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

Method HandleMsg

cpp/src/command_classes/MultiCmd.cpp:43–81  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

41// Handle a message from the Z-Wave network
42//-----------------------------------------------------------------------------
43bool MultiCmd::HandleMsg
44(
45 uint8 const* _data,
46 uint32 const _length,
47 uint32 const _instance // = 1
48)
49{
50 if( MultiCmdCmd_Encap == (MultiCmdCmd)_data[0] )
51 {
52 Log::Write( LogLevel_Info, GetNodeId(), "Received encapsulated multi-command from node %d", GetNodeId() );
53
54 if( Node const* node = GetNodeUnsafe() )
55 {
56 // Iterate over commands
57 uint8 base = 2;
58 for( uint8 i=0; i<_data[1]; ++i )
59 {
60 uint8 length = _data[base];
61 uint8 commandClassId = _data[base+1];
62
63 if( CommandClass* pCommandClass = node->GetCommandClass( commandClassId, false ) )
64 {
65 pCommandClass->HandleMsg( &_data[base+2], length-1 );
66 }
67
68 if( CommandClass* pCommandClass = node->GetCommandClass( commandClassId, true ) )
69 {
70 pCommandClass->HandleIncomingMsg( &_data[base+2], length-1 );
71 }
72
73 base += (length + 1);
74 }
75 }
76
77 Log::Write( LogLevel_Info, GetNodeId(), "End of encapsulated multi-command from node %d", GetNodeId() );
78 return true;
79 }
80 return false;
81}
82

Callers

nothing calls this directly

Calls 4

WriteFunction · 0.85
GetCommandClassMethod · 0.80
GetNodeIdFunction · 0.70
HandleIncomingMsgMethod · 0.45

Tested by

no test coverage detected