radar_sim.cpp 943 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include <stdint.h>
  2. #include "Protocol.pb.h"
  3. #include "../common/comm.h"
  4. #include "./include/EgoInterface.h"
  5. #include "EgoClient.h"
  6. #include "radar_sim.h"
  7. CRadarSim::CRadarSim(CEgoClient* radar) :_radar(radar)
  8. {
  9. }
  10. void CRadarSim::Start()
  11. {
  12. }
  13. void CRadarSim::Stop()
  14. {
  15. }
  16. void CRadarSim::OnPeerMessage(int16_t cmd, int16_t length, const void* data)
  17. {
  18. //RemoNet::CCSensor Req;
  19. RemoNet::CCRadarMessage Req;
  20. Req.ParseFromArray(data, length);
  21. _radar->OnRadarData(Req.radar0(), Req.radar1(), Req.radar2(), Req.radar3(), Req.radar4(), Req.radar5(), Req.radar6(), Req.radar7());
  22. /*
  23. int32_t range[7] = { 0 };
  24. int32_t count = Req.node_size();
  25. for (int32_t i = 0; i < count; i++)
  26. {
  27. //range[i] = Req.range(i);
  28. auto& n = Req.node(i);
  29. range[n.id()] = n.range();
  30. }
  31. _radar->OnRadarData(range[0], range[1], range[2], range[3], range[4], range[5],range[6],range[7]);
  32. _radar->OnEncodeData(Req.left_encode(), Req.right_encode());
  33. */
  34. }