mirror of
https://gitee.com/openharmony/xts_dcts
synced 2024-11-23 07:39:59 +00:00
620dcts
Signed-off-by: wuxiaodan <wuxiaodan5@huawei-partners.com>
This commit is contained in:
parent
8d71ff4305
commit
893f955e04
@ -33,29 +33,29 @@ export default class ApiMessage {
|
||||
this._apiResult = apiResult;
|
||||
|
||||
}
|
||||
marshalling(MessageSequence) {
|
||||
marshalling(messageSequence: rpc.MessageSequence) {
|
||||
console.log(logTag + "into marshalling.");
|
||||
MessageSequence.writeString(this._deviceName);
|
||||
MessageSequence.writeString(this._className);
|
||||
MessageSequence.writeString(this._methodName);
|
||||
MessageSequence.writeString(this._apiSession);
|
||||
messageSequence.writeString(this._deviceName);
|
||||
messageSequence.writeString(this._className);
|
||||
messageSequence.writeString(this._methodName);
|
||||
messageSequence.writeString(this._apiSession);
|
||||
console.log(logTag + "writeString successfully.");
|
||||
MessageSequence.writeStringArray(this._parameterTypes);
|
||||
MessageSequence.writeStringArray(this._parameters);
|
||||
MessageSequence.writeString(this._apiResult);
|
||||
messageSequence.writeStringArray(this._parameterTypes);
|
||||
messageSequence.writeStringArray(this._parameters);
|
||||
messageSequence.writeString(this._apiResult);
|
||||
console.log(logTag + "marshalling successfully.");
|
||||
return true;
|
||||
}
|
||||
|
||||
unmarshalling(MessageSequence) {
|
||||
unmarshalling(messageSequence: rpc.MessageSequence) {
|
||||
console.log(logTag + "into unmarshalling.");
|
||||
this._deviceName = MessageSequence.readString();
|
||||
this._className = MessageSequence.readString();
|
||||
this._methodName = MessageSequence.readString();
|
||||
this._apiSession = MessageSequence.readString();
|
||||
this._parameterTypes = MessageSequence.readStringArray();
|
||||
this._parameters = MessageSequence.readStringArray();
|
||||
this._apiResult = MessageSequence.readString();
|
||||
this._deviceName = messageSequence.readString();
|
||||
this._className = messageSequence.readString();
|
||||
this._methodName = messageSequence.readString();
|
||||
this._apiSession = messageSequence.readString();
|
||||
this._parameterTypes = messageSequence.readStringArray();
|
||||
this._parameters = messageSequence.readStringArray();
|
||||
this._apiResult = messageSequence.readString();
|
||||
console.log(logTag + "unmarshalling successfully.");
|
||||
return true;
|
||||
}
|
||||
|
@ -34,60 +34,60 @@ export default class Stub extends rpc.RemoteObject {
|
||||
try {
|
||||
console.log(logTag +" =================== onRemoteMessageRequest: code is " + code + " ===================");
|
||||
switch (code) {
|
||||
case CODE_INVOKE:
|
||||
{
|
||||
console.info(logTag +" case CODE_INVOKE start");
|
||||
let testBundle = new ApiMessage(null, null, null, null, null, null, null);
|
||||
data.readParcelable(testBundle);
|
||||
case CODE_INVOKE:
|
||||
{
|
||||
console.info(logTag +" case CODE_INVOKE start");
|
||||
let testBundle = new ApiMessage(null, null, null, null, null, null, null);
|
||||
data.readParcelable(testBundle);
|
||||
|
||||
let resultCall = new ApiResult(0,null);
|
||||
var resCallApi = -1;
|
||||
const reflectCallApi = new ReflectCallApi();
|
||||
resCallApi = reflectCallApi.call(testBundle);
|
||||
console.log(logTag+"_methodName call success,result is "+resCallApi);
|
||||
if (resCallApi == 1) {
|
||||
resultCall._resultCode = 1;
|
||||
resultCall._result = 1;
|
||||
} else {
|
||||
resultCall._resultCode = -1;
|
||||
resultCall._result = -1;
|
||||
}
|
||||
console.log(logTag + "The server's writeSequenceable result is " + JSON.stringify(resultCall));
|
||||
|
||||
testBundle._apiResult=JSON.stringify(resultCall);
|
||||
console.log(logTag +" The testBundle is " + JSON.stringify(testBundle));
|
||||
reply.writeParcelable(testBundle);
|
||||
|
||||
return true;
|
||||
}
|
||||
case CODE_INVOKE_TESTCASE:
|
||||
{
|
||||
console.info(logTag +" =================== case CODE_INVOKE_TESTCASE start =================== ");
|
||||
let testBundle = new ApiMessage(null, null, null, null, null, null, null);
|
||||
data.readSequenceable(testBundle);
|
||||
|
||||
let resultCall = new ApiResult(0,null);
|
||||
let resultCall = new ApiResult(0,null);
|
||||
var resCallApi = -1;
|
||||
const reflectCallApi = new ReflectCallApi();
|
||||
resCallApi = reflectCallApi.call(testBundle);
|
||||
console.log(logTag+"_methodName call success,result is "+resCallApi);
|
||||
if (resCallApi === 1) {
|
||||
resultCall._resultCode = 1;
|
||||
resultCall._result = 1;
|
||||
testBundle._apiResult=JSON.stringify(resultCall);
|
||||
reply.writeParcelable(testBundle);
|
||||
return true;
|
||||
}
|
||||
case CODE_INVOKE_OSVERSION:
|
||||
{
|
||||
console.info(logTag +" =================== case CODE_INVOKE_OSVERSION start =================== ");
|
||||
data.readString();
|
||||
let osFullNameInfo = deviceinfo.osFullName;
|
||||
console.info('the value of the deviceinfo osFullName is :' + osFullNameInfo);
|
||||
reply.writeString(osFullNameInfo);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
console.error(logTag +" default case " + code);
|
||||
return super.onRemoteMessageRequest(code, data, reply, option);
|
||||
} else {
|
||||
resultCall._resultCode = -1;
|
||||
resultCall._result = -1;
|
||||
}
|
||||
console.log(logTag + "The server's writeSequenceable result is " + JSON.stringify(resultCall));
|
||||
|
||||
testBundle._apiResult=JSON.stringify(resultCall);
|
||||
console.log(logTag +" The testBundle is " + JSON.stringify(testBundle));
|
||||
reply.writeParcelable(testBundle);
|
||||
|
||||
return true;
|
||||
}
|
||||
case CODE_INVOKE_TESTCASE:
|
||||
{
|
||||
console.info(logTag +" =================== case CODE_INVOKE_TESTCASE start =================== ");
|
||||
let testBundle = new ApiMessage(null, null, null, null, null, null, null);
|
||||
data.readSequenceable(testBundle);
|
||||
|
||||
let resultCall = new ApiResult(0,null);
|
||||
resultCall._resultCode = 1;
|
||||
resultCall._result = 1;
|
||||
testBundle._apiResult=JSON.stringify(resultCall);
|
||||
reply.writeParcelable(testBundle);
|
||||
return true;
|
||||
}
|
||||
case CODE_INVOKE_OSVERSION:
|
||||
{
|
||||
console.info(logTag +" =================== case CODE_INVOKE_OSVERSION start =================== ");
|
||||
data.readString();
|
||||
let osFullNameInfo = deviceinfo.osFullName;
|
||||
console.info('the value of the deviceinfo osFullName is :' + osFullNameInfo);
|
||||
reply.writeString(osFullNameInfo);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
console.error(logTag +' default case ' + code);
|
||||
return super.onRemoteMessageRequest(code, data, reply, option);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(logTag +"ERROR: onRemoteMessageRequest: " + error.code + error.message);
|
||||
console.log(logTag +'ERROR: onRemoteMessageRequest: ' + error.code + error.message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ export default class Stub extends rpc.RemoteObject {
|
||||
const reflectCallApi = new ReflectCallApi();
|
||||
resCallApi = reflectCallApi.call(testBundle);
|
||||
console.log(logTag+"_methodName call success,result is "+resCallApi);
|
||||
if (resCallApi == 1) {
|
||||
if (resCallApi === 1) {
|
||||
resultCall._resultCode = 1;
|
||||
resultCall._result = 1;
|
||||
} else {
|
||||
@ -89,7 +89,7 @@ export default class Stub extends rpc.RemoteObject {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(logTag +"ERROR: onRemoteMessageRequest: " + error.code + error.message);
|
||||
console.log(logTag +'ERROR: onRemoteMessageRequest: ' + error.code + error.message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user