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

Method AddCommandClass

cpp/src/Node.cpp:2137–2169  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Add a command class to the node -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2135// Add a command class to the node
2136//-----------------------------------------------------------------------------
2137CommandClass* Node::AddCommandClass
2138(
2139 uint8 const _commandClassId,
2140 bool advertised
2141)
2142{
2143 if( GetCommandClass( _commandClassId ) || GetCommandClass( _commandClassId, true))
2144 {
2145 // Class and instance have already been added
2146 return NULL;
2147 }
2148
2149 // Create the command class object and add it to our map
2150 if( CommandClass* pCommandClass = CommandClasses::CreateCommandClass( _commandClassId, m_homeId, m_nodeId ) )
2151 {
2152 if (!advertised)
2153 {
2154 m_commandClassMap[_commandClassId] = pCommandClass;
2155 }
2156 else
2157 {
2158 m_advertisedCommandClassMap[_commandClassId] = pCommandClass;
2159 pCommandClass->SetAfterMark();
2160 }
2161 return pCommandClass;
2162 }
2163 else
2164 {
2165 Log::Write( LogLevel_Info, m_nodeId, "AddCommandClass - Unsupported Command Class 0x%.2x", _commandClassId );
2166 }
2167
2168 return NULL;
2169}
2170
2171//-----------------------------------------------------------------------------
2172// <Node::RemoveCommandClass>

Callers 1

Calls 1

WriteFunction · 0.85

Tested by

no test coverage detected