Ego.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #include "Ego.h"
  2. // start -> login -> OnSigin -> OnCarConnect -> OnRobot -> OnCarLeave
  3. // -> OnNotifyDel
  4. void CEgoNotify::OnSigin(bool bRet) {
  5. emit egoLoginResult(bRet);
  6. //emit egoMoveEnd(10004, WorkArea::Area_F, 32);
  7. }
  8. void CEgoNotify::OnRobot(std::unique_ptr<UserCamera> &info) {
  9. UserCamera users;
  10. users.uid = info->uid;
  11. users.name = info->name;
  12. users.type = info->type;
  13. users.state = info->state;
  14. users.carType = info->carType;
  15. //_users.push_back(users);
  16. emit egoCarAppend(users);
  17. }
  18. void CEgoNotify::OnNotifyDel(int32_t peer) {
  19. qDebug() << "OnNotifyDel";
  20. emit egoNotifyDel(peer);
  21. }
  22. void CEgoNotify::OnNotifyRadar(int32_t r0, int32_t r1, int32_t r2, int32_t r3,
  23. int32_t r4, int32_t r5,int32_t r6) {
  24. emit egoRadar(r0, r1, r2, r3, r4, r5,r6);
  25. }
  26. void CEgoNotify::OnNotifyEncode(int32_t left, int32_t right)
  27. {
  28. emit egoEncode(left, right);
  29. }
  30. //void CEgoNotify::OnNotifyIMU() {}
  31. void CEgoNotify::OnNotifyPing(int32_t value,double temp) { emit egoPing(value,temp); }
  32. void CEgoNotify::OnNotifyKickOff() {
  33. qDebug() << "kick off";
  34. emit egoKickoff();
  35. }
  36. void CEgoNotify::OnNotifyMoveEnd(int32_t rid, WorkArea area, int32_t no)
  37. {
  38. emit egoMoveEnd(rid, area, no);
  39. }
  40. void CEgoNotify::OnNotifyMoveRet(MoveDesc desc)
  41. {
  42. emit egoMoveRet(desc);
  43. }
  44. // void CEgoNotify::OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR) {
  45. //
  46. // }
  47. // void CEgoNotify::OnAccel(int16_t accel, bool onoff)
  48. // {
  49. //
  50. // }
  51. // void CEgoNotify::OnSteer(uint64_t steer)
  52. // {
  53. //
  54. // }
  55. // void CEgoNotify::OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff)
  56. // {
  57. //
  58. // }
  59. void CEgoNotify::OnNotifyFeed(const FeedData& data)
  60. {
  61. emit egoFeedData(data);
  62. }
  63. void CEgoNotify::OnNotifyLeave(int32_t peer)
  64. {
  65. emit egoNotifyLeave(peer);
  66. }
  67. void CEgoNotify::OnNotifyState(int32_t uid, UserState state)
  68. {
  69. /*
  70. for (auto& node : _users)
  71. {
  72. if (node.uid == uid)
  73. {
  74. node.state = state;
  75. break;
  76. }
  77. }
  78. */
  79. emit egoNotifyState(uid,state);
  80. }
  81. void CEgoNotify::OnNotifyVideoFail(int32_t uid)
  82. {
  83. emit egoNotifyFail(uid);
  84. }
  85. void CEgoNotify::OnNDTPos(Position* pos)
  86. {
  87. emit egoPosition(pos->x, pos->y, pos->z);
  88. }