提交 8039e4fe 编写于 作者: H HuangXW

和Beta3同步

Change-Id: Ic1b2e6aeaa95672fa5fbd9d4dad92f02135dab0e
Signed-off-by: NHuangXW <huangxinwei4@huawei.com>
上级 09aaa0db
...@@ -61,7 +61,7 @@ function sleep(delay) { ...@@ -61,7 +61,7 @@ function sleep(delay) {
export default { export default {
onStart(want) { onStart(want) {
console.debug('ACTS_SerivceAbilityServer 0425 ====>onStart .ts 0851 =' console.debug('ACTS_SerivceAbilityServer 0425 ====>onStart .ts 0851 ='
+ want + " , JSON." + JSON.stringify(want)); + want + " , JSON." + JSON.stringify(want));
commonEvent.publish("ACTS_SerivceAbilityServer_onStart", (err) => { }); commonEvent.publish("ACTS_SerivceAbilityServer_onStart", (err) => { });
}, },
onStop() { onStop() {
...@@ -70,8 +70,8 @@ export default { ...@@ -70,8 +70,8 @@ export default {
}, },
onCommand(want, restart, startId) { onCommand(want, restart, startId) {
console.debug('ACTS_SerivceAbilityServer ====>onCommand=' console.debug('ACTS_SerivceAbilityServer ====>onCommand='
+ "JSON(want)=" + JSON.stringify(want) + "JSON(want)=" + JSON.stringify(want)
+ " ,restart=" + restart + " ,startId=" + startId); + " ,restart=" + restart + " ,startId=" + startId);
if (want.action == 'ServiceStartService_0900') { if (want.action == 'ServiceStartService_0900') {
particleAbility.startAbility( particleAbility.startAbility(
{ {
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
}, },
} }
); );
sleep(600) sleep(600)
} else if (want.action == 'ServiceStartService_1000') { } else if (want.action == 'ServiceStartService_1000') {
particleAbility.startAbility( particleAbility.startAbility(
{ {
...@@ -94,17 +94,17 @@ export default { ...@@ -94,17 +94,17 @@ export default {
action: "ServiceStartService_1000", action: "ServiceStartService_1000",
}, },
}, (err, data) => { }, (err, data) => {
console.debug('ACTS_SerivceAbilityServer start Ability 1000 callback=====' console.debug('ACTS_SerivceAbilityServer start Ability 1000 callback====='
+ err + ', data= ' + data + " , JSON." + JSON.stringify(data)); + err + ', data= ' + data + " , JSON." + JSON.stringify(data));
} }
); );
} else { } else {
commonEvent.publish("ACTS_SerivceAbilityServer_onCommand" + "_" + want.action, (err) => { commonEvent.publish("ACTS_SerivceAbilityServer_onCommand" + "_" + want.action, (err) => {
if (!err.code) { if (!err.code) {
if (want.action == 'PageStartService_0100' || want.action == 'PageStartService_0200' if (want.action == 'PageStartService_0100' || want.action == 'PageStartService_0200'
|| want.action == 'PageStartService_0301' || want.action == 'PageStartService_0401') { || want.action == 'PageStartService_0301' || want.action == 'PageStartService_0401') {
console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.=====>' console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.=====>'
+ want.action); + want.action);
} }
} else { } else {
console.debug('ACTS_SerivceAbilityServer_onCommand publish err=====>' + err); console.debug('ACTS_SerivceAbilityServer_onCommand publish err=====>' + err);
...@@ -116,25 +116,26 @@ export default { ...@@ -116,25 +116,26 @@ export default {
console.info('ACTS_SerivceAbilityServer ====< onConnect'); console.info('ACTS_SerivceAbilityServer ====< onConnect');
try { try {
console.debug('ACTS_SerivceAbilityServer ====>onConnect=' console.debug('ACTS_SerivceAbilityServer ====>onConnect='
+ want + " , JSON." + JSON.stringify(want)); + want + " , JSON." + JSON.stringify(want));
commonEvent.publish("ACTS_SerivceAbilityServer_onConnect" + "_" + want.action, (err) => { });
function onConnectCallback(element, remote) { function onConnectCallback(element, remote) {
console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> mConnIdJs=' console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> mConnIdJs='
+ JSON.stringify(mConnIdJs) + " , " + mConnIdJs); + JSON.stringify(mConnIdJs) + " , " + mConnIdJs);
console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> element=' console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> element='
+ JSON.stringify(element) + " , " + element); + JSON.stringify(element) + " , " + element);
console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> remote=' console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> remote='
+ JSON.stringify(remote) + " , " + remote); + JSON.stringify(remote) + " , " + remote);
} }
function onDisconnectCallback(element) { function onDisconnectCallback(element) {
console.debug('ACTS_SerivceAbilityServer_onDisconnectCallback ====> element=' console.debug('ACTS_SerivceAbilityServer_onDisconnectCallback ====> element='
+ JSON.stringify(element) + " , " + element); + JSON.stringify(element) + " , " + element);
} }
function onFailedCallback(code) { function onFailedCallback(code) {
console.debug('ACTS_SerivceAbilityServer_onFailedCallback ====> code=' console.debug('ACTS_SerivceAbilityServer_onFailedCallback ====> code='
+ JSON.stringify(code) + " , " + code) + JSON.stringify(code) + " , " + code)
} }
if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400' if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400'
|| want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') { || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') {
mConnIdJs = particleAbility.connectAbility( mConnIdJs = particleAbility.connectAbility(
{ {
bundleName: serversecond_bundleName, bundleName: serversecond_bundleName,
...@@ -147,8 +148,6 @@ export default { ...@@ -147,8 +148,6 @@ export default {
onFailed: onFailedCallback, onFailed: onFailedCallback,
}, },
) )
} else {
commonEvent.publish("ACTS_SerivceAbilityServer_onConnect" + "_" + want.action, (err) => { });
} }
} catch (err) { } catch (err) {
console.log("ACTS_SerivceAbilityServer ====< error:" + err) console.log("ACTS_SerivceAbilityServer ====< error:" + err)
...@@ -158,39 +157,34 @@ export default { ...@@ -158,39 +157,34 @@ export default {
}, },
onDisconnect(want) { onDisconnect(want) {
console.debug('ACTS_SerivceAbilityServer ====>onDisConnect=' console.debug('ACTS_SerivceAbilityServer ====>onDisConnect='
+ want + " , JSON." + JSON.stringify(want)); + want + " , JSON." + JSON.stringify(want));
commonEvent.publish("ACTS_SerivceAbilityServer_onDisConnect" + want.action, (err) => { commonEvent.publish("ACTS_SerivceAbilityServer_onDisConnect_" + want.action, (err) => {
if (err.code) { console.debug('ACTS_SerivceAbilityServer_onDisConnect ===' + want.action);
console.debug('ACTS_SerivceAbilityServer_onDisConnect publish err=====>' + err);
} else {
console.debug('ACTS_SerivceAbilityServer_onDisConnect =====<'
+ want.action);
if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400'
|| want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
|| want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601'
) {
particleAbility.disconnectAbility(mConnIdJs, (err) => {
console.debug("=ACTS_SerivceAbilityServer_onDisConnect 13 14 15 16 err====>"
+ ("json err=") + JSON.stringify(err) + " , " + want.action);
})
}
}
}); });
if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400'
|| want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
|| want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601'
) {
particleAbility.disconnectAbility(mConnIdJs, (err) => {
console.debug("=ACTS_SerivceAbilityServer_onDisConnect 13 14 15 16 err====>"
+ ("json err=") + JSON.stringify(err) + " , " + want.action);
})
}
}, },
onReady() { onReady() {
console.debug('ACTS_SerivceAbilityServer ====<onReady'); console.debug('ACTS_SerivceAbilityServer ====<onReady');
}, },
onReconnect(want) { onReconnect(want) {
console.debug('ACTS_SerivceAbilityServer ====>onReconnect=' console.debug('ACTS_SerivceAbilityServer ====>onReconnect='
+ want + " , JSON." + JSON.stringify(want)); + want + " , JSON." + JSON.stringify(want));
commonEvent.publish("ACTS_SerivceAbilityServer_onReconnect" + "_" + want.action, (err) => { }); commonEvent.publish("ACTS_SerivceAbilityServer_onReconnect" + "_" + want.action, (err) => { });
}, },
OnAbilityConnectDone(element, remoteObject, resultCode) { OnAbilityConnectDone(element, remoteObject, resultCode) {
console.debug('ACTS_SerivceAbilityServer ====>OnAbilityConnectDone=' console.debug('ACTS_SerivceAbilityServer ====>OnAbilityConnectDone='
+ element + " , JSON." + JSON.stringify(element) + element + " , JSON." + JSON.stringify(element)
+ remoteObject + " , JSON." + JSON.stringify(remoteObject) + remoteObject + " , JSON." + JSON.stringify(remoteObject)
+ resultCode + " , JSON." + JSON.stringify(resultCode) + resultCode + " , JSON." + JSON.stringify(resultCode)
); );
commonEvent.publish("ACTS_SerivceAbilityServer_OnAbilityConnectDone", (err) => { }); commonEvent.publish("ACTS_SerivceAbilityServer_OnAbilityConnectDone", (err) => { });
}, },
}; };
\ No newline at end of file
...@@ -49,19 +49,13 @@ class StubTest extends rpc.RemoteObject { ...@@ -49,19 +49,13 @@ class StubTest extends rpc.RemoteObject {
} }
} }
function sleep(delay) { function sleep(ms) {
let start = new Date().getTime(); return new Promise(resolve => setTimeout(resolve, ms));
while (true) {
if (new Date().getTime() - start > delay) {
break;
}
}
} }
export default { export default {
onStart(want) { onStart(want) {
console.debug('ACTS_SerivceAbilityServerSecond ====>onStart=' console.debug('ACTS_SerivceAbilityServerSecond ====>onStart='
+ want + " , JSON." + JSON.stringify(want)); + want + " , JSON." + JSON.stringify(want));
commonEvent.publish("ACTS_SerivceAbilityServerSecond_onStart", (err) => { }); commonEvent.publish("ACTS_SerivceAbilityServerSecond_onStart", (err) => { });
}, },
onStop() { onStop() {
...@@ -70,26 +64,26 @@ export default { ...@@ -70,26 +64,26 @@ export default {
}, },
onCommand(want, restart, startId) { onCommand(want, restart, startId) {
console.debug('ACTS_SerivceAbilityServerSecond ====>onCommand=' console.debug('ACTS_SerivceAbilityServerSecond ====>onCommand='
+ "JSON(want)=" + JSON.stringify(want) + "JSON(want)=" + JSON.stringify(want)
+ " ,restart=" + restart + " ,startId=" + startId); + " ,restart=" + restart + " ,startId=" + startId);
commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => { commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => {
console.debug("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action + console.debug("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action +
"err: " + JSON.stringify(err)) "err: " + JSON.stringify(err))
}); });
sleep(500) sleep(500)
}, },
onConnect(want) { onConnect(want) {
console.info('ACTS_SerivceAbilityServerSecond ====< onConnect'); console.info('ACTS_SerivceAbilityServerSecond ====< onConnect');
try { try {
console.debug('ACTS_SerivceAbilityServerSecond ====>onConnect=' console.debug('ACTS_SerivceAbilityServerSecond ====>onConnect='
+ want + " , JSON." + JSON.stringify(want)); + want + " , JSON." + JSON.stringify(want));
function onConnectCallback(element, remote) { function onConnectCallback(element, remote) {
console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> want.action=' console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> want.action='
+ JSON.stringify(want.action) + " , " + want.action); + JSON.stringify(want.action) + " , " + want.action);
console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> element=' console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> element='
+ JSON.stringify(element) + " , " + element); + JSON.stringify(element) + " , " + element);
console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> remote=' console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> remote='
+ JSON.stringify(remote) + " , " + remote); + JSON.stringify(remote) + " , " + remote);
if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') { if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') {
commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => { commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => {
console.debug("publish = ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action); console.debug("publish = ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action);
...@@ -99,12 +93,12 @@ export default { ...@@ -99,12 +93,12 @@ export default {
function onDisconnectCallback(element) { function onDisconnectCallback(element) {
console.debug('ACTS_SerivceAbilityServerSecond_onDisconnectCallback ====> element=' console.debug('ACTS_SerivceAbilityServerSecond_onDisconnectCallback ====> element='
+ JSON.stringify(element) + " , " + element); + JSON.stringify(element) + " , " + element);
} }
function onFailedCallback(code) { function onFailedCallback(code) {
console.debug('ACTS_SerivceAbilityServerSecond_onFailedCallback ====> code=' console.debug('ACTS_SerivceAbilityServerSecond_onFailedCallback ====> code='
+ JSON.stringify(code) + " , " + code) + JSON.stringify(code) + " , " + code)
} }
if (want.action == 'ServiceConnectService_1500') { if (want.action == 'ServiceConnectService_1500') {
mConnIdJs = particleAbility.connectAbility( mConnIdJs = particleAbility.connectAbility(
...@@ -156,19 +150,19 @@ export default { ...@@ -156,19 +150,19 @@ export default {
}, },
onDisconnect(want) { onDisconnect(want) {
console.debug('ACTS_SerivceAbilityServerSecond ====>onDisConnect=' console.debug('ACTS_SerivceAbilityServerSecond ====>onDisConnect='
+ want + " , JSON." + JSON.stringify(want)); + want + " , JSON." + JSON.stringify(want));
commonEvent.publish("ACTS_SerivceAbilityServerSecond_onDisConnect", (err) => { commonEvent.publish("ACTS_SerivceAbilityServerSecond_onDisConnect_" + want.action, (err) => {
if (err.code) { if (err.code) {
console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect publish err=====>' + err); console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect publish err=====>' + err);
} else { } else {
console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect =====<' console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect =====<'
+ want.action); + want.action);
if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501' if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
|| want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601' || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601'
|| want.action == 'ServiceConnectService_1590') { || want.action == 'ServiceConnectService_1590') {
particleAbility.disconnectAbility(mConnIdJs, (err) => { particleAbility.disconnectAbility(mConnIdJs, (err) => {
console.debug("=ACTS_SerivceAbilityServerSecond_onDisConnect err====>" console.debug("=ACTS_SerivceAbilityServerSecond_onDisConnect err====>"
+ ("json err=") + JSON.stringify(err) + " , " + want.action); + ("json err=") + JSON.stringify(err) + " , " + want.action);
}) })
} }
} }
...@@ -179,13 +173,13 @@ export default { ...@@ -179,13 +173,13 @@ export default {
}, },
onReconnect(want) { onReconnect(want) {
console.debug('ACTS_SerivceAbilityServerSecond ====>onReconnect=' console.debug('ACTS_SerivceAbilityServerSecond ====>onReconnect='
+ want + " , JSON." + JSON.stringify(want)); + want + " , JSON." + JSON.stringify(want));
}, },
OnAbilityConnectDone(element, remoteObject, resultCode) { OnAbilityConnectDone(element, remoteObject, resultCode) {
console.debug('ACTS_SerivceAbilityServerSecond ====>OnAbilityConnectDone=' console.debug('ACTS_SerivceAbilityServerSecond ====>OnAbilityConnectDone='
+ element + " , JSON." + JSON.stringify(element) + element + " , JSON." + JSON.stringify(element)
+ remoteObject + " , JSON." + JSON.stringify(remoteObject) + remoteObject + " , JSON." + JSON.stringify(remoteObject)
+ resultCode + " , JSON." + JSON.stringify(resultCode) + resultCode + " , JSON." + JSON.stringify(resultCode)
); );
commonEvent.publish("ACTS_SerivceAbilityServerSecond_OnAbilityConnectDone", (err) => { }); commonEvent.publish("ACTS_SerivceAbilityServerSecond_OnAbilityConnectDone", (err) => { });
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册