----------------------------------------------------------------------------- Apply settings from XML -----------------------------------------------------------------------------
| 118 | // Apply settings from XML |
| 119 | //----------------------------------------------------------------------------- |
| 120 | void 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"); |
nothing calls this directly
no test coverage detected