From cab27e09a7e78e662b55de7b72e6b232988d5b27 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 12 Jun 2024 11:29:06 +0800 Subject: [PATCH] update --- api/apibasic/cmdid.hpp | 3 ++- api/zi_event_bus.hpp | 14 -------------- protocol.hpp | 4 +--- protocol_event_bus_sender.cpp | 24 ------------------------ protocol_event_bus_sender.hpp | 20 -------------------- 5 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 protocol_event_bus_sender.cpp delete mode 100644 protocol_event_bus_sender.hpp diff --git a/api/apibasic/cmdid.hpp b/api/apibasic/cmdid.hpp index 4fed3b9..5f68b56 100644 --- a/api/apibasic/cmdid.hpp +++ b/api/apibasic/cmdid.hpp @@ -15,7 +15,7 @@ typedef enum { kboard_reset = CMDID(0, 0), // para:{}, ack:{} - kevent_bus_reg_change_report = CMDID(0, 100), // para:{}, ack:{} + kevent_bus_reg_change_report = CMDID(0, 100), // val{regindex, oldval, toval} kmodule_ping = CMDID(1, 0), kmodule_get_status = CMDID(1, 4), @@ -137,6 +137,7 @@ typedef enum { kpipette_write_cmd_direct = CMDID(0x72, 21), // para:{strbuf}, ack:{strbuf} kpipette_get_sensor_sample_data = CMDID(0x72, 22), // para:{index} , ack:{motor_pos,cval,pval} kpipette_get_sensor_sample_data_num = CMDID(0x72, 23), // para:{} , ack:{num} + kpipette_sensor_sample_data_report = CMDID(0x72, 50), // val{regindex, oldval, toval} } cmdid_t; diff --git a/api/zi_event_bus.hpp b/api/zi_event_bus.hpp index a66e030..52be2bc 100644 --- a/api/zi_event_bus.hpp +++ b/api/zi_event_bus.hpp @@ -11,18 +11,4 @@ namespace iflytop { using namespace std; -// typedef enum { -// kreg_change_event = 1, -// } event_type_t; - -class ZIEventBusSender { - public: - virtual ~ZIEventBusSender() {} - /** - * @brief 模块状态发生改变,具体的状态上位机通过查询指令进行确定 - * - * @param moduleid - */ - virtual void push_reg_state_change_event(int32_t moduleid, int32_t regindex, int32_t oldval, int32_t toval) = 0; -}; } // namespace iflytop diff --git a/protocol.hpp b/protocol.hpp index 412f90d..9c86988 100644 --- a/protocol.hpp +++ b/protocol.hpp @@ -3,6 +3,4 @@ // #include "i_zcanreceiver.hpp" // -#include "reg_index_table.hpp" -// -#include "protocol_event_bus_sender.hpp" \ No newline at end of file +#include "reg_index_table.hpp" \ No newline at end of file diff --git a/protocol_event_bus_sender.cpp b/protocol_event_bus_sender.cpp deleted file mode 100644 index 353a387..0000000 --- a/protocol_event_bus_sender.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "protocol_event_bus_sender.hpp" - -#include "api/api.hpp" -#include "i_zcanreceiver.hpp" -namespace iflytop { -using namespace std; - -void ProtocolEventBusSender::initialize(IZCanReceiver* zcanreceiver) { m_zcanreceiver = zcanreceiver; } - -void ProtocolEventBusSender::push_reg_state_change_event(int32_t moduleid, int32_t regindex, int32_t oldval, int32_t toval) { - zcr_cmd_header_t cmd_header = {0}; - int32_t data[3]; - - cmd_header.subModuleid = moduleid; - cmd_header.cmdMainId = zcr::kevent_bus_reg_change_report >> 8; - cmd_header.subModuleid = zcr::kevent_bus_reg_change_report & 0xff; - - data[1] = regindex; - data[2] = oldval; - data[3] = toval; - m_zcanreceiver->triggerEvent(&cmd_header, (uint8_t*)data, sizeof(data)); -} - -} // namespace iflytop \ No newline at end of file diff --git a/protocol_event_bus_sender.hpp b/protocol_event_bus_sender.hpp deleted file mode 100644 index 9d81618..0000000 --- a/protocol_event_bus_sender.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "api/api.hpp" -#include "i_zcanreceiver.hpp" -namespace iflytop { -using namespace std; - -class ProtocolEventBusSender : public ZIEventBusSender { - IZCanReceiver* m_zcanreceiver = nullptr; - - public: - static ProtocolEventBusSender* inst() { - static ProtocolEventBusSender instance; - return &instance; - } - - void initialize(IZCanReceiver* zcanreceiver); - - virtual void push_reg_state_change_event(int32_t moduleid, int32_t regindex, int32_t oldval, int32_t toval) override; -}; -} // namespace iflytop