----------------------------------------------------------------------------- Set the state of the switch -----------------------------------------------------------------------------
| 155 | // Set the state of the switch |
| 156 | //----------------------------------------------------------------------------- |
| 157 | bool SwitchBinary::SetValue |
| 158 | ( |
| 159 | Value const& _value |
| 160 | ) |
| 161 | { |
| 162 | bool res = false; |
| 163 | uint8 instance = _value.GetID().GetInstance(); |
| 164 | |
| 165 | switch( _value.GetID().GetIndex() ) |
| 166 | { |
| 167 | case SwitchBinaryIndex_Level: |
| 168 | { |
| 169 | if( ValueBool* value = static_cast<ValueBool*>( GetValue( instance, SwitchBinaryIndex_Level ) ) ) |
| 170 | { |
| 171 | res = SetState( instance, (static_cast<ValueBool const*>(&_value))->GetValue() ); |
| 172 | value->Release(); |
| 173 | } |
| 174 | break; |
| 175 | } |
| 176 | case SwitchBinaryIndex_Duration: |
| 177 | { |
| 178 | if( ValueByte* value = static_cast<ValueByte*>( GetValue( instance, SwitchBinaryIndex_Duration ) ) ) |
| 179 | { |
| 180 | value->OnValueRefreshed( (static_cast<ValueByte const*>(&_value))->GetValue() ); |
| 181 | value->Release(); |
| 182 | } |
| 183 | res = true; |
| 184 | break; |
| 185 | } |
| 186 | |
| 187 | } |
| 188 | |
| 189 | return res; |
| 190 | } |
| 191 | |
| 192 | //----------------------------------------------------------------------------- |
| 193 | // <SwitchBinary::SetValueBasic> |
nothing calls this directly
no test coverage detected