----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------
| 122 | // Handle a message from the Z-Wave network |
| 123 | //----------------------------------------------------------------------------- |
| 124 | bool ZWavePlusInfo::HandleMsg |
| 125 | ( |
| 126 | uint8 const* _data, |
| 127 | uint32 const _length, |
| 128 | uint32 const _instance // = 1 |
| 129 | ) |
| 130 | { |
| 131 | if( ZWavePlusInfoCmd_Report == _data[0] ) |
| 132 | { |
| 133 | uint8 version = _data[1]; |
| 134 | uint8 role = _data[2]; |
| 135 | uint8 nodeType = _data[3]; |
| 136 | uint16 installerIcon = (_data[4]<< 8) | _data[5]; |
| 137 | uint16 deviceType = (_data[6]<< 8) | _data[7]; |
| 138 | |
| 139 | /* Only set the role, NodeType and DeviceType on Instance 1 Reports. The other instances |
| 140 | * Just have unique Icons for each endpoint */ |
| 141 | if (_instance == 1) { |
| 142 | if( Node* node = GetNodeUnsafe() ) |
| 143 | { |
| 144 | node->SetPlusDeviceClasses( role, nodeType, deviceType ); |
| 145 | } |
| 146 | // ClearStaticRequest( StaticRequest_Values ); |
| 147 | } |
| 148 | ValueByte* value; |
| 149 | if( (value = static_cast<ValueByte*>( GetValue( _instance, ZWavePlusInfoIndex_Version ) )) ) |
| 150 | { |
| 151 | value->OnValueRefreshed( version ); |
| 152 | value->Release(); |
| 153 | } |
| 154 | |
| 155 | ValueShort* svalue; |
| 156 | if( (svalue = static_cast<ValueShort*>( GetValue( _instance, ZWavePlusInfoIndex_InstallerIcon ) )) ) |
| 157 | { |
| 158 | svalue->OnValueRefreshed( installerIcon ); |
| 159 | svalue->Release(); |
| 160 | } |
| 161 | |
| 162 | if( (svalue = static_cast<ValueShort*>( GetValue( _instance, ZWavePlusInfoIndex_UserIcon ) )) ) |
| 163 | { |
| 164 | svalue->OnValueRefreshed( deviceType ); |
| 165 | svalue->Release(); |
| 166 | } |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | return true; |
| 172 | } |
| 173 | return false; |
| 174 | } |
| 175 | |
| 176 | //----------------------------------------------------------------------------- |
| 177 | // <ZWavePlusInfo::CreateVars> |
nothing calls this directly
no test coverage detected