----------------------------------------------------------------------------- Set a value on the Z-Wave device -----------------------------------------------------------------------------
| 126 | // Set a value on the Z-Wave device |
| 127 | //----------------------------------------------------------------------------- |
| 128 | bool 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> |
nothing calls this directly
no test coverage detected