m_json.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef M_JSON_H
  2. #define M_JSON_H
  3. #include <QJsonObject>
  4. #include <QJsonDocument>
  5. #include <QJsonParseError>
  6. #include <QJsonArray>
  7. #include <QObject>
  8. #include <QTime>
  9. #include <main.h>
  10. #include <m_loger.h>
  11. class JsonFunc : public QObject
  12. {
  13. Q_OBJECT
  14. public:
  15. QByteArray MotorPosInit(); //每次对焦前,电机位置初始化
  16. QByteArray MotorMove(QString select,QString setup,QString speed);
  17. QByteArray Autofocus();
  18. QByteArray ImageFunc(double m_focus);
  19. QByteArray BoardMessage();
  20. QByteArray ReadBoardData();
  21. QByteArray MakeJsonWarn(const QString &status,const QString &type);
  22. QByteArray WillMessage();
  23. QByteArray setLedState(bool sw);
  24. QByteArray CollectFan_ctr(bool sw);
  25. QByteArray Jiaodai_ctr(bool sw);
  26. QByteArray AutoTest(bool sw);
  27. QByteArray CmdUpdate();
  28. QByteArray CmdReboot();
  29. QByteArray CmdParamconf(int sh1,int eh1,int sh2,int eh2,int sh3,int eh3);
  30. QByteArray CmdParamconf_min(int sh1,int eh1,int sh2,int eh2,int sh3,int eh3);
  31. QByteArray CmdParamconf_xy_dis(int x_dis,int y_dis);
  32. QByteArray CmdParamconf_temp(int tpl,int tph);
  33. QByteArray CmdFocus();
  34. QByteArray WarnPhoto(QString err);
  35. signals:
  36. void motor_initsuccess();
  37. void motor_movesuccess();
  38. public slots:
  39. void setmqttState_d();
  40. void setmqttState_c();
  41. private:
  42. QString getLteRsrp()
  43. {
  44. auto qtContext = QJniObject(QNativeInterface::QAndroidApplication::context()); //activity
  45. jint rsrp = QJniObject::callStaticMethod<jint>("com/yfkj/bzyv1/StatusBarCtr",
  46. "getRsrp",
  47. "(Landroid/content/Context;)I",
  48. qtContext.object());
  49. LOG("信号强度:{}",rsrp);
  50. if(rsrp==4){
  51. return "优秀";
  52. }else if(rsrp==3){
  53. return "良好";
  54. }else if (rsrp==2) {
  55. return "一般";
  56. } else if (rsrp==1){
  57. return "差";
  58. }else if (rsrp==0){
  59. return "NoSignal"; // 无效值
  60. }
  61. return "NoSignal"; // 无效值
  62. }
  63. };
  64. #endif // M_JSON_H