Browse Source

fix some bug

storage-in-realtime
zhaohe 12 months ago
parent
commit
0e2f5a3574
  1. 4
      app_protocols/appexception/appexception.hpp
  2. 6
      appsrc/appcomponents/canchannel/com/zscanprotocol_com.cpp
  3. 2
      appsrc/appcomponents/canchannel/transmit_disinfection_can_master.hpp
  4. 7
      appsrc/service/app/add_liquid_service.cpp
  5. 2
      appsrc/service/app/air_leak_detect_test.hpp
  6. 9
      appsrc/service/app/drain_liquid_service.cpp
  7. 2
      appsrc/service/app/drain_liquid_service.hpp
  8. 2
      appsrc/service/device_info_mgr_service.cpp
  9. 1
      appsrc/service/front_end_realtime_display_content_mgr.cpp

4
app_protocols/appexception/appexception.hpp

@ -34,7 +34,7 @@ class appexception : public std::exception {
this->description = description; this->description = description;
this->m_ecode = ecode; this->m_ecode = ecode;
this->whatstr = fmt::format("[{}:{}] throw exception: {} {}", thisclass.className, func, ecode2str(ecode), description); this->whatstr = fmt::format("[{}:{}] throw exception: {} {}", thisclass.className, func, ecode2str(ecode), description);
thisclass.logger->error(whatstr);
// thisclass.logger->error(whatstr);
} }
appexception(ThisClass &thisclass, string func, int32_t ecode, const char *fmt, ...) { appexception(ThisClass &thisclass, string func, int32_t ecode, const char *fmt, ...) {
@ -46,7 +46,7 @@ class appexception : public std::exception {
this->description = buffer; this->description = buffer;
this->m_ecode = ecode; this->m_ecode = ecode;
this->whatstr = fmt::format("[{}:{}] throw exception: {} {}", thisclass.className, func, ecode2str(ecode), buffer); this->whatstr = fmt::format("[{}:{}] throw exception: {} {}", thisclass.className, func, ecode2str(ecode), buffer);
thisclass.logger->error(whatstr);
// thisclass.logger->error(whatstr);
} }
virtual ~appexception() {} virtual ~appexception() {}

6
appsrc/appcomponents/canchannel/com/zscanprotocol_com.cpp

@ -195,19 +195,23 @@ shared_ptr<Receipt> ZSCanProtocolCom::base_callcmd(int32_t to, int32_t cmdid, ui
shared_ptr<Receipt> ZSCanProtocolCom::callcmd(int32_t to, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime) { shared_ptr<Receipt> ZSCanProtocolCom::callcmd(int32_t to, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime) {
shared_ptr<Receipt> receipt; shared_ptr<Receipt> receipt;
usleep(10 * 1000);
for (size_t i = 0; i <= 3; i++) { for (size_t i = 0; i <= 3; i++) {
try { try {
if (i != 0) logger->warn("callcmd overtime, retry {}", i);
receipt = base_callcmd(to, cmdid, param, paramLen, overtime); receipt = base_callcmd(to, cmdid, param, paramLen, overtime);
} catch (const appexception &e) { } catch (const appexception &e) {
if (e.ecode() == err::kerr_overtime) { if (e.ecode() == err::kerr_overtime) {
// sl
if (i != 0) logger->warn("callcmd cmdid[%d] to [%d] overtime, retry {}", cmdid, to, i);
usleep(100 * 1000);
continue; continue;
} }
throw; throw;
} }
break; break;
} }
if (receipt == nullptr) THROW_APP_EXCEPTION(err::kerr_overtime, "overtime"); if (receipt == nullptr) THROW_APP_EXCEPTION(err::kerr_overtime, "overtime");
return receipt; return receipt;
} }

2
appsrc/appcomponents/canchannel/transmit_disinfection_can_master.hpp

@ -15,7 +15,7 @@
// //
#include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp" #include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp"
#include "appcomponents/canchannel/com/zscanprotocol_com.hpp" #include "appcomponents/canchannel/com/zscanprotocol_com.hpp"
#define DEFUALT_OVERTIME 30
#define DEFUALT_OVERTIME 100
namespace iflytop { namespace iflytop {
using namespace std; using namespace std;

7
appsrc/service/app/add_liquid_service.cpp

@ -8,6 +8,11 @@ using namespace iflytop;
void AddLiquidService::initialize() { void AddLiquidService::initialize() {
logger->info("AddLiquidService initialize"); logger->info("AddLiquidService initialize");
GET_TO_SERVICE(m_db);
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(m_gConfig);
GET_TO_SERVICE(m_dics);
GET_TO_SERVICE(m_dwus);
REG_EXTFN(start, void(int), stopatg); REG_EXTFN(start, void(int), stopatg);
REG_EXTFN_VOID(stop, void()); REG_EXTFN_VOID(stop, void());
@ -151,5 +156,5 @@ void AddLiquidService::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
cfg["maxLiquid"] = PORT.getDisinfectantBucketCapacity(); cfg["maxLiquid"] = PORT.getDisinfectantBucketCapacity();
cfg["show"] = true; cfg["show"] = true;
cfg["updatePeriod"] = 300; cfg["updatePeriod"] = 300;
cxt->rely = cfg;
cxt->rely = cfg;
} }

2
appsrc/service/app/air_leak_detect_test.hpp

@ -13,7 +13,7 @@
#include "service/hardware/device_io_ctrl_service.hpp" #include "service/hardware/device_io_ctrl_service.hpp"
namespace iflytop { namespace iflytop {
class AirLeakDetectTest : public enable_shared_from_this<AirLeakDetectTest> { class AirLeakDetectTest : public enable_shared_from_this<AirLeakDetectTest> {
THISCLASS(AddLiquidService);
THISCLASS(AirLeakDetectTest);
public: public:
typedef enum { typedef enum {

9
appsrc/service/app/drain_liquid_service.cpp

@ -4,6 +4,13 @@ using namespace iflytop;
void DrainLiquidService::initialize() { void DrainLiquidService::initialize() {
logger->info("DrainLiquidService initialize"); logger->info("DrainLiquidService initialize");
GET_TO_SERVICE(m_db);
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(m_gConfig);
GET_TO_SERVICE(m_dics);
GET_TO_SERVICE(m_dwus);
REG_EXTFN_VOID(start, void()); REG_EXTFN_VOID(start, void());
REG_EXTFN_VOID(stop, void()); REG_EXTFN_VOID(stop, void());
REG_EXTFN_VOID(getState, void()); REG_EXTFN_VOID(getState, void());
@ -73,7 +80,7 @@ void DrainLiquidService::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
cfg["maxLiquid"] = PORT.getDisinfectantBucketCapacity(); cfg["maxLiquid"] = PORT.getDisinfectantBucketCapacity();
cfg["show"] = true; cfg["show"] = true;
cfg["updatePeriod"] = 300; cfg["updatePeriod"] = 300;
cxt->rely = cfg;
cxt->rely = cfg;
} }
void DrainLiquidService::workThread() { void DrainLiquidService::workThread() {

2
appsrc/service/app/drain_liquid_service.hpp

@ -15,7 +15,7 @@
// //
namespace iflytop { namespace iflytop {
class DrainLiquidService : public enable_shared_from_this<DrainLiquidService> { class DrainLiquidService : public enable_shared_from_this<DrainLiquidService> {
THISCLASS(AddLiquidService);
THISCLASS(DrainLiquidService);
public: public:
typedef enum { typedef enum {

2
appsrc/service/device_info_mgr_service.cpp

@ -19,5 +19,5 @@ void DeviceInfoMgrService::getDeviceInfo(shared_ptr<MsgProcessContext> cxt) { /
content["projectType"] = PORT.getProjTypeString(); content["projectType"] = PORT.getProjTypeString();
content["appVersion"] = VERSION; content["appVersion"] = VERSION;
content["mircoVersion"] = "3.0.0"; // TODO:换成真实的版本信息 content["mircoVersion"] = "3.0.0"; // TODO:换成真实的版本信息
content["ip"] = "192.168.8.10";
content["ip"] = "192.168.73.10";
} }

1
appsrc/service/front_end_realtime_display_content_mgr.cpp

@ -8,7 +8,6 @@ void FrontEndRealtimeDisplayContentMgr::initialize() { //
} }
void FrontEndRealtimeDisplayContentMgr::readH2O2SensorData(shared_ptr<MsgProcessContext> cxt) { void FrontEndRealtimeDisplayContentMgr::readH2O2SensorData(shared_ptr<MsgProcessContext> cxt) {
auto& content = cxt->rely;
auto h2o2Mgr = GET_SERVICE(DeviceIoControlService)->getH2O2SensorMgr(); auto h2o2Mgr = GET_SERVICE(DeviceIoControlService)->getH2O2SensorMgr();

Loading…
Cancel
Save