Ego.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. //传递所有车辆信息,以egoCarAppend信号中的参数发送到appmodel类
  9. void CEgoNotify::OnRobot(std::unique_ptr<UserCamera> &info) {
  10. UserCamera users;
  11. users.uid = info->uid;
  12. users.name = info->name;
  13. users.type = info->type;
  14. users.state = info->state;
  15. users.carType = info->carType;
  16. //_users.push_back(users);
  17. //发送信号到appmodel类中
  18. emit egoCarAppend(users);
  19. }
  20. void CEgoNotify::OnNotifyDel(int32_t peer) {
  21. qDebug() << "OnNotifyDel";
  22. emit egoNotifyDel(peer);
  23. }
  24. void CEgoNotify::OnNotifyRadar(int32_t r0, int32_t r1, int32_t r2, int32_t r3,
  25. int32_t r4, int32_t r5,int32_t r6, int32_t r7) {
  26. emit egoRadar(r0, r1, r2, r3, r4, r5,r6,r7);
  27. }
  28. void CEgoNotify::OnNotifyImu(float x, float y) { emit egoImu(x, y); }
  29. void CEgoNotify::OnNotifyEncode(int32_t left, int32_t right)
  30. {
  31. emit egoEncode(left, right);
  32. }
  33. //void CEgoNotify::OnNotifyIMU() {}
  34. void CEgoNotify::OnNotifyPing(int32_t value,double temp) { emit egoPing(value,temp); }
  35. void CEgoNotify::OnNotifyKickOff() {
  36. qDebug() << "kick off";
  37. emit egoKickoff();
  38. }
  39. void CEgoNotify::OnNotifyMoveEnd(int32_t rid, WorkArea area, int32_t no)
  40. {
  41. emit egoMoveEnd(rid, area, no);
  42. }
  43. void CEgoNotify::OnNotifyMoveRet(MoveDesc desc)
  44. {
  45. emit egoMoveRet(desc);
  46. }
  47. // void CEgoNotify::OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR) {
  48. //
  49. // }
  50. // void CEgoNotify::OnAccel(int16_t accel, bool onoff)
  51. // {
  52. //
  53. // }
  54. // void CEgoNotify::OnSteer(uint64_t steer)
  55. // {
  56. //
  57. // }
  58. // void CEgoNotify::OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff)
  59. // {
  60. //
  61. // }
  62. void CEgoNotify::OnNotifyFeed(const FeedData& data)
  63. {
  64. emit egoFeedData(data);
  65. }
  66. void CEgoNotify::OnNotifyLeave(int32_t peer)
  67. {
  68. emit egoNotifyLeave(peer);
  69. }
  70. void CEgoNotify::OnNotifyState(int32_t uid, UserState state)
  71. {
  72. /*
  73. for (auto& node : _users)
  74. {
  75. if (node.uid == uid)
  76. {
  77. node.state = state;
  78. break;
  79. }
  80. }
  81. */
  82. emit egoNotifyState(uid,state);
  83. }
  84. void CEgoNotify::OnNotifyVideoFail(int32_t uid)
  85. {
  86. emit egoNotifyFail(uid);
  87. }
  88. void CEgoNotify::OnNDTPos(Position* pos)
  89. {
  90. emit egoPosition(pos->x, pos->y, pos->z);
  91. }
  92. void CEgoNotify::OnCautionLight(bool cautionLight)
  93. {
  94. emit egoCautionLightChanged(cautionLight);
  95. }
  96. void CEgoNotify::OnLightL(bool lightL)
  97. {
  98. emit egoLightLChanged(lightL);
  99. }
  100. void CEgoNotify::OnLightR(bool lightR)
  101. {
  102. emit egoLightRChanged(lightR);
  103. }
  104. void CEgoNotify::OnGearF(bool gearF)
  105. {
  106. emit egoGearFChanged(gearF);
  107. }
  108. void CEgoNotify::OnGearR(bool gearR)
  109. {
  110. emit egoGearRChanged(gearR);
  111. }
  112. void CEgoNotify::OnCarPark(bool carPark)
  113. {
  114. emit egoCarParkChanged(carPark);
  115. }
  116. void CEgoNotify::OnBuzzerPlay(bool buzzerPlay)
  117. {
  118. emit egoBuzzerPlayChanged(buzzerPlay);
  119. }
  120. void CEgoNotify::OnLightFront(bool lightFront)
  121. {
  122. emit egoLightFrontChanged(lightFront);
  123. }
  124. void CEgoNotify::OnLightWork(bool lightWork)
  125. {
  126. emit egoLightWorkChanged(lightWork);
  127. }
  128. void CEgoNotify::OnEmergency(bool emergency)
  129. {
  130. emit egoEmergencyChanged(emergency);
  131. }