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

Method ReadDeviceProtocolXML

cpp/src/Node.cpp:1175–1234  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Read the device's protocol configuration from a device config file (Not cache) -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1173// cache)
1174//-----------------------------------------------------------------------------
1175void Node::ReadDeviceProtocolXML
1176(
1177 TiXmlElement const* _ccsElement
1178)
1179{
1180 char const *str = _ccsElement->Attribute("Revision");
1181 if ( str ) {
1182 /* as we are loading the Node from the device config file, both the
1183 * File and Loaded Revisions will be the same
1184 */
1185 this->setFileConfigRevision(atol(str));
1186 this->setLoadedConfigRevision(m_fileConfigRevision);
1187 Log::Write(LogLevel_Info, GetNodeId(), " Configuration File Revision is %d", m_fileConfigRevision);
1188 } else {
1189 this->setFileConfigRevision(0);
1190 this->setLoadedConfigRevision(m_fileConfigRevision);
1191 }
1192
1193 TiXmlElement const* ccElement = _ccsElement->FirstChildElement();
1194 while( ccElement )
1195 {
1196 str = ccElement->Value();
1197 if( str && !strcmp( str, "Protocol" ) )
1198 {
1199 str = ccElement->Attribute( "nodeinfosupported" );
1200 if( str )
1201 {
1202 m_nodeInfoSupported = !strcmp( str, "true" );
1203 }
1204
1205 str = ccElement->Attribute( "refreshonnodeinfoframe" );
1206 if ( str )
1207 {
1208 m_refreshonNodeInfoFrame = !strcmp( str, "true" );
1209 }
1210
1211 // Some controllers support API calls that aren't advertised in their returned data.
1212 // So provide a way to manipulate the returned data to reflect reality.
1213 TiXmlElement const* childElement = _ccsElement->FirstChildElement();
1214 while( childElement )
1215 {
1216 str = childElement->Value();
1217 if( str && !strcmp( str, "APIcall" ) )
1218 {
1219 char const* funcStr = childElement->Attribute( "function" );
1220 char *p;
1221 uint8 func = (uint8)strtol( funcStr, &p, 16 );
1222 if( p != funcStr )
1223 {
1224 char const* presStr = ccElement->Attribute( "present" );
1225 GetDriver()->SetAPICall( func, !strcmp( presStr, "true" ) );
1226 }
1227 }
1228 childElement = childElement->NextSiblingElement();
1229 }
1230 return;
1231 }
1232 ccElement = ccElement->NextSiblingElement();

Callers 1

LoadConfigXMLMethod · 0.80

Calls 8

setFileConfigRevisionMethod · 0.95
WriteFunction · 0.85
AttributeMethod · 0.80
GetNodeIdFunction · 0.70
FirstChildElementMethod · 0.45
ValueMethod · 0.45
NextSiblingElementMethod · 0.45

Tested by 1

LoadConfigXMLMethod · 0.64