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

Method DeviceClass

cpp/src/Node.cpp:3649–3695  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Constructor -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3647// Constructor
3648//-----------------------------------------------------------------------------
3649Node::DeviceClass::DeviceClass
3650(
3651 TiXmlElement const* _el
3652):
3653m_mandatoryCommandClasses(NULL),
3654m_basicMapping(0)
3655{
3656 char const* str = _el->Attribute( "label" );
3657 if( str )
3658 {
3659 m_label = str;
3660 }
3661
3662 str = _el->Attribute( "command_classes" );
3663 if( str )
3664 {
3665 // Parse the comma delimted command class
3666 // list into a temporary vector.
3667 vector<uint8> ccs;
3668 char* pos = const_cast<char*>(str);
3669 while( *pos )
3670 {
3671 ccs.push_back( (uint8)strtol( pos, &pos, 16 ) );
3672 if( (*pos) == ',' )
3673 {
3674 ++pos;
3675 }
3676 }
3677
3678 // Copy the vector contents into an array.
3679 size_t numCCs = ccs.size();
3680 m_mandatoryCommandClasses = new uint8[numCCs+1];
3681 m_mandatoryCommandClasses[numCCs] = 0; // Zero terminator
3682
3683 for( uint32 i=0; i<numCCs; ++i )
3684 {
3685 m_mandatoryCommandClasses[i] = ccs[i];
3686 }
3687 }
3688
3689 str = _el->Attribute( "basic" );
3690 if( str )
3691 {
3692 char* pStop;
3693 m_basicMapping = (uint8)strtol( str, &pStop, 16 );
3694 }
3695}
3696
3697//-----------------------------------------------------------------------------
3698// <Node::GenericDeviceClass::GenericDeviceClass>

Callers

nothing calls this directly

Calls 2

AttributeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected