----------------------------------------------------------------------------- Apply settings from XML -----------------------------------------------------------------------------
| 145 | // Apply settings from XML |
| 146 | //----------------------------------------------------------------------------- |
| 147 | void Value::ReadXML |
| 148 | ( |
| 149 | uint32 const _homeId, |
| 150 | uint8 const _nodeId, |
| 151 | uint8 const _commandClassId, |
| 152 | TiXmlElement const* _valueElement |
| 153 | ) |
| 154 | { |
| 155 | int intVal; |
| 156 | |
| 157 | ValueID::ValueGenre genre = Value::GetGenreEnumFromName( _valueElement->Attribute( "genre" ) ); |
| 158 | ValueID::ValueType type = Value::GetTypeEnumFromName( _valueElement->Attribute( "type" ) ); |
| 159 | |
| 160 | uint8 instance = 1; |
| 161 | if( TIXML_SUCCESS == _valueElement->QueryIntAttribute( "instance", &intVal ) ) |
| 162 | { |
| 163 | instance = (uint8)intVal; |
| 164 | } |
| 165 | |
| 166 | uint16 index = 0; |
| 167 | if( TIXML_SUCCESS == _valueElement->QueryIntAttribute( "index", &intVal ) ) |
| 168 | { |
| 169 | /* index is only 10 bytes in the ValueID class */ |
| 170 | index = (uint16)(intVal & 0x3FF); |
| 171 | } |
| 172 | |
| 173 | m_id = ValueID( _homeId, _nodeId, genre, _commandClassId, instance, index, type ); |
| 174 | |
| 175 | char const* label = _valueElement->Attribute( "label" ); |
| 176 | if( label ) |
| 177 | { |
| 178 | SetLabel(label); |
| 179 | } |
| 180 | |
| 181 | char const* units = _valueElement->Attribute( "units" ); |
| 182 | if( units ) |
| 183 | { |
| 184 | m_units = units; |
| 185 | } |
| 186 | |
| 187 | char const* readOnly = _valueElement->Attribute( "read_only" ); |
| 188 | if( readOnly ) |
| 189 | { |
| 190 | m_readOnly = !strcmp( readOnly, "true" ); |
| 191 | } |
| 192 | |
| 193 | char const* writeOnly = _valueElement->Attribute( "write_only" ); |
| 194 | if( writeOnly ) |
| 195 | { |
| 196 | m_writeOnly = !strcmp( writeOnly, "true" ); |
| 197 | } |
| 198 | |
| 199 | if( TIXML_SUCCESS == _valueElement->QueryIntAttribute( "poll_intensity", &intVal ) ) |
| 200 | { |
| 201 | m_pollIntensity = (uint8)intVal; |
| 202 | } |
| 203 | |
| 204 | char const* affects = _valueElement->Attribute( "affects" ); |
nothing calls this directly
no test coverage detected