|
@@ -1,377 +0,0 @@
|
|
|
-// 下列 ifdef 块是创建使从 DLL 导出更简单的
|
|
|
-// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 SATHTTP_EXPORTS
|
|
|
-// 符号编译的。在使用此 DLL 的
|
|
|
-// 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
|
|
|
-// SATHTTP_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
|
|
|
-// 符号视为是被导出的。
|
|
|
-#ifdef SATHTTP_EXPORTS
|
|
|
-#define SATHTTP_API __declspec(dllexport)
|
|
|
-#else
|
|
|
-#define SATHTTP_API __declspec(dllimport)
|
|
|
-#endif
|
|
|
-
|
|
|
-// 此类是从 SATHTTP.dll 导出的
|
|
|
-class SATHTTP_API CSATHTTP
|
|
|
-{
|
|
|
- std::string url;
|
|
|
-public:
|
|
|
- CSATHTTP(void);
|
|
|
- // TODO: 在此添加您的方法。
|
|
|
-};
|
|
|
-
|
|
|
-namespace SATParameters{
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 通用的结构体;
|
|
|
- typedef struct __ST_DEVICE__{
|
|
|
- std::string strStatus; // 0表示设备空闲; 1表示设备忙碌
|
|
|
- std::string strDeviceSerial;
|
|
|
- std::string strHardwareVersion;
|
|
|
- std::string strManu;
|
|
|
- std::string strDeviceMac;
|
|
|
- std::string strLastJobStartTime;
|
|
|
- std::string strLastTimeBreak;
|
|
|
- std::string strComments;
|
|
|
- std::string strCPU;
|
|
|
- std::string strSoftwareVersion;
|
|
|
- std::string strPhoneNumber;
|
|
|
- std::string strLastJobFinishTime;
|
|
|
- std::string strMemory;
|
|
|
- std::string strModel;
|
|
|
- std::string strLastJob;
|
|
|
- std::string strLastTimeConnected;
|
|
|
- std::string strElectric;
|
|
|
- }STDevice, *pSTDevice;
|
|
|
-
|
|
|
- typedef struct __ST_RESPONE__
|
|
|
- {
|
|
|
- std::string strCode;
|
|
|
- std::string strMessage;
|
|
|
- std::string strStr;
|
|
|
- }STRespone, *pSTRespone;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 1、登录SAT的请求参数;
|
|
|
- typedef struct __ST_LOGIN_REQ__{
|
|
|
- std::string strUserName;
|
|
|
- std::string strStatus; // 0:表示请求登录; 1:表示请求登出;
|
|
|
- std::string strDeleteStatus;
|
|
|
- std::string strIP;
|
|
|
- std::string strMemory;
|
|
|
- std::string strStorage;
|
|
|
- std::string strConnectTime;
|
|
|
- std::string strExecuteName;
|
|
|
- std::string strMAC;
|
|
|
- std::string strDisconnectTime;
|
|
|
- std::string strPassword;
|
|
|
- std::string strCPU;
|
|
|
- }STLoginReq, *pSTLoginReq;
|
|
|
-
|
|
|
- // 登录SAT返回结果;
|
|
|
- typedef struct __ST_LOGIN_RESP__:__ST_RESPONE__{
|
|
|
- int nPortCount;
|
|
|
- int nCompanyId;
|
|
|
- std::string strRunnerToken;
|
|
|
- }STLoginResp, *pSTLoginResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 2、更新设备信息的请求参数;
|
|
|
- typedef struct __ST_UPDATE_DEVICE_REQ__
|
|
|
- {
|
|
|
- std::string strStatus; // 0:表示空闲; 1:离线; 2:表示忙碌; 3=?; 4:任务异常?; 5=忙碌中?;
|
|
|
- std::string strUserName;
|
|
|
- std::string strIP;
|
|
|
- std::string strStorage;
|
|
|
- std::string strRunnerName;
|
|
|
- std::string strMAC;
|
|
|
- std::string strReportType;
|
|
|
- std::string strStartTime;
|
|
|
- std::string strMemory;
|
|
|
- std::string strEndTime;
|
|
|
- std::string strCPU;
|
|
|
- std::vector<STDevice> devicelist;
|
|
|
- }STUpdateDeviceReq, *pSTUpdateDeviceReq;
|
|
|
-
|
|
|
- typedef struct __ST_UPDATE_DEVICE_RESP__:__ST_RESPONE__
|
|
|
- {
|
|
|
-
|
|
|
- }STUpdateDeviceResp, *pSTUpdateDeviceResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 3、SAT心跳请求参数;
|
|
|
- typedef struct __ST_HEARTBEAT_REQ__{
|
|
|
- std::string strUserName;
|
|
|
- std::string strRunnerMac;
|
|
|
- std::vector<STDevice> devicelist;
|
|
|
- }STHeartbeatReq, *pSTHeartbeatReq;
|
|
|
-
|
|
|
- typedef struct __ST_CASE__
|
|
|
- {
|
|
|
- std::string strIndex;
|
|
|
- std::string strCaseName;
|
|
|
- std::string strMainFilePath;
|
|
|
- std::string strId;
|
|
|
- std::string strCaseType;
|
|
|
- }STCase, *pSTCase;
|
|
|
-
|
|
|
- typedef struct __ST_JOB__
|
|
|
- {
|
|
|
- std::string strCloudPort;
|
|
|
- std::string strExecuteIP;
|
|
|
- std::string strMonkeyPctSysKeys;
|
|
|
- std::string strRedRatDeviceName;
|
|
|
- std::string strExecuteId;
|
|
|
- // std::vector<std::string> vtRunSceneParams;
|
|
|
- std::string strMonkeyPctAppSwitch;
|
|
|
- std::string strDeviceId;
|
|
|
- std::string strLoopNumber;
|
|
|
- std::vector<std::string> vtEmails;
|
|
|
- std::string strTaskType; // 1=表示SAT任务可执行, 2=表示SAT上停止了任务,请在执行完当前脚本后退出; 3=表示SAT上停止任务,并要求马上停止;
|
|
|
- std::string strMonkeyFrequency;
|
|
|
- std::string strCloudVersion;
|
|
|
- std::string strTaskInstanceName;
|
|
|
- std::string strRepeatRunTime;
|
|
|
- std::string strMonkeyTime;
|
|
|
- std::string strOutEquipmentId;
|
|
|
- std::string strPoweroff;
|
|
|
- std::string strFilePath;
|
|
|
- std::string strScriptFailRepeart;
|
|
|
- std::string strTaskInstanceId;
|
|
|
- std::string strUserId;
|
|
|
- std::string strDiffTaskInstanceFlag;
|
|
|
- std::string strBusCode;
|
|
|
- std::string strRound;
|
|
|
- std::string strControlType;
|
|
|
- std::string strMonkeyPctMajornav;
|
|
|
- std::string strTaskName;
|
|
|
- std::string strMonkeyType;
|
|
|
- std::string strMonkeyDictate;
|
|
|
- std::string strDetectedDeviceName;
|
|
|
- std::string strExecuteName;
|
|
|
- std::string strProjectName;
|
|
|
- std::string strProjectId;
|
|
|
- std::string strUniqueId;
|
|
|
- std::string strTaskId;
|
|
|
- std::string strSoftwareVersion;
|
|
|
- std::string strMonkeyPctNav;
|
|
|
- std::vector<STCase> vtCases;
|
|
|
- }STJob, *pSTJob;
|
|
|
-
|
|
|
- typedef struct __ST_TASK__
|
|
|
- {
|
|
|
- std::string strInstanceName;
|
|
|
- std::string strExecutionStatus;
|
|
|
- std::string strInstanceType;
|
|
|
- int nExecuteId;
|
|
|
- std::string strRequestIP;
|
|
|
- std::string strTaskUseType;
|
|
|
- int nDeviceId;
|
|
|
- std::vector<std::string> vtEmails;
|
|
|
- std::string strDiffTaskInstanceFlag;
|
|
|
- std::string strTaskType;
|
|
|
- int nInstanceId;
|
|
|
- std::string strProgress;
|
|
|
- std::string strStartTime;
|
|
|
- std::string strStopTime;
|
|
|
- std::string strTaskName;
|
|
|
- int Id; // 注意:对应__ST_NOTIFY_JOB_START_REQ__的strInstanceId,而非__ST_TASK__.nInstanceId;
|
|
|
- int fd;
|
|
|
- int nTaskId;
|
|
|
- STJob Job;
|
|
|
- }STTask, *pSTTask;
|
|
|
-
|
|
|
- // SAT心跳返回结果;
|
|
|
- typedef struct __ST_HEARTBEAT_RESP__:__ST_RESPONE__{
|
|
|
- std::vector<STTask> vtTask;
|
|
|
- }STHeartbeatResp, *pSTHeartbeatResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 4、通知SAT任务开始;
|
|
|
- typedef struct __ST_NOTIFY_JOB_START_REQ__
|
|
|
- {
|
|
|
- std::string strInstanceId;
|
|
|
- std::string strSignalImageUrl;
|
|
|
- std::string strDeviceId;
|
|
|
- std::string strTaskId;
|
|
|
- std::string strExecuteId;
|
|
|
- }STNotifyJobStartReq, *pSTNotifyJobStartReq;
|
|
|
-
|
|
|
- typedef struct __ST_NOTIFY_JOB_START_RESP__:__ST_RESPONE__
|
|
|
- {
|
|
|
-
|
|
|
- }STNotifyJobStartResp, *pSTNotifyJobStartResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 5、SetResultList;
|
|
|
- typedef struct __ST_JOB_PROCESS_REQ__
|
|
|
- {
|
|
|
- std::string strResultState; // 空表示Runner开始执行任务; 1=表示Runner已执行完成任务;
|
|
|
- std::string strCaseScene;
|
|
|
- std::string strCaseStep;
|
|
|
- std::string strApkMD5;
|
|
|
- std::string strCrashTime;
|
|
|
- std::string strRunnerId;
|
|
|
- std::string strCPUInfo;
|
|
|
- std::string strRunnedActionNameList;
|
|
|
- std::string strArtificialResult;
|
|
|
- std::string strArtificialModify;
|
|
|
- std::string strRunnerName;
|
|
|
- std::string strTaskType;
|
|
|
- std::string strCaseRepeat;
|
|
|
- std::string strApplicationGroup;
|
|
|
- std::string strInstanceId;
|
|
|
- std::string strCaseId;
|
|
|
- std::string strProgress;
|
|
|
- std::string strReusltMessage;
|
|
|
- std::string strJobRepeat;
|
|
|
- std::string strScreenShot;
|
|
|
- std::string strStartTime;
|
|
|
- std::string strCrashNumber;
|
|
|
- std::string strCaseName;
|
|
|
- std::string strFailedReason;
|
|
|
- std::string strImgName;
|
|
|
- std::string strCaseIndex;
|
|
|
- std::string strDeviceId;
|
|
|
- std::string strSceneIndex;
|
|
|
- std::string strTaskId;
|
|
|
- std::string strAnalysis;
|
|
|
- std::string strDevnceName;
|
|
|
- std::string strInfoType;
|
|
|
- std::string strMemoryInfo;
|
|
|
- std::string strEndTime;
|
|
|
- std::string strRoundNumber;
|
|
|
- std::string strResultType;
|
|
|
- std::string strOperationStep;
|
|
|
- }STJobProcessReq, *pSTJobProcessReq;
|
|
|
-
|
|
|
- typedef struct __ST_JOB_PROCESS_RESP__:__ST_RESPONE__
|
|
|
- {
|
|
|
- std::string strIsDelete;
|
|
|
- }STJobProcessResp, *pSTJobProcessResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 6、获取脚本下载地址;
|
|
|
- typedef struct __ST_SCRIPURL_RESP__
|
|
|
- {
|
|
|
- std::string strCaseType;
|
|
|
- std::string strCode;
|
|
|
- std::string strURL;
|
|
|
- std::string strMessage;
|
|
|
- std::string strProjectId;
|
|
|
- // 脚本保存路径;
|
|
|
- std::string strScripFile;
|
|
|
- }STScriptUrlResp,*pSTScriptUrlResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 7、保存用例脚本或任务日志;
|
|
|
- typedef struct __ST_STOP_TASK_RESP__:__ST_RESPONE__
|
|
|
- {
|
|
|
- std::string strData;
|
|
|
- }STStopTaskResp, *pSTStopTaskResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 8、保存用例脚本或任务日志;
|
|
|
- typedef struct __ST_SAVE_LOG_REQ__
|
|
|
- {
|
|
|
- std::string strUserId;
|
|
|
- std::string strFileType;
|
|
|
- std::string strCaseId;
|
|
|
- std::string strTaskId;
|
|
|
- std::string strExecuteId;
|
|
|
- std::string strUploads; // 要上传的文件;
|
|
|
- }STSaveLogReq, *pSTSaveLogReq;
|
|
|
-
|
|
|
- typedef struct __ST_SAVE_LOG_RESP__:__ST_RESPONE__
|
|
|
- {
|
|
|
- std::string strData;
|
|
|
- }STSaveLogResp, *pSTSaveLogResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 8、保存用例脚本或任务日志;
|
|
|
- typedef struct __ST_SAVE_FILE_REQ__
|
|
|
- {
|
|
|
- std::string strRoundNum;
|
|
|
- std::string strCaseRepeat;
|
|
|
- std::string strJobRepeat;
|
|
|
- std::string strInstanceId;
|
|
|
- std::string strDeviceId;
|
|
|
- std::string strExecuteId;
|
|
|
- std::string strTaskName;
|
|
|
- std::string strSceneIndex;
|
|
|
- std::string strTaskId;
|
|
|
- std::string strCaseId;
|
|
|
- std::string strDeviceName;
|
|
|
- std::string strRunnerName;
|
|
|
- std::string strRunnerIP;
|
|
|
- std::string strRunnerMAC;
|
|
|
- std::string strCaseName;
|
|
|
- std::string strCaseIndex;
|
|
|
- std::string strTaskRepeat;
|
|
|
- std::string strBusCode;
|
|
|
- std::string strFileType;
|
|
|
- std::string strCaseStep;
|
|
|
- // 要上传的文件;
|
|
|
- std::string strUploads;
|
|
|
- }STSaveFileReq, *pSTSaveFileReq;
|
|
|
-
|
|
|
- typedef struct __ST_SAVE_FILE_RESP__:__ST_RESPONE__
|
|
|
- {
|
|
|
- std::string strData;
|
|
|
- }STSaveFileResp, *pSTSaveFileResp;
|
|
|
-
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
- // 9、保存用例图片;
|
|
|
- typedef struct __ST_SAVE_IMG_REQ__
|
|
|
- {
|
|
|
- std::string strInstanceId;
|
|
|
- std::string strDeviceId;
|
|
|
- std::string strRoundNum;
|
|
|
- std::string strCaseId;
|
|
|
- std::string strCaseStep;
|
|
|
- std::string strTaskType;
|
|
|
- std::string strExecuteId;
|
|
|
- std::string strCaseRepeat;
|
|
|
- std::string strJobRepeat;
|
|
|
- // 要上传的文件;
|
|
|
- std::string strUploads;
|
|
|
- }STSaveImgReq, *pSTSaveImgReq;
|
|
|
-
|
|
|
- typedef struct __ST_SAVE_IMG_RESP__:__ST_RESPONE__
|
|
|
- {
|
|
|
- std::string strData;
|
|
|
- }STSaveImgResp, *pSTSaveImgResp;
|
|
|
-}
|
|
|
-
|
|
|
-extern SATHTTP_API int nSATHTTP;
|
|
|
-
|
|
|
-// 登录接口;
|
|
|
-SATHTTP_API int Login(std::string url, const SATParameters::STLoginReq &stLoginReq, SATParameters::STLoginResp &stLoginResp) throw();
|
|
|
-
|
|
|
-// 登录完后,必须向服务器更新设备信息,否则SAT上执行任务时无法更新Runner出来;
|
|
|
-SATHTTP_API int UpdateDeviceMessage(std::string url, const SATParameters::STUpdateDeviceReq &stUpdateDeviceReq, SATParameters::STUpdateDeviceResp &stUpdateDeviceResp) throw();
|
|
|
-
|
|
|
-// 更新完设备信息后,向服务器查询任务;
|
|
|
-SATHTTP_API int Heartbeat(std::string url, const SATParameters::STHeartbeatReq &stHeartbeatReq, SATParameters::STHeartbeatResp &stHeartbeatResp) throw();
|
|
|
-
|
|
|
-// 从心跳包中获取到任务后,通知SAT任务开始(变更SAT上的任务状态);
|
|
|
-// 注意坑:STNotifyJobStartReq.strInstanceId引用的是STTask.Id而非STTask.nInstanceId
|
|
|
-SATHTTP_API int SetResult(std::string url, const SATParameters::STNotifyJobStartReq &stNotifyJobStartReq, SATParameters::STNotifyJobStartResp &stNotifyJobStartResp) throw();
|
|
|
-
|
|
|
-// 通知SAT用例脚本已开始;
|
|
|
-SATHTTP_API int SetResultList(std::string url, const SATParameters::STJobProcessReq &stJobProcessReq, SATParameters::STJobProcessResp &stJobProcessResp) throw();
|
|
|
-
|
|
|
-SATHTTP_API int GetCaseFileListUrl(std::string url, std::string strCaseId, SATParameters::STScriptUrlResp &stScriptUrlResp) throw();
|
|
|
-SATHTTP_API int DownloadScript(std::string url, std::string strCaseId, std::string strSaveDir, SATParameters::STScriptUrlResp &stScriptUrlResp) throw();
|
|
|
-
|
|
|
-// 停止Runner上的任务;
|
|
|
-// 注意:strInstnaceId对应的是STTask.nInstanceId;
|
|
|
-SATHTTP_API int StopTaskFromRunner(std::string url, std::string strInstnaceId, SATParameters::STStopTaskResp &stStopTaskResp) throw();
|
|
|
-
|
|
|
-SATHTTP_API int SaveCaseOrTaskLog(std::string url, const SATParameters::STSaveLogReq &stSaveLogReq, SATParameters::STSaveLogResp &stSaveLogResp) throw();
|
|
|
-SATHTTP_API int SaveResultFile(std::string url, const SATParameters::STSaveFileReq &stSaveFileReq, SATParameters::STSaveFileResp &stSaveFileResp) throw();
|
|
|
-SATHTTP_API int SaveResultImg(std::string url, const SATParameters::STSaveImgReq &stSaveImgReq, SATParameters::STSaveImgResp &stSaveImgResp) throw();
|
|
|
-SATHTTP_API int GetIdNumber();
|
|
|
-SATHTTP_API int GetPyCaseInfo();
|
|
|
-SATHTTP_API int GetCaseInfo();
|
|
|
-
|
|
|
-
|
|
|
-
|