----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------
| 41 | // Handle a message from the Z-Wave network |
| 42 | //----------------------------------------------------------------------------- |
| 43 | bool 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 |
nothing calls this directly
no test coverage detected