提交 c275cd86 编写于 作者: X xuchenghua09

update

Signed-off-by: Nxuchenghua09 <xuchenghua09@huawei.com>
上级 4fefdaaf
......@@ -16,31 +16,44 @@ import commonEvent from '@ohos.commonEvent'
import ServiceExtension from '@ohos.application.ServiceExtensionAbility'
import rpc from '@ohos.rpc';
var conn = -1;
function publishCallBackOne () {
function publishCallBackOne() {
console.log("========Publish CallBack AMS_ConnectAbility_0100_commonEvent========");
}
function publishCallBackTwo () {
function publishCallBackTwo() {
console.log("========Publish CallBack AMS_ConnectAbility_0200_commonEvent========");
}
function publishCallBackThree () {
function publishCallBackThree() {
console.log("========Publish CallBack AMS_ConnectAbility_0300_commonEvent========");
}
function publishCallBackFour () {
function publishCallBackFour() {
console.log("========Publish CallBack AMS_ConnectAbility_0400_commonEvent========");
}
function publishCallBackFive () {
function publishCallBackFive() {
console.log("========Publish CallBack AMS_ConnectAbility_0500_commonEvent========");
}
function publishCallBackSix () {
function publishCallBackSix() {
console.log("========Publish CallBack AMS_ConnectAbility_0600_commonEvent========");
}
function publishCallBackzero () {
function publishCallBackzero() {
console.log("========Publish CallBack AMSc_disonnectAbility_0100_commonEvent========");
}
function publishCallBackttwo () {
function publishCallBackttwo() {
console.log("========Publish CallBack AMSc_disonnectAbility_0200_commonEvent========");
}
function onConnectCallback(element, remote) {
console.log('onConnectCallback====> element=' + JSON.stringify(element));
console.log('onConnectCallback====> remote=' + JSON.stringify(remote));
}
function onDisconnectCallback(element) {
console.log('onDisconnectCallback====> element=' + JSON.stringify(element));
}
function onFailedCallback(code) {
console.log('onFailedCallback====> code=' + JSON.stringify(code))
}
export default class ServiceAbility extends ServiceExtension {
onCreate(want) {
console.log('ServiceAbility onCreate, want: ' + want.abilityName);
......@@ -85,6 +98,10 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility2",
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
};
......@@ -93,6 +110,10 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility3",
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
};
......@@ -102,12 +123,16 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName: 'com.example.actsconnectabilitysystemabilitytest',
abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2'
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
})
setTimeout(()=>{
extensionContext.disconnectAbility(num).then(()=>{
setTimeout(() => {
extensionContext.disconnectAbility(num).then(() => {
console.log('in disconnectAbility');
})
},1000)
}, 1000)
};
if (want.action == "Ten") {
......@@ -116,12 +141,16 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName: 'com.example.actsconnectabilitysystemabilitytest',
abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2'
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
})
setTimeout(()=>{
extensionContext.disconnectAbility(num).then(()=>{
setTimeout(() => {
extensionContext.disconnectAbility(num).then(() => {
console.log('in disconnectAbility2');
})
},1000)
}, 1000)
};
if (want.action == "Ten one") {
......@@ -130,12 +159,16 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName: 'com.example.actsconnectabilitysystemabilitytest',
abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2'
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
})
setTimeout(()=>{
extensionContext.disconnectAbility(2222).then(()=>{
setTimeout(() => {
extensionContext.disconnectAbility(2222).then(() => {
console.log('in disconnectAbility3');
})
},1000)
}, 1000)
};
if (want.action == "Ten two") {
......@@ -144,12 +177,16 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName: 'com.example.actsconnectabilitysystemabilitytest',
abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2'
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
})
setTimeout(()=>{
extensionContext.disconnectAbility(2222).then(()=>{
setTimeout(() => {
extensionContext.disconnectAbility(2222).then(() => {
console.log('in disconnectAbility4');
})
},1000)
}, 1000)
};
return new rpc.RemoteObject('connect');
......@@ -157,8 +194,8 @@ export default class ServiceAbility extends ServiceExtension {
onDisconnect(want) {
console.log('ServiceAbility onDisconnect, want:' + want.abilityName);
commonEvent.publish("AMSc_disonnectAbility_0100_commonEvent",publishCallBackzero);
commonEvent.publish("AMSc_disonnectAbility_0200_commonEvent",publishCallBackttwo);
commonEvent.publish("AMSc_disonnectAbility_0100_commonEvent", publishCallBackzero);
commonEvent.publish("AMSc_disonnectAbility_0200_commonEvent", publishCallBackttwo);
}
onDestroy() {
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import testsuite from "../../test/List.test.ets"
@Entry
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册