14 changed files with 118 additions and 14 deletions
-
4api/api.hpp
-
9api/i_zcan_cmder.hpp
-
2api/i_zcan_cmder_master.hpp
-
1api/packet_interface.hpp
-
3api/reg_index.hpp
-
25api/zi_event_bus.hpp
-
2api/zi_module.hpp
-
3cmdid.hpp
-
19protocol_event_bus_sender.cpp
-
13protocol_event_bus_sender.hpp
-
13zmodule_device_manager.cpp
-
13zmodule_device_manager.hpp
-
18zmodule_device_script_cmder_paser.cpp
-
7zmodule_device_script_cmder_paser.hpp
@ -0,0 +1,25 @@ |
|||
#pragma once
|
|||
#include <stdint.h>
|
|||
|
|||
#include <functional>
|
|||
|
|||
#include "errorcode.hpp"
|
|||
|
|||
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 toval) = 0; |
|||
}; |
|||
} // namespace iflytop
|
@ -0,0 +1,19 @@ |
|||
#include "protocol_event_bus_sender.hpp"
|
|||
|
|||
#include "api/api.hpp"
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
|
|||
void ProtocolEventBusSender::initialize(IZCanCmder* zcan_cmder) { m_zcan_cmder = zcan_cmder; } |
|||
|
|||
void ProtocolEventBusSender::push_reg_state_change_event(int32_t moduleid, int32_t event_id, int32_t eventval) { |
|||
zcr_cmd_header_t rx_cmd_header = {0}; |
|||
int32_t data[4]; |
|||
data[0] = kreg_change_event; |
|||
data[1] = moduleid; |
|||
data[2] = event_id; |
|||
data[3] = eventval; |
|||
m_zcan_cmder->triggerEvent(&rx_cmd_header, (uint8_t*)data, sizeof(data)); |
|||
} |
|||
|
|||
} // namespace iflytop
|
@ -0,0 +1,13 @@ |
|||
#include "api/api.hpp"
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
|
|||
class ProtocolEventBusSender : public ZIEventBusSender { |
|||
IZCanCmder* m_zcan_cmder = nullptr; |
|||
|
|||
public: |
|||
void initialize(IZCanCmder* zcan_cmder); |
|||
|
|||
virtual void push_reg_state_change_event(int32_t moduleid, int32_t event_id, int32_t eventval) override; |
|||
}; |
|||
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue