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

Method SetValue

cpp/src/command_classes/ControllerReplication.cpp:128–173  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Set a value on the Z-Wave device -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

126// Set a value on the Z-Wave device
127//-----------------------------------------------------------------------------
128bool ControllerReplication::SetValue
129(
130 Value const& _value
131)
132{
133 bool res = false;
134 uint8 instance = _value.GetID().GetInstance();
135
136 switch( _value.GetID().GetIndex() )
137 {
138 case ControllerReplicationIndex_NodeId:
139 {
140 if( ValueByte* value = static_cast<ValueByte*>( GetValue( instance, (uint16)ControllerReplicationIndex_NodeId ) ) )
141 {
142 value->OnValueRefreshed( (static_cast<ValueByte const*>( &_value))->GetValue() );
143 value->Release();
144 res = true;
145 }
146 break;
147 }
148 case ControllerReplicationIndex_Function:
149 {
150 if( ValueList* value = static_cast<ValueList*>( GetValue( instance, ControllerReplicationIndex_Function ) ) )
151 {
152 ValueList::Item const *item = (static_cast<ValueList const*>( &_value))->GetItem();
153 value->OnValueRefreshed( item->m_value );
154 value->Release();
155 res = true;
156 }
157 break;
158 }
159 case ControllerReplicationIndex_Replicate:
160 {
161 if( ValueButton* button = static_cast<ValueButton*>( GetValue( instance, ControllerReplicationIndex_Replicate ) ) )
162 {
163 if( button->IsPressed() )
164 {
165 res = StartReplication( instance );
166 }
167 button->Release();
168 }
169 break;
170 }
171 }
172 return res;
173}
174
175//-----------------------------------------------------------------------------
176// <ControllerReplication::StartReplication>

Callers

nothing calls this directly

Calls 6

GetInstanceMethod · 0.80
GetItemMethod · 0.80
IsPressedMethod · 0.80
OnValueRefreshedMethod · 0.45
GetValueMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected