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

Method CancelControllerCommand

cpp/src/Driver.cpp:5807–5890  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Stop the current controller function -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

5805// Stop the current controller function
5806//-----------------------------------------------------------------------------
5807bool Driver::CancelControllerCommand
5808(
5809)
5810{
5811 if( m_currentControllerCommand == NULL )
5812 {
5813 // Controller is not doing anything
5814 return false;
5815 }
5816
5817 switch( m_currentControllerCommand->m_controllerCommand )
5818 {
5819 case ControllerCommand_AddDevice:
5820 {
5821 Log::Write( LogLevel_Info, 0, "Cancel Add Node" );
5822 m_currentControllerCommand->m_controllerCommandNode = 0xff; // identify the fact that there is no new node to initialize
5823 AddNodeStop( FUNC_ID_ZW_ADD_NODE_TO_NETWORK );
5824 break;
5825 }
5826 case ControllerCommand_CreateNewPrimary:
5827 {
5828 Log::Write( LogLevel_Info, 0, "Cancel Create New Primary" );
5829 Msg* msg = new Msg( "CreateNewPrimary Stop", 0xff, REQUEST, FUNC_ID_ZW_CREATE_NEW_PRIMARY, true );
5830 msg->Append( CREATE_PRIMARY_STOP );
5831 SendMsg( msg, MsgQueue_Command );
5832 break;
5833 }
5834 case ControllerCommand_ReceiveConfiguration:
5835 {
5836 Log::Write( LogLevel_Info, 0, "Cancel Receive Configuration" );
5837 Msg* msg = new Msg( "ReceiveConfiguration Stop", 0xff, REQUEST, FUNC_ID_ZW_SET_LEARN_MODE, false, false );
5838 msg->Append( 0 );
5839 SendMsg( msg, MsgQueue_Command );
5840 break;
5841 }
5842 case ControllerCommand_RemoveDevice:
5843 {
5844 Log::Write( LogLevel_Info, 0, "Cancel Remove Device" );
5845 m_currentControllerCommand->m_controllerCommandNode = 0xff; // identify the fact that there is no node to remove
5846 AddNodeStop( FUNC_ID_ZW_REMOVE_NODE_FROM_NETWORK );
5847 break;
5848 }
5849 case ControllerCommand_TransferPrimaryRole:
5850 {
5851 Log::Write( LogLevel_Info, 0, "Cancel Transfer Primary Role" );
5852 Msg* msg = new Msg( "Transfer Primary Role Stop", 0xff, REQUEST, FUNC_ID_ZW_CONTROLLER_CHANGE, true );
5853 msg->Append( CONTROLLER_CHANGE_STOP );
5854 SendMsg( msg, MsgQueue_Command );
5855 break;
5856 }
5857 case ControllerCommand_ReplicationSend:
5858 {
5859 Log::Write( LogLevel_Info, 0, "Cancel Replication Send" );
5860 m_currentControllerCommand->m_controllerCommandNode = 0xff; // identify the fact that there is no new node to initialize
5861 AddNodeStop( FUNC_ID_ZW_ADD_NODE_TO_NETWORK );
5862 break;
5863 }
5864 case ControllerCommand_CreateButton:

Callers

nothing calls this directly

Calls 2

WriteFunction · 0.85
AppendMethod · 0.45

Tested by

no test coverage detected