T-Box Basic dev
Loading...
Searching...
No Matches
TBOX_SIM

T-Box SIM 卡 More...

Data Structures

struct  tbox_sim_pin_request_t
 PIN 操作请求。 More...

Macros

#define TBOX_RIL_PIN_MAX   16U
 包含结尾 NUL 的 PIN 或 PUK 容量
#define TBOX_RIL_IMSI_MAX   16U
 包含结尾 NUL 的 IMSI 容量
#define TBOX_RIL_ICCID_MAX   21U
 包含结尾 NUL 的 ICCID 容量
#define TBOX_RIL_SIM_NUMBER_MAX   32U
 包含结尾 NUL 的 SIM 卡号容量

Enumerations

enum  tbox_sim_state_t {
  TBOX_SIM_STATE_UNKNOWN = 0 , TBOX_SIM_STATE_ABSENT = 1 , TBOX_SIM_STATE_PIN_REQUIRED = 2 , TBOX_SIM_STATE_PUK_REQUIRED = 3 ,
  TBOX_SIM_STATE_READY = 4 , TBOX_SIM_STATE_BLOCKED = 5
}
 SIM 卡状态。 More...
enum  tbox_sim_pin_type_t { TBOX_SIM_PIN = 0 , TBOX_SIM_PUK = 1 , TBOX_SIM_PIN2 = 2 , TBOX_SIM_PUK2 = 3 }
 PIN 操作类别。 More...

Functions

int tbox_sim_get_status (tbox_sim_state_t *status)
 查询 SIM 卡状态。
int tbox_sim_get_imsi (char *value, size_t *length)
 查询 IMSI。
int tbox_sim_get_iccid (char *value, size_t *length)
 查询 ICCID。
int tbox_sim_get_number (char *value, size_t *length)
 查询 SIM 卡号(MSISDN)。
int tbox_sim_verify_pin (tbox_sim_pin_type_t type, const char *pin)
 校验 PIN。
int tbox_sim_change_pin (tbox_sim_pin_type_t type, const char *old_pin, const char *new_pin)
 修改 PIN。
int tbox_sim_unblock_pin (tbox_sim_pin_type_t type, const char *puk, const char *new_pin)
 使用 PUK 解锁。
int tbox_sim_enable_pin (tbox_sim_pin_type_t type, const char *pin)
 启用 PIN 保护。
int tbox_sim_disable_pin (tbox_sim_pin_type_t type, const char *pin)
 禁用 PIN 保护。

Detailed Description

T-Box SIM 卡

接口均为线程安全的同步调用,调用前需通过

See also
tbox_ril_init() 初始化;远端调用最多等待 2 秒。

Enumeration Type Documentation

◆ tbox_sim_pin_type_t

PIN 操作类别。

Enumerator
TBOX_SIM_PIN 

PIN1.

TBOX_SIM_PUK 

PUK1.

TBOX_SIM_PIN2 

PIN2.

TBOX_SIM_PUK2 

PUK2.

◆ tbox_sim_state_t

SIM 卡状态。

Enumerator
TBOX_SIM_STATE_UNKNOWN 

未知

TBOX_SIM_STATE_ABSENT 

未插卡

TBOX_SIM_STATE_PIN_REQUIRED 

需要 PIN

TBOX_SIM_STATE_PUK_REQUIRED 

需要 PUK

TBOX_SIM_STATE_READY 

可用

TBOX_SIM_STATE_BLOCKED 

已锁死

Function Documentation

◆ tbox_sim_change_pin()

int tbox_sim_change_pin ( tbox_sim_pin_type_t type,
const char * old_pin,
const char * new_pin )

修改 PIN。

Parameters
typePIN 或 PIN2。
old_pinNUL 结尾的当前 PIN,仅在调用期间借用。
new_pinNUL 结尾的新 PIN,仅在调用期间借用。
Returns
TBOX_OK 成功,其他值失败。

◆ tbox_sim_disable_pin()

int tbox_sim_disable_pin ( tbox_sim_pin_type_t type,
const char * pin )

禁用 PIN 保护。

Parameters
typePIN 或 PIN2。
pinNUL 结尾的 PIN,仅在调用期间借用。
Returns
TBOX_OK 成功,其他值失败。

◆ tbox_sim_enable_pin()

int tbox_sim_enable_pin ( tbox_sim_pin_type_t type,
const char * pin )

启用 PIN 保护。

Parameters
typePIN 或 PIN2。
pinNUL 结尾的 PIN,仅在调用期间借用。
Returns
TBOX_OK 成功,其他值失败。

◆ tbox_sim_get_iccid()

int tbox_sim_get_iccid ( char * value,
size_t * length )

查询 ICCID。

当 value 为 NULL 时,仅返回所需长度。

Parameters
value输出 NUL 结尾的 ICCID,可为 NULL。
length输入缓冲区长度,输出包含 NUL 的实际或所需长度。
Returns
TBOX_OK 成功,其他值失败。

◆ tbox_sim_get_imsi()

int tbox_sim_get_imsi ( char * value,
size_t * length )

查询 IMSI。

当 value 为 NULL 时,仅返回所需长度。

Parameters
value输出 NUL 结尾的 IMSI,可为 NULL。
length输入缓冲区长度,输出包含 NUL 的实际或所需长度。
Returns
TBOX_OK 成功,其他值失败。

◆ tbox_sim_get_number()

int tbox_sim_get_number ( char * value,
size_t * length )

查询 SIM 卡号(MSISDN)。

当 value 为 NULL 时,仅返回所需长度。

Parameters
value输出 NUL 结尾的 SIM 卡号,可为 NULL。
length输入缓冲区长度,输出包含 NUL 的实际或所需长度。
Returns
TBOX_OK 成功,其他值失败。

◆ tbox_sim_get_status()

int tbox_sim_get_status ( tbox_sim_state_t * status)

查询 SIM 卡状态。

本接口为同步查询,调用前需先通过

See also
tbox_ril_init() 初始化 RIL 客户端。
Parameters
status输出 SIM 卡状态。
Returns
TBOX_OK 成功,其他值失败。

◆ tbox_sim_unblock_pin()

int tbox_sim_unblock_pin ( tbox_sim_pin_type_t type,
const char * puk,
const char * new_pin )

使用 PUK 解锁。

Parameters
typePUK 或 PUK2。
pukNUL 结尾的 PUK,仅在调用期间借用。
new_pinNUL 结尾的新 PIN,仅在调用期间借用。
Returns
TBOX_OK 成功,其他值失败。

◆ tbox_sim_verify_pin()

int tbox_sim_verify_pin ( tbox_sim_pin_type_t type,
const char * pin )

校验 PIN。

Parameters
typePIN 或 PIN2。
pinNUL 结尾的 PIN,仅在调用期间借用。
Returns
TBOX_OK 成功,其他值失败。