为数据库插入增加保护
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#include "PowerManagerFsm.hpp"
|
||||
|
||||
|
||||
void WaterBasedReady::entry() {
|
||||
PowerManagerFsm::entry();
|
||||
pm->workCondition = WorkCondition::CHANING;
|
||||
PowerManagerFsm::handleCuriseWork();
|
||||
//启动水声设备
|
||||
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::DVL, (unsigned char)EquipmentCommand::ON);
|
||||
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, DeviceId::USBL, (unsigned char)EquipmentCommand::ON);
|
||||
pm->m_upperCommManager->processPeriodicTasks();
|
||||
pm->workCondition = WorkCondition::WATER_BASED_READY;
|
||||
LOG_F(INFO, "进入水中备航状态");
|
||||
}
|
||||
|
||||
// WaterBasedReady实现
|
||||
void WaterBasedReady::react(MasterCommandEvent const &) {
|
||||
PowerManagerFsm::handelPowerCmd();
|
||||
PowerManagerFsm::handleModCmd();
|
||||
PowerManagerFsm::handleWorkCmd();
|
||||
}
|
||||
|
||||
void WaterBasedReady::react(DevCmdExt const &e)
|
||||
{
|
||||
int id = e.id;
|
||||
int cmd = e.cmd;
|
||||
if(underWterDevices.find(id) != underWterDevices.end())
|
||||
{
|
||||
if (pm->currentMod != PMMode::Debug)
|
||||
{
|
||||
if(pm->m_depth < OVER_DEPTH)
|
||||
{
|
||||
LOG_F(INFO, "水下设备操作上电保护 %d ", id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 如果是前视声纳断电则先关机再断电
|
||||
if(id == DeviceId::forwardSonar)
|
||||
{
|
||||
if(cmd == 0)
|
||||
{
|
||||
LOG_F(INFO,"前视声纳关机指令");
|
||||
pm->sendNotification("uExternComm_frontSonarControl_cmd","0");
|
||||
MOOSPause(10000);
|
||||
}
|
||||
}
|
||||
LOG_F(INFO, "水声设备操作: %s,%d, %d", DeviceId::toString((DeviceId::Type)id), id, cmd);
|
||||
pm->m_driver.setDeviceState(pm->m_subDisSysCmd, (DeviceId::Type)id, (unsigned char)cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pm->currentMod == PMMode::Normal)
|
||||
{
|
||||
LOG_F(INFO,"正常模式:操作禁止");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
PowerManagerFsm::react(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user