----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------
| 54 | // Handle a message from the Z-Wave network |
| 55 | //----------------------------------------------------------------------------- |
| 56 | bool Configuration::HandleMsg |
| 57 | ( |
| 58 | uint8 const* _data, |
| 59 | uint32 const _length, |
| 60 | uint32 const _instance // = 1 |
| 61 | ) |
| 62 | { |
| 63 | if (ConfigurationCmd_Report == (ConfigurationCmd)_data[0]) |
| 64 | { |
| 65 | // Extract the parameter index and value |
| 66 | uint8 parameter = _data[1]; |
| 67 | uint8 size = _data[2] & 0x07; |
| 68 | int32 paramValue = 0; |
| 69 | for( uint8 i=0; i<size; ++i ) |
| 70 | { |
| 71 | paramValue <<= 8; |
| 72 | paramValue |= (int32)_data[i+3]; |
| 73 | } |
| 74 | |
| 75 | if ( Value* value = GetValue( 1, parameter ) ) |
| 76 | { |
| 77 | switch ( value->GetID().GetType() ) |
| 78 | { |
| 79 | case ValueID::ValueType_BitSet: |
| 80 | { |
| 81 | ValueBitSet* vbs = static_cast<ValueBitSet*>( value ); |
| 82 | vbs->OnValueRefreshed( paramValue != 0 ); |
| 83 | break; |
| 84 | } |
| 85 | case ValueID::ValueType_Bool: |
| 86 | { |
| 87 | ValueBool* valueBool = static_cast<ValueBool*>( value ); |
| 88 | valueBool->OnValueRefreshed( paramValue != 0 ); |
| 89 | break; |
| 90 | } |
| 91 | case ValueID::ValueType_Byte: |
| 92 | { |
| 93 | ValueByte* valueByte = static_cast<ValueByte*>( value ); |
| 94 | valueByte->OnValueRefreshed( (uint8)paramValue ); |
| 95 | break; |
| 96 | } |
| 97 | case ValueID::ValueType_Short: |
| 98 | { |
| 99 | ValueShort* valueShort = static_cast<ValueShort*>( value ); |
| 100 | valueShort->OnValueRefreshed( (int16)paramValue ); |
| 101 | break; |
| 102 | } |
| 103 | case ValueID::ValueType_Int: |
| 104 | { |
| 105 | ValueInt* valueInt = static_cast<ValueInt*>( value ); |
| 106 | valueInt->OnValueRefreshed( paramValue ); |
| 107 | break; |
| 108 | } |
| 109 | case ValueID::ValueType_List: |
| 110 | { |
| 111 | ValueList* valueList = static_cast<ValueList*>( value ); |
| 112 | valueList->OnValueRefreshed( paramValue ); |
| 113 | break; |
nothing calls this directly
no test coverage detected