提交 2d0f8b70 编写于 作者: Z zha wei

description: OMA接口文档第一次review整改

Signed-off-by: Nzha wei <zhawei@kaihong.com>
上级 62cd9ebc
# @ohos.secureElement(SE服务管理&SE Reader管理& 基础和逻辑通道管理)
# @ohos.secureElement( 安全单元的通道管理)
本模块主要用于
本模块主要用于操作及管理安全单元SE,SE是SecureElement简称 ,文档中出现的SE服务为SEService实例,参见[newSEService](#secureElement.newSEService)
对于文档中出现以下类型说明:
| 类型 | 说明 |
| ------- | ---------------------------------------------- |
| Session | 此类的实例表示与设备上可用的某个SE的连接会话。 |
| Reader | 此类的实例表示该设备支持的SE Reader。 |
| Channel | 此类的实例表示向SE打开的ISO/IEC 7816-4通道。 |
> **说明:**
>
......@@ -12,7 +20,7 @@
import secureElement from '@ohos.secureElement';
```
## ServiceState
## secureElement.ServiceState
定义不同的SE 服务状态值。
......@@ -25,87 +33,74 @@ import secureElement from '@ohos.secureElement';
## secureElement.newSEService
newSEService(type: 'serviceState', callback: Callback<[ServiceState](#ServiceState)>): [SEService](#SEService)
newSEService(type: 'serviceState', callback: Callback<[ServiceState](#secureElement.ServiceState)>): SEService
建立一个可用于连接到系统中所有可用SE的新连接(服务)。连接过程可能很长,所以它是以异步方式进行的。仅当
建立一个可用于连接到系统中所有可用SE的新连接(服务)。连接过程可能很长,所以它是以异步方式进行的。
指定的回调或者如果[isConnected](#SEService.isConnected)返回true时,该返回[SEService](#SEService)对象是可用的。
> **说明:**
> 从 API version10 开始支持
仅当指定的回调或者如果[isConnected](#SEService.isConnected)方法返回true时,该返回SEService对象是可用的。
**系统能力:** SystemCapability.Communication.SecureElement
**参数:**
| **参数名** | **类型** | **说明** |
| ---------- | --------------------------------------- | ---------------------- |
| ---------- | ----------------------------------------------------- | -------------------- |
| type | string | 'serviceState' |
| callback | Callback<[ServiceState](#ServiceState)> | 返回service 状态的回调 |
| callback | Callback<[ServiceState](#secureElement.ServiceState)> | 返回SE服务状态的回调 |
**返回值:**
| **类型** | **说明** |
| :-------- | :----------------------------------------------------------- |
| SEService | 仅当callback状态是[ServiceState](#ServiceState).CONNECTED或[isConnected](#SEService.isConnected)接口返回值是true时,该service可用。 失败抛出异常 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
| :-------- | :--------- |
| SEService | SE服务实例 |
**示例:**
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcSEService: secureElement.SEService = null;
this.result = "获取SEService结果:";
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.result = "Service state is Connected";
}
});
} catch (e) {
this.result += "newSEService出现异常:" + e.message;
this.result = "newSEService occurs exception:" + e.message;
}
```
## SEService.getReaders
getReaders(): [Reader](#Reader)[]
getReaders(): Reader[]
返回可用SE [Reader](#Reader)的数组。返回的数组中不能有重复的对象。即使没有插入卡,也应列出所有可用的reader
> **说明:**
> 从 API version 10
返回可用SE Reader的数组。返回的数组中不能有重复的对象。即使没有插入卡,也应列出所有可用的reader。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| :------------------ | :-------------------------------- |
| [Reader](#Reader)[] | 返回可用[Reader](#Reader)对象数组 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
| :------- | :--------------------- |
| Reader[] | 返回可用Reader对象数组 |
**示例:**
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcSEService: secureElement.SEService = null;
@State nfcServiceState: secureElement.ServiceState = null;
@State nfcOmaReader: secureElement.Reader = null;
@State nfcOmaReaderList: secureElement.Reader[] = null;
// get SEService
try {
......@@ -114,22 +109,23 @@ try {
if (state == secureElement.ServiceState.DISCONNECTED) {
this.result = "Service state is Disconnected";
} else {
this.result = "Service state is connected";
this.result = "Service state is Connected";
}
});
} catch (e) {
this.result += "newSEService出现异常:" + e.message;
this.result = "newSEService excpetion:" + e.message;
}
try {
this.nfcOmaReader = this.nfcSEService.getReaders()[0];
if (this.nfcOmaReader) {
this.result = "获取reader成功";
this.nfcOmaReaderList = this.nfcSEService.getReaders();
if (this.nfcOmaReaderList) {
this.nfcOmaReader = this.nfcOmaReaderList[0];
this.result = "get reader successfully";
} else {
this.result = "获取reader失败";
this.result = "get reader failed";
}
} catch (e) {
this.result = "getReaders异常:" + e.message;
this.result = "getReaders exception:" + e.message;
}
```
......@@ -144,12 +140,8 @@ isConnected(): boolean
**返回值:**
| **类型** | **说明** |
| :------- | :----------------------------------------------------------- |
| boolean | true:SE 服务状态[ServiceState](#ServiceState).CONNECTED false:SE服务状态[ServiceState](#ServiceState).DISCONNECTED |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
| :------- | :--------------------------------------------- |
| boolean | true:SE 服务状态已连接 false:SE服务状态已断开 |
**示例:**
......@@ -161,15 +153,15 @@ import secureElement from '@ohos.secureElement';
try {
let ret: boolean;
// 有效this.nfcSEService,获取方式参考newSEService
// refer to newSEService for this.nfcSEService
ret = this.nfcSEService.isConnected();
if (ret) {
this.result = '获取连接状态:connected';
this.result = 'get state: connected';
} else {
this.result = '获取连接状态:not connected';
this.result = 'get state: not connected';
}
} catch (e) {
this.result = "isConnected异常:" + e.message;
this.result = "isConnected exception: " + e.message;
}
```
......@@ -179,21 +171,8 @@ shutdown(): void
释放该service分配的所有SE资源。此后[isConnected](#SEService.isConnected)将返回false。
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
**示例:**
```js
......@@ -203,11 +182,11 @@ import secureElement from '@ohos.secureElement';
@State nfcSEService: secureElement.SEService = null;
try {
// 有效this.nfcSEService,获取方式参考newSEService
// refer to newSEService for this.nfcSEService
this.nfcSEService.shutdown();
this.result = "shutdown成功";
this.result = "shutdown successfully";
} catch (e) {
this.result = "shutdown异常:" + e.message;
this.result = "shutdown exception:" + e.message;
}
```
......@@ -215,22 +194,15 @@ try {
getVersion(): string
返回此实现所基于的OMA规范的版本号
> **说明:**
> 从 API version 10 开始支持。
返回此实现所基于的OMA规范的版本号。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ------------------------------------------------------------ |
| string | OMA版本号(例如,“3.3”表示开放移动API规范版本3.3),失败抛出异常。 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
| -------- | -------------------------------------------------- |
| string | OMA版本号(例如,“3.3”表示开放移动API规范版本3.3) |
**示例:**
......@@ -240,12 +212,12 @@ import secureElement from '@ohos.secureElement';
@State result: string = '';
@State nfcSEService: secureElement.SEService = null;
this.result = "版本名称:"
this.result = "version: "
try {
// 有效this.nfcSEService,获取方式参考newSEService
// refer to newSEService for this.nfcSEService
this.result += this.nfcSEService.getVersion();
} catch (e) {
this.result += "getVersion异常:" + e.message;
this.result = "getVersion exception:" + e.message;
}
```
......@@ -253,10 +225,7 @@ try {
getName(): string
返回此reader的名称。如果此读卡器是SIM reader,则其名称必须为“SIM[Slot]”。如果读卡器是嵌入式SE reader,则其名称须为“eSE[slot]”
> **说明:**
> 从 API version 10 开始支持。
返回此reader的名称。如果此读卡器是SIM reader,则其名称必须为“SIM[Slot]”。如果读卡器是嵌入式SE reader,则其名称须为“eSE[slot]”。
**系统能力:** SystemCapability.Communication.SecureElement
......@@ -266,23 +235,19 @@ getName(): string
| -------- | ---------- |
| string | reader名称 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
**示例:**
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaReader: secureElement.Reader = null;
try {
// this.nfcOmaReader有效的Reader,获取方式参考SEService.getReaders
// refer to SEService.getReaders for this.nfcOmaReader
this.result = this.nfcOmaReader.getName();
} catch (e) {
this.result = "getName异常:" + e.message;
this.result = "getName exception:" + e.message;
}
```
......@@ -290,18 +255,15 @@ try {
isSecureElementPresent(): boolean
检查reader中是否存在SE。
> **说明:**
> 从 API version 10 开始支持。
检查当前Reader所对应的安全单元是否可用。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ------------------------------------- |
| boolean | 当前reader的SE存在返回true,否则false |
| -------- | -------------------------------------------- |
| boolean | true: 安全单元可用, false: 安全单元不可用。 |
**错误码:**
......@@ -316,37 +278,34 @@ isSecureElementPresent(): boolean
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaReader: secureElement.Reader = null;
try {
// this.nfcOmaReader有效的Reader,获取方式参考SEService.getReaders
// refer to SEService.getReaders for this.nfcOmaReader
if (this.nfcOmaReader.isSecureElementPresent()) {
this.result = "isSecureElementPresent返回TRUE";
this.result = "isSecureElementPresent TRUE";
} else {
this.result = "isSecureElementPresent返回FALSE";
this.result = "isSecureElementPresent FALSE";
}
} catch (e) {
this.result = "isSecureElementPresent异常:" + e.message;
this.result = "isSecureElementPresent exception:" + e.message;
}
```
## Reader.openSession
openSession(): [Session](#Session)
openSession(): Session
连接到此reader中的SE。此方法在返回会话对象之前准备(初始化)SE进行通信。同一reader上可能同时打开多个会话。
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| ------------------- | ------------------------------------------ |
| [Session](#Session) | 用于创建channel的[Session](#Session)对象。 |
| -------- | ------------------------------ |
| Session | 用于创建channel的Session对象。 |
**错误码:**
......@@ -362,20 +321,20 @@ try {
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaReader: secureElement.Reader = null;
@State nfcOmaSession: secureElement.Session = null;
try {
// this.nfcOmaReader有效的Reader,获取方式参考SEService.getReaders
// refer to SEService.getReaders for this.nfcOmaReader
this.nfcOmaSession = this.nfcOmaReader.openSession();
if (this.nfcOmaSession) {
this.result = "获取session成功";
this.result = "get session successfully";
} else {
this.result = "获取session失败";
this.result = "get session failed";
}
} catch (e) {
this.result = "OpenSession异常:" + e.message;
this.result = "OpenSession exception: " + e.message;
}
```
......@@ -385,17 +344,8 @@ try {
关闭在此reader上打开的所有session。所有这些session打开的所有channel都将关闭。
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
......@@ -409,58 +359,51 @@ try {
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaReader: secureElement.Reader = null;
try {
// this.nfcOmaReader有效的Reader,获取方式参考SEService.getReaders
// refer to SEService.getReaders for this.nfcOmaReader
this.nfcOmaReader.closeSessions();
this.result = "关闭Sessions成功";
this.result = "close Sessions successfully";
} catch (e) {
this.result = "closeSessions 异常:" + e.message;
this.result = "closeSessions exception:" + e.message;
}
```
## Session.getReader
getReader(): [Reader](#Reader)
getReader(): Reader
获取提供此session的reader
> **说明:**
> 从 API version 10 开始支持。
获取提供此session的reader。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| ----------------- | ------------------------------------ |
| [Reader](#Reader) | 返回此session的[Reader](#Reader)对象 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
| -------- | --------------------------- |
| Reader | 返回此session的Reader对象。 |
**示例:**
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaReader: secureElement.Reader = null;
@State nfcOmaSession: secureElement.Session = null;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
this.nfcOmaReader = this.nfcOmaSession.getReader();
if (this.nfcOmaReader) {
this.result = "获取reader成功";
this.result = "get reader successfully";
} else {
this.result = "获取reader失败";
this.result = "get reader failed";
}
} catch (e) {
this.result = "getReader出现异常:" + e.message;
this.result = "getReader exception:" + e.message;
}
```
......@@ -470,16 +413,13 @@ getATR(): number[]
获取该SE的ATR。如果该SE的ATR不可用,则应返回空数组。
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ------------------------------------------ |
| number[] | 返回SE的ATR,SE的ATR不可用时,返回空的数组 |
| -------- | -------------------------------------------- |
| number[] | 返回SE的ATR,SE的ATR不可用时,返回空的数组 |
**错误码:**
......@@ -494,24 +434,24 @@ getATR(): number[]
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
let ret = this.nfcOmaSession.getATR();
if (ret) {
this.result = "getATR结果:[";
this.result = "getATR result:[";
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 result is null";
}
} catch (e) {
this.result = "getATR异常:" + e.message;
this.result = "getATR exception:" + e.message;
}
```
......@@ -521,17 +461,8 @@ close(): void
关闭与SE的连接。这将关闭此应用程序与此SE打开的所有channel。
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
......@@ -545,15 +476,15 @@ close(): void
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
this.nfcOmaSession.close();
this.result = "session close 成功";
this.result = "session close successfully";
} catch (e) {
this.result = "session close 异常:" + e.message;
this.result = "session close exception:" + e.message;
}
```
......@@ -561,18 +492,15 @@ try {
isClosed(): boolean
检查session是否关闭.
> **说明:**
> 从 API version 10 开始支持。
检查session是否关闭。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ---------------------------------- |
| boolean | true:session状态已关闭,否则false |
| -------- | ------------------------------------ |
| boolean | true:session状态已关闭,否则false |
**错误码:**
......@@ -583,19 +511,19 @@ isClosed(): boolean
```Js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
let ret = this.nfcOmaSession.isClosed();
if (ret) {
this.result = "session状态:closed";
this.result = "session state is closed";
} else {
this.result = "session状态:not closed";
this.result = "session state is not closed";
}
} catch (e) {
this.result = "isClosed异常:" + e.message;
this.result = "isClosed exception:" + e.message;
}
```
......@@ -605,17 +533,8 @@ closeChannels(): void
关闭此session上打开的所有channel。
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
......@@ -629,26 +548,23 @@ closeChannels(): void
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
this.nfcOmaSession.closeChannels();
this.result = "关闭Channels成功";
this.result = "close Channels successfully";
} catch (e) {
this.result = "closeChannels出现异常:" + e.message;
this.result = "closeChannels exception:" + e.message;
}
```
## Session.openBasicChannel
openBasicChannel(aid: number[]): Promise<[Channel](#Channel)>
openBasicChannel(aid: number[]): Promise<Channel>
获取基本channel,参考[ISO 7816-4](https://www.iso.org/standard/77180.html)协议,返回[Channel](#Channel)实例对象
> **说明:**
> 从 API version 10 开始支持。
获取基本channel,参考[ISO 7816-4]协议,返回Channel实例对象,SE不能提供新逻辑Channel或因缺乏可用逻辑Channel对象而无法获取访问控制规则,返回null。
**系统能力:** SystemCapability.Communication.SecureElement
......@@ -656,13 +572,13 @@ openBasicChannel(aid: number[]): Promise<[Channel](#Channel)>
| **参数名** | **类型** | **说明** |
| ---------- | -------- | ------------------------------------------------------------ |
| aid | number[] | 在此channel上选择的applet的AID数组或null 如果没有applet被选择 |
| aid | number[] | 在此channel上选择的applet的AID数组或如果没有applet被选择时空的数组null。 |
**返回值:**
| **类型** | **说明** |
| ------------------- | ------------------------------------------------------------ |
| [Channel](#Channel) | 返回可用[Channel](#Channel)对象实例,SE不能提供新逻辑[Channel](#Channel)或因缺乏可用逻辑[Channel](#Channel)对象而无法获取访问控制规则,返回null |
| -------- | --------------------- |
| Channel | 可用Channel对象实例。 |
**错误码:**
......@@ -680,47 +596,38 @@ openBasicChannel(aid: number[]): Promise<[Channel](#Channel)>
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
@State nfcOmaChannel: secureElement.Channel = null;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
let getPromise = this.nfcOmaSession.openBasicChannel(this.aidArray);
getPromise.then((channel) => {
this.nfcOmaChannel = channel;
this.result = "openBasicChannel1获取channel成功";
this.result = "openBasicChannel1 get channel successfully";
}).catch((err) => {
this.result = "openBasicChannel1出现异常:" + err.meesage;
this.result = "openBasicChannel1 exception:" + err.message;
});
} catch (e) {
this.result = "OpenBasicChannel1出现异常:" + e.message;
this.result = "OpenBasicChannel1 exception:" + e.message;
}
```
## Session.openBasicChannel
openBasicChannel(aid: number[], callback: AsyncCallback<[Channel](#Channel)>): void
openBasicChannel(aid: number[], callback: AsyncCallback<Channel>): void
获取基本channel,参考[ISO 7816-4](https://www.iso.org/standard/77180.html)协议,返回channel实例对象
> **说明:**
> 从 API version 10 开始支持。
获取基本channel,参考[ISO 7816-4]协议,返回channel实例对象,SE不能提供新逻辑Channel或因缺乏可用逻辑Channel对象而无法获取访问控制规则,返回null。
**系统能力:** SystemCapability.Communication.SecureElement
**参数:**
| **参数名** | **类型** | **说明** |
| ---------- | ---------------------------------- | ------------------------------------------------------------ |
| aid | number[] | 在此channel上选择的applet的AID数组或null 如果没有applet被选择 |
| callback | AsyncCallback<[Channel](#Channel)> | callback返回可用[Channel](#Channel)对象实例,SE不能提供新逻辑[Channel](#Channel)或因缺乏可用逻辑[Channel](#Channel)对象而无法获取访问控制规则,返回null |
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
| ---------- | ---------------------- | ------------------------------------------------------------ |
| aid | number[] | 在此channel上选择的applet的AID数组或null 如果没有applet被选择。 |
| callback | AsyncCallback<Channel> | callback返回可用Channel对象实例。 |
**错误码:**
......@@ -738,34 +645,31 @@ try {
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@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
// refer to Reader.openSession for this.nfcOmaSession
this.nfcOmaSession.openBasicChannel(this.aidArray, (error, data) => {
if (error) {
this.result = "openBasicChannel2失败:" + JSON.stringify(error);
this.result = "openBasicChannel2 failed:" + JSON.stringify(error);
return;
}
this.nfcOmaChannel = data;
this.result = "openBasicChannel2获取channel成功";
this.result = "openBasicChannel2 get channel successfully";
});
} catch (e) {
this.result = "openBasicChannel2出现异常:" + e.message;
this.result = "openBasicChannel2 exception:" + e.message;
}
```
## Session.openBasicChannel
openBasicChannel(aid: number[], p2: number): Promise<[Channel](#Channel)>
获取基本channel,参考[ISO 7816-4](https://www.iso.org/standard/77180.html)协议,返回[Channel](#Channel)实例对象
openBasicChannel(aid: number[], p2: number): Promise<Channel>
> **说明:**
> 从 API version 10 开始支持。
获取基本channel,参考[ISO 7816-4]协议,返回Channel实例对象,SE不能提供新逻辑Channel对象或因缺乏可用逻辑Channel对象而无法获取访问控制规则,返回null。
**系统能力:** SystemCapability.Communication.SecureElement
......@@ -773,14 +677,14 @@ openBasicChannel(aid: number[], p2: number): Promise<[Channel](#Channel)>
| **参数名** | **类型** | **说明** |
| ---------- | -------- | ------------------------------------------------------------ |
| aid | number[] | 在此channel上选择的applet的AID数组或null 如果没有applet被选择 |
| p2 | number | 在该channel上执行的SELECT APDU的P2参数 |
| aid | number[] | 在此channel上选择的applet的AID数组或null 如果没有applet被选择 |
| p2 | number | 在该channel上执行的SELECT APDU的P2参数 |
**返回值:**
| **类型** | **说明** |
| ------------------- | ------------------------------------------------------------ |
| [Channel](#Channel) | 返回可用[Channel](#Channel)对象实例,SE不能提供新逻辑[Channel](#Channel)对象或因缺乏可用逻辑[Channel](#Channel)对象而无法获取访问控制规则,返回null |
| -------- | --------------------- |
| Channel | 可用Channel对象实例。 |
**错误码:**
......@@ -798,50 +702,41 @@ openBasicChannel(aid: number[], p2: number): Promise<[Channel](#Channel)>
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
@State nfcOmaChannel: secureElement.Channel = null;
aidArray: number[] = [720, 1080]
p2: number = 0x00
aidArray: number[] = [720, 1080];
p2: number = 0x00;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
let getPromise = this.nfcOmaSession.openBasicChannel(this.aidArray, this.p2)
// refer to Reader.openSession for this.nfcOmaSession
let getPromise = this.nfcOmaSession.openBasicChannel(this.aidArray, this.p2);
getPromise.then((channel) => {
this.nfcOmaChannel = channel;
this.result = "openBasicChannel3 获取channel成功";
this.result = "openBasicChannel3 get channel successfully";
}).catch((err) => {
this.result = "openBasicChannel3 出现异常";
this.result = "openBasicChannel3 exception";
});
} catch (e) {
this.result = "openBasicChannel3出现异常:" + e.message;
this.result = "openBasicChannel3 exception:" + e.message;
}
```
## Session.openBasicChannel
openBasicChannel(aid: number[], p2:number, callback: AsyncCallback<[Channel](#Channel)>): void
openBasicChannel(aid: number[], p2:number, callback: AsyncCallback<Channel>): void
获取基本channel,参考[ISO 7816-4](https://www.iso.org/standard/77180.html)协议,返回channel实例对象
> **说明:**
> 从 API version 10 开始支持。
获取基本channel,参考[ISO 7816-4]协议,返回channel实例对象,SE不能提供新逻辑Channel对象或因缺乏可用逻辑Channel对象而无法获取访问控制规则,返回null。
**系统能力:** SystemCapability.Communication.SecureElement
**参数:**
| **参数名** | **类型** | **说明** |
| ---------- | ---------------------------------- | ------------------------------------------------------------ |
| aid | number[] | 在此channel上选择的applet的AID数组或null 如果没有applet被选择 |
| ---------- | ---------------------- | ------------------------------------------------------------ |
| aid | number[] | 在此channel上选择的applet的AID数组或null 如果没有applet被选择。 |
| p2 | number | 此channel上执行SELECT APDU命令的P2参数。 |
| callback | AsyncCallback<[Channel](#Channel)> | callback返回可用[Channel](#Channel)对象实例,SE不能提供新逻辑[Channel](#Channel)对象或因缺乏可用逻辑[Channel](#Channel)对象而无法获取访问控制规则,返回null |
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
| callback | AsyncCallback<Channel> | callback返回可用Channel对象实例。 |
**错误码:**
......@@ -859,24 +754,24 @@ openBasicChannel(aid: number[], p2:number, callback: AsyncCallback<[Channel](#Ch
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
@State nfcOmaChannel: secureElement.Channel = null;
aidArray: number[] = [720, 1080]
p2: number = 0x00
aidArray: number[] = [720, 1080];
p2: number = 0x00;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
this.nfcOmaSession.openBasicChannel(this.aidArray, this.p2, (error, data) => {
if (error) {
this.result = "openBasicChannel4失败:" + JSON.stringify(error);
this.result = "openBasicChannel4 failed:" + JSON.stringify(error);
return;
}
this.nfcOmaChannel = data;
this.result = "openBasicChannel4获取channel成功";
this.result = "openBasicChannel4 get channel successfully";
});
} catch (e) {
this.result = "openBasicChannel4异常:" + e.message;
this.result = "openBasicChannel4 exception:" + e.message;
}
```
......@@ -884,24 +779,21 @@ try {
openLogicalChannel(aid: number[]): Promise<[Channel](#Channel)>
打开指定SE的逻辑[Channel](#Channel)对象
> **说明:**
> 从 API version 10 开始支持。
打开指定SE的逻辑Channel对象。
**系统能力:** SystemCapability.Communication.SecureElement
**参数:**
| **参数名** | **类型** | **说明** |
| ---------- | -------- | --------------------------------------------------- |
| aid | number[] | 在该[Channel](#Channel)对象上选择的applet AID数组。 |
| ---------- | -------- | --------------------------------------- |
| aid | number[] | 在该Channel对象上选择的applet AID数组。 |
**返回值:**
| **类型** | **说明** |
| ------------------- | ------------------------------------------------------------ |
| [Channel](#Channel) | 返回可用[Channel](#Channel)对象实例,SE不能提供新的[Channel](#Channel)对象或因缺乏可用逻辑[Channel](#Channel)对象无法获取访问控制规则返回null |
| -------- | ------------------------------------------------------------ |
| Channel | 返回可用Channel对象实例,SE不能提供新的Channel对象或因缺乏可用逻辑Channel对象无法获取访问控制规则返回null。 |
**错误码:**
......@@ -919,22 +811,22 @@ openLogicalChannel(aid: number[]): Promise<[Channel](#Channel)>
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@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
// refer to Reader.openSession for this.nfcOmaSession
let getPromise = this.nfcOmaSession.openLogicalChannel(this.aidArray)
getPromise.then((channel) => {
this.nfcOmaChannel = channel;
this.result = "openLogicChannel1获取channel成功";
this.result = "openLogicChannel1 get channel successfully";
}).catch((err) => {
this.result = "openLogicChannel1出现异常:" + err.code;
this.result = "openLogicChannel1 exception:" + err.message;
});
} catch (e) {
this.result = "openLogicChannel1出现异常:" + e.message;
this.result = "openLogicChannel1 exception:" + e.message;
}
```
......@@ -942,25 +834,16 @@ try {
openLogicalChannel(aid:number[], callback: AsyncCallback<[Channel](#Channel)>): void
打开指定SE的逻辑[Channel](#Channel)对象
> **说明:**
> 从 API version 10 开始支持。
打开指定SE的逻辑Channel对象。
**系统能力:** SystemCapability.Communication.SecureElement
**参数:**
| **参数名** | **类型** | **说明** |
| ---------- | ---------------------------------- | ------------------------------------------------------------ |
| aid | number[] | 在该[Channel](#Channel)对象上被选择的applet AID数组。 |
| callback | AsyncCallback<[Channel](#Channel)> | callback返回可用[Channel](#Channel)对象实例,SE不能提供新的channel或因缺乏可用逻辑[Channel](#Channel)对象无法获取访问控制规则返回null |
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
| ---------- | ---------------------- | ------------------------------------------------------------ |
| aid | number[] | 在该Channel对象上被选择的applet AID数组。 |
| callback | AsyncCallback<Channel> | callback返回可用Channel对象实例,SE不能提供新的channel或因缺乏可用逻辑Channel对象无法获取访问控制规则返回null。 |
**错误码:**
......@@ -978,29 +861,29 @@ try {
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
@State nfcOmaChannel: secureElement.Channel = null;
aidArray: number[] = [720, 1080];
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
this.nfcOmaSession.openLogicalChannel(this.aidArray, (error, data) => {
if (error) {
this.result = "openLogicChannel2失败:" + JSON.stringify(error);
this.result = "openLogicChannel2 failed:" + JSON.stringify(error);
return;
}
this.nfcOmaChannel = data;
this.result = "openLogicChannel2获取channel成功";
this.result = "openLogicChannel2 get channel successfully";
});
} catch (e) {
this.result = "openLogicChannel2 异常:" + e.message;
this.result = "openLogicChannel2 exception:" + e.message;
}
```
## Session.openLogicalChannel
openLogicalChannel(aid: number[], p2: number): Promise<[Channel](#Channel)>
openLogicalChannel(aid: number[], p2: number): Promise<Channel>
使用SE打开逻辑通道,选择由给定AID数组(AID非null且长度不为0)表示的applet.
......@@ -1010,24 +893,15 @@ openLogicalChannel(aid: number[], p2: number): Promise<[Channel](#Channel)>
P2通常为0x00。设备应允许P2的任何值,并且应允许以下值: 0x00, 0x04, 0x08, 0x0C (如 [ISO 7816-4](https://www.iso.org/standard/77180.html)中所定义).
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**参数:**
| **参数名** | **类型** | **说明** |
| ---------- | -------- | ----------------------------------------------------- |
| aid | number[] | 在该[Channel](#Channel)对象上被选择的applet AID数组。 |
| ---------- | -------- | ----------------------------------------- |
| aid | number[] | 在该Channel对象上被选择的applet AID数组。 |
| p2 | number | 此channel上执行SELECT APDU命令的P2参数。 |
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
......@@ -1044,30 +918,30 @@ P2通常为0x00。设备应允许P2的任何值,并且应允许以下值: 0x
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
@State nfcOmaChannel: secureElement.Channel = null;
aidArray: number[] = [720, 1080]
p2: number = 0x00
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)
// refer to Reader.openSession for this.nfcOmaSession
let getPromise = this.nfcOmaSession.openLogicalChannel(this.aidArray, this.p2);
getPromise.then((channel) => {
this.nfcOmaChannel = channel;
this.result = "openLogicChannel3获取channel成功";
this.result = "openLogicChannel3 get channel successfully";
}).catch((err) => {
this.result = "openLogicChannel3 出现异常";
});
this.result = "openLogicChannel3 exception";
})
} catch (e) {
this.result = "openLogicChannel3出现异常:" + e.message;
this.result = "openLogicChannel3 exception:" + e.message;
}
```
## Session.openLogicalChannel
openLogicalChannel(aid: number[], p2: number, callback: AsyncCallback<[Channel](#Channel)>):void
openLogicalChannel(aid: number[], p2: number, callback: AsyncCallback<Channel>):void
使用SE打开逻辑通道,选择由给定AID数组(AID非null且长度不为0)表示的applet.
......@@ -1077,24 +951,15 @@ openLogicalChannel(aid: number[], p2: number, callback: AsyncCallback<[Channel](
P2通常为0x00。设备应允许P2的任何值,并且应允许以下值: 0x00, 0x04, 0x08, 0x0C (如 [ISO 7816-4](https://www.iso.org/standard/77180.html)中所定义).
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**参数:**
| **参数名** | **类型** | **说明** |
| ---------- | ---------------------------------- | ------------------------------------------------------------ |
| aid | number[] | 在该[Channel](#Channel)对象上被选择的applet AID数组。 |
| ---------- | ---------------------- | ------------------------------------------------------------ |
| aid | number[] | 在该Channel对象上被选择的applet AID数组。 |
| p2 | number | 此channel上执行SELECT APDU命令的P2参数。 |
| callback | AsyncCallback<[Channel](#Channel)> | callback返回可用[Channel](#Channel)对象实例,SE不能提供新的[Channel](#Channel)对象或因缺乏可用逻辑[Channel](#Channel)对象无法获取访问控制规则返回null |
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 失败抛出异常 |
| callback | AsyncCallback<Channel> | callback返回可用Channel对象实例,SE不能提供新的Channel对象或因缺乏可用逻辑Channel对象无法获取访问控制规则返回null。 |
**错误码:**
......@@ -1112,67 +977,60 @@ P2通常为0x00。设备应允许P2的任何值,并且应允许以下值: 0x
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
@State nfcOmaChannel: secureElement.Channel = null;
aidArray: number[] = [720, 1080]
p2: number = 0x00
aidArray: number[] = [720, 1080];
p2: number = 0x00;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Reader.openSession for this.nfcOmaSession
this.nfcOmaSession.openLogicalChannel(this.aidArray, this.p2, (error, data) => {
if (error) {
this.result = "openLogicChannel4失败:" + JSON.stringify(error);
this.result = "openLogicChannel4 failed:" + JSON.stringify(error);
return;
}
this.nfcOmaChannel = data;
this.result = "openLogicChannel4获取channel成功";
this.result = "openLogicChannel4 get channel successfully";
})
} catch (e) {
this.result = "openLogicChannel4异常:" + e.message;
this.result = "openLogicChannel4 exception:" + e.message;
}
```
## Channel. getSession
getSession(): [Session](#Session)
获取打开该channel的[Session](#Session)对象。
getSession(): Session
> **说明:**
> 从 API version 10 开始支持。
获取打开该channel的Session对象。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| ------------------- | --------------------------------------- |
| [Session](#Session) | 该channel绑定的[Session](#Session) 对象 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
| ------------------- | ----------------------------- |
| [Session](#Session) | 该channel绑定的Session 对象。 |
**示例:**
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
@State nfcOmaChannel: secureElement.Channel = null;
try {
// this.nfcOmaSession:有效的Session,获取方式参考Reader.openSession
// refer to Session.openBasicChannel for this.nfcOmaChannel
let ret = this.nfcOmaChannel.getSession();
if (ret) {
this.result = "获取到session对象";
this.result = "get session successfully";
} else {
this.result = "无法获取到session对象";
this.result = "get session failed";
}
} catch (e) {
this.result = "getSession异常:" + e.message;
this.result = "getSession exception:" + e.message;
}
```
......@@ -1180,38 +1038,25 @@ try {
close(): void
关闭与SE的此channel
> **说明:**
> 从 API version 10 开始支持。
关闭与SE的此channel。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| ------------ | -------- |
| 失败抛出异常 |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
**示例:**
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaSession: secureElement.Session = null;
@State nfcOmaChannel: secureElement.Channel = null;
try {
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
// refer to Session.openBasicChannel for this.nfcOmaChannel
this.nfcOmaChannel.close();
this.result = "channel close成功";
this.result = "channel close successfully";
} catch (e) {
this.result = "channel close异常:" + e.message;
this.result = "channel close exception:" + e.message;
}
```
......@@ -1219,33 +1064,26 @@ try {
isBasicChannel(): boolean
检查该channel是否为基本channel
> **说明:**
> 从 API version 10 开始支持。
检查该channel是否为基本channel。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ---------------------------------------------- |
| boolean | true:如果该channel是基本channel,否则返回false |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
| -------- | ------------------------------------------------------------ |
| boolean | true: 该channel是基本channel false:该channel不是基本channel 。 |
**示例:**
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaChannel: secureElement.Channel = null;
try {
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
// refer to Session.openBasicChannel for this.nfcOmaChannel
let ret = this.nfcOmaChannel.isBasicChannel();
if (ret) {
this.result = "isBasicChannel TRUE";
......@@ -1263,31 +1101,24 @@ isClosed(): boolean
检查该channel是否为closed。
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
| **类型** | **说明** |
| -------- | ----------------------------------------- |
| boolean | true:如果该channel是closed,否则返回false |
**错误码:**
错误码的详细介绍请参见[SE错误码](../errorcodes/errorcode-se.md)
| -------- | --------------------------------------------- |
| boolean | true:channel是closed false: 不是closed状态。 |
**示例:**
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaChannel: secureElement.Channel = null;
try {
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
// refer to Session.openBasicChannel for this.nfcOmaChannel
let ret = this.nfcOmaChannel.isClosed();
if (ret) {
this.result = "channel isClosed TRUE";
......@@ -1295,7 +1126,7 @@ try {
this.result = "channel isClosed False";
}
} catch (e) {
this.result = "Channel isClosed异常:" + e.message;
this.result = "Channel isClosed exception:" + e.message;
}
```
......@@ -1305,9 +1136,6 @@ getSelectResponse():number[]
返回从应用程序选择命令接收的数据,包括在applet选择时接收的状态字。
> **说明:**
> 从 API version 10 开始支持。
**系统能力:** SystemCapability.Communication.SecureElement
**返回值:**
......@@ -1325,24 +1153,24 @@ getSelectResponse():number[]
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaChannel: secureElement.Channel = null;
try {
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
// refer to Session.openBasicChannel for this.nfcOmaChannel
let ret = this.nfcOmaChannel.getSelectResponse();
if (ret) {
this.result = "getSelectResponse结果:[";
this.result = "getSelectResponse result:[";
for (let i = 0; i < ret.length; ++i) {
this.result += ret[i];
this.result += ' ';
}
this.result += ']'
this.result += ']';
} else {
this.result = "getSelectResponse结果为空"
this.result = "getSelectResponse result is null";
}
} catch (e) {
this.result = "getSelectResponse异常:" + e.message;
this.result = "getSelectResponse exception:" + e.message;
}
```
......@@ -1350,10 +1178,7 @@ try {
transmit(command: number[]): Promise<number[]>
向SE发送APDU命令(根据ISO/IEC 7816)
> **说明:**
> 从 API version 10 开始支持。
向SE发送APDU命令(根据ISO/IEC 7816)。
**系统能力:** SystemCapability.Communication.SecureElement
......@@ -1366,8 +1191,8 @@ transmit(command: number[]): Promise<number[]>
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| number[] | 响应结果数组 |
| -------- | -------------- |
| number[] | 响应结果数组 |
**错误码:**
......@@ -1384,25 +1209,25 @@ transmit(command: number[]): Promise<number[]>
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaChannel: secureElement.Channel = null;
try {
let command: number[] = [100, 200]
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
let command: number[] = [100, 200];
// refer to Session.openBasicChannel for this.nfcOmaChannel
let getPromise = this.nfcOmaChannel.transmit(command);
getPromise.then((data) => {
this.result = "transmit1 结果:[";
this.result = "transmit1 result:[";
for (let i = 0; i < data.length; ++i) {
this.result += data[i];
this.result += " ";
}
this.result += "]";
}).catch((err) => {
this.result = "transmit1出现异常:" + err.code;
this.result = "transmit1 exception:" + err.code;
})
} catch (e) {
this.result = "transit1 调用异常:" + e.message;
this.result = "transit1 exception:" + e.message;
}
```
......@@ -1410,10 +1235,7 @@ try {
transmit(command: number[], callback: AsyncCallback<number[]>): void
向SE发送APDU命令(根据ISO/IEC 7816)
> **说明:**
> 从 API version 10 开始支持。
向SE发送APDU命令(根据ISO/IEC 7816)。
**系统能力:** SystemCapability.Communication.SecureElement
......@@ -1422,13 +1244,7 @@ transmit(command: number[], callback: AsyncCallback<number[]>): void
| **参数名** | **类型** | **说明** |
| ---------- | ----------------------- | ------------------------------------- |
| command | number[] | 在该Channel上被选择的applet AID数组。 |
| callback | AsyncCallback<number[]> | 返回接收到的响应的回调,number数组 |
**返回值:**
| **类型** | **说明** |
| -------- | ------------ |
| void | 出错抛出异常 |
| callback | AsyncCallback<number[]> | 返回接收到的响应的回调,number数组。 |
**错误码:**
......@@ -1445,18 +1261,18 @@ transmit(command: number[], callback: AsyncCallback<number[]>): void
```js
import secureElement from '@ohos.secureElement';
@State result: string = ''
@State result: string = '';
@State nfcOmaChannel: secureElement.Channel = null;
try {
let command: number[] = [100, 200];
// this.nfcOmaChannel:获取方式参考Session.openBasicChannel
// refer to Session.openBasicChannel for this.nfcOmaChannel
this.nfcOmaChannel.transmit(command, (error, data) => {
if (error) {
this.result = "transmit2异常:" + JSON.stringify(error);
this.result = "transmit2 exception:" + JSON.stringify(error);
return;
}
this.result = "transmit2 结果:[";
this.result = "transmit2 result:[";
for (let i = 0; i < data.length; ++i) {
this.result += data[i];
this.result += " ";
......@@ -1464,24 +1280,6 @@ try {
this.result += "]";
});
} catch(e) {
this.result = "transit2 调用异常:" + e.message;
this.result = "transit2 exception:" + e.message;
}
```
# SE Tech [ISO/IEC 7816-4]
## SEService
​ SEService实现与设备上可用的SE的通信。
## Reader
​ 此类的实例表示该设备支持的SE Reader。
## Session
​ 此类的实例表示与设备上可用的某个SE的连接会话。
## Channel
​ 此类的实例表示向SE打开的ISO/IEC 7816-4通道。
......@@ -4,7 +4,7 @@
>
> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。
## 3100101
## 3300101
**错误信息**
......@@ -12,17 +12,17 @@ Illegal service state exception.
**错误描述**
SEService服务状态异常
SE服务状态异常。
**可能原因**
1. SEService状态已断开
1. SE服务状态已断开。
**处理步骤**
1. 重新执行打开或关闭SE服务。
1. 关闭SE服务。
2. 重新和SE服务建立连接。
## 3300102
......@@ -32,7 +32,7 @@ No such element exception.
**错误描述**
没有这样的SE异常
没有这样的SE异常
**可能原因**
......@@ -41,7 +41,7 @@ No such element exception.
**处理步骤**
1. 重新执行打开或关闭SE
1. 关闭SE服务后重新建立连接
2. 重启设备尝试。
## 3300103
......@@ -56,12 +56,12 @@ Illegal access rule exception.
**可能原因**
1. 无可用的channel
1. 安全单元上没有应用所依赖的访问规则
**处理步骤**
1. 释放已经连接的Channel
2. 重启设备尝试
1. 写入正确的访问规则到安全单元上
2. 关闭SE服务后重新建立连接
## 3300104
......@@ -71,7 +71,7 @@ Secure element IO exception.
**错误描述**
SE芯片IO异常
SE芯片IO异常
**可能原因**
......@@ -80,8 +80,6 @@ SE芯片IO异常
**处理步骤**
1. 重启设备尝试。
2. 重新执行打开或关闭SE。
1. 关闭SE服务后重新建立连接。
2. 重启设备尝试。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册