123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #ifndef __DevicePLAYER_H_
- #define __DevicePLAYER_H_
- #include <iostream>
- #include "deviceBase.h"
- #include "PlayerControl.h"
- #include "PlayerDeviceList.h"
- #include "PlayerLogin.h"
- #include "PlayerLogout.h"
- #include "PlayerStatus.h"
- #include "ExpelDevice.h"
- class devicePlayer:public deviceBase
- {
- private:
- std::string did = "";
- std::string cname = "";
- std::string dtype = "全向声波 R360XS2";
- public:
- devicePlayer(): deviceBase(){
- this->setDeviceToken(http);
- this->setDeviceInfo("深圳宝安机场 派尔云驱鸟设备协议");
- }
- ~devicePlayer() {}
- void serialization(){}
- bool deserialization(){}
- bool Consumer(uint8_t *data, int len, int &msg_id){return true;}
- bool getStatusMsg(int &msg_id){ return false;};
-
- /**
- * @description: 构建数据信息
- * @param {SendDevice&} sendDevice
- * @return {*}
- */
- void BuildDeviceInfo(SendDevice& sendDevice) {
- // sendDevice.deviceId = this->getDeviceId().c_str();
- // sendDevice.commandCode = "1";
- // sendDevice.status = 1;
- // sendDevice.workStatus = 1;
- // sendDevice.powerStatus = 1;
- // sendDevice.batteryStatus = 1;
- // sendDevice.num = 0;
- // sendDevice.oxyPressure = 0;
- // sendDevice.gasPressure = 0;
- // sendDevice.remark = "";
- };
-
- int32_t Open(std::string DeviceId,uint8_t* data, int& length){
- PlayerControl playerControl;
- playerControl.cid = "coperate";
- playerControl.did = DeviceId;
- playerControl.cname = ServerCname;
- playerControl.dtype = "全向声波 R360XS2";
- PlayerCommand playerCommand;
- playerCommand.device = "audioplayer";
- playerCommand.ctype = "play";
- playerCommand.param = "";
- playerControl.command.push_back(playerCommand);
- std::string json;
- playerControl.objectToJson(json);
- memcpy(data, json.c_str(), json.length());
- length = json.length();
- return 0;
- };
- int32_t Close(std::string DeviceId, uint8_t* data, int&length){
- PlayerControl playerControl;
- playerControl.cid = "coperate";
- playerControl.did = DeviceId;
- playerControl.cname = ServerCname;
- playerControl.dtype = "全向声波 R360XS2";
- PlayerCommand playerCommand;
- playerCommand.device = "audioplayer";
- playerCommand.ctype = "stop";
- playerCommand.param = "";
- playerControl.command.push_back(playerCommand);
- std::string json;
- playerControl.objectToJson(json);
- memcpy(data, json.c_str(), json.length());
- length = json.length();
- return 0;
- };
- int32_t Fire(std::string DeviceId, uint8_t* data, int& length){
- return this->Open(DeviceId, data, length);
- };
- int32_t Status(std::string DeviceId, uint8_t* data, int& length){
- PlayerInquire playerInquire;
- playerInquire.cid = "cstatus";
- playerInquire.ctype = "windows";
- playerInquire.cname = ServerCname;
- playerInquire.dtype = "全向声波 R360XS2";
- playerInquire.did = DeviceId;
- std::string json;
- playerInquire.objectToJson(json);
- memcpy(data, json.c_str(), json.length());
- length = json.length();
- return 0;
- };
- };
- #endif
|