----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------
| 117 | // Handle a message from the Z-Wave network |
| 118 | //----------------------------------------------------------------------------- |
| 119 | bool ThermostatFanState::HandleMsg |
| 120 | ( |
| 121 | uint8 const* _data, |
| 122 | uint32 const _length, |
| 123 | uint32 const _instance // = 1 |
| 124 | ) |
| 125 | { |
| 126 | if( ThermostatFanStateCmd_Report == (ThermostatFanStateCmd)_data[0] ) |
| 127 | { |
| 128 | // We have received the thermostat fan state from the Z-Wave device |
| 129 | if( ValueString* valueString = static_cast<ValueString*>( GetValue( _instance, 0 ) ) ) |
| 130 | { |
| 131 | /* No need bounds checking as the state can only be a single byte - No larger than our Char array anyway */ |
| 132 | uint8 state = (_data[1]&0x0f); |
| 133 | |
| 134 | valueString->OnValueRefreshed( c_stateName[state] ); |
| 135 | valueString->Release(); |
| 136 | Log::Write( LogLevel_Info, GetNodeId(), "Received thermostat fan state: %s", valueString->GetValue().c_str() ); |
| 137 | } |
| 138 | return true; |
| 139 | } |
| 140 | |
| 141 | return false; |
| 142 | } |
| 143 | |
| 144 | //----------------------------------------------------------------------------- |
| 145 | // <ThermostatFanState::CreateVars> |