Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c275cd86
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c275cd86
编写于
8月 25, 2022
作者:
X
xuchenghua09
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
Signed-off-by:
N
xuchenghua09
<
xuchenghua09@huawei.com
>
上级
4fefdaaf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
29 deletion
+66
-29
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
...ytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
+65
-28
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/index/index.ets
...ystemabilitytest/entry/src/main/ets/pages/index/index.ets
+1
-1
未找到文件。
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
浏览文件 @
c275cd86
...
...
@@ -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,7 +98,11 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName
:
"
com.example.actsconnectabilitysystemabilitytest
"
,
abilityName
:
"
com.example.actsconnectabilitysystemabilitytest.ServiceAbility2
"
,
}
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
}
);
};
if
(
want
.
action
==
"
Eight
"
)
{
...
...
@@ -93,7 +110,11 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName
:
"
com.example.actsconnectabilitysystemabilitytest
"
,
abilityName
:
"
com.example.actsconnectabilitysystemabilitytest.ServiceAbility3
"
,
}
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
}
);
};
if
(
want
.
action
==
"
Nine
"
)
{
...
...
@@ -102,12 +123,16 @@ export default class ServiceAbility extends ServiceExtension {
{
bundleName
:
'
com.example.actsconnectabilitysystemabilitytest
'
,
abilityName
:
'
com.example.actsconnectabilitysystemabilitytest.ServiceAbility2
'
})
setTimeout
(()
=>
{
extensionContext
.
disconnectAbility
(
num
).
then
(()
=>
{
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
})
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
'
})
setTimeout
(()
=>
{
extensionContext
.
disconnectAbility
(
num
).
then
(()
=>
{
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
})
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
'
})
setTimeout
(()
=>
{
extensionContext
.
disconnectAbility
(
2222
).
then
(()
=>
{
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
})
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
'
})
setTimeout
(()
=>
{
extensionContext
.
disconnectAbility
(
2222
).
then
(()
=>
{
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
})
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
()
{
...
...
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/index/index.ets
浏览文件 @
c275cd86
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录