Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3e67c30b
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3e67c30b
编写于
6月 07, 2023
作者:
Z
zha wei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
description:code style fix
Signed-off-by:
N
zha wei
<
zhawei@kaihong.com
>
上级
1c07a8eb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
174 addition
and
179 deletion
+174
-179
zh-cn/application-dev/reference/apis/js-apis-secureElement.md
...n/application-dev/reference/apis/js-apis-secureElement.md
+174
-179
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-secureElement.md
浏览文件 @
3e67c30b
...
...
@@ -62,18 +62,17 @@ import secureElement from '@ohos.secureElement';
@
State
nfcSEService
:
secureElement
.
SEService
=
null
;
this
.
result
=
"
获取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
"
;
}
}
);
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
"
;
}
});
}
catch
(
e
)
{
this
.
result
+=
"
newSEService出现异常:
"
+
e
.
message
;
this
.
result
+=
"
newSEService出现异常:
"
+
e
.
message
;
}
```
...
...
@@ -109,27 +108,25 @@ import secureElement from '@ohos.secureElement';
@
State
nfcOmaReader
:
secureElement
.
Reader
=
null
;
// 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
"
;
}
}
);
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
"
;
}
});
}
catch
(
e
)
{
this
.
result
+=
"
newSEService出现异常:
"
+
e
.
message
;
this
.
result
+=
"
newSEService出现异常:
"
+
e
.
message
;
}
try
{
this
.
nfcOmaReader
=
this
.
nfcSEService
.
getReaders
()[
0
];
if
(
this
.
nfcOmaReader
)
{
this
.
result
=
"
获取reader成功
"
;
}
else
{
this
.
result
=
"
获取reader失败
"
;
}
this
.
nfcOmaReader
=
this
.
nfcSEService
.
getReaders
()[
0
];
if
(
this
.
nfcOmaReader
)
{
this
.
result
=
"
获取reader成功
"
;
}
else
{
this
.
result
=
"
获取reader失败
"
;
}
}
catch
(
e
)
{
this
.
result
=
"
getReaders异常:
"
+
e
.
message
;
}
...
...
@@ -162,11 +159,11 @@ import secureElement from '@ohos.secureElement';
@State nfcSEService: secureElement.SEService = null;
try {
let ret: boolean;
let ret: boolean;
// 有效this.nfcSEService,获取方式参考newService
ret = this.nfcSEService.isConnected();
if (ret) {
this.result = '获取连接状态:connected';
this.result = '获取连接状态:connected';
} else {
this.result = '获取连接状态:not connected';
}
...
...
@@ -323,8 +320,8 @@ import secureElement from '@ohos.secureElement';
try
{
// this.nfcOmaReader有效的Reader,获取方式参考SEService.getReaders
if
(
this
.
nfcOmaReader
.
isSecureElementPresent
())
{
this
.
result
=
"
isSecureElementPresent返回TRUE
"
;
if
(
this
.
nfcOmaReader
.
isSecureElementPresent
())
{
this
.
result
=
"
isSecureElementPresent返回TRUE
"
;
}
else
{
this
.
result
=
"
isSecureElementPresent返回FALSE
"
;
}
...
...
@@ -372,7 +369,7 @@ try {
// this.nfcOmaReader有效的Reader,获取方式参考SEService.getReaders
this
.
nfcOmaSession
=
this
.
nfcOmaReader
.
openSession
();
if
(
this
.
nfcOmaSession
)
{
this
.
result
=
"
获取session成功
"
;
this
.
result
=
"
获取session成功
"
;
}
else
{
this
.
result
=
"
获取session失败
"
;
}
...
...
@@ -418,9 +415,9 @@ try {
// this.nfcOmaReader有效的Reader,获取方式参考SEService.getReaders
this
.
nfcOmaReader
.
closeSessions
();
this
.
result
=
"
关闭Sessions成功
"
;
}
catch
(
e
)
{
this
.
result
=
"
closeSessions 异常:
"
+
e
.
message
;
}
}
catch
(
e
)
{
this
.
result
=
"
closeSessions 异常:
"
+
e
.
message
;
}
```
## Session.getReader
...
...
@@ -455,14 +452,14 @@ import secureElement from '@ohos.secureElement';
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
this
.
nfcOmaReader
=
this
.
nfcOmaSession
.
getReader
();
if
(
this
.
nfcOmaReader
)
{
this
.
result
=
"
获取reader成功
"
;
this
.
nfcOmaReader
=
this
.
nfcOmaSession
.
getReader
();
if
(
this
.
nfcOmaReader
)
{
this
.
result
=
"
获取reader成功
"
;
}
else
{
this
.
result
=
"
获取reader失败
"
;
this
.
result
=
"
获取reader失败
"
;
}
}
catch
(
e
)
{
this
.
result
=
"
getReader出现异常:
"
+
e
.
message
;
this
.
result
=
"
getReader出现异常:
"
+
e
.
message
;
}
```
...
...
@@ -503,17 +500,17 @@ try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let
ret
=
this
.
nfcOmaSession
.
getATR
();
if
(
ret
)
{
this
.
result
=
"
getATR结果:[
"
;
for
(
let
i
=
0
;
i
<
ret
.
length
;
++
i
)
{
this
.
result
=
"
getATR结果:[
"
;
for
(
let
i
=
0
;
i
<
ret
.
length
;
++
i
)
{
this
.
result
+=
ret
[
i
];
this
.
result
+=
'
'
;
}
this
.
result
+=
'
]
'
}
this
.
result
+=
'
]
'
}
else
{
this
.
result
=
"
getATR结果为空
"
this
.
result
=
"
getATR结果为空
"
}
}
catch
(
e
)
{
this
.
result
=
"
getATR异常:
"
+
e
.
message
;
this
.
result
=
"
getATR异常:
"
+
e
.
message
;
}
```
...
...
@@ -592,9 +589,9 @@ try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let ret = this.nfcOmaSession.isClosed();
if (ret) {
this.result = "session状态:closed";
this.result = "session状态:closed";
} else {
this.result = "session状态:not closed";
this.result = "session状态:not closed";
}
} catch (e) {
this.result = "isClosed异常:" + e.message;
...
...
@@ -635,11 +632,11 @@ import secureElement from '@ohos.secureElement';
@
State
nfcOmaSession
:
secureElement
.
Session
=
null
;
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
this
.
nfcOmaSession
.
closeChannels
();
this
.
result
=
"
关闭Channels成功
"
;
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
this
.
nfcOmaSession
.
closeChannels
();
this
.
result
=
"
关闭Channels成功
"
;
}
catch
(
e
)
{
this
.
result
=
"
closeChannels出现异常:
"
+
e
.
message
;
this
.
result
=
"
closeChannels出现异常:
"
+
e
.
message
;
}
```
...
...
@@ -688,15 +685,15 @@ import secureElement from '@ohos.secureElement';
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let
getPromise
=
this
.
nfcOmaSession
.
openBasicChannel
(
this
.
aidArray
)
let
getPromise
=
this
.
nfcOmaSession
.
openBasicChannel
(
this
.
aidArray
)
;
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openBasicChannel1获取channel成功
"
;
}).
catch
((
err
)
=>
{
this
.
result
=
"
openBasicChannel1出现异常:
"
+
err
.
meesage
;
})
this
.
result
=
"
openBasicChannel1出现异常:
"
+
err
.
meesage
;
})
;
}
catch
(
e
)
{
this
.
result
=
"
OpenBasicChannel1出现异常:
"
+
e
.
message
;
this
.
result
=
"
OpenBasicChannel1出现异常:
"
+
e
.
message
;
}
```
...
...
@@ -746,18 +743,17 @@ import secureElement from '@ohos.secureElement';
aidArray
:
number
[]
=
[
720
,
1080
]
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
this
.
nfcOmaSession
.
openBasicChannel
(
this
.
aidArray
,
(
error
,
data
)
=>
{
if
(
error
)
{
this
.
result
=
"
openBasicChannel2失败:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
nfcOmaChannel
=
data
;
this
.
result
=
"
openBasicChannel2获取channel成功
"
;
}
)
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
this
.
nfcOmaSession
.
openBasicChannel
(
this
.
aidArray
,
(
error
,
data
)
=>
{
if
(
error
)
{
this
.
result
=
"
openBasicChannel2失败:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
nfcOmaChannel
=
data
;
this
.
result
=
"
openBasicChannel2获取channel成功
"
;
});
}
catch
(
e
)
{
this
.
result
=
"
openBasicChannel2出现异常:
"
+
e
.
message
;
this
.
result
=
"
openBasicChannel2出现异常:
"
+
e
.
message
;
}
```
...
...
@@ -814,8 +810,8 @@ try {
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openBasicChannel3 获取channel成功
"
;
}).
catch
((
err
)
=>
{
this
.
result
=
"
openBasicChannel3 出现异常
"
;
})
this
.
result
=
"
openBasicChannel3 出现异常
"
;
})
;
}
catch
(
e
)
{
this
.
result
=
"
openBasicChannel3出现异常:
"
+
e
.
message
;
}
...
...
@@ -870,14 +866,14 @@ p2: number = 0x00
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
this
.
nfcOmaSession
.
openBasicChannel
(
this
.
aidArray
,
this
.
p2
,
(
error
,
data
)
=>
{
if
(
error
)
{
this
.
result
=
"
openBasicChannel4失败:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
nfcOmaChannel
=
data
;
this
.
result
=
"
openBasicChannel4获取channel成功
"
;
})
this
.
nfcOmaSession
.
openBasicChannel
(
this
.
aidArray
,
this
.
p2
,
(
error
,
data
)
=>
{
if
(
error
)
{
this
.
result
=
"
openBasicChannel4失败:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
nfcOmaChannel
=
data
;
this
.
result
=
"
openBasicChannel4获取channel成功
"
;
});
}
catch
(
e
)
{
this
.
result
=
"
openBasicChannel4异常:
"
+
e
.
message
;
}
...
...
@@ -929,15 +925,15 @@ aidArray: number[] = [720, 1080]
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let
getPromise
=
this
.
nfcOmaSession
.
openLogicalChannel
(
this
.
aidArray
)
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openLogicChannel1获取channel成功
"
;
}).
catch
((
err
)
=>
{
this
.
result
=
"
openLogicChannel1出现异常:
"
+
err
.
code
;
})
let
getPromise
=
this
.
nfcOmaSession
.
openLogicalChannel
(
this
.
aidArray
)
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openLogicChannel1获取channel成功
"
;
}).
catch
((
err
)
=>
{
this
.
result
=
"
openLogicChannel1出现异常:
"
+
err
.
code
;
});
}
catch
(
e
)
{
this
.
result
=
"
openLogicChannel1出现异常:
"
+
e
.
message
;
this
.
result
=
"
openLogicChannel1出现异常:
"
+
e
.
message
;
}
```
...
...
@@ -984,20 +980,20 @@ import secureElement from '@ohos.secureElement';
@
State
result
:
string
=
''
@
State
nfcOmaSession
:
secureElement
.
Session
=
null
;
@
State
nfcOmaChannel
:
secureElement
.
Channel
=
null
;
aidArray
:
number
[]
=
[
720
,
1080
]
aidArray
:
number
[]
=
[
720
,
1080
]
;
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
this
.
nfcOmaSession
.
openLogicalChannel
(
this
.
aidArray
,
(
error
,
data
)
=>
{
if
(
error
)
{
this
.
result
=
"
openLogicChannel2失败:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
nfcOmaChannel
=
data
;
this
.
result
=
"
openLogicChannel2获取channel成功
"
;
})
this
.
nfcOmaSession
.
openLogicalChannel
(
this
.
aidArray
,
(
error
,
data
)
=>
{
if
(
error
)
{
this
.
result
=
"
openLogicChannel2失败:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
nfcOmaChannel
=
data
;
this
.
result
=
"
openLogicChannel2获取channel成功
"
;
});
}
catch
(
e
)
{
this
.
result
=
"
openLogicChannel2 异常:
"
+
e
.
message
;
this
.
result
=
"
openLogicChannel2 异常:
"
+
e
.
message
;
}
```
...
...
@@ -1054,17 +1050,17 @@ aidArray: number[] = [720, 1080]
p2
:
number
=
0x00
if
(
this
.
nfcOmaSession
)
{
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let
getPromise
=
this
.
nfcOmaSession
.
openLogicalChannel
(
this
.
aidArray
,
this
.
p2
)
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openLogicChannel3获取channel成功
"
;
}).
catch
((
err
)
=>
{
this
.
result
=
"
openLogicChannel3 出现异常
"
;
})
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let
getPromise
=
this
.
nfcOmaSession
.
openLogicalChannel
(
this
.
aidArray
,
this
.
p2
)
getPromise
.
then
((
channel
)
=>
{
this
.
nfcOmaChannel
=
channel
;
this
.
result
=
"
openLogicChannel3获取channel成功
"
;
}).
catch
((
err
)
=>
{
this
.
result
=
"
openLogicChannel3 出现异常
"
;
})
;
}
catch
(
e
)
{
this
.
result
=
"
openLogicChannel3出现异常:
"
+
e
.
message
;
this
.
result
=
"
openLogicChannel3出现异常:
"
+
e
.
message
;
}
```
...
...
@@ -1124,15 +1120,15 @@ p2: number = 0x00
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
this
.
nfcOmaSession
.
openLogicalChannel
(
this
.
aidArray
,
this
.
p2
,
(
error
,
data
)
=>
{
if
(
error
)
{
this
.
result
=
"
openLogicChannel4失败:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
nfcOmaChannel
=
data
;
this
.
result
=
"
openLogicChannel4获取channel成功
"
;
if
(
error
)
{
this
.
result
=
"
openLogicChannel4失败:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
nfcOmaChannel
=
data
;
this
.
result
=
"
openLogicChannel4获取channel成功
"
;
})
}
catch
(
e
)
{
this
.
result
=
"
openLogicChannel4异常:
"
+
e
.
message
;
this
.
result
=
"
openLogicChannel4异常:
"
+
e
.
message
;
}
```
...
...
@@ -1167,13 +1163,13 @@ import secureElement from '@ohos.secureElement';
@
State
nfcOmaChannel
:
secureElement
.
Channel
=
null
;
try
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let
ret
=
this
.
nfcOmaChannel
.
getSession
();
if
(
ret
)
{
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let
ret
=
this
.
nfcOmaChannel
.
getSession
();
if
(
ret
)
{
this
.
result
=
"
获取到session对象
"
;
}
else
{
}
else
{
this
.
result
=
"
无法获取到session对象
"
;
}
}
}
catch
(
e
)
{
this
.
result
=
"
getSession异常:
"
+
e
.
message
;
}
...
...
@@ -1210,12 +1206,11 @@ import secureElement from '@ohos.secureElement';
@
State
nfcOmaChannel
:
secureElement
.
Channel
=
null
;
try
{
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
this
.
nfcOmaChannel
.
close
();
this
.
result
=
"
channel close成功
"
;
}
catch
(
e
)
{
this
.
result
=
"
channel close异常:
"
+
e
.
message
;
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
this
.
nfcOmaChannel
.
close
();
this
.
result
=
"
channel close成功
"
;
}
catch
(
e
)
{
this
.
result
=
"
channel close异常:
"
+
e
.
message
;
}
```
...
...
@@ -1249,15 +1244,15 @@ import secureElement from '@ohos.secureElement';
@
State
nfcOmaChannel
:
secureElement
.
Channel
=
null
;
try
{
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let
ret
=
this
.
nfcOmaChannel
.
isBasicChannel
();
if
(
ret
)
{
this
.
result
=
"
isBasicChannel TRUE
"
;
}
else
{
this
.
result
=
"
isBasicChannel FALSE
"
;
}
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let
ret
=
this
.
nfcOmaChannel
.
isBasicChannel
();
if
(
ret
)
{
this
.
result
=
"
isBasicChannel TRUE
"
;
}
else
{
this
.
result
=
"
isBasicChannel FALSE
"
;
}
}
catch
(
e
)
{
this
.
result
=
"
isBasicChannel异常:
"
+
e
.
message
;
this
.
result
=
"
isBasicChannel异常:
"
+
e
.
message
;
}
```
...
...
@@ -1291,15 +1286,15 @@ import secureElement from '@ohos.secureElement';
@
State
nfcOmaChannel
:
secureElement
.
Channel
=
null
;
try
{
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let
ret
=
this
.
nfcOmaChannel
.
isClosed
()
if
(
ret
)
{
this
.
result
=
"
channel isClosed TRUE
"
;
}
else
{
this
.
result
=
"
channel isClosed False
"
;
}
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let
ret
=
this
.
nfcOmaChannel
.
isClosed
();
if
(
ret
)
{
this
.
result
=
"
channel isClosed TRUE
"
;
}
else
{
this
.
result
=
"
channel isClosed False
"
;
}
}
catch
(
e
)
{
this
.
result
=
"
Channel isClosed异常:
"
+
e
.
message
;
this
.
result
=
"
Channel isClosed异常:
"
+
e
.
message
;
}
```
...
...
@@ -1333,20 +1328,20 @@ import secureElement from '@ohos.secureElement';
@
State
nfcOmaChannel
:
secureElement
.
Channel
=
null
;
try
{
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let
ret
=
this
.
nfcOmaChannel
.
getSelectResponse
();
if
(
ret
)
{
this
.
result
=
"
getSelectResponse结果:[
"
;
for
(
let
i
=
0
;
i
<
ret
.
length
;
++
i
)
{
this
.
result
+=
ret
[
i
];
this
.
result
+=
'
'
;
}
this
.
result
+=
'
]
'
}
else
{
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let
ret
=
this
.
nfcOmaChannel
.
getSelectResponse
();
if
(
ret
)
{
this
.
result
=
"
getSelectResponse结果:[
"
;
for
(
let
i
=
0
;
i
<
ret
.
length
;
++
i
)
{
this
.
result
+=
ret
[
i
];
this
.
result
+=
'
'
;
}
this
.
result
+=
'
]
'
}
else
{
this
.
result
=
"
getSelectResponse结果为空
"
}
}
}
catch
(
e
)
{
this
.
result
=
"
getSelectResponse异常:
"
+
e
.
message
;
this
.
result
=
"
getSelectResponse异常:
"
+
e
.
message
;
}
```
...
...
@@ -1392,21 +1387,21 @@ import secureElement from '@ohos.secureElement';
@
State
nfcOmaChannel
:
secureElement
.
Channel
=
null
;
try
{
let
command
:
number
[]
=
[
100
,
200
]
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let
getPromise
=
this
.
nfcOmaChannel
.
transmit
(
command
);
getPromise
.
then
((
data
)
=>
{
this
.
result
=
"
transmit1 结果:[
"
;
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
this
.
result
+=
data
[
i
];
this
.
result
+=
"
"
;
}
this
.
result
+=
"
]
"
;
}).
catch
((
err
)
=>
{
this
.
result
=
"
transmit1出现异常:
"
+
err
.
code
;
})
let
command
:
number
[]
=
[
100
,
200
]
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let
getPromise
=
this
.
nfcOmaChannel
.
transmit
(
command
);
getPromise
.
then
((
data
)
=>
{
this
.
result
=
"
transmit1 结果:[
"
;
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
this
.
result
+=
data
[
i
];
this
.
result
+=
"
"
;
}
this
.
result
+=
"
]
"
;
}).
catch
((
err
)
=>
{
this
.
result
=
"
transmit1出现异常:
"
+
err
.
code
;
})
}
catch
(
e
)
{
this
.
result
=
"
transit1 调用异常:
"
+
e
.
message
;
this
.
result
=
"
transit1 调用异常:
"
+
e
.
message
;
}
```
...
...
@@ -1454,19 +1449,19 @@ import secureElement from '@ohos.secureElement';
try
{
let
command
:
number
[]
=
[
100
,
200
];
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
this
.
nfcOmaChannel
.
transmit
(
command
,
(
error
,
data
)
=>
{
if
(
error
)
{
this
.
result
=
"
transmit2异常:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
result
=
"
transmit2 结果:[
"
;
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
this
.
result
+=
data
[
i
];
this
.
result
+=
"
"
;
}
this
.
result
+=
"
]
"
;
})
if
(
error
)
{
this
.
result
=
"
transmit2异常:
"
+
JSON
.
stringify
(
error
);
return
;
}
this
.
result
=
"
transmit2 结果:[
"
;
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
this
.
result
+=
data
[
i
];
this
.
result
+=
"
"
;
}
this
.
result
+=
"
]
"
;
})
;
}
catch
(
e
)
{
this
.
result
=
"
transit2 调用异常:
"
+
e
.
message
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录