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

Method CommonAddNodeStatusRequestHandler

cpp/src/Driver.cpp:4090–4220  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Handle common AddNode processing for many similar commands -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

4088// Handle common AddNode processing for many similar commands
4089//-----------------------------------------------------------------------------
4090void Driver::CommonAddNodeStatusRequestHandler
4091(
4092 uint8 _funcId,
4093 uint8* _data
4094)
4095{
4096 uint8 nodeId = GetNodeNumber( m_currentMsg );
4097 ControllerState state = ControllerState_Normal;
4098 if( m_currentControllerCommand != NULL )
4099 {
4100 state = m_currentControllerCommand->m_controllerState;
4101 }
4102 switch( _data[3] )
4103 {
4104 case ADD_NODE_STATUS_LEARN_READY:
4105 {
4106 Log::Write( LogLevel_Info, nodeId, "ADD_NODE_STATUS_LEARN_READY" );
4107 m_currentControllerCommand->m_controllerAdded = false;
4108 state = ControllerState_Waiting;
4109 break;
4110 }
4111 case ADD_NODE_STATUS_NODE_FOUND:
4112 {
4113 Log::Write( LogLevel_Info, nodeId, "ADD_NODE_STATUS_NODE_FOUND" );
4114 state = ControllerState_InProgress;
4115 break;
4116 }
4117 case ADD_NODE_STATUS_ADDING_SLAVE:
4118 {
4119 Log::Write( LogLevel_Info, nodeId, "ADD_NODE_STATUS_ADDING_SLAVE" );
4120 Log::Write( LogLevel_Info, nodeId, "Adding node ID %d - %s", _data[4], m_currentControllerCommand->m_controllerCommandArg ? "Secure" : "Non-Secure");
4121 /* Discovered all the CC's are sent in this packet as well:
4122 * position description
4123 * 4 - Node ID
4124 * 5 - Length
4125 * 6 - Basic Device Class
4126 * 7 - Generic Device Class
4127 * 8 - Specific Device Class
4128 * 9 to Length - Command Classes
4129 * Last pck - CRC
4130 */
4131 if( m_currentControllerCommand != NULL )
4132 {
4133 m_currentControllerCommand->m_controllerAdded = false;
4134 m_currentControllerCommand->m_controllerCommandNode = _data[4];
4135 /* make sure we dont overrun our buffer. Its ok to truncate */
4136 uint8 length = _data[5];
4137 if (length > 254) length = 254;
4138 memcpy(&m_currentControllerCommand->m_controllerDeviceProtocolInfo, &_data[6], length);
4139 m_currentControllerCommand->m_controllerDeviceProtocolInfoLength = length;
4140 }
4141 // AddNodeStop( _funcId );
4142 // sleep(1);
4143 break;
4144 }
4145 case ADD_NODE_STATUS_ADDING_CONTROLLER:
4146 {
4147 Log::Write( LogLevel_Info, nodeId, "ADD_NODE_STATUS_ADDING_CONTROLLER");

Callers

nothing calls this directly

Calls 1

WriteFunction · 0.85

Tested by

no test coverage detected