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

Method UpdateNodeInfo

cpp/src/Node.cpp:1801–1896  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Set up the command classes from the node info frame -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1799// Set up the command classes from the node info frame
1800//-----------------------------------------------------------------------------
1801void Node::UpdateNodeInfo
1802(
1803 uint8 const* _data,
1804 uint8 const _length
1805)
1806{
1807 if( !NodeInfoReceived() )
1808 {
1809 // Add the command classes specified by the device
1810 Log::Write( LogLevel_Info, m_nodeId, " Optional command classes for node %d:", m_nodeId );
1811
1812 bool newCommandClasses = false;
1813 uint32 i;
1814
1815 bool afterMark = false;
1816 for( i=0; i<_length; ++i )
1817 {
1818 if( _data[i] == 0xef )
1819 {
1820 // COMMAND_CLASS_MARK.
1821 // Marks the end of the list of supported command classes. The remaining classes
1822 // are those that can be controlled by the device. These classes are created
1823 // without values. Messages received cause notification events instead.
1824 afterMark = true;
1825
1826 if( !newCommandClasses )
1827 {
1828 Log::Write( LogLevel_Info, m_nodeId, " None" );
1829 }
1830 Log::Write( LogLevel_Info, m_nodeId, " Optional command classes controlled by node %d:", m_nodeId );
1831 newCommandClasses = false;
1832 continue;
1833 }
1834
1835 if( CommandClasses::IsSupported( _data[i] ) )
1836 {
1837 if (Security::StaticGetCommandClassId() == _data[i] && !GetDriver()->isNetworkKeySet()) {
1838 Log::Write (LogLevel_Info, m_nodeId, " %s (Disabled - Network Key Not Set)", Security::StaticGetCommandClassName().c_str());
1839 continue;
1840 }
1841 if( CommandClass* pCommandClass = AddCommandClass( _data[i] , afterMark) )
1842 {
1843 /* this CC was in the NIF frame */
1844 pCommandClass->SetInNIF();
1845 // If this class came after the COMMAND_CLASS_MARK, then we do not create values.
1846 if( afterMark )
1847 {
1848 pCommandClass->SetAfterMark();
1849 }
1850
1851 // Start with an instance count of one. If the device supports COMMMAND_CLASS_MULTI_INSTANCE
1852 // then some command class instance counts will increase once the responses to the RequestState
1853 // call at the end of this method have been processed.
1854 pCommandClass->SetInstance( 1 );
1855 newCommandClasses = true;
1856 Log::Write( LogLevel_Info, m_nodeId, " %s", pCommandClass->GetCommandClassName().c_str() );
1857 } else if (CommandClass *pCommandClass = GetCommandClass( _data[i] ) ) {
1858 /* this CC was in the NIF frame */

Callers 1

Calls 6

WriteFunction · 0.85
isNetworkKeySetMethod · 0.80
SetAwakeMethod · 0.80
c_strMethod · 0.45
SetInstanceMethod · 0.45
GetCommandClassNameMethod · 0.45

Tested by

no test coverage detected