支持读取和写入打印机设置。 更多...
#include <SettingsReadWrite.h>
实例方法 | |
| (instancetype) | - initWithTcpComm:usingDataPort: |
| 使用已打开的 TcpComm 连接初始化 SettingsReadWrite 实例。 | |
| (instancetype) | - initWithBtComm:usingDataPort: |
| 使用 BtComm 连接初始化 SettingsReadWrite 实例。 | |
| (instancetype) | - initWithBleComm:usingDataPort: |
| 使用 BleComm 连接初始化 SettingsReadWrite 实例。 | |
| (instancetype) | - initWithJsonComm: |
| 使用给定的 JSON 通信对象初始化一个新实例。 | |
| (instancetype) | - initWithCommDescriptor: |
| 创建由 SDK 管理的连接时调用的构造函数。 | |
| (NSDictionary< NSString *, NSString * > *) | - getAllValuesWithTimeout: |
| 读取所有设置的键/值对。 | |
| (NSString *) | - getValueForKey:timeout: |
| 读取与给定键关联的设置。 | |
| (NSDictionary< NSString *, NSString * > *) | - getValuesForKeys:timeout: |
| 读取与给定键列表关联的多个设置。 | |
| (BOOL) | - setValue:forKey:timeout: |
| 写入与给定键关联的设置值。 | |
| (BOOL) | - setValues:timeout: |
| 写入与给定键关联的多个设置。 | |
| (Setting *) | - getPropertiesForKey:timeout: |
| 读取与给定键关联的属性。 | |
| (NSDictionary< NSString *, Setting * > *) | - getPropertiesForKeys:timeout: |
| 读取与多个键关联的属性。 | |
| (NSDictionary< NSString *, Setting * > *) | - getAllPropertiesWithTimeout: |
| 读取所有设置为 Setting 对象。 | |
支持读取和写入打印机设置。
有关有效键和值的列表,请参阅:Settings Key/Value Items。
| - (NSDictionary< NSString *, Setting * > *) getAllPropertiesWithTimeout: | (int) | timeout |
| - (NSDictionary< NSString *, NSString * > *) getAllValuesWithTimeout: | (int) | timeout |
| - (Setting *) getPropertiesForKey: | (NSString *) | key | |
| timeout: | (int) | timeout |
| - (NSDictionary< NSString *, Setting * > *) getPropertiesForKeys: | (NSArray< NSString * > *) | keys | |
| timeout: | (int) | timeout |
| - (NSString *) getValueForKey: | (NSString *) | key | |
| timeout: | (int) | timeout |
| - (NSDictionary< NSString *, NSString * > *) getValuesForKeys: | (NSArray< NSString * > *) | keys | |
| timeout: | (int) | timeout |
| - (instancetype) initWithBleComm: | (BleComm *) | connection | |
| usingDataPort: | (BOOL) | usingDataPort |
使用 BleComm 连接初始化 SettingsReadWrite 实例。
| connection | BLE(低功耗蓝牙)通信对象。 |
| usingDataPort | 是否使用数据端口进行通信。 |
| - (instancetype) initWithBtComm: | (BtComm *) | connection | |
| usingDataPort: | (BOOL) | usingDataPort |
使用 BtComm 连接初始化 SettingsReadWrite 实例。
| connection | 蓝牙通信对象。 |
| usingDataPort | 是否使用数据端口进行通信。 |
| - (instancetype) initWithCommDescriptor: | (NSString *) | commDescriptor |
创建由 SDK 管理的连接时调用的构造函数。
commDescriptor 是用于连接打印机的通信描述符。
TCP 描述符格式:"ip" 或 "ip:port"
例如 "127.0.0.1" 或 "127.0.0.1:3007"
如果未提供端口,则使用默认值。
| commDescriptor | 通信描述符。 |
| - (instancetype) initWithJsonComm: | (JsonComm *) | mgmtComm |
| - (instancetype) initWithTcpComm: | (TcpComm *) | connection | |
| usingDataPort: | (BOOL) | usingDataPort |
使用已打开的 TcpComm 连接初始化 SettingsReadWrite 实例。
如果监听来自打印机的非请求消息,该连接必须保持打开状态。 发送/接收打印机状态消息需要连接。
| connection | TCP 通信对象。 |
| usingDataPort | 是否使用数据端口进行通信。 |
| - (BOOL) setValue: | (NSString *) | value | |
| forKey: | (NSString *) | key | |
| timeout: | (int) | timeout |
写入与给定键关联的设置值。
如果写入成功,则返回 YES。
注意:要作为字符串处理的值应加引号。 例如,value = SomeString 和 value = "SomeString" 将按接收到的内容发送,但打印机可能会以不同方式处理。
在 SettingsReadWrite 中实现。
| value | 要设置的值。 |
| key | 要设置值的键。 |
| timeout | 等待的最大时间(毫秒)。 |
| - (BOOL) setValues: | (NSDictionary< NSString *, NSString * > *) | keysToSet | |
| timeout: | (int) | timeout |
写入与给定键关联的多个设置。
如果写入成功,则返回 YES。
注意:要作为字符串处理的值应加引号。 例如,value = SomeString 和 value = "SomeString" 将按接收到的内容发送,但打印机可能会以不同方式处理。
在 SettingsReadWrite 中实现。
| keysToSet | 包含要设置的键和值的字典。 |
| timeout | 等待的最大时间(毫秒)。 |