|
@@ -9,6 +9,22 @@
|
|
|
#define new DEBUG_NEW
|
|
|
#endif
|
|
|
|
|
|
+__if_not_exists(NotifyJobStart)
|
|
|
+{
|
|
|
+ int NotifyJobStart(std::string url, const SATParameters::STNotifyJobStartReq &stNotifyJobStartReq, SATParameters::STNotifyJobStartResp &stNotifyJobStartResp) throw()
|
|
|
+ {
|
|
|
+ return SetResult(url, stNotifyJobStartReq, stNotifyJobStartResp);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+__if_not_exists(ProcessJob)
|
|
|
+{
|
|
|
+ int ProcessJob(std::string url, const SATParameters::STJobProcessReq &stJobProcessReq, SATParameters::STJobProcessResp &stJobProcessResp) throw()
|
|
|
+ {
|
|
|
+ return SetResultList(url, stJobProcessReq, stJobProcessResp);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
#ifdef __CONSOLE__
|
|
|
|
|
|
// 唯一的应用程序对象
|
|
@@ -82,46 +98,48 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
|
|
|
stLoginResp.strStr.c_str(),
|
|
|
stLoginResp.nPortCount,
|
|
|
stLoginResp.nCompanyId,
|
|
|
- stLoginResp.strRunnerToken.c_str());
|
|
|
-
|
|
|
- // ##########################更新设备信息##############################;
|
|
|
- SATParameters::STUpdateDeviceReq stUpdateDeviceReq;
|
|
|
- SATParameters::STUpdateDeviceResp stUpdateDeviceResp;
|
|
|
- __if_not_exists(url)
|
|
|
- {
|
|
|
- std::string url = host + "/btc_execute_se/ajaxInteractiveManage!updateDeviceMessage.action";
|
|
|
- }
|
|
|
- __if_exists(url)
|
|
|
- {
|
|
|
- url = host + "/btc_execute_se/ajaxInteractiveManage!updateDeviceMessage.action";
|
|
|
- }
|
|
|
-
|
|
|
- stUpdateDeviceReq.strStatus = "0";
|
|
|
- stUpdateDeviceReq.strUserName = "superAdmin";
|
|
|
- stUpdateDeviceReq.strIP = "10.118.158.175";
|
|
|
- stUpdateDeviceReq.strStorage = "228092536KB";
|
|
|
- stUpdateDeviceReq.strRunnerName = "SAT-Admin";
|
|
|
- stUpdateDeviceReq.strMAC = "40:16:7e:23:10:53";
|
|
|
- stUpdateDeviceReq.strReportType = "1";
|
|
|
- stUpdateDeviceReq.strStartTime = "2019-12-16 19:15:30";
|
|
|
- stUpdateDeviceReq.strMemory = "8938544KB";
|
|
|
- stUpdateDeviceReq.strEndTime = "";
|
|
|
- stUpdateDeviceReq.strCPU = "24.7%";
|
|
|
- stUpdateDeviceReq.devicelist.push_back(stDevice);
|
|
|
- if ( UpdateDeviceMessage(url, stUpdateDeviceReq, stUpdateDeviceResp) )
|
|
|
- {
|
|
|
- printf("更新设备信息成功:code=%s, msg=%s, str=%s\n",
|
|
|
- stLoginResp.strCode.c_str(),
|
|
|
- stLoginResp.strMessage.c_str(),
|
|
|
- stLoginResp.strStr.c_str());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- printf("更新设备信息失败!\n");
|
|
|
- }
|
|
|
+ stLoginResp.strRunnerToken.c_str()
|
|
|
+ );
|
|
|
|
|
|
while(true)
|
|
|
{
|
|
|
+ // ##########################更新设备信息##############################;
|
|
|
+ SATParameters::STUpdateDeviceReq stUpdateDeviceReq;
|
|
|
+ SATParameters::STUpdateDeviceResp stUpdateDeviceResp;
|
|
|
+ __if_not_exists(url)
|
|
|
+ {
|
|
|
+ std::string url = host + "/btc_execute_se/ajaxInteractiveManage!updateDeviceMessage.action";
|
|
|
+ }
|
|
|
+ __if_exists(url)
|
|
|
+ {
|
|
|
+ url = host + "/btc_execute_se/ajaxInteractiveManage!updateDeviceMessage.action";
|
|
|
+ }
|
|
|
+
|
|
|
+ stUpdateDeviceReq.strStatus = "0";
|
|
|
+ stUpdateDeviceReq.strUserName = "superAdmin";
|
|
|
+ stUpdateDeviceReq.strIP = "10.118.158.175";
|
|
|
+ stUpdateDeviceReq.strStorage = "228092536KB";
|
|
|
+ stUpdateDeviceReq.strRunnerName = "SAT-Admin";
|
|
|
+ stUpdateDeviceReq.strMAC = "40:16:7e:23:10:53";
|
|
|
+ stUpdateDeviceReq.strReportType = "1";
|
|
|
+ stUpdateDeviceReq.strStartTime = "2019-12-16 19:15:30";
|
|
|
+ stUpdateDeviceReq.strMemory = "8938544KB";
|
|
|
+ stUpdateDeviceReq.strEndTime = "";
|
|
|
+ stUpdateDeviceReq.strCPU = "24.7%";
|
|
|
+ stUpdateDeviceReq.devicelist.push_back(stDevice);
|
|
|
+
|
|
|
+ if ( UpdateDeviceMessage(url, stUpdateDeviceReq, stUpdateDeviceResp) )
|
|
|
+ {
|
|
|
+ printf("更新设备信息成功:code=%s, msg=%s, str=%s\n",
|
|
|
+ stLoginResp.strCode.c_str(),
|
|
|
+ stLoginResp.strMessage.c_str(),
|
|
|
+ stLoginResp.strStr.c_str());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ printf("更新设备信息失败!\n");
|
|
|
+ }
|
|
|
+
|
|
|
// ##########################心跳包机制##############################;
|
|
|
SATParameters::STHeartbeatReq stHeartbeatReq;
|
|
|
SATParameters::STHeartbeatResp stHeartbeatResp;
|
|
@@ -135,8 +153,8 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
|
|
|
}
|
|
|
|
|
|
// 示例值;
|
|
|
- stDevice.strStatus = "0";
|
|
|
- stDevice.strDeviceSerial = "192.168.1.119:5555";
|
|
|
+ //stDevice.strStatus = "0";
|
|
|
+ //stDevice.strDeviceSerial = "192.168.1.119:5555";
|
|
|
|
|
|
stHeartbeatReq.strUserName = "superAdmin";
|
|
|
stHeartbeatReq.strRunnerMac = "40:16:7e:23:10:53";
|
|
@@ -184,6 +202,9 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
|
|
|
// 查询任务是否已在SAT上存在;
|
|
|
if ( NotifyJobStart(url, stNotifyJobStartReq, stNotifyJobStartResp) )
|
|
|
{
|
|
|
+ // 更新设备为忙碌状态;
|
|
|
+ //stDevice.strStatus = "2"; // 忙碌状态,此时请求Heartbeat将不会查询任务;
|
|
|
+ stDevice.strStatus = "2";
|
|
|
printf("NotifyJobStart 成功\n");
|
|
|
}
|
|
|
else
|
|
@@ -205,7 +226,7 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
|
|
|
}
|
|
|
|
|
|
{
|
|
|
- stJobProcessReq.strResultState = "";
|
|
|
+ stJobProcessReq.strResultState = "1";
|
|
|
stJobProcessReq.strCaseScene = "";
|
|
|
stJobProcessReq.strCaseStep = "0";
|
|
|
stJobProcessReq.strApkMD5 = "";
|
|
@@ -255,7 +276,7 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
|
|
|
stJobProcessReq.strOperationStep = "";
|
|
|
}
|
|
|
|
|
|
- // 向SAT上报:任务开始,请SAT变更任务状态;
|
|
|
+ //
|
|
|
if ( ProcessJob(url, stJobProcessReq, stJobProcessResp) )
|
|
|
{
|
|
|
// 开始下载脚本;
|