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

Method ReadXML

cpp/src/value_classes/ValueBitSet.cpp:120–189  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

118// Apply settings from XML
119//-----------------------------------------------------------------------------
120void ValueBitSet::ReadXML
121(
122 uint32 const _homeId,
123 uint8 const _nodeId,
124 uint8 const _commandClassId,
125 TiXmlElement const* _valueElement
126)
127{
128 Value::ReadXML( _homeId, _nodeId, _commandClassId, _valueElement );
129
130 int intVal;
131 if( TIXML_SUCCESS == _valueElement->QueryIntAttribute( "bitmask", &intVal ) )
132 {
133 m_BitMask = (uint32)intVal;
134 }
135 else
136 {
137 Log::Write( LogLevel_Info, "Missing BitMask value from xml configuration: node %d, class 0x%02x, instance %d, index %d", _nodeId, _commandClassId, GetID().GetInstance(), GetID().GetIndex() );
138 }
139 if( TIXML_SUCCESS == _valueElement->QueryIntAttribute( "value", &intVal ) )
140 {
141 m_value.SetValue((uint32)intVal);
142 }
143 else
144 {
145 Log::Write( LogLevel_Info, "Missing default integer value from xml configuration: node %d, class 0x%02x, instance %d, index %d", _nodeId, _commandClassId, GetID().GetInstance(), GetID().GetIndex() );
146 }
147 // Get size of values
148 int intSize;
149 if ( TIXML_SUCCESS == _valueElement->QueryIntAttribute( "size", &intSize ) )
150 {
151 if( intSize == 1 || intSize == 2 || intSize == 4 )
152 {
153 m_size = intSize;
154 }
155 else
156 {
157 Log::Write( LogLevel_Info, "Value size is invalid. Only 1, 2 & 4 supported for node %d, class 0x%02x, instance %d, index %d", _nodeId, _commandClassId, GetID().GetInstance(), GetID().GetIndex() );
158 m_size = 1;
159 }
160 }
161 else
162 {
163 Log::Write( LogLevel_Info, "Value list size is not set, assuming 1 bytes for node %d, class 0x%02x, instance %d, index %d", _nodeId, _commandClassId, GetID().GetInstance(), GetID().GetIndex() );
164 m_size = 1;
165 }
166 TiXmlElement const *BitSetElement = _valueElement->FirstChildElement("BitSet");
167 while (BitSetElement) {
168 uint32 id = 0;
169 if( TIXML_SUCCESS == BitSetElement->QueryIntAttribute( "id", &intVal ) )
170 {
171 id = (uint32)intVal;
172 TiXmlElement const *BitSetLabelElement = BitSetElement->FirstChildElement("Label");
173 while (BitSetLabelElement) {
174 char const* lang = BitSetLabelElement->Attribute( "lang" );
175 Localization::Get()->SetValueItemLabel(m_id.GetCommandClassId(), m_id.GetIndex(), -1, id, BitSetLabelElement->GetText(), lang ? lang : "");
176
177 BitSetLabelElement = BitSetLabelElement->NextSiblingElement("Label");

Callers

nothing calls this directly

Calls 12

WriteFunction · 0.85
QueryIntAttributeMethod · 0.80
GetInstanceMethod · 0.80
AttributeMethod · 0.80
SetValueItemLabelMethod · 0.80
GetTextMethod · 0.80
SetValueItemHelpMethod · 0.80
GetFunction · 0.50
SetValueMethod · 0.45
FirstChildElementMethod · 0.45
GetCommandClassIdMethod · 0.45
NextSiblingElementMethod · 0.45

Tested by

no test coverage detected