MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / SetValue

Method SetValue

cpp/src/command_classes/SwitchBinary.cpp:157–190  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Set the state of the switch -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

155// Set the state of the switch
156//-----------------------------------------------------------------------------
157bool 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>

Callers

nothing calls this directly

Calls 4

GetInstanceMethod · 0.80
GetValueMethod · 0.45
ReleaseMethod · 0.45
OnValueRefreshedMethod · 0.45

Tested by

no test coverage detected