123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- #ifndef APPMODEL_H
- #define APPMODEL_H
- #include "EgoInterface.h"
- #include "ImageProvider.h"
- #include <QObject>
- #include <QtCore/QObject>
- #include <QtCore/QString>
- #include <QtGui>
- #include <QtQml/qqml.h>
- class CarData : public QObject {
- Q_OBJECT
- Q_PROPERTY(int32_t uid READ uid WRITE setUid NOTIFY dataChanged)
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY dataChanged)
- Q_PROPERTY(QString type READ type WRITE setType NOTIFY dataChanged)
- Q_PROPERTY(QString state READ state WRITE setState NOTIFY dataChanged)
- public:
- explicit CarData(QObject *parent = 0);
- CarData(const CarData &other);
- int32_t uid() const;
- QString name() const;
- QString type() const;
- QString state() const;
- int32_t carType() const;
- void setUid(const int32_t &value);
- void setName(const QString &value);
- void setType(const QString &value);
- void setState(const QString &value);
- void setCarType(const int32_t& value);
- signals:
- void dataChanged();
- private:
- int32_t m_uid;
- int32_t m_carType;
- QString m_name;
- QString m_type;
- QString m_state;
- };
- Q_DECLARE_METATYPE(CarData)
- class AppModelPrivate;
- class CFishEyeWindow;
- class AppModel : public QObject {
- Q_OBJECT
- Q_PROPERTY(bool ready READ ready WRITE setReady NOTIFY readyChanged)
- Q_PROPERTY(QQmlListProperty<CarData> car READ car NOTIFY carChanged)
- Q_PROPERTY(int32_t radar1 READ radar1 WRITE setRadar1 NOTIFY radar1Changed)
- Q_PROPERTY(int32_t radar2 READ radar2 WRITE setRadar2 NOTIFY radar2Changed)
- Q_PROPERTY(int32_t radar3 READ radar3 WRITE setRadar3 NOTIFY radar3Changed)
- Q_PROPERTY(int32_t radar4 READ radar4 WRITE setRadar4 NOTIFY radar4Changed)
- Q_PROPERTY(int32_t radar5 READ radar5 WRITE setRadar5 NOTIFY radar5Changed)
- // Q_PROPERTY(int32_t radar6 READ radar6 WRITE setRadar6 NOTIFY radar6Changed)
- // Q_PROPERTY(int32_t radar7 READ radar7 WRITE setRadar7 NOTIFY radar7Changed)
- Q_PROPERTY(float Steer READ Steer WRITE setSteerAngle NOTIFY steerAngleChanged)
- //Q_PROPERTY(int32_t radar6 READ radar6 WRITE setRadar6 NOTIFY radar6Changed)
- Q_PROPERTY(int32_t ping READ ping WRITE setPing NOTIFY pingChanged)
- Q_PROPERTY(int32_t temp READ temp WRITE setTemp NOTIFY tempChanged)
- Q_PROPERTY(int32_t alertSound READ alertSound NOTIFY playAlertSound)
- Q_PROPERTY(int32_t Speed READ Speed WRITE SetSpeed NOTIFY speedChanged)
- Q_PROPERTY(int32_t Visible READ Visible WRITE SetVisible NOTIFY visibleChanged)
- // Q_PROPERTY(int32_t Gear READ Gear WRITE SetGear NOTIFY gearChanged)
- Q_PROPERTY(QString Account READ Account WRITE setAccount NOTIFY accountChanged)
- Q_PROPERTY(QString Password READ Password WRITE setPassword NOTIFY passwordChanged)
- Q_PROPERTY(QString CarName READ CarName WRITE setCarName NOTIFY carNameChanged)
- Q_PROPERTY(QString DriveName READ DriveName WRITE setDriveName NOTIFY driveNameChanged)
- Q_PROPERTY(int32_t BrakePressure READ BrakePressure WRITE SetBrakePressure NOTIFY brakePressureChanged)
- Q_PROPERTY(int32_t GearboxOilPressure READ GearboxOilPressure WRITE SetGearBoxOilPressure NOTIFY gearboxOilPressureChanged)
- Q_PROPERTY(int32_t GearboxOilTemp READ GearboxOilTemp WRITE SetGearBoxOilTemp NOTIFY gearboxOilTempChanged)
- Q_PROPERTY(int32_t EnginRpm READ EnginRpm WRITE SetEngingRpm NOTIFY engineRpmChanged)
- Q_PROPERTY(int32_t EngineOilPressure READ EngineOilPressure WRITE SetEngineOilPressure NOTIFY engineoilPressureChanged)
- Q_PROPERTY(int32_t OilPos READ OilPos WRITE SetOilPos NOTIFY oilPosChanged)
- Q_PROPERTY(int32_t WorkPressure READ WorkPressure WRITE setWorkPressure NOTIFY workPressureChanged)
- Q_PROPERTY(int32_t Cold READ Cold WRITE SetCold NOTIFY coldChanged)
- Q_PROPERTY(int32_t leftAngle READ leftAngle WRITE setLeftAngle NOTIFY leftAngleChanged)
- Q_PROPERTY(int32_t rightAngle READ rightAngle WRITE setRightAngle NOTIFY rightAngleChanged)
- // Q_PROPERTY(int32_t ModelX READ ModelX WRITE setModelX NOTIFY modelXChanged)
- // Q_PROPERTY(int32_t ModelY READ ModelY WRITE setModelY NOTIFY modelYChanged)
- // Q_PROPERTY(int32_t ModelZ READ ModelZ WRITE setModelZ NOTIFY modelZChanged)
- public:
- explicit AppModel(IEgoNotify *n , IEgoControl *c , QObject* qmlObj, QObject *parent = 0);
- ~AppModel();
- Q_INVOKABLE void userLogin(QString useName, QString password);
- Q_INVOKABLE void connectCar(int id);
- Q_INVOKABLE void leaveCar();
- Q_INVOKABLE void logout();
- Q_INVOKABLE void moveBegin(int32_t area,int32_t no);
-
- // Q_INVOKABLE void switchDriver();
- //Q_INVOKABLE void areaChanged(int32_t area);
- Q_INVOKABLE void controlCar(int id);
- Q_INVOKABLE void cancelControl();
- Q_INVOKABLE void showBackDlg(QString content, WorkArea area, int32_t no, int32_t uid);
- Q_INVOKABLE void showMoveDlg(MoveDesc desc);
- Q_INVOKABLE bool idle(int32_t uid);
- //Q_INVOKABLE void showTrackDlg();
- // Q_INVOKABLE void track();
- //Q_INVOKABLE void unTrack();
- //Q_INVOKABLE bool autoClose();
- //Q_INVOKABLE QString ReadyText();
- bool ready() const;
- int radar1() const;
- int radar2() const;
- int radar3() const;
- int radar4() const;
- int radar5() const;
- //int radar6() const;
- //int radar7() const;
- QString Account() const;
- QString Password() const;
- QString CarName() const;
- QString DriveName() const;
-
- /*int radar6() const;*/
- int ping() const;
- double temp() const;
-
- int alertSound() const;
- int32_t BrakePressure() const;
- int32_t OilPos() const;
- int32_t GearboxOilPressure()const;
- int32_t GearboxOilTemp()const;
- int32_t EnginRpm()const;
- int32_t EngineOilPressure()const;
- int32_t Speed()const;
- bool Visible() const;
- //int32_t Gear() const;
- int32_t Cold() const;
- //int32_t ModelX() const;
- // int32_t ModelY() const;
- // int32_t ModelZ() const;
- int32_t leftAngle() const;
- int32_t rightAngle() const;
- float Steer() const;
- int32_t WorkPressure() const;
- void SetBrakePressure(const int32_t value);
- void SetOilPos(const int32_t value);
- void SetGearBoxOilPressure(const int32_t value);
- void SetGearBoxOilTemp(const int32_t value);
- void SetEngingRpm(const int32_t value);
- void SetEngineOilPressure(const int32_t value);
- void SetSpeed(const int32_t value);
- void SetVisible(const bool value);
- //void SetGear(const int32_t value);
- void SetCold(const int32_t value);
- void setReady(const bool value);
- void setRadar1(const int32_t &value);
- void setRadar2(const int32_t &value);
- void setRadar3(const int32_t &value);
- void setRadar4(const int32_t &value);
- void setRadar5(const int32_t &value);
- //void setRadar6(const int32_t& value);
- //void setRadar7(const int32_t& value);
- void setAccount(const QString& value);
- void setPassword(const QString& password);
- void setCarName(const QString& carname);
- void setDriveName(const QString& drivename);
- void setWorkPressure(const int32_t value);
- //void setModelX(const int32_t value);
- //void setModelY(const int32_t value);
- //void setModelZ(const int32_t value);
- void setLeftAngle(const int32_t value);
- void setRightAngle(const int32_t value);
- //void setRadar6(const int32_t &value);
- void setPing(const int32_t &value);
- void setTemp(const double& value);
- void setSteerAngle(const float& value);
- QQmlListProperty<CarData> car() const;
- public slots:
- void onLoginRst(bool rst);
- void onCarAppend(const UserCamera &info);
- void onRadarUpadte(int32_t r0, int32_t r1, int32_t r2, int32_t r3, int32_t r4,
- int32_t r5, int32_t r6);
- void onEncodeUpdate(int32_t left, int32_t right);
- void onFeedData(const FeedData& data);
-
- void onNotifyState(int32_t uid, UserState state);
- void onPing(int32_t value,double temp);
- void onMoveEnd(int32_t rid, WorkArea area, int32_t no);
- void onNotifyDel(int32_t peer);
- void onKickoff();
- void onNotifyLeave(int32_t peer);
- void onNotifyFail(int32_t peer);
- void onMoveRet(MoveDesc desc);
- void OnClose();
- //void OnPosition(float x, float y, float z);
- signals:
- void readyChanged();
- void carChanged();
- void radar1Changed();
- void radar2Changed();
- void radar3Changed();
- void radar4Changed();
- void radar5Changed();
- //void radar6Changed();
- //void radar7Changed();
- void accountChanged();
- void passwordChanged();
- void carNameChanged();
- void driveNameChanged();
- void sectionTextChanged();
- void steerAngleChanged();
- // void radar6Changed();
- void pingChanged();
- void tempChanged();
- void speedChanged();
- void visibleChanged();
- void gearChanged();
- void coldChanged();
- void gearboxOilPressureChanged();
- void gearboxOilTempChanged();
- void engineRpmChanged();
- void engineoilPressureChanged();
- void brakePressureChanged();
- void playAlertSound();
- void carConnected();
- void closeWin();
- void oilPosChanged();
- void workPressureChanged();
- void leftAngleChanged();
- void rightAngleChanged();
- private:
- IEgoNotify *_notify;
- IEgoControl *_control;
- // std::unique_ptr<CFishEyeWindow> _window;
- AppModelPrivate *d;
- std::vector<UserCamera> _users;
- QString m_account;
- QString m_password;
- QString m_carName;
- QString m_driveName;
- int32_t m_radar1 = 0;
- int32_t m_radar2 = 0;
- int32_t m_radar3 = 0;
- int32_t m_radar4 = 0;
- int32_t m_radar5 = 0;
- //int32_t m_radar6 = 0;
- //int32_t m_radar7 = 0;
- int32_t m_ping =0;
- double m_temp = 0.f;
- int32_t m_alert;
- int32_t m_peer;
- int32_t m_work_pressure =0; //工作系统压力
- int32_t m_brake_pressure =0;//制动系统压力
- int32_t m_gearbox_oil_temp =0;//变速箱油温
- int32_t m_gearbox_oil_pressure=0;//变速箱油压
- int32_t m_oil_pos = 0;
- int32_t m_cold_water = 0;
- int32_t m_engine_rpm =0;//发动机转速
- int32_t m_engine_oil_pressure =0;// 发动机油压
- int32_t m_speed =0;
- bool m_visible = true;
- //int32_t m_gear =0;
- //WorkArea m_area= WorkArea::Area_A;
- // int32_t m_no;
- bool m_ready;
- QObject* m_qmlObj = nullptr;
- //int32_t m_modelx = 0;
- //int32_t m_modely = 0;
- int32_t m_steerAngle = 0;
- // int32_t m_modelz = 0;
- int32_t m_leftAngle = 0;
- int32_t m_rightAngle = 0;
- Lock_Status m_leftlock;
- Lock_Status m_rightlock;
- };
- #endif // APPMODEL_H
|