You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
761 B

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #include "protocol_event_bus_sender.hpp"
  2. #include "api/api.hpp"
  3. #include "cmdid.hpp"
  4. namespace iflytop {
  5. using namespace std;
  6. void ProtocolEventBusSender::initialize(IZCanReceiver* zcanreceiver) { m_zcanreceiver = zcanreceiver; }
  7. void ProtocolEventBusSender::push_reg_state_change_event(int32_t moduleid, int32_t regindex, int32_t oldval, int32_t toval) {
  8. zcr_cmd_header_t cmd_header = {0};
  9. int32_t data[3];
  10. cmd_header.subModuleid = moduleid;
  11. cmd_header.cmdMainId = zcr::kevent_bus_reg_change_report >> 8;
  12. cmd_header.subModuleid = zcr::kevent_bus_reg_change_report & 0xff;
  13. data[1] = regindex;
  14. data[2] = oldval;
  15. data[3] = toval;
  16. m_zcanreceiver->triggerEvent(&cmd_header, (uint8_t*)data, sizeof(data));
  17. }
  18. } // namespace iflytop