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

Method HandleMsg

cpp/src/command_classes/Protection.cpp:109–135  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

107// Handle a message from the Z-Wave network
108//-----------------------------------------------------------------------------
109bool Protection::HandleMsg
110(
111 uint8 const* _data,
112 uint32 const _length,
113 uint32 const _instance // = 1
114)
115{
116 if (ProtectionCmd_Report == (ProtectionCmd)_data[0])
117 {
118 int8 stateValue = _data[1];
119 if (stateValue > 2) /* size of c_protectionStateNames minus Invalid */
120 {
121 Log::Write (LogLevel_Warning, GetNodeId(), "State Value was greater than range. Setting to Invalid");
122 stateValue = 3;
123 }
124 Log::Write( LogLevel_Info, GetNodeId(), "Received a Protection report: %s", c_protectionStateNames[_data[1]] );
125 if( ValueList* value = static_cast<ValueList*>( GetValue( _instance, 0 ) ) )
126 {
127 value->OnValueRefreshed( (int)_data[1] );
128 value->Release();
129 }
130
131 return true;
132 }
133
134 return false;
135}
136
137//-----------------------------------------------------------------------------
138// <Protection::SetValue>

Callers

nothing calls this directly

Calls 4

WriteFunction · 0.85
GetNodeIdFunction · 0.70
OnValueRefreshedMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected