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

Method InitNode

cpp/src/Driver.cpp:4643–4684  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Queue a node to be interrogated for its setup details -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

4641// Queue a node to be interrogated for its setup details
4642//-----------------------------------------------------------------------------
4643void Driver::InitNode
4644(
4645 uint8 const _nodeId,
4646 bool newNode,
4647 bool secure,
4648 uint8 const *_protocolInfo,
4649 uint8 const _length
4650)
4651{
4652 // Delete any existing node and replace it with a new one
4653 {
4654 LockGuard LG(m_nodeMutex);
4655 if( m_nodes[_nodeId] )
4656 {
4657 // Remove the original node
4658 delete m_nodes[_nodeId];
4659 Notification* notification = new Notification( Notification::Type_NodeRemoved );
4660 notification->SetHomeAndNodeIds( m_homeId, _nodeId );
4661 QueueNotification( notification );
4662 }
4663
4664 // Add the new node
4665 m_nodes[_nodeId] = new Node( m_homeId, _nodeId );
4666 if (newNode == true) static_cast<Node *>(m_nodes[_nodeId])->SetAddingNode();
4667 }
4668
4669 Notification* notification = new Notification( Notification::Type_NodeAdded );
4670 notification->SetHomeAndNodeIds( m_homeId, _nodeId );
4671 QueueNotification( notification );
4672
4673 if (_length == 0) {
4674 // Request the node info
4675 m_nodes[_nodeId]->SetQueryStage( Node::QueryStage_ProtocolInfo );
4676 } else {
4677 if (isNetworkKeySet())
4678 m_nodes[_nodeId]->SetSecured(secure);
4679 else
4680 Log::Write(LogLevel_Info, _nodeId, "Network Key Not Set - Secure Option is %s", secure ? "required" : "not required");
4681 m_nodes[_nodeId]->SetProtocolInfo(_protocolInfo, _length);
4682 }
4683 Log::Write(LogLevel_Info, _nodeId, "Initializing Node. New Node: %s (%s)", static_cast<Node *>(m_nodes[_nodeId])->IsAddingNode() ? "true" : "false", newNode ? "true" : "false");
4684}
4685
4686//-----------------------------------------------------------------------------
4687// <Driver::IsNodeListeningDevice>

Callers

nothing calls this directly

Calls 6

WriteFunction · 0.85
SetAddingNodeMethod · 0.80
SetQueryStageMethod · 0.80
SetSecuredMethod · 0.80
SetProtocolInfoMethod · 0.80
IsAddingNodeMethod · 0.80

Tested by

no test coverage detected