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

Method HandleMsg

cpp/src/command_classes/AssociationCommandConfiguration.cpp:137–229  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

135// Handle a message from the Z-Wave network
136//-----------------------------------------------------------------------------
137bool AssociationCommandConfiguration::HandleMsg
138(
139 uint8 const* _data,
140 uint32 const _length,
141 uint32 const _instance // = 1
142)
143{
144 if (AssociationCommandConfigurationCmd_SupportedRecordsReport == (AssociationCommandConfigurationCmd)_data[0])
145 {
146 uint8 maxCommandLength = _data[1] >> 2;
147 bool commandsAreValues = ( (_data[1] & 0x02) != 0 );
148 bool commandsAreConfigurable = ( (_data[1] & 0x01) != 0 );
149 int16 numFreeCommands = (((int16)_data[2])<<16) | (int16)_data[3];
150 int16 maxCommands = (((int16)_data[4])<<16) | (int16)_data[5];
151
152 Log::Write( LogLevel_Info, GetNodeId(), "Received AssociationCommandConfiguration Supported Records Report:" );
153 Log::Write( LogLevel_Info, GetNodeId(), " Maximum command length = %d bytes", maxCommandLength );
154 Log::Write( LogLevel_Info, GetNodeId(), " Maximum number of commands = %d", maxCommands );
155 Log::Write( LogLevel_Info, GetNodeId(), " Number of free commands = %d", numFreeCommands );
156 Log::Write( LogLevel_Info, GetNodeId(), " Commands are %s and are %s", commandsAreValues ? "values" : "not values", commandsAreConfigurable ? "configurable" : "not configurable" );
157
158 ValueBool* valueBool;
159 ValueByte* valueByte;
160 ValueShort* valueShort;
161
162 if( (valueByte = static_cast<ValueByte*>( GetValue( _instance, AssociationCommandConfigurationIndex_MaxCommandLength ) )) )
163 {
164 valueByte->OnValueRefreshed( maxCommandLength );
165 valueByte->Release();
166 }
167
168 if( (valueBool = static_cast<ValueBool*>( GetValue( _instance, AssociationCommandConfigurationIndex_CommandsAreValues ) )) )
169 {
170 valueBool->OnValueRefreshed( commandsAreValues );
171 valueBool->Release();
172 }
173
174 if( (valueBool = static_cast<ValueBool*>( GetValue( _instance, AssociationCommandConfigurationIndex_CommandsAreConfigurable ) )) )
175 {
176 valueBool->OnValueRefreshed( commandsAreConfigurable );
177 valueBool->Release();
178 }
179
180 if( (valueShort = static_cast<ValueShort*>( GetValue( _instance, AssociationCommandConfigurationIndex_NumFreeCommands ) )) )
181 {
182 valueShort->OnValueRefreshed( numFreeCommands );
183 valueShort->Release();
184 }
185
186 if( (valueShort = static_cast<ValueShort*>( GetValue( _instance, AssociationCommandConfigurationIndex_MaxCommands ) )) )
187 {
188 valueShort->OnValueRefreshed( maxCommands );
189 valueShort->Release();
190 }
191 return true;
192 }
193
194 if (AssociationCommandConfigurationCmd_Report == (AssociationCommandConfigurationCmd)_data[0])

Callers

nothing calls this directly

Calls 7

WriteFunction · 0.85
GetGroupMethod · 0.80
ClearCommandsMethod · 0.80
AddCommandMethod · 0.80
GetNodeIdFunction · 0.70
OnValueRefreshedMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected