Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e136c924
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e136c924
编写于
6月 07, 2023
作者:
Z
zha wei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
description:accept issue
Signed-off-by:
N
zha wei
<
zhawei@kaihong.com
>
上级
2d0f8b70
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
26 deletion
+24
-26
zh-cn/application-dev/reference/apis/js-apis-secureElement.md
...n/application-dev/reference/apis/js-apis-secureElement.md
+24
-26
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-secureElement.md
浏览文件 @
e136c924
# @ohos.secureElement( 安全单元的通道管理)
本模块主要用于操作及管理安全单元
SE,SE是SecureElement简称 ,
文档中出现的SE服务为SEService实例,参见
[
newSEService
](
#secureElement.newSEService
)
。
本模块主要用于操作及管理安全单元
(SecureElement,简称SE)。
文档中出现的SE服务为SEService实例,参见
[
newSEService
](
#secureElement.newSEService
)
。
对于文档中出现以下类型说明:
...
...
@@ -35,9 +35,9 @@ import secureElement from '@ohos.secureElement';
newSEService(type: 'serviceState', callback: Callback
<
[
ServiceState
](
#secureElement.ServiceState
)
>
): SEService
建立一个可用于连接到系统中所有可用SE的新连接(服务)。连接过程
可能很长,所以它是以
异步方式进行的。
建立一个可用于连接到系统中所有可用SE的新连接(服务)。连接过程
较为耗时,所以此方法仅提供
异步方式进行的。
仅当指定的回调或者
如果
[
isConnected
](
#SEService.isConnected
)
方法返回true时,该返回SEService对象是可用的。
仅当指定的回调或者
当
[
isConnected
](
#SEService.isConnected
)
方法返回true时,该返回SEService对象是可用的。
**系统能力:**
SystemCapability.Communication.SecureElement
...
...
@@ -64,14 +64,13 @@ import secureElement from '@ohos.secureElement';
this
.
result
=
"
Service state is Unkown
"
;
try
{
this
.
nfcSEService
=
secureElement
.
newSEService
(
"
serviceState
"
,
(
state
)
=>
{
if
(
state
==
secureElement
.
ServiceState
.
DISCONNECTED
)
{
this
.
result
=
"
Service state is Disconnected
"
;
}
else
{
this
.
result
=
"
Service state is Connected
"
;
}
});
this
.
nfcSEService
=
secureElement
.
newSEService
(
"
serviceState
"
,
(
state
)
=>
{
if
(
state
==
secureElement
.
ServiceState
.
DISCONNECTED
)
{
this
.
result
=
"
Service state is Disconnected
"
;
}
else
{
this
.
result
=
"
Service state is Connected
"
;
}
});
}
catch
(
e
)
{
this
.
result
=
"
newSEService occurs exception:
"
+
e
.
message
;
}
...
...
@@ -104,21 +103,20 @@ import secureElement from '@ohos.secureElement';
// get SEService
try
{
this
.
nfcSEService
=
secureElement
.
newSEService
(
"
serviceState
"
,
(
state
)
=>
{
if
(
state
==
secureElement
.
ServiceState
.
DISCONNECTED
)
{
this
.
result
=
"
Service state is Disconnected
"
;
}
else
{
this
.
result
=
"
Service state is Connected
"
;
}
});
this
.
nfcSEService
=
secureElement
.
newSEService
(
"
serviceState
"
,
(
state
)
=>
{
if
(
state
==
secureElement
.
ServiceState
.
DISCONNECTED
)
{
this
.
result
=
"
Service state is Disconnected
"
;
}
else
{
this
.
result
=
"
Service state is Connected
"
;
}
});
}
catch
(
e
)
{
this
.
result
=
"
newSEService excpetion:
"
+
e
.
message
;
}
try
{
this
.
nfcOmaReaderList
=
this
.
nfcSEService
.
getReaders
();
if
(
this
.
nfcOmaReaderList
)
{
if
(
this
.
nfcOmaReaderList
!=
null
&&
this
.
nfcOmaReaderList
.
length
>
0
)
{
this
.
nfcOmaReader
=
this
.
nfcOmaReaderList
[
0
];
this
.
result
=
"
get reader successfully
"
;
}
else
{
...
...
@@ -606,7 +604,7 @@ try {
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openBasicChannel1 get channel successfully
"
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
this
.
result
=
"
openBasicChannel1 exception:
"
+
err
.
message
;
});
}
catch
(
e
)
{
...
...
@@ -714,7 +712,7 @@ try {
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openBasicChannel3 get channel successfully
"
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
this
.
result
=
"
openBasicChannel3 exception
"
;
});
}
catch
(
e
)
{
...
...
@@ -822,7 +820,7 @@ try {
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openLogicChannel1 get channel successfully
"
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
this
.
result
=
"
openLogicChannel1 exception:
"
+
err
.
message
;
});
}
catch
(
e
)
{
...
...
@@ -931,7 +929,7 @@ if (this.nfcOmaSession) {
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openLogicChannel3 get channel successfully
"
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
this
.
result
=
"
openLogicChannel3 exception
"
;
})
}
catch
(
e
)
{
...
...
@@ -1223,7 +1221,7 @@ try {
this
.
result
+=
"
"
;
}
this
.
result
+=
"
]
"
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
this
.
result
=
"
transmit1 exception:
"
+
err
.
code
;
})
}
catch
(
e
)
{
...
...
@@ -1279,7 +1277,7 @@ try {
}
this
.
result
+=
"
]
"
;
});
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
result
=
"
transit2 exception:
"
+
e
.
message
;
}
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录