MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / UpdateProtocolInfo

Method UpdateProtocolInfo

cpp/src/Node.cpp:1436–1546  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Handle the FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO response -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1434// Handle the FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO response
1435//-----------------------------------------------------------------------------
1436void Node::UpdateProtocolInfo
1437(
1438 uint8 const* _data
1439)
1440{
1441 if( ProtocolInfoReceived() )
1442 {
1443 // We already have this info
1444 return;
1445 }
1446
1447 if( _data[4] == 0 )
1448 {
1449 // Node doesn't exist if Generic class is zero.
1450 Log::Write( LogLevel_Info, m_nodeId, " Protocol Info for Node %d reports node nonexistent", m_nodeId );
1451 SetNodeAlive( false );
1452 return;
1453 }
1454
1455 // Capabilities
1456 m_listening = ( ( _data[0] & 0x80 ) != 0 );
1457 m_routing = ( ( _data[0] & 0x40 ) != 0 );
1458
1459 m_maxBaudRate = 9600;
1460 if( ( _data[0] & 0x38 ) == 0x10 )
1461 {
1462 m_maxBaudRate = 40000;
1463 }
1464
1465 m_version = ( _data[0] & 0x07 ) + 1;
1466
1467 m_frequentListening = ( ( _data[1] & ( SecurityFlag_Sensor250ms | SecurityFlag_Sensor1000ms ) ) != 0 );
1468 m_beaming = ( ( _data[1] & SecurityFlag_BeamCapability ) != 0 );
1469
1470 // Security
1471 m_security = ( ( _data[1] & SecurityFlag_Security ) != 0 );
1472
1473 // Optional flag is true if the device reports optional command classes.
1474 // NOTE: We stopped using this because not all devices report it properly,
1475 // and now just request the optional classes regardless.
1476 // bool optional = (( _data[1] & 0x80 ) != 0 );
1477 /* dont do any further processing if we have already recieved our Protocol Info, or basicprotocolInfo */
1478 if( ProtocolInfoReceived())
1479 {
1480 // We already have this info
1481 return;
1482 }
1483
1484 Log::Write( LogLevel_Info, m_nodeId, " Protocol Info for Node %d:", m_nodeId );
1485 if( m_listening )
1486 Log::Write( LogLevel_Info, m_nodeId, " Listening = true" );
1487 else
1488 {
1489 Log::Write( LogLevel_Info, m_nodeId, " Listening = false" );
1490 Log::Write( LogLevel_Info, m_nodeId, " Frequent = %s", m_frequentListening ? "true" : "false" );
1491 }
1492 Log::Write( LogLevel_Info, m_nodeId, " Beaming = %s", m_beaming ? "true" : "false" );
1493 Log::Write( LogLevel_Info, m_nodeId, " Routing = %s", m_routing ? "true" : "false" );

Callers 1

Calls 9

WriteFunction · 0.85
QueueNotificationMethod · 0.80
ReadButtonsMethod · 0.80
GetControllerNodeIdMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
GetCommandClassNameMethod · 0.45
SetInstanceMethod · 0.45

Tested by

no test coverage detected