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

Method ReadXML

cpp/src/value_classes/Value.cpp:147–279  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Apply settings from XML -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

145// Apply settings from XML
146//-----------------------------------------------------------------------------
147void 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" );

Callers

nothing calls this directly

Calls 10

WriteFunction · 0.85
AttributeMethod · 0.80
QueryIntAttributeMethod · 0.80
ReadXMLVIDHelpMethod · 0.80
ReadXMLVIDLabelMethod · 0.80
ValueIDFunction · 0.70
GetFunction · 0.50
FirstChildElementMethod · 0.45
ValueMethod · 0.45
NextSiblingElementMethod · 0.45

Tested by

no test coverage detected