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

Method ReadCommandClassesXML

cpp/src/Node.cpp:1240–1297  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Read the command classes from XML -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1238// Read the command classes from XML
1239//-----------------------------------------------------------------------------
1240void Node::ReadCommandClassesXML
1241(
1242 TiXmlElement const* _ccsElement
1243)
1244{
1245 char const* str;
1246 int32 intVal;
1247
1248 TiXmlElement const* ccElement = _ccsElement->FirstChildElement();
1249 while( ccElement )
1250 {
1251 str = ccElement->Value();
1252 if( str && !strcmp( str, "CommandClass" ) )
1253 {
1254 if( TIXML_SUCCESS == ccElement->QueryIntAttribute( "id", &intVal ) )
1255 {
1256 uint8 id = (uint8)intVal;
1257
1258 // Check whether this command class is to be removed (product XMLs might
1259 // request this if a class is not implemented properly by the device)
1260 bool remove = false;
1261 char const* action = ccElement->Attribute( "action" );
1262 if( action && !strcasecmp( action, "remove" ) )
1263 {
1264 remove = true;
1265 }
1266
1267 CommandClass* cc = GetCommandClass( id );
1268 if( remove )
1269 {
1270 // Remove support for the command class
1271 RemoveCommandClass( id );
1272 }
1273 else
1274 {
1275 if( NULL == cc )
1276 {
1277 if (Security::StaticGetCommandClassId() == id && !GetDriver()->isNetworkKeySet()) {
1278 Log::Write(LogLevel_Warning, "Security Command Class cannot be Loaded. NetworkKey is not set");
1279 ccElement = ccElement->NextSiblingElement();
1280 continue;
1281 }
1282
1283 // Command class support does not exist yet, so we create it
1284 cc = AddCommandClass( id );
1285 }
1286
1287 if( NULL != cc )
1288 {
1289 cc->ReadXML( ccElement );
1290 }
1291 }
1292 }
1293 }
1294
1295 ccElement = ccElement->NextSiblingElement();
1296 }
1297}

Callers 1

LoadConfigXMLMethod · 0.80

Calls 8

WriteFunction · 0.85
QueryIntAttributeMethod · 0.80
AttributeMethod · 0.80
isNetworkKeySetMethod · 0.80
FirstChildElementMethod · 0.45
ValueMethod · 0.45
NextSiblingElementMethod · 0.45
ReadXMLMethod · 0.45

Tested by 1

LoadConfigXMLMethod · 0.64