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

Method AddMandatoryCommandClasses

cpp/src/Node.cpp:3468–3515  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Add mandatory command classes to the node -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3466// Add mandatory command classes to the node
3467//-----------------------------------------------------------------------------
3468bool Node::AddMandatoryCommandClasses
3469(
3470 uint8 const* _commandClasses
3471)
3472{
3473 if( NULL == _commandClasses )
3474 {
3475 // No command classes to add
3476 return false;
3477 }
3478
3479 int i=0;
3480 bool afterMark = false;
3481 while( uint8 cc = _commandClasses[i++] )
3482 {
3483 if( cc == 0xef )
3484 {
3485 // COMMAND_CLASS_MARK.
3486 // Marks the end of the list of supported command classes. The remaining classes
3487 // are those that can be controlled by this device, which we can ignore.
3488 afterMark = true;
3489 continue;
3490 }
3491
3492 if( CommandClasses::IsSupported( cc ) )
3493 {
3494 if (Security::StaticGetCommandClassId() == cc && !GetDriver()->isNetworkKeySet()) {
3495 Log::Write(LogLevel_Warning, m_nodeId, "Security Command Class Cannot be Enabled - NetworkKey is not set");
3496 continue;
3497 }
3498
3499 if( CommandClass* commandClass = AddCommandClass( cc ) )
3500 {
3501 // If this class came after the COMMAND_CLASS_MARK, then we do not create values.
3502 if( afterMark )
3503 {
3504 commandClass->SetAfterMark();
3505 }
3506
3507 // Start with an instance count of one. If the device supports COMMMAND_CLASS_MULTI_INSTANCE
3508 // then some command class instance counts will increase.
3509 commandClass->SetInstance( 1 );
3510 }
3511 }
3512 }
3513
3514 return true;
3515}
3516
3517//-----------------------------------------------------------------------------
3518// <Node::ReadDeviceClasses>

Callers

nothing calls this directly

Calls 3

WriteFunction · 0.85
isNetworkKeySetMethod · 0.80
SetInstanceMethod · 0.45

Tested by

no test coverage detected