----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------
| 209 | // Handle a message from the Z-Wave network |
| 210 | //----------------------------------------------------------------------------- |
| 211 | bool MultiChannelAssociation::HandleMsg |
| 212 | ( |
| 213 | uint8 const* _data, |
| 214 | uint32 const _length, |
| 215 | uint32 const _instance // = 1 |
| 216 | ) |
| 217 | { |
| 218 | bool handled = false; |
| 219 | uint32 i; |
| 220 | |
| 221 | if( Node* node = GetNodeUnsafe() ) |
| 222 | { |
| 223 | if( MultiChannelAssociationCmd_GroupingsReport == (MultiChannelAssociationCmd)_data[0] ) |
| 224 | { |
| 225 | // Retrieve the number of groups this device supports. |
| 226 | // The groups will be queried with the session data. |
| 227 | m_numGroups = _data[1]; |
| 228 | Log::Write( LogLevel_Info, GetNodeId(), "Received Multi Instance Association Groupings report from node %d. Number of groups is %d", GetNodeId(), m_numGroups ); |
| 229 | ClearStaticRequest( StaticRequest_Values ); |
| 230 | handled = true; |
| 231 | } |
| 232 | else if( MultiChannelAssociationCmd_Report == (MultiChannelAssociationCmd)_data[0] ) |
| 233 | { |
| 234 | // Get the group info |
| 235 | uint8 groupIdx = _data[1]; |
| 236 | uint8 maxAssociations = _data[2]; // If the maxAssociations is zero, this is not a supported group. |
| 237 | uint8 numReportsToFollow = _data[3]; // If a device supports a lot of associations, they may come in more than one message. |
| 238 | |
| 239 | if( maxAssociations ) |
| 240 | { |
| 241 | if( _length >= 5 ) |
| 242 | { |
| 243 | // format: |
| 244 | // node A |
| 245 | // node B |
| 246 | // 0x00 Marker |
| 247 | // node C |
| 248 | // instance # |
| 249 | // node D |
| 250 | // instance # |
| 251 | Log::Write( LogLevel_Info, GetNodeId(), "Received Multi Instance Association report from node %d, group %d", GetNodeId(), groupIdx ); |
| 252 | Log::Write( LogLevel_Info, GetNodeId(), " The group contains:" ); |
| 253 | bool pastMarker = false; |
| 254 | for( i=0; i < _length-5; ++i ) |
| 255 | { |
| 256 | if (_data[i+4] == 0x00) |
| 257 | { |
| 258 | pastMarker = true; |
| 259 | } |
| 260 | else |
| 261 | { |
| 262 | if (!pastMarker) |
| 263 | { |
| 264 | Log::Write( LogLevel_Info, GetNodeId(), " Node %d", _data[i+4] ); |
| 265 | InstanceAssociation association; |
| 266 | association.m_nodeId=_data[i+4]; |
| 267 | association.m_instance=0x00; |
| 268 | m_pendingMembers.push_back( association ); |
nothing calls this directly
no test coverage detected