Ego.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include <stdint.h>
  2. #include <memory>
  3. #include "../common/comm.h"
  4. #include "Ego.h"
  5. // start -> login -> OnSigin -> OnCarConnect -> OnRobot -> OnCarLeave
  6. // -> OnNotifyDel
  7. void CEgoNotify::OnLogin(bool bRet) {
  8. emit egoLoginResult(bRet);
  9. //emit egoMoveEnd(10004, WorkArea::Area_F, 32);
  10. }
  11. void CEgoNotify::OnRobot(std::unique_ptr<UserDriver> &info) {
  12. UserDriver users;
  13. users.uid = info->uid;
  14. users.name = info->name;
  15. users.type = info->type;
  16. users.state = info->state;
  17. //_users.push_back(users);
  18. emit egoCarAppend(users);
  19. }
  20. void CEgoNotify::OnNotifyDel(int32_t peer) {
  21. qDebug() << "OnNotifyDel";
  22. emit egoNotifyDel(peer);
  23. }
  24. // void CEgoNotify::OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR) {
  25. //
  26. // }
  27. // void CEgoNotify::OnAccel(int16_t accel, bool onoff)
  28. // {
  29. //
  30. // }
  31. // void CEgoNotify::OnSteer(uint64_t steer)
  32. // {
  33. //
  34. // }
  35. // void CEgoNotify::OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff)
  36. // {
  37. //
  38. // }
  39. void CEgoNotify::OnNotifyLeave(int32_t peer)
  40. {
  41. emit egoNotifyLeave(peer);
  42. }
  43. void CEgoNotify::OnNotifyState(int32_t uid, UserState state)
  44. {
  45. /*
  46. for (auto& node : _users)
  47. {
  48. if (node.uid == uid)
  49. {
  50. node.state = state;
  51. break;
  52. }
  53. }
  54. */
  55. emit egoNotifyState(uid,state);
  56. }
  57. void CEgoNotify::OnNotifyVideoFail(int32_t uid)
  58. {
  59. emit egoNotifyFail(uid);
  60. }