wangsaitao 10 kuukautta sitten
vanhempi
commit
7a9205885a
1 muutettua tiedostoa jossa 119 lisäystä ja 118 poistoa
  1. 119 118
      public/static/phonejs/deviceapi.js

+ 119 - 118
public/static/phonejs/deviceapi.js

@@ -6,41 +6,42 @@ var W_EXCEED_NUM =3;//超过用户数了
 
 
 function getEvent(parseEvent) {
+	return ;
 //	if(g_msg) return;
-	$.ajax({ 
-		type: "post", 
-		url: "http://127.0.0.1:3001/msg/", 
-		dataType: "jsonp", 
-		timeout: 30000,		
+	$.ajax({
+		type: "post",
+		url: "http://127.0.0.1:3001/msg/",
+		dataType: "jsonp",
+		timeout: 30000,
 		data: {"act": "get","timeout":30000},
 	//data中的timeout值要跟前面AJAX的timeout值相等,不设置默认是30000
-		success: function (data,textStatus) { 
+		success: function (data,textStatus) {
 			// $("#StatusArea").append("--- " + data );
 			if(textStatus == "success")
 			{
-				getEvent(parseEvent);		
+				getEvent(parseEvent);
 			}
 			if(data != null)
 			{
 			 	//AppendStatus(data+ "--\r\n");
 				parseEvent(data.ch,data.e_type,data.e_handle,data.l_result,data.e_data);
 			}
-		}, 
-		 complete:function(XMLHttpRequest,textStatus){  
-					if(XMLHttpRequest.readyState=="4"){  
-						//alert(XMLHttpRequest.responseText);  
-					}  
-			},  		
-		error: function (XMLHttpRequest, textStatus, errorThrown) { 
+		},
+		 complete:function(XMLHttpRequest,textStatus){
+					if(XMLHttpRequest.readyState=="4"){
+						//alert(XMLHttpRequest.responseText);
+					}
+			},
+		error: function (XMLHttpRequest, textStatus, errorThrown) {
 			//$("#StatusArea").append("[state: " + textStatus + ", error: " + errorThrown + " ]<br/>");
 			if (textStatus == "timeout") { // 请求超时
 					  // 递归调用
 					getEvent(parseEvent);
 				// 其他错误,如网络错误等
-				} else { 
+				} else {
 					 getEvent(parseEvent);
 				}
-		} 
+		}
 	});
 	 //setTimeout(getEvent ,1000);
 }
@@ -49,36 +50,36 @@ function sendCmd(cmd_name,paraObj,resultCallback)
 {
 	var nResult = -99;
 	var bSync = false;
-	$.ajax({ 
-		type: "post", 
-		url: "http://127.0.0.1:3001/cmd/", 
-		dataType: "jsonp", 
+	$.ajax({
+		type: "post",
+		url: "http://127.0.0.1:3001/cmd/",
+		dataType: "jsonp",
 		data: {"act": cmd_name,"para":JSON.stringify(paraObj)},
 		async:false,
-		success: function (data,textStatus) { 
+		success: function (data,textStatus) {
 			// $("#StatusArea").append("--- " + data );
 			bSync = true;
 			nResult = data.result;
 			if(resultCallback!="" && resultCallback != null)
 				resultCallback(nResult);
 			return nResult;
-		}, 
-		 complete:function(XMLHttpRequest,textStatus){  
-					if(XMLHttpRequest.readyState=="4"){  
-						//alert(XMLHttpRequest.responseText);  
-					}  
-			},  		
-		error: function (XMLHttpRequest, textStatus, errorThrown) { 
+		},
+		 complete:function(XMLHttpRequest,textStatus){
+					if(XMLHttpRequest.readyState=="4"){
+						//alert(XMLHttpRequest.responseText);
+					}
+			},
+		error: function (XMLHttpRequest, textStatus, errorThrown) {
 			console.log("网络错误! " + textStatus + ", error: " + errorThrown );
 			if (textStatus == "timeout") { // 请求超时
 					//getEvent(); // 递归调用
 				// 其他错误,如网络错误等
-				} else { 
+				} else {
 					//getEvent();
 				}
 			bSync = true;
-		} 
-	});	
+		}
+	});
 //	Sleep(500);
  //	var timestamp=new Date().getTime();
  //	alert(timestamp+"---"+ nResult);
@@ -90,38 +91,38 @@ function check_ver(iVer,nextFunc)
 	var nResult = -99;
 	var paraObj={};
 	paraObj.a= iVer;
-	$.ajax({ 
-		type: "post", 
-		url: "http://127.0.0.1:3001/cmd/", 
-		dataType: "jsonp", 
+	$.ajax({
+		type: "post",
+		url: "http://127.0.0.1:3001/cmd/",
+		dataType: "jsonp",
 		data: {"act": "check_ver","para":JSON.stringify(paraObj)},
 		timeout: 1000,
 		//async:false,
-		success: function (data,textStatus) { 
+		success: function (data,textStatus) {
 			// $("#StatusArea").append("--- " + data );
 			nResult = data.result;
 			if(nextFunc!="" && nextFunc != null)
 				nextFunc(nResult);
 			return nResult;
-		}, 
-		 complete:function(XMLHttpRequest,textStatus){  
-					if(XMLHttpRequest.readyState=="4"){  
-						//alert(XMLHttpRequest.responseText);  
-					}  
-			},  		
-		error: function (XMLHttpRequest, textStatus, errorThrown) { 
+		},
+		 complete:function(XMLHttpRequest,textStatus){
+					if(XMLHttpRequest.readyState=="4"){
+						//alert(XMLHttpRequest.responseText);
+					}
+			},
+		error: function (XMLHttpRequest, textStatus, errorThrown) {
 			//alert("没有安装! " + textStatus + ", error: " + errorThrown );
 			nextFunc(nResult);
 			if (textStatus == "timeout") { // 请求超时
 					//getEvent(); // 递归调用
 				// 其他错误,如网络错误等
-				} else { 
+				} else {
 					//getEvent();
 				}
 			return nResult;
-		} 
-	});	
-	return nResult;	
+		}
+	});
+	return nResult;
 }
 function set_check_data_url(strUrl,nextFunc)
 {
@@ -129,7 +130,7 @@ function set_check_data_url(strUrl,nextFunc)
 	var paraObj={};
 	paraObj.a= strUrl;
 	nResult = sendCmd("set_check_url",paraObj,nextFunc);
-	return nResult;	
+	return nResult;
 }
 //最右边的是执行下一个函数的参数
 //下一步函数格式为function nextFunc(nResult)内含上次函数执行后返回的结果
@@ -148,7 +149,7 @@ function CloseDevice(nDevice_type,nextFunc) {
 	paraObj.a=nDevice_type;
 	paraObj.b = 0;
 	nResult = sendCmd("QNV_CloseDevice",paraObj,nextFunc);
-	return nResult;	
+	return nResult;
 }
 function SetDevCtrl( nChannelID, uCtrlType, nValue,nextFunc)
 {
@@ -158,7 +159,7 @@ function SetDevCtrl( nChannelID, uCtrlType, nValue,nextFunc)
 	paraObj.b = uCtrlType;
 	paraObj.c = nValue;
 	nResult = sendCmd("QNV_SetDevCtrl",paraObj,nextFunc);
-	return nResult;		
+	return nResult;
 }
 function GetDevCtrl(nChannelID,uCtrlType,nextFunc)
 {
@@ -167,7 +168,7 @@ function GetDevCtrl(nChannelID,uCtrlType,nextFunc)
 	paraObj.a = nChannelID;
 	paraObj.b = uCtrlType;
 	nResult = sendCmd("QNV_GetDevCtrl",paraObj,nextFunc);
-	return nResult;			
+	return nResult;
 }
 function SetParam(  nChannelID,  uParamType,  nValue,nextFunc)
 {
@@ -177,7 +178,7 @@ function SetParam(  nChannelID,  uParamType,  nValue,nextFunc)
 	paraObj.b = uParamType;
 	paraObj.c = nValue;
 	nResult = sendCmd("QNV_SetParam",paraObj,nextFunc);
-	return nResult;		
+	return nResult;
 }
 function GetParam(  nChannelID,  uParamType,nextFunc )
 {
@@ -186,7 +187,7 @@ function GetParam(  nChannelID,  uParamType,nextFunc )
 	paraObj.a = nChannelID;
 	paraObj.b = uParamType;
 	nResult = sendCmd("QNV_GetParam",paraObj,nextFunc);
-	return nResult;		
+	return nResult;
 }
 function PlayFile(  nChannelID,  uPlayType,  nValue,  nValueEx, pValue,nextFunc)
 {
@@ -198,7 +199,7 @@ function PlayFile(  nChannelID,  uPlayType,  nValue,  nValueEx, pValue,nextFunc)
 	paraObj.d = nValueEx;
 	paraObj.e = pValue;
 	nResult = sendCmd("QNV_PlayFile",paraObj,nextFunc);
-	return nResult;		
+	return nResult;
 }
 function PlayMultiFile(  nChannelID,  uPlayType,  nValue,  nValueEx, pValue,nextFunc)
 {
@@ -210,7 +211,7 @@ function PlayMultiFile(  nChannelID,  uPlayType,  nValue,  nValueEx, pValue,next
 	paraObj.d = nValueEx;
 	paraObj.e = pValue;
 	nResult = sendCmd("QNV_PlayMultiFile",paraObj,nextFunc);
-	return nResult;			
+	return nResult;
 }
 function PlayString(  nChannelID,  uPlayType,  nValue,  nValueEx, pValue,nextFunc)
 {
@@ -222,7 +223,7 @@ function PlayString(  nChannelID,  uPlayType,  nValue,  nValueEx, pValue,nextFun
 	paraObj.d = nValueEx;
 	paraObj.e = pValue;
 	nResult = sendCmd("QNV_PlayString",paraObj,nextFunc);
-	return nResult;			
+	return nResult;
 }
 function RecordFile(  nChannelID,  uRecordType,  nValue,  nValueEx, pValue,nextFunc)
 {
@@ -234,7 +235,7 @@ function RecordFile(  nChannelID,  uRecordType,  nValue,  nValueEx, pValue,nextF
 	paraObj.d = nValueEx;
 	paraObj.e = pValue;
 	nResult = sendCmd("QNV_RecordFile",paraObj,nextFunc);
-	return nResult;	
+	return nResult;
 }
 function Conference(  nChannelID,  nConfID,  uConfType,  nValue, pValue,nextFunc)
 {
@@ -246,7 +247,7 @@ function Conference(  nChannelID,  nConfID,  uConfType,  nValue, pValue,nextFunc
 	paraObj.d = nValue;
 	paraObj.e = pValue;
 	nResult = sendCmd("QNV_Conference",paraObj,nextFunc);
-	return nResult;		
+	return nResult;
 }
 function General(  nChannelID,  uGeneralType,  nValue, pValue,nextFunc)
 {
@@ -257,7 +258,7 @@ function General(  nChannelID,  uGeneralType,  nValue, pValue,nextFunc)
 	paraObj.c = nValue;
 	paraObj.d = pValue;
 	nResult = sendCmd("QNV_General",paraObj,nextFunc);
-	return nResult;		
+	return nResult;
 }
 function DevInfo(  nChannelID,  uDevInfoType,nextFunc)
 {
@@ -266,7 +267,7 @@ function DevInfo(  nChannelID,  uDevInfoType,nextFunc)
 	paraObj.a = nChannelID;
 	paraObj.b = uDevInfoType;
 	nResult = sendCmd("QNV_DevInfo",paraObj,nextFunc);
-	return nResult;			
+	return nResult;
 }
 //nextFunc参数是一个对象包含result和缓存
 function  Storage(  nDevID,  uOPType,  uSeek, pPwd, pValue,nextFunc )
@@ -279,13 +280,13 @@ function  Storage(  nDevID,  uOPType,  uSeek, pPwd, pValue,nextFunc )
 	paraObj.e = pValue;
 	var objResult ={};
 	objResult.result = -99;
-	$.ajax({ 
-		type: "post", 
-		url: "http://127.0.0.1:3001/cmd/", 
-		dataType: "jsonp", 
+	$.ajax({
+		type: "post",
+		url: "http://127.0.0.1:3001/cmd/",
+		dataType: "jsonp",
 		data: {"act": "QNV_Storage","para":JSON.stringify(paraObj)},
 		async:false,
-		success: function (data) { 
+		success: function (data) {
 			// $("#StatusArea").append("--- " + data );
 			objResult.result = data.result;
 			objResult.content = data.content;
@@ -293,23 +294,23 @@ function  Storage(  nDevID,  uOPType,  uSeek, pPwd, pValue,nextFunc )
 				objResult.outbuf  = decodeURIComponent(data.outbuf);
 				if(nextFunc != null)
 					nextFunc(objResult);
-		}, 
-		 complete:function(XMLHttpRequest,textStatus){  
-					if(XMLHttpRequest.readyState=="4"){  
-						//alert(XMLHttpRequest.responseText);  
-					}  
-			},  		
-		error: function (XMLHttpRequest, textStatus, errorThrown) { 
+		},
+		 complete:function(XMLHttpRequest,textStatus){
+					if(XMLHttpRequest.readyState=="4"){
+						//alert(XMLHttpRequest.responseText);
+					}
+			},
+		error: function (XMLHttpRequest, textStatus, errorThrown) {
 			alert("网络错误! " + textStatus + ", error: " + errorThrown );
 			if (textStatus == "timeout") { // 请求超时
 					//getEvent(); // 递归调用
 				// 其他错误,如网络错误等
-				} else { 
+				} else {
 					//getEvent();
 				}
-		} 
-	});		
-	return objResult;			
+		}
+	});
+	return objResult;
 }
 //接受文件在asp,php的参数为filedata1="文件名"
 function Remote(  uRemoteType,  nValue, pInValue, pInValueEx, pOutValue,  nBufSize,nextFunc)
@@ -321,9 +322,9 @@ function Remote(  uRemoteType,  nValue, pInValue, pInValueEx, pOutValue,  nBufSi
 	paraObj.c = pInValue;
 	paraObj.d = pInValueEx;
 	paraObj.e = pOutValue;
-	
+
 	nResult = sendCmd("QNV_Remote",paraObj,nextFunc);
-	return nResult;			
+	return nResult;
 }
 //接受文件在asp,php的参数为filedata1="文件名"
 function Remote(  uRemoteType,  nValue, pInValue, pInValueEx, pOutValue,  nBufSize,nextFunc)
@@ -335,9 +336,9 @@ function Remote(  uRemoteType,  nValue, pInValue, pInValueEx, pOutValue,  nBufSi
 	paraObj.c = pInValue;
 	paraObj.d = pInValueEx;
 	paraObj.e = pOutValue;
-	
+
 	nResult = sendCmd("QNV_Remote",paraObj,nextFunc);
-	return nResult;			
+	return nResult;
 }
 //返回一个结果对象
 function Tool(  uToolType,  nValue, pInValue, pInValueEx, nextFunc )
@@ -349,20 +350,20 @@ function Tool(  uToolType,  nValue, pInValue, pInValueEx, nextFunc )
 	paraObj.c = pInValue;
 	paraObj.d = pInValueEx;
 	objResult.result = -99;
-	$.ajax({ 
-		type: "post", 
-		url: "http://127.0.0.1:3001/cmd/", 
-		dataType: "jsonp", 
+	$.ajax({
+		type: "post",
+		url: "http://127.0.0.1:3001/cmd/",
+		dataType: "jsonp",
 		data: {"act": "QNV_Tool","para":JSON.stringify(paraObj)},
 		async:false,
-		success: function (data) { 
+		success: function (data) {
 			// $("#StatusArea").append("--- " + data );
 			objResult.result = data.result;
 			objResult.content = data.content;
 			objResult.outbuf = "";
 			if(data.outbuf != null )
 			{
-				objResult.outbuf = decodeURIComponent(data.outbuf);	 
+				objResult.outbuf = decodeURIComponent(data.outbuf);
 			}
 			 switch(uToolType) {
 			 case 	QNV_TOOL_PSTNEND:
@@ -417,25 +418,25 @@ function Tool(  uToolType,  nValue, pInValue, pInValueEx, nextFunc )
 				 if(nextFunc != null)
 			 		nextFunc(objResult.result);
 				return objResult.result;
-			 }					
-		}, 
-		 complete:function(XMLHttpRequest,textStatus){  
-					if(XMLHttpRequest.readyState=="4"){  
-						//alert(XMLHttpRequest.responseText);  
-					}  
-			},  		
-		error: function (XMLHttpRequest, textStatus, errorThrown) { 
+			 }
+		},
+		 complete:function(XMLHttpRequest,textStatus){
+					if(XMLHttpRequest.readyState=="4"){
+						//alert(XMLHttpRequest.responseText);
+					}
+			},
+		error: function (XMLHttpRequest, textStatus, errorThrown) {
 			alert("网络错误! " + textStatus + ", error: " + errorThrown );
 			if (textStatus == "timeout") { // 请求超时
 					//getEvent(); // 递归调用
 				// 其他错误,如网络错误等
-				} else { 
+				} else {
 					//getEvent();
 				}
-		} 
-	});		
+		}
+	});
 
-	return objResult;		
+	return objResult;
 }
 
 function CallLog( nChannelID, uLogType,nextFunc)
@@ -445,13 +446,13 @@ function CallLog( nChannelID, uLogType,nextFunc)
 	paraObj.a = nChannelID;
 	paraObj.b = uLogType;
 	objResult.result = -99;
-	$.ajax({ 
-		type: "post", 
-		url: "http://127.0.0.1:3001/cmd/", 
-		dataType: "jsonp", 
+	$.ajax({
+		type: "post",
+		url: "http://127.0.0.1:3001/cmd/",
+		dataType: "jsonp",
 		data: {"act": "QNV_CallLog","para":JSON.stringify(paraObj)},
 		async:false,
-		success: function (data) { 
+		success: function (data) {
 			// $("#StatusArea").append("--- " + data );
 			objResult.result = data.result;
 			objResult.content = data.content;
@@ -475,25 +476,25 @@ function CallLog( nChannelID, uLogType,nextFunc)
 				 		nextFunc(objResult.outbuf);
 					return objResult.outbuf;;
 				 }
-				
-		}, 
-		 complete:function(XMLHttpRequest,textStatus){  
-					if(XMLHttpRequest.readyState=="4"){  
-						//alert(XMLHttpRequest.responseText);  
-					}  
-			},  		
-		error: function (XMLHttpRequest, textStatus, errorThrown) { 
+
+		},
+		 complete:function(XMLHttpRequest,textStatus){
+					if(XMLHttpRequest.readyState=="4"){
+						//alert(XMLHttpRequest.responseText);
+					}
+			},
+		error: function (XMLHttpRequest, textStatus, errorThrown) {
 			alert("网络错误! " + textStatus + ", error: " + errorThrown );
 			if (textStatus == "timeout") { // 请求超时
 					//getEvent(); // 递归调用
 				// 其他错误,如网络错误等
-				} else { 
+				} else {
 					//getEvent();
 				}
-		} 
-	});		
+		}
+	});
 
-	return objResult;			
+	return objResult;
 }
 //URL中所有参数可以以p1=v1&p2=v2赋值,以post格式传送
 ////接受文件在asp,php的参数为file="文件名
@@ -505,7 +506,7 @@ function UploadFile(  strUrl,  strFilePath,nextFunc)
 	var paraObj = {};
 	paraObj.a = strUrl;
 	paraObj.b = strFilePath;
-	
+
 	nResult = sendCmd("UploadFile",paraObj,nextFunc);
-	return nResult;			
-}
+	return nResult;
+}