----------------------------------------------------------------------------- Start the controller performing one of its network management functions -----------------------------------------------------------------------------
| 5437 | // Start the controller performing one of its network management functions |
| 5438 | //----------------------------------------------------------------------------- |
| 5439 | void Driver::DoControllerCommand |
| 5440 | ( |
| 5441 | ) |
| 5442 | { |
| 5443 | UpdateControllerState( ControllerState_Starting ); |
| 5444 | switch( m_currentControllerCommand->m_controllerCommand ) |
| 5445 | { |
| 5446 | case ControllerCommand_AddDevice: |
| 5447 | { |
| 5448 | if( !IsPrimaryController() ) |
| 5449 | { |
| 5450 | UpdateControllerState( ControllerState_Error, ControllerError_NotPrimary ); |
| 5451 | } |
| 5452 | else |
| 5453 | { |
| 5454 | Log::Write( LogLevel_Info, 0, "Add Device" ); |
| 5455 | Msg* msg = new Msg( "ControllerCommand_AddDevice", 0xff, REQUEST, FUNC_ID_ZW_ADD_NODE_TO_NETWORK, true ); |
| 5456 | uint8 options = ADD_NODE_ANY; |
| 5457 | if (m_currentControllerCommand->m_highPower) options |= OPTION_HIGH_POWER; |
| 5458 | if (IsAPICallSupported(FUNC_ID_ZW_EXPLORE_REQUEST_INCLUSION)) options |= OPTION_NWI; |
| 5459 | msg->Append( options); |
| 5460 | SendMsg( msg, MsgQueue_Command ); |
| 5461 | } |
| 5462 | break; |
| 5463 | } |
| 5464 | case ControllerCommand_CreateNewPrimary: |
| 5465 | { |
| 5466 | if( IsPrimaryController() ) |
| 5467 | { |
| 5468 | UpdateControllerState( ControllerState_Error, ControllerError_NotSecondary ); |
| 5469 | } |
| 5470 | else if( !IsStaticUpdateController() ) |
| 5471 | { |
| 5472 | UpdateControllerState( ControllerState_Error, ControllerError_NotSUC ); |
| 5473 | } |
| 5474 | else |
| 5475 | { |
| 5476 | Log::Write( LogLevel_Info, 0, "Create New Primary" ); |
| 5477 | Msg* msg = new Msg( "ControllerCommand_CreateNewPrimary", 0xff, REQUEST, FUNC_ID_ZW_CREATE_NEW_PRIMARY, true ); |
| 5478 | msg->Append( CREATE_PRIMARY_START ); |
| 5479 | SendMsg( msg, MsgQueue_Command ); |
| 5480 | } |
| 5481 | break; |
| 5482 | } |
| 5483 | case ControllerCommand_ReceiveConfiguration: |
| 5484 | { |
| 5485 | Log::Write( LogLevel_Info, 0, "Receive Configuration" ); |
| 5486 | Msg* msg = new Msg( "ControllerCommand_ReceiveConfiguration", 0xff, REQUEST, FUNC_ID_ZW_SET_LEARN_MODE, true ); |
| 5487 | msg->Append( 0xff ); |
| 5488 | SendMsg( msg, MsgQueue_Command ); |
| 5489 | break; |
| 5490 | } |
| 5491 | case ControllerCommand_RemoveDevice: |
| 5492 | { |
| 5493 | if( !IsPrimaryController() ) |
| 5494 | { |
| 5495 | UpdateControllerState( ControllerState_Error, ControllerError_NotPrimary ); |
| 5496 | } |
nothing calls this directly
no test coverage detected