用于通过 JSON 通信管理配置的类。
更多...
#include <JsonConfig.h>
◆ getAllConfigWithTimeout:
| - (NSArray< Config * > *) getAllConfigWithTimeout: |
|
(int) | timeout |
|
◆ getConfigWithNumber:timeout:
| - (Config *) getConfigWithNumber: |
|
(int) | cfgNumber |
| timeout: |
|
(int) | timeout |
获取具有指定编号的配置。
此方法会在指定的超时时间内,检索与给定编号对应的配置对象。
- 参数
-
| cfgNumber | 要检索的配置编号。 |
| timeout | 等待的最大时间(毫秒)。 |
- 返回
- 具有指定编号的配置对象,如果未找到则返回 nil。
◆ initWithBleComm:usingDataPort:
| - (instancetype) initWithBleComm: |
|
(BleComm *) | connection |
| usingDataPort: |
|
(BOOL) | usingDataPort |
使用已打开的 BleComm 藍牙低功耗連接初始化。
- 参数
-
| connection | BLE 通信对象。 |
| usingDataPort | 是否使用数据端口通信。 |
- 返回
- 一个初始化的 JsonConfig 实例。
◆ initWithBtComm:usingDataPort:
| - (instancetype) initWithBtComm: |
|
(BtComm *) | connection |
| usingDataPort: |
|
(BOOL) | usingDataPort |
使用已打开的 BtComm 蓝牙连接初始化。
- 参数
-
| connection | 蓝牙通信对象。 |
| usingDataPort | 是否使用数据端口通信。 |
- 返回
- 一个初始化的 JsonConfig 实例。
◆ initWithCommDescriptor:
| - (instancetype) initWithCommDescriptor: |
|
(NSString *) | commDescriptor |
|
在创建由 SDK 管理的连接时调用的构造函数。
- 参数
-
| commDescriptor | 用于连接打印机的通信描述符,TCP 描述符格式:"ip" 或 "ip:port",例如 "127.0.0.1" 或 "127.0.0.1:3007"。如果未提供端口,则使用默认值。 |
- 返回
- 一个初始化的 JsonConfig 实例,如果无法创建对象,则返回 nil。
◆ initWithJsonComm:
| - (instancetype) initWithJsonComm: |
|
(JsonComm *) | mgmtComm |
|
使用给定的 JSON 通信对象初始化一个新实例。
- 参数
-
- 返回
- 一个初始化的 JsonConfig 实例,如果无法创建对象,则返回 nil。
◆ initWithTcpComm:usingDataPort:
| - (instancetype) initWithTcpComm: |
|
(TcpComm *) | connection |
| usingDataPort: |
|
(BOOL) | usingDataPort |
必须传递一个已打开的 TcpComm 连接,如果需要监听来自打印机的非请求消息,该连接必须保持打开。
- 参数
-
| connection | TCP 通信对象。 |
| usingDataPort | 是否使用数据端口通信。 |
- 返回
- 一个初始化的 JsonConfig 实例,如果无法创建对象,则返回 nil。
◆ setConfig:pCfg:
| - (BOOL) setConfig: |
|
(Config *) | |
| pCfg: |
|
(int) | timeout |
设置指定的配置。
此方法会在指定的超时时间内,将给定的配置对象写入设备。
- 参数
-
| pCfg | 表示要设置的配置的 Config 对象。 |
| timeout | 等待的最大时间(毫秒)。 |
- 返回
- 如果配置成功设置,则返回 YES;否则返回 NO。
该类的文档由以下文件生成:
- /Users/bob_huang/Documents/Project/sdk_json_Objective-C_IOS/sdk_json_Objective-C_IOS/Json/JsonConfig.h