Browse Source

update

storage-in-realtime
zhaohe 12 months ago
parent
commit
793ca672e3
  1. 2
      app_protocols/apperrorcode/apperrorcode.hpp
  2. 4
      appsrc/appbase/appevent/app_events.hpp
  3. 4
      appsrc/appbase/appevent/app_promopt_event.hpp
  4. 10
      appsrc/appbase/appevent/app_warning_promopt_event.hpp
  5. 6
      appsrc/appbase/appevent/iapp_event.hpp
  6. 16
      appsrc/appsetting/project_port/project_port.cpp
  7. 1
      appsrc/appsetting/project_port/project_port.hpp
  8. 29
      appsrc/baseservice/app_event_bus.cpp
  9. 16
      appsrc/baseservice/app_event_bus.hpp
  10. 3
      appsrc/baseservice/baseservice.hpp
  11. 17
      appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp

2
app_protocols/apperrorcode/apperrorcode.hpp

@ -79,6 +79,8 @@ typedef enum {
kappe_sensor_is_pre_hearting = 10027, // 传感器正在预热
kappe_disinfection_state_is_wrong = 10028, // 消毒状态错误
} apperror_t;
}

4
appsrc/appbase/appevent/app_events.hpp

@ -0,0 +1,4 @@
#pragma once
#include "app_promopt_event.hpp"
#include "app_warning_promopt_event.hpp"
#include "iapp_event.hpp"

4
appsrc/appbase/appevent/app_promopt_event.hpp

@ -1,7 +1,7 @@
#include "app_event.hpp"
#include "iapp_event.hpp"
namespace iflytop {
class AppPromoptEvent : public AppEvent {
class AppPromoptEvent : public IAppEvent {
private:
string message;

10
appsrc/appbase/appevent/app_warning_promopt_event.hpp

@ -1,14 +1,14 @@
#pragma once
#include "app_event.hpp"
#include "iapp_event.hpp"
namespace iflytop {
class AppWarningPromoptEvent : public AppEvent {
class AppWarningPromoptEvent : public IAppEvent {
private:
string message;
int ecode;
public:
AppWarningPromoptEvent(string message) : message(message) {}
AppWarningPromoptEvent(int ecode) : ecode(ecode) {}
virtual ~AppWarningPromoptEvent() {}
string getMessage() { return message; }
int getEcode() { return ecode; }
};
} // namespace iflytop

6
appsrc/appbase/appevent/app_event.hpp → appsrc/appbase/appevent/iapp_event.hpp

@ -11,10 +11,10 @@
#include <vector>
namespace iflytop {
using namespace std;
class AppEvent {
class IAppEvent {
public:
AppEvent(/* args */) {}
virtual ~AppEvent() {}
IAppEvent(/* args */) {}
virtual ~IAppEvent() {}
};
} // namespace ifytop

16
appsrc/appsetting/project_port/project_port.cpp

@ -222,3 +222,19 @@ int32_t ProjectPort::getExtH2O2SensorNum() {
}
return 0;
}
bool ProjectPort::isHasDisinfectantBucket() {
if (isLageSpaceDM()) {
return true;
}
if (isSmallSpaceDM()) {
return true;
}
if (isPipeDM()) {
return true;
}
if (isDrawBarDM()) {
return false;
}
return false;
}

1
appsrc/appsetting/project_port/project_port.hpp

@ -104,6 +104,7 @@ class ProjectPort {
int32_t getExtH2O2SensorNum();
// int emptyPipeSprayPumpRPM = 700;
int32_t getEmptyPipeSprayPumpRPM();
bool isHasDisinfectantBucket();
private:
void initProjectSetting(int projectTypeInt);

29
appsrc/baseservice/app_event_bus.cpp

@ -1 +1,28 @@
#include "app_event_bus.hpp"
#include "app_event_bus.hpp"
using namespace iflytop;
void AppEventBus::initialize() {
m_eventBusThread.reset(new Thread("appEventBus", [this]() {
while (true) {
shared_ptr<IAppEvent> event;
{
lock_guard<mutex> lock(m_eventQueueMutex);
if (m_eventQueue.size() > 0) {
event = m_eventQueue.front();
m_eventQueue.pop_front();
}
}
if (event) {
onEvent(event);
} else {
this_thread::sleep_for(chrono::milliseconds(10));
}
}
}));
}
void AppEventBus::push(shared_ptr<IAppEvent> event) {
lock_guard<mutex> lock(m_eventQueueMutex);
m_eventQueue.push_back(event);
}

16
appsrc/baseservice/app_event_bus.hpp

@ -12,17 +12,23 @@
//
#include "appbase/appbase.hpp"
#include "appbase/appevent/app_event.hpp"
#include "appbase/appevent/app_events.hpp"
#include "appsetting/appsetting.hpp"
//
namespace iflytop {
class AppEventBus : public enable_shared_from_this<AppEventBus> {
THISCLASS(AppEventBus);
bool isInitialized = false;
bool isInitialized = false;
unique_ptr<Thread> m_eventBusThread;
list<shared_ptr<IAppEvent>> m_eventQueue;
mutex m_eventQueueMutex;
public:
nod::signal<void(shared_ptr<AppEvent>)> onEvent;
nod::signal<void(shared_ptr<IAppEvent>)> onEvent;
public:
static AppEventBus* ins() {
@ -34,10 +40,10 @@ class AppEventBus : public enable_shared_from_this<AppEventBus> {
return &instance;
}
void push(shared_ptr<AppEvent> event) {}
void push(shared_ptr<IAppEvent> event) ;
private:
void initialize() {}
void initialize() ;
};
} // namespace iflytop

3
appsrc/baseservice/baseservice.hpp

@ -2,9 +2,10 @@
#include "appbase/appbase.hpp"
#include "appsetting/appsetting.hpp"
//
#include "app_event_bus.hpp"
#include "appcomponents/canchannel/transmit_disinfection_can_master.hpp"
#include "db/db_service.hpp"
#include "devicestate/device_state_service.hpp"
#include "front_msg_processer/front_msg_processer.hpp"
#include "iflytop_front_end_service/iflytop_front_end_service.hpp"
#include "udisk_mgr_service.hpp"
#include "udisk_mgr_service.hpp"

17
appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp

@ -189,6 +189,14 @@ void DisinfectionCtrlService::checkBeforeStart() {
if (m_thread->isWaitingForJoin()) {
THROW_APP_EXCEPTION(err::kappe_disinfection_state_is_wrong, "");
}
if (dics->WaterSensor_readDeviceBottom()) {
THROW_APP_EXCEPTION(err::kappe_the_bottom_of_the_device_has_water, "");
}
if (dics->WaterSensor_readEvaporationBin()) {
THROW_APP_EXCEPTION(err::kappe_the_evaporation_bin_has_water, "");
}
}
void DisinfectionCtrlService::startWorkThread() {
@ -475,6 +483,15 @@ void DisinfectionCtrlService::processStateDisinfection(DisinfectionEvent* event)
*/
changeToNextState();
}
// AppEventBus
if (PORT.isHasDisinfectantBucket()) {
if (dwus->getWeight() < 10) {
logger->error("DisinfectantBucket is empty");
AppEventBus::ins()->push(make_shared<AppWarningPromoptEvent>(err::kappe_disinfectant_insufficient));
changeToNextState();
}
}
tryLogState(false);
// 检查是否消毒完成

Loading…
Cancel
Save