Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
008ed8b8
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看板
提交
008ed8b8
编写于
12月 01, 2021
作者:
Z
zhaoyuan17
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update xts service 1201
Signed-off-by:
N
zhaoyuan17
<
zhaoyuan17@huawei.com
>
上级
bb3554f2
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
1232 addition
and
227 deletion
+1232
-227
appexecfwk/ams_standard/BUILD.gn
appexecfwk/ams_standard/BUILD.gn
+1
-0
appexecfwk/ams_standard/serviceability/stserviceabilityclient/entry/src/main/js/test/StServiceAbilityClient.test.js
...ent/entry/src/main/js/test/StServiceAbilityClient.test.js
+768
-153
appexecfwk/ams_standard/serviceability/stserviceabilityserver/entry/src/main/config.json
...ability/stserviceabilityserver/entry/src/main/config.json
+3
-11
appexecfwk/ams_standard/serviceability/stserviceabilityserver/entry/src/main/js/default/pages/index/index.js
...lityserver/entry/src/main/js/default/pages/index/index.js
+140
-63
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/BUILD.gn
...dard/serviceability/stserviceabilityserversecond/BUILD.gn
+31
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/Test.json
...ard/serviceability/stserviceabilityserversecond/Test.json
+3
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/config.json
...y/stserviceabilityserversecond/entry/src/main/config.json
+53
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/app.js
...rviceabilityserversecond/entry/src/main/js/default/app.js
+22
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/i18n/en-US.json
...ityserversecond/entry/src/main/js/default/i18n/en-US.json
+6
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/i18n/zh-CN.json
...ityserversecond/entry/src/main/js/default/i18n/zh-CN.json
+6
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/pages/index/index.css
...versecond/entry/src/main/js/default/pages/index/index.css
+12
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/pages/index/index.hml
...versecond/entry/src/main/js/default/pages/index/index.hml
+8
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/pages/index/index.js
...rversecond/entry/src/main/js/default/pages/index/index.js
+167
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/resources/base/element/string.json
...cond/entry/src/main/js/resources/base/element/string.json
+12
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/resources/base/media/icon.png
...versecond/entry/src/main/js/resources/base/media/icon.png
+0
-0
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/signature/openharmony_sx.p7b
...stserviceabilityserversecond/signature/openharmony_sx.p7b
+0
-0
未找到文件。
appexecfwk/ams_standard/BUILD.gn
浏览文件 @
008ed8b8
...
@@ -26,6 +26,7 @@ group("ams_standard") {
...
@@ -26,6 +26,7 @@ group("ams_standard") {
"serviceability/sceneProject/particletestserver:ParticleTestServer",
"serviceability/sceneProject/particletestserver:ParticleTestServer",
"serviceability/stserviceabilityclient:amsStServiceAbilityClient",
"serviceability/stserviceabilityclient:amsStServiceAbilityClient",
"serviceability/stserviceabilityserver:amsStServiceAilityServer",
"serviceability/stserviceabilityserver:amsStServiceAilityServer",
"serviceability/stserviceabilityserversecond:stserviceabilityserversecond",
]
]
}
}
}
}
appexecfwk/ams_standard/serviceability/stserviceabilityclient/entry/src/main/js/test/StServiceAbilityClient.test.js
浏览文件 @
008ed8b8
此差异已折叠。
点击以展开。
appexecfwk/ams_standard/serviceability/stserviceabilityserver/entry/src/main/config.json
浏览文件 @
008ed8b8
...
@@ -22,26 +22,18 @@
...
@@ -22,26 +22,18 @@
"distro"
:
{
"distro"
:
{
"deliveryWithInstall"
:
true
,
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
"moduleType"
:
"entry"
,
"installationFree"
:
true
},
},
"abilities"
:
[
"abilities"
:
[
{
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.amsst.stserviceabilityserver.MainAbility"
,
"name"
:
"com.amsst.stserviceabilityserver.MainAbility"
,
"icon"
:
"$media:icon"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"label"
:
"$string:app_name"
,
"type"
:
"service"
,
"type"
:
"service"
,
"visible"
:
true
,
"visible"
:
true
,
"uri"
:
"serviceability://com.amsst.stserviceabilityserver"
,
"launchType"
:
"standard"
"launchType"
:
"standard"
}
}
],
],
...
...
appexecfwk/ams_standard/serviceability/stserviceabilityserver/entry/src/main/js/default/pages/index/index.js
浏览文件 @
008ed8b8
...
@@ -12,12 +12,14 @@
...
@@ -12,12 +12,14 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import
rpc
from
"
@ohos.rpc
"
;
import
rpc
from
"
@ohos.rpc
"
;
let
mMyStub
;
let
mMyStub
;
let
mMyProxy
;
import
particleAbility
from
'
@ohos.ability.particleability
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
commonEvent
from
'
@ohos.commonevent
'
var
serversecond_bundleName
=
"
com.amsst.stserviceabilityserversecond
"
;
var
serversecond_abilityName
=
"
com.amsst.stserviceabilityserversecond.MainAbility
"
;
var
mConnIdJs
;
export
default
{
export
default
{
data
:
{
data
:
{
title
:
""
title
:
""
...
@@ -25,75 +27,150 @@ export default {
...
@@ -25,75 +27,150 @@ export default {
onInit
()
{
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
},
onStart
(
want
)
{
onShow
()
{
console
.
log
(
'
SerivceAbilityServer onStart
'
);
console
.
debug
(
'
ACTS_SerivceAbilityServer ====<onShow
'
)
class
MyStub
extends
rpc
.
RemoteObject
{
},
constructor
(
des
)
{
onReady
()
{
if
(
typeof
des
===
'
string
'
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServer ====<onReady
'
);
super
(
des
,
des
.
length
);
},
onReconnect
(
want
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServer ====>onReconnect=
'
+
want
+
"
, JSON.
"
+
JSON
.
stringify
(
want
));
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onReconnect
"
+
"
_
"
+
want
.
action
,
(
err
)
=>
{
});
},
onActive
()
{
console
.
debug
(
'
ACTS_SerivceAbilityServer ====<onActive
'
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onActive
"
,
(
err
)
=>
{
});
},
onCommand
(
want
,
restart
,
startId
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServer ====>onCommand=
'
+
"
JSON(want)=
"
+
JSON
.
stringify
(
want
)
+
"
,restart=
"
+
restart
+
"
,startId=
"
+
startId
);
if
(
want
.
action
==
'
ServiceStartService_0900
'
)
{
particleAbility
.
startAbility
(
{
want
:
{
bundleName
:
serversecond_bundleName
,
abilityName
:
serversecond_abilityName
,
action
:
"
ServiceStartService_0900
"
,
},
}
}
return
null
;
);
}
featureAbility
.
terminateSelf
();
onRemoteRequest
(
code
,
message
,
reply
,
option
)
{
}
else
if
(
want
.
action
==
'
ServiceStartService_1000
'
)
{
console
.
log
(
"
RPCTestServer onRemoteRequest code:
"
+
code
);
particleAbility
.
startAbility
(
if
(
code
===
1
)
{
{
console
.
log
(
"
RPCTestServer: 调用到方法
"
);
want
:
let
getContextObject
=
rpc
.
IPCSkeleton
.
getContextObject
();
{
console
.
log
(
"
RPCTestServer: getContextObject 方法调用的结果为:
"
+
getContextObject
);
bundleName
:
serversecond_bundleName
,
let
getCallingPid
=
rpc
.
IPCSkeleton
.
getCallingPid
();
abilityName
:
serversecond_abilityName
,
console
.
log
(
"
RPCTestServer: getCallingPid 方法调用的结果为:
"
+
getCallingPid
);
action
:
"
ServiceStartService_1000
"
,
let
getCallingUid
=
rpc
.
IPCSkeleton
.
getCallingUid
();
},
console
.
log
(
"
RPCTestServer: getCallingUid 方法调用的结果为:
"
+
getCallingUid
);
},
(
err
,
data
)
=>
{
let
getCallingDeviceID
=
rpc
.
IPCSkeleton
.
getCallingDeviceID
();
console
.
debug
(
'
ACTS_SerivceAbilityServer start Ability 1000 callback=====
'
console
.
log
(
"
RPCTestServer: getCallingDeviceID 方法调用的结果为:
"
+
getCallingDeviceID
);
+
err
+
'
, data=
'
+
data
+
"
, JSON.
"
+
JSON
.
stringify
(
data
));
let
getLocalDeviceID
=
rpc
.
IPCSkeleton
.
getLocalDeviceID
();
featureAbility
.
terminateSelf
();
console
.
log
(
"
RPCTestServer: getLocalDeviceID 方法调用的结果为:
"
+
getLocalDeviceID
);
let
isLocalCalling
=
rpc
.
IPCSkeleton
.
isLocalCalling
();
console
.
log
(
"
RPCTestServer: isLocalCalling 方法调用的结果为:
"
+
isLocalCalling
);
let
remoteObject
=
new
rpc
.
RemoteObject
(
"
aaa
"
,
3
);
let
flushCommands
=
rpc
.
IPCSkeleton
.
flushCommands
(
remoteObject
);
console
.
log
(
"
RPCTestServer: flushCommands 方法调用的结果为:
"
+
flushCommands
);
let
resetCallingIdentity
=
rpc
.
IPCSkeleton
.
resetCallingIdentity
();
console
.
log
(
"
RPCTestServer: resetCallingIdentity 方法调用的结果为:
"
+
resetCallingIdentity
);
let
setCallingIdentity
=
rpc
.
IPCSkeleton
.
setCallingIdentity
(
"
aaa
"
,
3
);
console
.
log
(
"
RPCTestServer: setCallingIdentity 方法调用的结果为:
"
+
setCallingIdentity
);
let
num
=
message
.
readInt
();
let
msg
=
message
.
readString
();
console
.
log
(
"
num is
"
+
num
+
"
msg is
"
+
msg
);
reply
.
writeString
(
"
Success
"
);
return
true
;
}
}
}
);
}
else
{
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onCommand
"
+
"
_
"
+
want
.
action
,
(
err
)
=>
{
if
(
!
err
.
code
)
{
if
(
want
.
action
==
'
PageStartService_0100
'
||
want
.
action
==
'
PageStartService_0200
'
||
want
.
action
==
'
PageStartService_0301
'
||
want
.
action
==
'
PageStartService_0401
'
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServer_onCommand 100 200 301 401.terminateSelf()=====>
'
+
want
.
action
);
featureAbility
.
terminateSelf
();
}
}
else
{
console
.
debug
(
'
ACTS_SerivceAbilityServer_onCommand publish err=====>
'
+
err
);
}
});
}
}
console
.
log
(
"
RPCTestServer: 判断其是否可以创建对象
"
)
mMyStub
=
new
MyStub
(
"
ServiceAbility-test
"
);
console
.
log
(
"
xxx RPCTestServer: 创建的对象为:
"
+
mMyStub
)
// console.log("RPCTestServer: 向saMgr中注册stub");
// let result = rpc.IPCSkeleton.addLocalAbility(mMyStub);
// console.log("RPCTestServer: 注册的结果为:" + result);
// mMyProxy = rpc.IPCSkeleton.getLocalAbility();
// console.log("RPCTestProxy: 判断当前获取的对象是不是proxy:" + (mMyProxy instanceof rpc.RemoteProxy));
},
},
onReady
()
{
onStart
(
want
)
{
console
.
info
(
'
SerivceAbilityServer onReady
'
);
console
.
debug
(
'
ACTS_SerivceAbilityServer ====>onStart=
'
+
want
+
"
, JSON.
"
+
JSON
.
stringify
(
want
));
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onStart
"
,
(
err
)
=>
{
});
class
MyStub
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
super
(
des
);
}
}
console
.
debug
(
"
ACTS_SerivceAbilityServer ====< RPCTestServer
"
);
mMyStub
=
new
MyStub
(
"
ServiceAbility-test
"
);
console
.
debug
(
"
ACTS_SerivceAbilityServer RPCTestServer: mMyStub:
"
+
mMyStub
+
"
,
"
+
JSON
.
stringify
(
mMyStub
))
},
},
onStop
()
{
onStop
()
{
console
.
info
(
'
SerivceAbilityServer onStop
'
);
console
.
debug
(
'
ACTS_SerivceAbilityServer ====<onStop
'
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onStop
"
,
(
err
)
=>
{
});
featureAbility
.
terminateSelf
();
},
},
onConnect
(
want
)
{
onConnect
(
want
)
{
console
.
info
(
'
stub SerivceAbilityServer OnConnect
'
);
console
.
debug
(
'
ACTS_SerivceAbilityServer ====>onConnect=
'
+
want
+
"
, JSON.
"
+
JSON
.
stringify
(
want
));
function
onConnectCallback
(
element
,
remote
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServer_onConnectCallback ====> mConnIdJs=
'
+
JSON
.
stringify
(
mConnIdJs
)
+
"
,
"
+
mConnIdJs
);
console
.
debug
(
'
ACTS_SerivceAbilityServer_onConnectCallback ====> element=
'
+
JSON
.
stringify
(
element
)
+
"
,
"
+
element
);
console
.
debug
(
'
ACTS_SerivceAbilityServer_onConnectCallback ====> remote=
'
+
JSON
.
stringify
(
remote
)
+
"
,
"
+
remote
);
}
function
onDisconnectCallback
(
element
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServer_onDisconnectCallback ====> element=
'
+
JSON
.
stringify
(
element
)
+
"
,
"
+
element
);
}
function
onFailedCallback
(
code
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServer_onFailedCallback ====> code=
'
+
JSON
.
stringify
(
code
)
+
"
,
"
+
code
)
}
if
(
want
.
action
==
'
ServiceConnectService_1300
'
||
want
.
action
==
'
ServiceConnectService_1400
'
||
want
.
action
==
'
ServiceConnectService_1500
'
||
want
.
action
==
'
ServiceConnectService_1600
'
)
{
mConnIdJs
=
particleAbility
.
connectAbility
(
{
bundleName
:
serversecond_bundleName
,
abilityName
:
serversecond_abilityName
,
action
:
want
.
action
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
,
},
)
}
else
{
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onConnect
"
+
"
_
"
+
want
.
action
,
(
err
)
=>
{
});
}
return
mMyStub
;
return
mMyStub
;
},
},
onReconnect
(
want
)
{
OnAbilityConnectDone
(
element
,
remoteObject
,
resultCode
)
{
console
.
info
(
'
SerivceAbilityServer onReconnect
'
);
console
.
debug
(
'
ACTS_SerivceAbilityServer ====>OnAbilityConnectDone=
'
},
+
element
+
"
, JSON.
"
+
JSON
.
stringify
(
element
)
onDisconnect
()
{
+
remoteObject
+
"
, JSON.
"
+
JSON
.
stringify
(
remoteObject
)
console
.
info
(
'
SerivceAbilityServer OnDisConnect
'
);
+
resultCode
+
"
, JSON.
"
+
JSON
.
stringify
(
resultCode
)
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_OnAbilityConnectDone
"
,
(
err
)
=>
{
});
},
},
onCommand
(
want
,
restart
,
startId
)
{
onDisconnect
(
want
)
{
console
.
info
(
'
SerivceAbilityServer onCommand
'
);
console
.
debug
(
'
ACTS_SerivceAbilityServer ====>onDisConnect=
'
+
want
+
"
, JSON.
"
+
JSON
.
stringify
(
want
));
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServer_onDisConnect
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
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
);
})
}
featureAbility
.
terminateSelf
();
}
});
},
},
}
}
\ No newline at end of file
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/BUILD.gn
0 → 100644
浏览文件 @
008ed8b8
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("amsStServiceAilityServerSecond") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsStServiceAilityServerSecond"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/Test.json
0 → 100644
浏览文件 @
008ed8b8
{
"description"
:
"Configuration for hjunit demo Tests"
}
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/config.json
0 → 100755
浏览文件 @
008ed8b8
{
"app"
:
{
"bundleName"
:
"com.amsst.stserviceabilityserversecond"
,
"vendor"
:
"amsst"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.amsst.stserviceabilityserversecond"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
,
"installationFree"
:
true
},
"abilities"
:
[
{
"name"
:
"com.amsst.stserviceabilityserversecond.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"service"
,
"visible"
:
true
,
"uri"
:
"serviceability://com.amsst.stserviceabilityserversecond"
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/app.js
0 → 100755
浏览文件 @
008ed8b8
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
TestApplication onDestroy
'
);
}
};
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/i18n/en-US.json
0 → 100755
浏览文件 @
008ed8b8
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/i18n/zh-CN.json
0 → 100755
浏览文件 @
008ed8b8
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/pages/index/index.css
0 → 100755
浏览文件 @
008ed8b8
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
.titleST
{
font-size
:
32px
;
}
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/pages/index/index.hml
0 → 100755
浏览文件 @
008ed8b8
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
StServiceAbilityServer
</text>
</div>
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/pages/index/index.js
0 → 100755
浏览文件 @
008ed8b8
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
rpc
from
"
@ohos.rpc
"
;
let
mMyStub
;
import
particleAbility
from
'
@ohos.ability.particleability
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
commonEvent
from
'
@ohos.commonevent
'
var
server_bundleName
=
"
com.amsst.stserviceabilityserver
"
;
var
server_abilityName
=
"
com.amsst.stserviceabilityserver.MainAbility
"
;
var
mConnIdJs
;
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
debug
(
'
ACTS_SerivceAbilityServer ====<onShow
'
)
},
onReady
()
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====<onReady
'
);
},
onReconnect
(
want
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====>onReconnect=
'
+
want
+
"
, JSON.
"
+
JSON
.
stringify
(
want
));
},
onActive
()
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====<onActive
'
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onActive
"
,
(
err
)
=>
{
});
},
onCommand
(
want
,
restart
,
startId
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====>onCommand=
'
+
"
JSON(want)=
"
+
JSON
.
stringify
(
want
)
+
"
,restart=
"
+
restart
+
"
,startId=
"
+
startId
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onCommand
"
+
"
_
"
+
want
.
action
,
(
err
)
=>
{
});
featureAbility
.
terminateSelf
();
},
onStart
(
want
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====>onStart=
'
+
want
+
"
, JSON.
"
+
JSON
.
stringify
(
want
));
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onStart
"
,
(
err
)
=>
{
});
class
MyStub
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
super
(
des
);
}
}
console
.
debug
(
"
ACTS_SerivceAbilityServerSecond ====< RPCTestServer
"
);
mMyStub
=
new
MyStub
(
"
ServiceAbility-test
"
);
console
.
debug
(
"
ACTS_SerivceAbilityServerSecond RPCTestServer: mMyStub:
"
+
mMyStub
+
"
,JSON.
"
+
JSON
.
stringify
(
mMyStub
))
},
onStop
()
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====<onStop
'
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onStop
"
,
(
err
)
=>
{
});
featureAbility
.
terminateSelf
();
},
onConnect
(
want
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====>onConnect=
'
+
want
+
"
, JSON.
"
+
JSON
.
stringify
(
want
));
function
onConnectCallback
(
element
,
remote
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond_onConnectCallback ====> want.action=
'
+
JSON
.
stringify
(
want
.
action
)
+
"
,
"
+
want
.
action
);
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond_onConnectCallback ====> element=
'
+
JSON
.
stringify
(
element
)
+
"
,
"
+
element
);
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond_onConnectCallback ====> remote=
'
+
JSON
.
stringify
(
remote
)
+
"
,
"
+
remote
);
if
(
want
.
action
==
'
ServiceConnectService_1500
'
||
want
.
action
==
'
ServiceConnectService_1600
'
){
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onConnect
"
+
"
_
"
+
want
.
action
,
(
err
)
=>
{
console
.
debug
(
"
publish = ACTS_SerivceAbilityServerSecond_onConnect
"
+
"
_
"
+
want
.
action
);
});
}
}
function
onDisconnectCallback
(
element
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond_onDisconnectCallback ====> element=
'
+
JSON
.
stringify
(
element
)
+
"
,
"
+
element
);
}
function
onFailedCallback
(
code
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond_onFailedCallback ====> code=
'
+
JSON
.
stringify
(
code
)
+
"
,
"
+
code
)
}
if
(
want
.
action
==
'
ServiceConnectService_1500
'
)
{
mConnIdJs
=
particleAbility
.
connectAbility
(
{
bundleName
:
server_bundleName
,
abilityName
:
server_abilityName
,
action
:
"
ServiceConnectService_1501
"
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
,
},
)
}
else
if
(
want
.
action
==
'
ServiceConnectService_1600
'
)
{
mConnIdJs
=
particleAbility
.
connectAbility
(
{
bundleName
:
server_bundleName
,
abilityName
:
server_abilityName
,
action
:
"
ServiceConnectService_1601
"
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
,
},
)
}
else
if
(
want
.
action
==
'
ServiceConnectService_1590
'
)
{
mConnIdJs
=
particleAbility
.
connectAbility
(
{
bundleName
:
server_bundleName
,
abilityName
:
server_abilityName
,
action
:
"
ServiceConnectService_1591
"
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
,
},
)
}
else
{
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onConnect
"
+
"
_
"
+
want
.
action
,
(
err
)
=>
{
});
}
return
mMyStub
;
},
OnAbilityConnectDone
(
element
,
remoteObject
,
resultCode
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====>OnAbilityConnectDone=
'
+
element
+
"
, JSON.
"
+
JSON
.
stringify
(
element
)
+
remoteObject
+
"
, JSON.
"
+
JSON
.
stringify
(
remoteObject
)
+
resultCode
+
"
, JSON.
"
+
JSON
.
stringify
(
resultCode
)
);
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_OnAbilityConnectDone
"
,
(
err
)
=>
{
});
},
onDisconnect
(
want
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond ====>onDisConnect=
'
+
want
+
"
, JSON.
"
+
JSON
.
stringify
(
want
));
commonEvent
.
publish
(
"
ACTS_SerivceAbilityServerSecond_onDisConnect
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond_onDisConnect publish err=====>
'
+
err
);
}
else
{
console
.
debug
(
'
ACTS_SerivceAbilityServerSecond_onDisConnect featureAbility.terminateSelf()=====<
'
+
want
.
action
);
if
(
want
.
action
==
'
ServiceConnectService_1500
'
||
want
.
action
==
'
ServiceConnectService_1501
'
||
want
.
action
==
'
ServiceConnectService_1600
'
||
want
.
action
==
'
ServiceConnectService_1601
'
||
want
.
action
==
'
ServiceConnectService_1590
'
)
{
particleAbility
.
disconnectAbility
(
mConnIdJs
,
(
err
)
=>
{
console
.
debug
(
"
=ACTS_SerivceAbilityServerSecond_onDisConnect err====>
"
+
(
"
json err=
"
)
+
JSON
.
stringify
(
err
)
+
"
,
"
+
want
.
action
);
})
}
featureAbility
.
terminateSelf
();
}
});
},
}
\ No newline at end of file
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/resources/base/element/string.json
0 → 100755
浏览文件 @
008ed8b8
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"StServiceAbilityServer"
},
{
"name"
:
"mainability_description"
,
"value"
:
"hap sample empty page"
}
]
}
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/resources/base/media/icon.png
0 → 100755
浏览文件 @
008ed8b8
6.6 KB
appexecfwk/ams_standard/serviceability/stserviceabilityserversecond/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
008ed8b8
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录