Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
858c54ec
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
858c54ec
编写于
10月 11, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 11, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5805 ServiceAbilityTest 修改---master
Merge pull request !5805 from HuangXW/ServiceAbilityTest
上级
5c49f339
8039e4fe
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
724 addition
and
789 deletion
+724
-789
ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js
...lienttest/src/main/js/test/StServiceAbilityClient.test.js
+652
-688
ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts
...erverrelyhap/entry/src/main/ets/ServiceAbility/service.ts
+44
-65
ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts
...econdrelyhap/entry/src/main/ets/ServiceAbility/service.ts
+28
-36
未找到文件。
ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js
浏览文件 @
858c54ec
此差异已折叠。
点击以展开。
ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts
浏览文件 @
858c54ec
...
@@ -49,25 +49,29 @@ class StubTest extends rpc.RemoteObject {
...
@@ -49,25 +49,29 @@ class StubTest extends rpc.RemoteObject {
}
}
}
}
function
sleep
(
delay
)
{
let
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
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
()
{
console
.
debug
(
'
ACTS_SerivceAbilityServer ====<onStop
'
);
console
.
debug
(
'
ACTS_SerivceAbilityServer ====<onStop
'
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onStop
"
,
(
err
)
=>
{
});
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onStop
"
,
(
err
)
=>
{
});
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf error:
'
+
JSON
.
stringify
(
error
));
});
},
},
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
(
{
{
...
@@ -79,11 +83,7 @@ export default {
...
@@ -79,11 +83,7 @@ export default {
},
},
}
}
);
);
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
sleep
(
600
)
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf error:
'
+
JSON
.
stringify
(
error
));
});
}
else
if
(
want
.
action
==
'
ServiceStartService_1000
'
)
{
}
else
if
(
want
.
action
==
'
ServiceStartService_1000
'
)
{
particleAbility
.
startAbility
(
particleAbility
.
startAbility
(
{
{
...
@@ -94,27 +94,17 @@ export default {
...
@@ -94,27 +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
));
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
}
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf error:
'
+
JSON
.
stringify
(
error
));
});
}
);
);
}
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.terminateSelf()=====>
'
console
.
debug
(
'
ACTS_SerivceAbilityServer_onCommand 100 200 301 401.=====>
'
+
want
.
action
);
+
want
.
action
);
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf error:
'
+
JSON
.
stringify
(
error
));
});
}
}
}
else
{
}
else
{
console
.
debug
(
'
ACTS_SerivceAbilityServer_onCommand publish err=====>
'
+
err
);
console
.
debug
(
'
ACTS_SerivceAbilityServer_onCommand publish err=====>
'
+
err
);
...
@@ -126,25 +116,26 @@ export default {
...
@@ -126,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
,
...
@@ -157,8 +148,6 @@ export default {
...
@@ -157,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
)
...
@@ -168,44 +157,34 @@ export default {
...
@@ -168,44 +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
"
,
(
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 featureAbility.terminateSelf()=====<
'
+
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
);
})
}
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf error:
'
+
JSON
.
stringify
(
error
));
});
}
});
});
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
ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts
浏览文件 @
858c54ec
...
@@ -49,44 +49,41 @@ class StubTest extends rpc.RemoteObject {
...
@@ -49,44 +49,41 @@ class StubTest extends rpc.RemoteObject {
}
}
}
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
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
()
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====<onStop
'
);
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====<onStop
'
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onStop
"
,
(
err
)
=>
{
});
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onStop
"
,
(
err
)
=>
{
});
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf error:
'
+
JSON
.
stringify
(
error
));
});
},
},
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
)
=>
{
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
debug
(
"
ACTS_SerivceAbilityServerSecond_onCommand
"
+
"
_
"
+
want
.
action
+
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf data:
'
+
JSON
.
stringify
(
data
));
"
err:
"
+
JSON
.
stringify
(
err
))
}).
catch
((
error
)
=>
{
});
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf error:
'
+
JSON
.
stringify
(
error
));
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
);
...
@@ -96,12 +93,12 @@ export default {
...
@@ -96,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
(
...
@@ -153,26 +150,21 @@ export default {
...
@@ -153,26 +150,21 @@ 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
featureAbility.terminateSelf()
=====<
'
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
);
})
})
}
}
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
'
ACTS_SerivceAbilityServer terminateSelf error:
'
+
JSON
.
stringify
(
error
));
});
}
}
});
});
},
},
...
@@ -181,13 +173,13 @@ export default {
...
@@ -181,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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录