seven365-zyprinter 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Package.swift +43 -0
- package/README.md +186 -0
- package/Seven365Zyprinter.podspec +27 -0
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/mycompany/plugins/example/Example.java +342 -0
- package/android/src/main/java/com/mycompany/plugins/example/ExamplePlugin.java +161 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +229 -0
- package/dist/esm/definitions.d.ts +56 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +49 -0
- package/dist/esm/web.js +40 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +54 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +57 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Seven365Zyprinter.podspec +28 -0
- package/ios/Sources/Plugin/ZyprintPlugin.swift +161 -0
- package/ios/Sources/Plugin/ZywellSDK.swift +358 -0
- package/ios/Sources/Seven365Zyprinter-Umbrella.h +16 -0
- package/ios/Sources/module.modulemap +12 -0
- package/ios/Sources/sources/BLEManager.h +658 -0
- package/ios/Sources/sources/BLEManager.m +2842 -0
- package/ios/Sources/sources/GCD/Documentation.html +47 -0
- package/ios/Sources/sources/GCD/GCDAsyncSocket.h +1226 -0
- package/ios/Sources/sources/GCD/GCDAsyncSocket.m +8560 -0
- package/ios/Sources/sources/GCD/GCDAsyncUdpSocket.h +1036 -0
- package/ios/Sources/sources/GCD/GCDAsyncUdpSocket.m +5632 -0
- package/ios/Sources/sources/GCD/PrinterManager.h +91 -0
- package/ios/Sources/sources/GCD/PrinterManager.m +513 -0
- package/ios/Sources/sources/GCD/WifiManager.h +91 -0
- package/ios/Sources/sources/GCD/WifiManager.m +510 -0
- package/ios/Sources/sources/ImageTranster.h +38 -0
- package/ios/Sources/sources/ImageTranster.m +389 -0
- package/ios/Sources/sources/POSBLEManager.h +759 -0
- package/ios/Sources/sources/POSBLEManager.m +834 -0
- package/ios/Sources/sources/POSSDK.h +93 -0
- package/ios/Sources/sources/POSWIFIManager.h +116 -0
- package/ios/Sources/sources/POSWIFIManager.m +260 -0
- package/ios/Sources/sources/POSWIFIManagerAsync.h +745 -0
- package/ios/Sources/sources/POSWIFIManagerAsync.m +1847 -0
- package/ios/Sources/sources/PosCommand.h +633 -0
- package/ios/Sources/sources/PosCommand.m +1019 -0
- package/ios/Sources/sources/TscCommand.h +723 -0
- package/ios/Sources/sources/TscCommand.m +566 -0
- package/ios/Tests/ExamplePluginTests/ExamplePluginTests.swift +15 -0
- package/package.json +339 -0
|
@@ -0,0 +1,1847 @@
|
|
|
1
|
+
////
|
|
2
|
+
//// PosWIFIManager.m
|
|
3
|
+
//// Printer
|
|
4
|
+
////
|
|
5
|
+
//// Created by apple on 16/4/5.
|
|
6
|
+
//// Copyright © 2016年 Admin. All rights reserved.
|
|
7
|
+
////
|
|
8
|
+
//
|
|
9
|
+
//#import "POSWIFIManager.h"
|
|
10
|
+
//#import "AsyncSocket.h"
|
|
11
|
+
//#import <SystemConfiguration/CaptiveNetwork.h>
|
|
12
|
+
//
|
|
13
|
+
//static POSWIFIManager *shareManager = nil;
|
|
14
|
+
//
|
|
15
|
+
//@interface POSWIFIManager ()<AsyncSocketDelegate>
|
|
16
|
+
//// 连接的socket对象
|
|
17
|
+
//@property (nonatomic,strong) AsyncSocket *sendSocket;
|
|
18
|
+
//@property (nonatomic,strong) NSTimer *connectTimer;
|
|
19
|
+
//@end
|
|
20
|
+
//
|
|
21
|
+
//@implementation POSWIFIManager
|
|
22
|
+
//
|
|
23
|
+
///// Create WiFi management object
|
|
24
|
+
//+ (instancetype)shareWifiManager {
|
|
25
|
+
// static dispatch_once_t onceToken;
|
|
26
|
+
// dispatch_once(&onceToken, ^{
|
|
27
|
+
// shareManager = [[POSWIFIManager alloc] init];
|
|
28
|
+
// });
|
|
29
|
+
// return shareManager;
|
|
30
|
+
//}
|
|
31
|
+
//
|
|
32
|
+
//- (instancetype)init {
|
|
33
|
+
// if (self = [super init]) {
|
|
34
|
+
// _sendSocket = [[AsyncSocket alloc] initWithDelegate:self];
|
|
35
|
+
// _sendSocket.userData = SocketOfflineByServer;
|
|
36
|
+
// _commandBuffer=[[NSMutableArray alloc]init];
|
|
37
|
+
// }
|
|
38
|
+
// return self;
|
|
39
|
+
//}
|
|
40
|
+
//
|
|
41
|
+
///**
|
|
42
|
+
// Disconnect manually
|
|
43
|
+
// */
|
|
44
|
+
//- (void)POSDisConnect {
|
|
45
|
+
//
|
|
46
|
+
// if (_sendSocket) {
|
|
47
|
+
// _sendSocket.userData = SocketOfflineByUser;
|
|
48
|
+
// _isAutoDisconnect = NO;
|
|
49
|
+
// [self.connectTimer invalidate];
|
|
50
|
+
// [_sendSocket disconnect];
|
|
51
|
+
// }
|
|
52
|
+
//}
|
|
53
|
+
//
|
|
54
|
+
//
|
|
55
|
+
///// send data
|
|
56
|
+
///// @param data data
|
|
57
|
+
//-(void)POSWriteCommandWithData:(NSData *)data{
|
|
58
|
+
// if (_connectOK) {
|
|
59
|
+
// //NSLog(@"----%@",data);
|
|
60
|
+
// if (commandSendMode==0){
|
|
61
|
+
// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
62
|
+
//
|
|
63
|
+
// }
|
|
64
|
+
// else{
|
|
65
|
+
// [_commandBuffer addObject: data];
|
|
66
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
67
|
+
// }
|
|
68
|
+
// }
|
|
69
|
+
//
|
|
70
|
+
//
|
|
71
|
+
//}
|
|
72
|
+
//
|
|
73
|
+
///// Send data and call back
|
|
74
|
+
///// @param data data
|
|
75
|
+
///// @param block callback
|
|
76
|
+
//-(void)POSWriteCommandWithData:(NSData *)data withResponse:(POSWIFICallBackBlock)block{
|
|
77
|
+
//
|
|
78
|
+
// if (_connectOK) {
|
|
79
|
+
// self.callBackBlock = block;
|
|
80
|
+
// if (commandSendMode==0)
|
|
81
|
+
// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
82
|
+
// else
|
|
83
|
+
// [_commandBuffer addObject: data];
|
|
84
|
+
// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
85
|
+
// }
|
|
86
|
+
//
|
|
87
|
+
//}
|
|
88
|
+
//
|
|
89
|
+
///**
|
|
90
|
+
//send messages
|
|
91
|
+
// @param str data
|
|
92
|
+
// */
|
|
93
|
+
//- (void)POSSendMSGWith:(NSString *)str {
|
|
94
|
+
// if (_connectOK) {
|
|
95
|
+
// str = [str stringByAppendingString:@"\r\n"];
|
|
96
|
+
// NSData *data = [str dataUsingEncoding:NSASCIIStringEncoding];
|
|
97
|
+
// NSLog(@"%@==%@",str,data);
|
|
98
|
+
// if (commandSendMode==0)
|
|
99
|
+
// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
100
|
+
// else
|
|
101
|
+
// [_commandBuffer addObject: data];
|
|
102
|
+
//
|
|
103
|
+
// }
|
|
104
|
+
//}
|
|
105
|
+
////
|
|
106
|
+
/////**
|
|
107
|
+
//// 发送POS指令
|
|
108
|
+
//// */
|
|
109
|
+
////- (void)PosWritePOSCommandWithData:(NSData *)data withResponse:(PosWIFICallBackBlock)block {
|
|
110
|
+
//// if (_connectOK) {
|
|
111
|
+
//// self.callBackBlock = block;
|
|
112
|
+
//// if (commandSendMode==0)
|
|
113
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
114
|
+
//// else
|
|
115
|
+
//// [_commandBuffer addObject: data];
|
|
116
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
117
|
+
//// }
|
|
118
|
+
////}
|
|
119
|
+
//
|
|
120
|
+
///// Connect the printer
|
|
121
|
+
///// @param hostStr Printer ip address
|
|
122
|
+
///// @param port port of printer
|
|
123
|
+
///// @param block callback
|
|
124
|
+
//-(void)POSConnectWithHost:(NSString *)hostStr port:(UInt16)port completion:(POSWIFIBlock)block
|
|
125
|
+
//{
|
|
126
|
+
// _connectOK = NO;
|
|
127
|
+
// _hostStr = hostStr;
|
|
128
|
+
// _port = port;
|
|
129
|
+
//
|
|
130
|
+
// NSError *error=nil;
|
|
131
|
+
// // 填写主机地址 和 端口号
|
|
132
|
+
// //_connectOK = [_sendSocket connectToHost: hostStr onPort: port error: &error];
|
|
133
|
+
// _connectOK=[self.sendSocket connectToHost:hostStr onPort:port withTimeout:3 error:&error];
|
|
134
|
+
// block(_connectOK);
|
|
135
|
+
////// self.callBack = block;
|
|
136
|
+
//// if (!_connectOK)
|
|
137
|
+
//// {
|
|
138
|
+
//// NSLog(@"%@",error);
|
|
139
|
+
//// [self showAlert:@"连接失败"];
|
|
140
|
+
//// }else{
|
|
141
|
+
//// NSLog(@"connect success!");
|
|
142
|
+
//// [self onSocket:_sendSocket didConnectToHost:hostStr port:port];
|
|
143
|
+
//// }
|
|
144
|
+
////
|
|
145
|
+
//// [_sendSocket setRunLoopModes:[NSArray arrayWithObject:NSRunLoopCommonModes]];
|
|
146
|
+
//}
|
|
147
|
+
//
|
|
148
|
+
///// Connection established
|
|
149
|
+
///// @param sock sock object
|
|
150
|
+
///// @param host Host address
|
|
151
|
+
///// @param port The port number
|
|
152
|
+
//- (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port
|
|
153
|
+
//{
|
|
154
|
+
// NSLog(@"%s host=%@ port = %d", __FUNCTION__, host,port);
|
|
155
|
+
// if ([self.delegate respondsToSelector:@selector(POSWIFIManager:didConnectedToHost:port:)]) {
|
|
156
|
+
// [self.delegate POSWIFIManager:self didConnectedToHost:host port:port];
|
|
157
|
+
// }
|
|
158
|
+
//// self.callBack(YES);
|
|
159
|
+
// // 每隔30s像服务器发送心跳包
|
|
160
|
+
// //self.connectTimer = [NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(longConnectToSocket) userInfo:nil repeats:YES];// 在longConnectToSocket方法中进行长连接需要向服务器发送的讯息
|
|
161
|
+
//
|
|
162
|
+
// //[self.connectTimer fire];
|
|
163
|
+
//
|
|
164
|
+
// [_sendSocket readDataWithTimeout: -1 tag: 0];
|
|
165
|
+
//}
|
|
166
|
+
//
|
|
167
|
+
//- (void)longConnectToSocket {
|
|
168
|
+
// // 根据服务器要求发送固定格式的数据,假设为指令@"longConnect",但是一般不会是这么简单的指令
|
|
169
|
+
//
|
|
170
|
+
// NSString *longConnect = @"longConnect";
|
|
171
|
+
//
|
|
172
|
+
// NSData *dataStream = [longConnect dataUsingEncoding:NSUTF8StringEncoding];
|
|
173
|
+
//
|
|
174
|
+
// //[_sendSocket writeData:dataStream withTimeout:1 tag:1];
|
|
175
|
+
//
|
|
176
|
+
// //[_sendSocket writeData:dataStream withTimeout:-1 tag:0];
|
|
177
|
+
//
|
|
178
|
+
//
|
|
179
|
+
//}
|
|
180
|
+
//
|
|
181
|
+
///**
|
|
182
|
+
// 写数据
|
|
183
|
+
// */
|
|
184
|
+
//- (void)onSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag
|
|
185
|
+
//{
|
|
186
|
+
// NSLog(@"%s %d, tag = %ld", __FUNCTION__, __LINE__, tag);
|
|
187
|
+
// if ([self.delegate respondsToSelector:@selector(POSWIFIManager:didWriteDataWithTag:)]) {
|
|
188
|
+
// [self.delegate POSWIFIManager:self didWriteDataWithTag:tag];
|
|
189
|
+
// }
|
|
190
|
+
// [_sendSocket readDataWithTimeout: -1 tag: 0];
|
|
191
|
+
//}
|
|
192
|
+
//
|
|
193
|
+
//// 遇到错误关闭连接
|
|
194
|
+
//- (void)onSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err
|
|
195
|
+
//{
|
|
196
|
+
// _isAutoDisconnect = YES;
|
|
197
|
+
// if ([self.delegate respondsToSelector:@selector(POSWIFIManager:willDisconnectWithError:)]) {
|
|
198
|
+
// [self.delegate POSWIFIManager:self willDisconnectWithError:err];
|
|
199
|
+
// }
|
|
200
|
+
// NSLog(@"%s %d, tag = %@", __FUNCTION__, __LINE__, err);
|
|
201
|
+
//}
|
|
202
|
+
//
|
|
203
|
+
//// 读取数据 这里必须要使用流式数据
|
|
204
|
+
//- (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
|
|
205
|
+
//{
|
|
206
|
+
//
|
|
207
|
+
// NSString *msg = [[NSString alloc] initWithData: data encoding:NSUTF8StringEncoding];
|
|
208
|
+
//
|
|
209
|
+
// if ([self.delegate respondsToSelector:@selector(POSWIFIManager:didReadData:tag:)]) {
|
|
210
|
+
// [self.delegate POSWIFIManager:self didReadData:data tag:tag];
|
|
211
|
+
// }
|
|
212
|
+
//// self.callBackBlock(data);
|
|
213
|
+
//// NSLog(@"%s %d, ==读取到从服务端返回的内容=== %@", __FUNCTION__, __LINE__, msg);
|
|
214
|
+
//
|
|
215
|
+
// NSLog(@"%@", data);
|
|
216
|
+
// [_sendSocket readDataWithTimeout: -1 tag: 0];
|
|
217
|
+
//}
|
|
218
|
+
//
|
|
219
|
+
//// 断开连接后执行
|
|
220
|
+
//- (void)onSocketDidDisconnect:(AsyncSocket *)sock
|
|
221
|
+
//{
|
|
222
|
+
// NSLog(@"%s %d", __FUNCTION__, __LINE__);
|
|
223
|
+
// _connectOK = NO;
|
|
224
|
+
// if ([self.delegate respondsToSelector:@selector(POSWIFIManagerDidDisconnected:)]) {
|
|
225
|
+
// [self.delegate POSWIFIManagerDidDisconnected:self];
|
|
226
|
+
// }
|
|
227
|
+
// if (sock.userData == SocketOfflineByServer) {
|
|
228
|
+
// _isAutoDisconnect = YES;
|
|
229
|
+
// // 重连
|
|
230
|
+
//
|
|
231
|
+
// [self POSConnectWithHost:_hostStr port:_port completion:^(BOOL isConnect) {
|
|
232
|
+
//
|
|
233
|
+
// }];
|
|
234
|
+
// }else if (sock.userData == SocketOfflineByUser) {
|
|
235
|
+
// _isAutoDisconnect = NO;
|
|
236
|
+
// return;
|
|
237
|
+
// }
|
|
238
|
+
//
|
|
239
|
+
//}
|
|
240
|
+
//
|
|
241
|
+
//- (void)showAlert:(NSString *)str {
|
|
242
|
+
// UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"提示" message:str delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
|
|
243
|
+
// [alter show];
|
|
244
|
+
//}
|
|
245
|
+
//
|
|
246
|
+
////#pragma mark - =============打印机TSC指令============
|
|
247
|
+
/////**
|
|
248
|
+
//// * 1.设置标签尺寸
|
|
249
|
+
//// */
|
|
250
|
+
////- (void)PosaddSizeWidth:(int)width height:(int)height; {
|
|
251
|
+
////
|
|
252
|
+
//// NSString *sizeStr = [NSString stringWithFormat:@"SIZE %d mm,%d mm",width,height];
|
|
253
|
+
//// [self PosSendMSGWith:sizeStr];
|
|
254
|
+
////}
|
|
255
|
+
/////**
|
|
256
|
+
//// * 2.设置间隙长度
|
|
257
|
+
//// */
|
|
258
|
+
////- (void)PosaddGap:(int)gap {
|
|
259
|
+
////
|
|
260
|
+
//// NSString *gapStr = [NSString stringWithFormat:@"GAP %d mm,0",gap];
|
|
261
|
+
//// [self PosSendMSGWith:gapStr];
|
|
262
|
+
////}
|
|
263
|
+
/////**
|
|
264
|
+
//// * 3.产生钱箱控制脉冲
|
|
265
|
+
//// */
|
|
266
|
+
////- (void)PosaddCashDrwer:(int)m t1:(int)t1 t2:(int)t2 {
|
|
267
|
+
//// NSString *cash = [NSString stringWithFormat:@"CASHDRAWER %d,%d,%d",m,t1,t2];
|
|
268
|
+
//// [self PosSendMSGWith:cash];
|
|
269
|
+
////}
|
|
270
|
+
/////**
|
|
271
|
+
//// * 4.控制每张标签的停止位置
|
|
272
|
+
//// */
|
|
273
|
+
////- (void)PosaddOffset:(float)offset {
|
|
274
|
+
//// NSString *offsetStr = [NSString stringWithFormat:@"OFFSET %.1f mm",offset];
|
|
275
|
+
//// [self PosSendMSGWith:offsetStr];
|
|
276
|
+
////}
|
|
277
|
+
/////**
|
|
278
|
+
//// * 5.设置打印速度
|
|
279
|
+
//// */
|
|
280
|
+
////- (void)PosaddSpeed:(float)speed {
|
|
281
|
+
//// NSString *speedStr = [NSString stringWithFormat:@"SPEED %.1f",speed];
|
|
282
|
+
//// [self PosSendMSGWith:speedStr];
|
|
283
|
+
////}
|
|
284
|
+
/////**
|
|
285
|
+
//// * 6.设置打印浓度
|
|
286
|
+
//// */
|
|
287
|
+
////- (void)PosaddDensity:(int)n {
|
|
288
|
+
//// NSString *denStr = [NSString stringWithFormat:@"DENSITY %d",n];
|
|
289
|
+
//// [self PosSendMSGWith:denStr];
|
|
290
|
+
////}
|
|
291
|
+
/////**
|
|
292
|
+
//// * 7.设置打印方向和镜像
|
|
293
|
+
//// */
|
|
294
|
+
////- (void)PosaddDirection:(int)n {
|
|
295
|
+
//// NSString *directionStr = [NSString stringWithFormat:@"DIRECTION %d",n];
|
|
296
|
+
//// [self PosSendMSGWith:directionStr];
|
|
297
|
+
////}
|
|
298
|
+
/////**
|
|
299
|
+
//// * 8.设置原点坐标
|
|
300
|
+
//// */
|
|
301
|
+
////- (void)PosaddReference:(int)x y:(int)y {
|
|
302
|
+
//// NSString *refStr = [NSString stringWithFormat:@"REFERENCE %d,%d",x,y];
|
|
303
|
+
//// [self PosSendMSGWith:refStr];
|
|
304
|
+
////}
|
|
305
|
+
/////**
|
|
306
|
+
//// * 9.清除打印缓冲区数据
|
|
307
|
+
//// */
|
|
308
|
+
////- (void)PosaddCls {
|
|
309
|
+
//// NSString *clsStr = @"CLS ";
|
|
310
|
+
//// [self PosSendMSGWith:clsStr];
|
|
311
|
+
////}
|
|
312
|
+
/////**
|
|
313
|
+
//// * 10.走纸
|
|
314
|
+
//// */
|
|
315
|
+
////- (void)PosaddFeed:(int)feed {
|
|
316
|
+
//// NSString *feedStr = [NSString stringWithFormat:@"FEED %d",feed];
|
|
317
|
+
//// [self PosSendMSGWith:feedStr];
|
|
318
|
+
////}
|
|
319
|
+
/////**
|
|
320
|
+
//// * 11.退纸
|
|
321
|
+
//// */
|
|
322
|
+
////- (void)PosaddBackFeed:(int)feed {
|
|
323
|
+
//// NSString *back = [NSString stringWithFormat:@"BACKFEED %d",feed];
|
|
324
|
+
//// [self PosSendMSGWith:back];
|
|
325
|
+
////}
|
|
326
|
+
/////**
|
|
327
|
+
//// * 12.走一张标签纸距离
|
|
328
|
+
//// */
|
|
329
|
+
////- (void)PosaddFormFeed {
|
|
330
|
+
//// [self PosSendMSGWith:@"FORMFEED "];
|
|
331
|
+
////}
|
|
332
|
+
/////**
|
|
333
|
+
//// * 13.标签位置进行一次校准
|
|
334
|
+
//// */
|
|
335
|
+
////- (void)PosaddHome {
|
|
336
|
+
//// [self PosSendMSGWith:@"HOME "];
|
|
337
|
+
////}
|
|
338
|
+
/////**
|
|
339
|
+
//// * 14.打印标签
|
|
340
|
+
//// */
|
|
341
|
+
////- (void)PosaddPrint:(int)m {
|
|
342
|
+
//// NSString *printStr = [NSString stringWithFormat:@"PRINT %d",m];
|
|
343
|
+
//// [self PosSendMSGWith:printStr];
|
|
344
|
+
////}
|
|
345
|
+
/////**
|
|
346
|
+
//// * 15.设置国际代码页
|
|
347
|
+
//// */
|
|
348
|
+
////- (void)PosaddCodePage:(int)page {
|
|
349
|
+
//// NSString *code = [NSString stringWithFormat:@"CODEPAGE %d",page];
|
|
350
|
+
//// [self PosSendMSGWith:code];
|
|
351
|
+
////}
|
|
352
|
+
/////**
|
|
353
|
+
//// * 16.设置蜂鸣器
|
|
354
|
+
//// */
|
|
355
|
+
////- (void)PosaddSound:(int)level interval:(int)interval {
|
|
356
|
+
//// NSString *soundStr = [NSString stringWithFormat:@"SOUND %d,%d",level,interval];
|
|
357
|
+
//// [self PosSendMSGWith:soundStr];
|
|
358
|
+
////}
|
|
359
|
+
/////**
|
|
360
|
+
//// * 17.设置打印机报错
|
|
361
|
+
//// */
|
|
362
|
+
////- (void)PosaddLimitFeed:(int)feed {
|
|
363
|
+
//// NSString *limitStr = [NSString stringWithFormat:@"LIMITFEED %d mm",feed];
|
|
364
|
+
//// [self PosSendMSGWith:limitStr];
|
|
365
|
+
////}
|
|
366
|
+
/////**
|
|
367
|
+
//// * 18.在打印缓冲区绘制黑块
|
|
368
|
+
//// */
|
|
369
|
+
////- (void)PosaddBar:(int)x y:(int)y width:(int)width height:(int)height {
|
|
370
|
+
//// NSString *barStr = [NSString stringWithFormat:@"BAR %d,%d,%d,%d",x,y,width,height];
|
|
371
|
+
//// [self PosSendMSGWith:barStr];
|
|
372
|
+
////}
|
|
373
|
+
/////**
|
|
374
|
+
//// * 19.在打印缓冲区绘制一维条码
|
|
375
|
+
//// */
|
|
376
|
+
////- (void)Posadd1DBarcodeX:(int)x
|
|
377
|
+
//// y:(int)y
|
|
378
|
+
//// type:(NSString *)type
|
|
379
|
+
//// height:(int)height
|
|
380
|
+
//// readable:(int)readable
|
|
381
|
+
//// rotation:(int)rotation
|
|
382
|
+
//// narrow:(int)narrow
|
|
383
|
+
//// wide:(int)wide
|
|
384
|
+
//// content:(NSString *)content
|
|
385
|
+
////{
|
|
386
|
+
//// NSString *codeStr = [NSString stringWithFormat:@"BARCODE %d,%d,\"%@\",%d,%d,%d,%d,%d,\"%@\"",x,y,type,height,readable,rotation,narrow,wide,content];
|
|
387
|
+
//// [self PosSendMSGWith:codeStr];
|
|
388
|
+
////}
|
|
389
|
+
/////**
|
|
390
|
+
//// * 20.在打印缓冲区绘制矩形
|
|
391
|
+
//// */
|
|
392
|
+
////- (void)PosaddBox:(int)x y:(int)y xend:(int)xend yend:(int)yend {
|
|
393
|
+
//// NSString *boxStr = [NSString stringWithFormat:@"BOX %d,%d,%d,%d",x,y,xend,yend];
|
|
394
|
+
//// [self PosSendMSGWith:boxStr];
|
|
395
|
+
////}
|
|
396
|
+
/////**
|
|
397
|
+
//// * 21.在打印缓冲区绘制位图
|
|
398
|
+
//// */
|
|
399
|
+
////- (void)PosaddBitmap:(int)x
|
|
400
|
+
//// y:(int)y
|
|
401
|
+
//// width:(int)width
|
|
402
|
+
//// height:(int)height
|
|
403
|
+
//// mode:(int)mode data:(int)data {
|
|
404
|
+
//// NSString *bitStr = [NSString stringWithFormat:@"BITMAP %d,%d,%d,%d,%d,%d",x,y,width,height,mode,data];
|
|
405
|
+
//// [self PosSendMSGWith:bitStr];
|
|
406
|
+
////}
|
|
407
|
+
/////**
|
|
408
|
+
//// * 22.擦除打印缓冲区中指定区域的数据
|
|
409
|
+
//// */
|
|
410
|
+
////- (void)PosaddErase:(int)x y:(int)y xwidth:(int)xwidth yheight:(int)yheight {
|
|
411
|
+
//// NSString *eraseStr = [NSString stringWithFormat:@"ERASE %d,%d,%d,%d",x,y,xwidth,yheight];
|
|
412
|
+
//// [self PosSendMSGWith:eraseStr];
|
|
413
|
+
////}
|
|
414
|
+
/////**
|
|
415
|
+
//// * 23.将指定区域的数据黑白反色
|
|
416
|
+
//// */
|
|
417
|
+
////- (void)PosaddReverse:(int)x y:(int)y xwidth:(int)xwidth yheight:(int)yheight {
|
|
418
|
+
//// NSString *revStr = [NSString stringWithFormat:@"REVERSE %d,%d,%d,%d",x,y,xwidth,yheight];
|
|
419
|
+
//// [self PosSendMSGWith:revStr];
|
|
420
|
+
////}
|
|
421
|
+
/////**
|
|
422
|
+
//// * 24.将指定区域的数据黑白反色
|
|
423
|
+
//// */
|
|
424
|
+
////- (void)PosaddText:(int)x y:(int)y font:(NSString *)font rotation:(int)rotation x_mul:(int)xmul y_mul:(int)ymul content:(NSString *)content {
|
|
425
|
+
//// NSString *text = [NSString stringWithFormat:@"TEXT %d,%d,%@,%d,%d,%d,%@",x,y,font,rotation,xmul,ymul,content];
|
|
426
|
+
//// [self PosSendMSGWith:text];
|
|
427
|
+
////}
|
|
428
|
+
/////**
|
|
429
|
+
//// * 25.在打印缓冲区中绘制文字
|
|
430
|
+
//// */
|
|
431
|
+
////- (void)PosaddQRCode:(int)x y:(int)y level:(int)level cellWidth:(int)cellWidth rotation:(int)totation data:(NSString *)dataStr {
|
|
432
|
+
////// NSString *qrCode = [@"QRCODE " stringByAppendingString:enable];
|
|
433
|
+
//// NSString *qrCode = [NSString stringWithFormat:@"QRCODE %d,%d,%d,%d,%d,%@",x,y,level,cellWidth,totation,dataStr];
|
|
434
|
+
//// [self PosSendMSGWith:qrCode];
|
|
435
|
+
////}
|
|
436
|
+
/////**
|
|
437
|
+
//// * 26.设置剥离功能是否开启
|
|
438
|
+
//// */
|
|
439
|
+
////- (void)PosaddPeel:(NSString *)enable {
|
|
440
|
+
//// NSString *peel = [@"SET PEEL " stringByAppendingString:enable];
|
|
441
|
+
//// [self PosSendMSGWith:peel];
|
|
442
|
+
////}
|
|
443
|
+
/////**
|
|
444
|
+
//// * 27.设置撕离功能是否开启
|
|
445
|
+
//// */
|
|
446
|
+
////- (void)PosaddTear:(NSString *)enable {
|
|
447
|
+
//// NSString *tear = [@"SET TEAR " stringByAppendingString:enable];
|
|
448
|
+
//// [self PosSendMSGWith:tear];
|
|
449
|
+
////}
|
|
450
|
+
/////**
|
|
451
|
+
//// * 28.设置切刀功能是否开启
|
|
452
|
+
//// */
|
|
453
|
+
////- (void)PosaddCut:(NSString *)enable {
|
|
454
|
+
//// NSString *cut = [@"SET CUTTER " stringByAppendingString:enable];
|
|
455
|
+
//// [self PosSendMSGWith:cut];
|
|
456
|
+
////}
|
|
457
|
+
/////**
|
|
458
|
+
//// * 29.设置打印机出错时,是否打印上一张内容
|
|
459
|
+
//// */
|
|
460
|
+
////- (void)PosaddReprint:(NSString *)enable {
|
|
461
|
+
//// NSString *reprint = [@"SET REPRINT " stringByAppendingString:enable];
|
|
462
|
+
//// [self PosSendMSGWith:reprint];
|
|
463
|
+
////}
|
|
464
|
+
/////**
|
|
465
|
+
//// * 30.设置是否按走纸键打印最近一张标签
|
|
466
|
+
//// */
|
|
467
|
+
////- (void)PosaddPrintKeyEnable:(NSString *)enable {
|
|
468
|
+
//// NSString *printKey = [@"SET PRINTKEY " stringByAppendingString:enable];
|
|
469
|
+
//// [self PosSendMSGWith:printKey];
|
|
470
|
+
////}
|
|
471
|
+
/////**
|
|
472
|
+
//// * 31.设置按走纸键打印最近一张标签的份数
|
|
473
|
+
//// */
|
|
474
|
+
////- (void)PosaddPrintKeyNum:(int)m {
|
|
475
|
+
//// NSString *printKey = [NSString stringWithFormat:@"SET PRINTKEY %d",m];
|
|
476
|
+
//// [self PosSendMSGWith:printKey];
|
|
477
|
+
////}
|
|
478
|
+
////
|
|
479
|
+
////#pragma mark - ===============打印机POS指令================
|
|
480
|
+
////#pragma mark - 水平定位
|
|
481
|
+
////- (void)PoshorizontalPosition {
|
|
482
|
+
//// Byte kValue[1] = {0};
|
|
483
|
+
//// kValue[0] = 0x09;
|
|
484
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
485
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
486
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
487
|
+
//// if (commandSendMode==0)
|
|
488
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
489
|
+
//// else
|
|
490
|
+
//// [_commandBuffer addObject: data];
|
|
491
|
+
////}
|
|
492
|
+
////
|
|
493
|
+
////#pragma mark - 打印并换行
|
|
494
|
+
////- (void)PosprintAndFeed {
|
|
495
|
+
//// Byte kValue[1] = {0};
|
|
496
|
+
//// kValue[0] = 0x0A;
|
|
497
|
+
////
|
|
498
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
499
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
500
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
501
|
+
//// if (commandSendMode==0)
|
|
502
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
503
|
+
//// else
|
|
504
|
+
//// [_commandBuffer addObject: data];
|
|
505
|
+
////}
|
|
506
|
+
////
|
|
507
|
+
////#pragma mark - 打印并回到标准模式
|
|
508
|
+
////- (void)PosPrintAndBackToNormalModel {
|
|
509
|
+
//// Byte kValue[1] = {0};
|
|
510
|
+
//// kValue[0] = 0x0C;
|
|
511
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
512
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
513
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
514
|
+
//// if (commandSendMode==0)
|
|
515
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
516
|
+
//// else
|
|
517
|
+
//// [_commandBuffer addObject: data];
|
|
518
|
+
////}
|
|
519
|
+
////#pragma mark - 页模式下取消打印
|
|
520
|
+
////- (void)PosCancelPrintData {
|
|
521
|
+
//// Byte kValue[1] = {0};
|
|
522
|
+
//// kValue[0] = 0x18;
|
|
523
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
524
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
525
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
526
|
+
//// if (commandSendMode==0)
|
|
527
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
528
|
+
//// else
|
|
529
|
+
//// [_commandBuffer addObject: data];
|
|
530
|
+
////}
|
|
531
|
+
////
|
|
532
|
+
////#pragma mark -实时状态传送
|
|
533
|
+
////- (void)PosUpdataPrinterState:(int)param completion:(PosWIFICallBackBlock)callBlock {
|
|
534
|
+
//// self.callBackBlock = callBlock;
|
|
535
|
+
//// Byte kValue[3] = {0};
|
|
536
|
+
//// kValue[0] = 16;
|
|
537
|
+
//// kValue[1] = 4;
|
|
538
|
+
//// kValue[2] = param;
|
|
539
|
+
////
|
|
540
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
541
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
542
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
543
|
+
//// if (commandSendMode==0)
|
|
544
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
545
|
+
//// else
|
|
546
|
+
//// [_commandBuffer addObject: data];
|
|
547
|
+
////
|
|
548
|
+
////}
|
|
549
|
+
////#pragma mark - 实时对打印机请求
|
|
550
|
+
////- (void)PosUpdataPrinterAnswer:(int)param {
|
|
551
|
+
//// Byte kValue[3] = {0};
|
|
552
|
+
//// kValue[0] = 16;
|
|
553
|
+
//// kValue[1] = 5;
|
|
554
|
+
//// kValue[2] = param;
|
|
555
|
+
////
|
|
556
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
557
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
558
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
559
|
+
//// if (commandSendMode==0)
|
|
560
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
561
|
+
//// else
|
|
562
|
+
//// [_commandBuffer addObject: data];
|
|
563
|
+
////}
|
|
564
|
+
////
|
|
565
|
+
////#pragma mark - 实时产生钱箱开启脉冲
|
|
566
|
+
////- (void)PosOpenBoxAndPulse:(int) n m:(int) m t:(int) t {
|
|
567
|
+
//// Byte kValue[5] = {0};
|
|
568
|
+
//// kValue[0] = 16;
|
|
569
|
+
//// kValue[1] = 20;
|
|
570
|
+
//// kValue[2] = n;
|
|
571
|
+
//// kValue[3] = m;
|
|
572
|
+
//// kValue[4] = t;
|
|
573
|
+
////
|
|
574
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
575
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
576
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
577
|
+
//// if (commandSendMode==0)
|
|
578
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
579
|
+
//// else
|
|
580
|
+
//// [_commandBuffer addObject: data];
|
|
581
|
+
////}
|
|
582
|
+
////
|
|
583
|
+
////#pragma mark - 页模式下打印
|
|
584
|
+
////- (void)PosPrintOnPageModel {
|
|
585
|
+
//// Byte kValue[2] = {0};
|
|
586
|
+
//// kValue[0] = 0x1B;
|
|
587
|
+
//// kValue[1] = 0x0c;
|
|
588
|
+
////
|
|
589
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
590
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
591
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
592
|
+
//// if (commandSendMode==0)
|
|
593
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
594
|
+
//// else
|
|
595
|
+
//// [_commandBuffer addObject: data];
|
|
596
|
+
////}
|
|
597
|
+
////
|
|
598
|
+
////#pragma mark - 设置字符右间距
|
|
599
|
+
////- (void)PosSetCharRightMargin:(int)n {
|
|
600
|
+
//// Byte kValue[3] = {0};
|
|
601
|
+
//// kValue[0] = 27;
|
|
602
|
+
//// kValue[1] = 32;
|
|
603
|
+
//// kValue[2] = n;
|
|
604
|
+
////
|
|
605
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
606
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
607
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
608
|
+
//// if (commandSendMode==0)
|
|
609
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
610
|
+
//// else
|
|
611
|
+
//// [_commandBuffer addObject: data];
|
|
612
|
+
////}
|
|
613
|
+
////
|
|
614
|
+
////#pragma mark - 选择打印模式
|
|
615
|
+
////- (void)PosSelectPrintModel:(int)n {
|
|
616
|
+
//// Byte kValue[3] = {0};
|
|
617
|
+
//// kValue[0] = 27;
|
|
618
|
+
//// kValue[1] = 33;
|
|
619
|
+
//// kValue[2] = n;
|
|
620
|
+
////
|
|
621
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
622
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
623
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
624
|
+
//// if (commandSendMode==0)
|
|
625
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
626
|
+
//// else
|
|
627
|
+
//// [_commandBuffer addObject: data];
|
|
628
|
+
////}
|
|
629
|
+
////
|
|
630
|
+
////#pragma mark - 设置打印绝对位置
|
|
631
|
+
////- (void)PosSetPrintLocationWithParam:(int)nL nH:(int)nH {
|
|
632
|
+
////
|
|
633
|
+
//// Byte kValue[4] = {0};
|
|
634
|
+
//// kValue[0] = 27;
|
|
635
|
+
//// kValue[1] = 36;
|
|
636
|
+
//// kValue[2] = nL;
|
|
637
|
+
//// kValue[3] = nH;
|
|
638
|
+
////
|
|
639
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
640
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
641
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
642
|
+
//// if (commandSendMode==0)
|
|
643
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
644
|
+
//// else
|
|
645
|
+
//// [_commandBuffer addObject: data];
|
|
646
|
+
////}
|
|
647
|
+
////
|
|
648
|
+
////#pragma mark - 12.选择/取消用户自定义字符
|
|
649
|
+
////- (void)PosSelectOrCancelCustomCharacter:(int)n {
|
|
650
|
+
//// Byte kValue[3] = {0};
|
|
651
|
+
//// kValue[0] = 27;
|
|
652
|
+
//// kValue[1] = 37;
|
|
653
|
+
//// kValue[2] = n;
|
|
654
|
+
////
|
|
655
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
656
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
657
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
658
|
+
//// if (commandSendMode==0)
|
|
659
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
660
|
+
//// else
|
|
661
|
+
//// [_commandBuffer addObject: data];
|
|
662
|
+
////}
|
|
663
|
+
////
|
|
664
|
+
////
|
|
665
|
+
/////**
|
|
666
|
+
//// * 13.定义用户自定义字符
|
|
667
|
+
//// */
|
|
668
|
+
////- (void)PosDefinCustomCharacter:(int)y c1:(int)c1 c2:(int)c2 dx:(NSArray *)points
|
|
669
|
+
////{
|
|
670
|
+
//// int length = 5 + points.count;
|
|
671
|
+
////
|
|
672
|
+
//// Byte kValue[length];
|
|
673
|
+
//// kValue[0] = 27;
|
|
674
|
+
//// kValue[1] = 38;
|
|
675
|
+
//// kValue[2] = y;
|
|
676
|
+
//// kValue[3] = c1;
|
|
677
|
+
//// kValue[4] = c2;
|
|
678
|
+
////
|
|
679
|
+
//// for (int i = 0; i<points.count; i++) {
|
|
680
|
+
//// NSString *str = points[i];
|
|
681
|
+
//// kValue[5+i] = str.intValue;
|
|
682
|
+
//// }
|
|
683
|
+
////
|
|
684
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
685
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
686
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
687
|
+
//// if (commandSendMode==0)
|
|
688
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
689
|
+
//// else
|
|
690
|
+
//// [_commandBuffer addObject: data];
|
|
691
|
+
////}
|
|
692
|
+
////
|
|
693
|
+
/////**
|
|
694
|
+
//// * 14.选择位图模式
|
|
695
|
+
//// */
|
|
696
|
+
////- (void)PosSelectBitmapModel:(int)m nL:(int)nL nH:(int)nH dx:(NSArray *)points
|
|
697
|
+
////{ int length = 5 + points.count;
|
|
698
|
+
//// Byte kValue[length];
|
|
699
|
+
//// kValue[0] = 27;
|
|
700
|
+
//// kValue[1] = 42;
|
|
701
|
+
//// kValue[2] = m;
|
|
702
|
+
//// kValue[3] = nL;
|
|
703
|
+
//// kValue[4] = nH;
|
|
704
|
+
////
|
|
705
|
+
//// for (int i = 0; i<points.count; i++) {
|
|
706
|
+
//// NSString *va = points[i];
|
|
707
|
+
//// kValue[5+i] = va.intValue;
|
|
708
|
+
//// }
|
|
709
|
+
////
|
|
710
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
711
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
712
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
713
|
+
//// if (commandSendMode==0)
|
|
714
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
715
|
+
//// else
|
|
716
|
+
//// [_commandBuffer addObject: data];
|
|
717
|
+
////
|
|
718
|
+
////}
|
|
719
|
+
////
|
|
720
|
+
/////**
|
|
721
|
+
//// * 15.取消下划线模式
|
|
722
|
+
//// */
|
|
723
|
+
////- (void)PosCancelUnderLineModelWith:(int)n {
|
|
724
|
+
//// Byte kValue[3] = {0};
|
|
725
|
+
//// kValue[0] = 27;
|
|
726
|
+
//// kValue[1] = 45;
|
|
727
|
+
//// kValue[2] = n;
|
|
728
|
+
////
|
|
729
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
730
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
731
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
732
|
+
//// if (commandSendMode==0)
|
|
733
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
734
|
+
//// else
|
|
735
|
+
//// [_commandBuffer addObject: data];
|
|
736
|
+
////}
|
|
737
|
+
/////**
|
|
738
|
+
//// * 16.设置默认行间距
|
|
739
|
+
//// */
|
|
740
|
+
////- (void)PosSetDefaultLineMargin {
|
|
741
|
+
//// Byte kValue[2] = {0};
|
|
742
|
+
//// kValue[0] = 27;
|
|
743
|
+
//// kValue[1] = 50;
|
|
744
|
+
////
|
|
745
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
746
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
747
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
748
|
+
//// if (commandSendMode==0)
|
|
749
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
750
|
+
//// else
|
|
751
|
+
//// [_commandBuffer addObject: data];
|
|
752
|
+
////}
|
|
753
|
+
////
|
|
754
|
+
/////**
|
|
755
|
+
//// * 17.设置行间距
|
|
756
|
+
//// */
|
|
757
|
+
////- (void)PosSetLineMarginWith:(int)n {
|
|
758
|
+
//// Byte kValue[3] = {0};
|
|
759
|
+
//// kValue[0] = 27;
|
|
760
|
+
//// kValue[1] = 51;
|
|
761
|
+
//// kValue[2] = n;
|
|
762
|
+
////
|
|
763
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
764
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
765
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
766
|
+
//// if (commandSendMode==0)
|
|
767
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
768
|
+
//// else
|
|
769
|
+
//// [_commandBuffer addObject: data];
|
|
770
|
+
////}
|
|
771
|
+
////
|
|
772
|
+
/////**
|
|
773
|
+
//// * 18.选择打印机
|
|
774
|
+
//// */
|
|
775
|
+
////- (void)PosSelectPrinterWith:(int)n {
|
|
776
|
+
//// Byte kValue[3] = {0};
|
|
777
|
+
//// kValue[0] = 27;
|
|
778
|
+
//// kValue[1] = 61;
|
|
779
|
+
//// kValue[2] = n;
|
|
780
|
+
////
|
|
781
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
782
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
783
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
784
|
+
//// if (commandSendMode==0)
|
|
785
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
786
|
+
//// else
|
|
787
|
+
//// [_commandBuffer addObject: data];
|
|
788
|
+
////}
|
|
789
|
+
/////**
|
|
790
|
+
//// * 19.取消用户自定义字符
|
|
791
|
+
//// */
|
|
792
|
+
////- (void)PosCancelCustomCharacterWith:(int)n {
|
|
793
|
+
//// Byte kValue[3] = {0};
|
|
794
|
+
//// kValue[0] = 27;
|
|
795
|
+
//// kValue[1] = 63;
|
|
796
|
+
//// kValue[2] = n;
|
|
797
|
+
////
|
|
798
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
799
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
800
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
801
|
+
//// if (commandSendMode==0)
|
|
802
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
803
|
+
//// else
|
|
804
|
+
//// [_commandBuffer addObject: data];
|
|
805
|
+
////}
|
|
806
|
+
////
|
|
807
|
+
/////**
|
|
808
|
+
//// * 20.初始化打印机
|
|
809
|
+
//// */
|
|
810
|
+
////- (void)PosInitializePrinter {
|
|
811
|
+
//// Byte kValue[2] = {0};
|
|
812
|
+
//// kValue[0] = 27;
|
|
813
|
+
//// kValue[1] = 64;
|
|
814
|
+
////
|
|
815
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
816
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
817
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
818
|
+
//// if (commandSendMode==0)
|
|
819
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
820
|
+
//// else
|
|
821
|
+
//// [_commandBuffer addObject: data];
|
|
822
|
+
////}
|
|
823
|
+
/////**
|
|
824
|
+
//// * 21.设置横向跳格位置
|
|
825
|
+
//// */
|
|
826
|
+
////- (void)PosSetTabLocationWith:(NSArray *)points {
|
|
827
|
+
////
|
|
828
|
+
//// Byte kValue[3 + points.count];
|
|
829
|
+
//// kValue[0] = 27;
|
|
830
|
+
//// kValue[1] = 68;
|
|
831
|
+
////
|
|
832
|
+
//// for (int i = 0; i<points.count; i++) {
|
|
833
|
+
//// NSString *str = points[i];
|
|
834
|
+
//// kValue[2+i] = str.intValue;
|
|
835
|
+
//// if (i == points.count-1) {
|
|
836
|
+
//// kValue[3+i] = 0;
|
|
837
|
+
//// }
|
|
838
|
+
//// }
|
|
839
|
+
////
|
|
840
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
841
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
842
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
843
|
+
//// if (commandSendMode==0)
|
|
844
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
845
|
+
//// else
|
|
846
|
+
//// [_commandBuffer addObject: data];
|
|
847
|
+
////}
|
|
848
|
+
/////**
|
|
849
|
+
//// * 22.选择/取消加粗模式
|
|
850
|
+
//// */
|
|
851
|
+
////- (void)PosSelectOrCancelBoldModelWith:(int)n {
|
|
852
|
+
//// Byte kValue[3] = {0};
|
|
853
|
+
//// kValue[0] = 27;
|
|
854
|
+
//// kValue[1] = 69;
|
|
855
|
+
//// kValue[2] = n;
|
|
856
|
+
////
|
|
857
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
858
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
859
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
860
|
+
//// if (commandSendMode==0)
|
|
861
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
862
|
+
//// else
|
|
863
|
+
//// [_commandBuffer addObject: data];
|
|
864
|
+
////}
|
|
865
|
+
/////**
|
|
866
|
+
//// * 23.选择/取消双重打印模式
|
|
867
|
+
//// */
|
|
868
|
+
////- (void)PosSelectOrCancelDoublePrintModel:(int)n {
|
|
869
|
+
//// Byte kValue[3] = {0};
|
|
870
|
+
//// kValue[0] = 27;
|
|
871
|
+
//// kValue[1] = 71;
|
|
872
|
+
//// kValue[2] = n;
|
|
873
|
+
////
|
|
874
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
875
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
876
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
877
|
+
//// if (commandSendMode==0)
|
|
878
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
879
|
+
//// else
|
|
880
|
+
//// [_commandBuffer addObject: data];
|
|
881
|
+
////}
|
|
882
|
+
/////**
|
|
883
|
+
//// * 24.打印并走纸
|
|
884
|
+
//// */
|
|
885
|
+
////- (void)PosPrintAndPushPageWith:(int)n {
|
|
886
|
+
//// Byte kValue[3] = {0};
|
|
887
|
+
//// kValue[0] = 27;
|
|
888
|
+
//// kValue[1] = 74;
|
|
889
|
+
//// kValue[2] = n;
|
|
890
|
+
////
|
|
891
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
892
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
893
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
894
|
+
//// if (commandSendMode==0)
|
|
895
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
896
|
+
//// else
|
|
897
|
+
//// [_commandBuffer addObject: data];
|
|
898
|
+
////}
|
|
899
|
+
/////**
|
|
900
|
+
//// * 25.选择页模式
|
|
901
|
+
//// */
|
|
902
|
+
////- (void)PosSelectPageModel {
|
|
903
|
+
//// Byte kValue[2] = {0};
|
|
904
|
+
//// kValue[0] = 27;
|
|
905
|
+
//// kValue[1] = 76;
|
|
906
|
+
////
|
|
907
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
908
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
909
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
910
|
+
//// if (commandSendMode==0)
|
|
911
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
912
|
+
//// else
|
|
913
|
+
//// [_commandBuffer addObject: data];
|
|
914
|
+
////}
|
|
915
|
+
/////**
|
|
916
|
+
//// * 26.选择字体
|
|
917
|
+
//// */
|
|
918
|
+
////- (void)PosSelectFontWith:(int)n {
|
|
919
|
+
//// Byte kValue[3] = {0};
|
|
920
|
+
//// kValue[0] = 27;
|
|
921
|
+
//// kValue[1] = 77;
|
|
922
|
+
//// kValue[2] = n;
|
|
923
|
+
////
|
|
924
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
925
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
926
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
927
|
+
//// if (commandSendMode==0)
|
|
928
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
929
|
+
//// else
|
|
930
|
+
//// [_commandBuffer addObject: data];
|
|
931
|
+
////}
|
|
932
|
+
/////**
|
|
933
|
+
//// * 27.选择国际字符集
|
|
934
|
+
//// */
|
|
935
|
+
////- (void)PosSelectINTL_CHAR_SETWith:(int)n {
|
|
936
|
+
//// Byte kValue[3] = {0};
|
|
937
|
+
//// kValue[0] = 27;
|
|
938
|
+
//// kValue[1] = 82;
|
|
939
|
+
//// kValue[2] = n;
|
|
940
|
+
////
|
|
941
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
942
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
943
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
944
|
+
//// if (commandSendMode==0)
|
|
945
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
946
|
+
//// else
|
|
947
|
+
//// [_commandBuffer addObject: data];
|
|
948
|
+
////}
|
|
949
|
+
/////**
|
|
950
|
+
//// * 28.选择标准模式
|
|
951
|
+
//// */
|
|
952
|
+
////- (void)PosSelectNormalModel {
|
|
953
|
+
//// Byte kValue[2] = {0};
|
|
954
|
+
//// kValue[0] = 27;
|
|
955
|
+
//// kValue[1] = 83;
|
|
956
|
+
////
|
|
957
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
958
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
959
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
960
|
+
//// if (commandSendMode==0)
|
|
961
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
962
|
+
//// else
|
|
963
|
+
//// [_commandBuffer addObject: data];
|
|
964
|
+
////}
|
|
965
|
+
/////**
|
|
966
|
+
//// * 29.在页模式下选择打印区域方向
|
|
967
|
+
//// */
|
|
968
|
+
////- (void)PosSelectPrintDirectionOnPageModel:(int)n {
|
|
969
|
+
//// Byte kValue[3] = {0};
|
|
970
|
+
//// kValue[0] = 27;
|
|
971
|
+
//// kValue[1] = 84;
|
|
972
|
+
//// kValue[2] = n;
|
|
973
|
+
////
|
|
974
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
975
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
976
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
977
|
+
//// if (commandSendMode==0)
|
|
978
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
979
|
+
//// else
|
|
980
|
+
//// [_commandBuffer addObject: data];
|
|
981
|
+
////}
|
|
982
|
+
/////**
|
|
983
|
+
//// * 30.选择/取消顺时针旋转90度
|
|
984
|
+
//// */
|
|
985
|
+
////- (void)PosSelectOrCancelRotationClockwise:(int)n {
|
|
986
|
+
//// Byte kValue[3] = {0};
|
|
987
|
+
//// kValue[0] = 27;
|
|
988
|
+
//// kValue[1] = 86;
|
|
989
|
+
//// kValue[2] = n;
|
|
990
|
+
////
|
|
991
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
992
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
993
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
994
|
+
//// if (commandSendMode==0)
|
|
995
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
996
|
+
//// else
|
|
997
|
+
//// [_commandBuffer addObject: data];
|
|
998
|
+
////}
|
|
999
|
+
////
|
|
1000
|
+
/////**
|
|
1001
|
+
//// * 31.页模式下设置打印区域
|
|
1002
|
+
//// */
|
|
1003
|
+
////- (void)PosSetprintLocationOnPageModelWithXL:(int)xL
|
|
1004
|
+
//// xH:(int)xH
|
|
1005
|
+
//// yL:(int)yL
|
|
1006
|
+
//// yH:(int)yH
|
|
1007
|
+
//// dxL:(int)dxL
|
|
1008
|
+
//// dxH:(int)dxH
|
|
1009
|
+
//// dyL:(int)dyL
|
|
1010
|
+
//// dyH:(int)dyH
|
|
1011
|
+
////{
|
|
1012
|
+
//// Byte kValue[10];
|
|
1013
|
+
//// kValue[0] = 27;
|
|
1014
|
+
//// kValue[1] = 87;
|
|
1015
|
+
//// kValue[2] = xL;
|
|
1016
|
+
//// kValue[3] = xH;
|
|
1017
|
+
//// kValue[4] = yL;
|
|
1018
|
+
//// kValue[5] = yH;
|
|
1019
|
+
//// kValue[6] = dxL;
|
|
1020
|
+
//// kValue[7] = dxH;
|
|
1021
|
+
//// kValue[8] = dyL;
|
|
1022
|
+
//// kValue[9] = dyH;
|
|
1023
|
+
////
|
|
1024
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1025
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1026
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1027
|
+
//// if (commandSendMode==0)
|
|
1028
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1029
|
+
//// else
|
|
1030
|
+
//// [_commandBuffer addObject: data];
|
|
1031
|
+
////}
|
|
1032
|
+
////
|
|
1033
|
+
/////**
|
|
1034
|
+
//// * 32.设置横向打印位置
|
|
1035
|
+
//// */
|
|
1036
|
+
////- (void)PosSetHorizonLocationWith:(int)nL nH:(int)nH {
|
|
1037
|
+
//// Byte kValue[4] = {0};
|
|
1038
|
+
//// kValue[0] = 27;
|
|
1039
|
+
//// kValue[1] = 92;
|
|
1040
|
+
//// kValue[2] = nL;
|
|
1041
|
+
//// kValue[3] = nH;
|
|
1042
|
+
////
|
|
1043
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1044
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1045
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1046
|
+
//// if (commandSendMode==0)
|
|
1047
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1048
|
+
//// else
|
|
1049
|
+
//// [_commandBuffer addObject: data];
|
|
1050
|
+
////}
|
|
1051
|
+
////
|
|
1052
|
+
/////**
|
|
1053
|
+
//// * 33.选择对齐方式
|
|
1054
|
+
//// */
|
|
1055
|
+
////- (void)PosSelectAlignmentWithN:(int)n {
|
|
1056
|
+
//// Byte kValue[3] = {0};
|
|
1057
|
+
//// kValue[0] = 27;
|
|
1058
|
+
//// kValue[1] = 97;
|
|
1059
|
+
//// kValue[2] = n;
|
|
1060
|
+
////
|
|
1061
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1062
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1063
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1064
|
+
//// if (commandSendMode==0)
|
|
1065
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1066
|
+
//// else
|
|
1067
|
+
//// [_commandBuffer addObject: data];
|
|
1068
|
+
////}
|
|
1069
|
+
/////**
|
|
1070
|
+
//// * 34.选择打印纸传感器以输出信号
|
|
1071
|
+
//// */
|
|
1072
|
+
////- (void)PosSelectSensorForOutputSignal:(int)n {
|
|
1073
|
+
//// Byte kValue[4] = {0};
|
|
1074
|
+
//// kValue[0] = 27;
|
|
1075
|
+
//// kValue[1] = 99;
|
|
1076
|
+
//// kValue[2] = 51;
|
|
1077
|
+
//// kValue[3] = n;
|
|
1078
|
+
////
|
|
1079
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1080
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1081
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1082
|
+
//// if (commandSendMode==0)
|
|
1083
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1084
|
+
//// else
|
|
1085
|
+
//// [_commandBuffer addObject: data];
|
|
1086
|
+
////}
|
|
1087
|
+
////
|
|
1088
|
+
/////**
|
|
1089
|
+
//// * 35.选择打印纸传感器以停止打印
|
|
1090
|
+
//// */
|
|
1091
|
+
////- (void)PosSelectSensorForStopPrint:(int)n {
|
|
1092
|
+
//// Byte kValue[4] = {0};
|
|
1093
|
+
//// kValue[0] = 27;
|
|
1094
|
+
//// kValue[1] = 99;
|
|
1095
|
+
//// kValue[2] = 52;
|
|
1096
|
+
//// kValue[3] = n;
|
|
1097
|
+
////
|
|
1098
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1099
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1100
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1101
|
+
//// if (commandSendMode==0)
|
|
1102
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1103
|
+
//// else
|
|
1104
|
+
//// [_commandBuffer addObject: data];
|
|
1105
|
+
////}
|
|
1106
|
+
/////**
|
|
1107
|
+
//// * 36.允许/禁止按键
|
|
1108
|
+
//// */
|
|
1109
|
+
////- (void)PosAllowOrDisableKeypress:(int)n {
|
|
1110
|
+
//// Byte kValue[4] = {0};
|
|
1111
|
+
//// kValue[0] = 27;
|
|
1112
|
+
//// kValue[1] = 99;
|
|
1113
|
+
//// kValue[2] = 53;
|
|
1114
|
+
//// kValue[3] = n;
|
|
1115
|
+
////
|
|
1116
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1117
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1118
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1119
|
+
//// if (commandSendMode==0)
|
|
1120
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1121
|
+
//// else
|
|
1122
|
+
//// [_commandBuffer addObject: data];
|
|
1123
|
+
////}
|
|
1124
|
+
/////**
|
|
1125
|
+
//// * 37.打印并向前走纸 N 行
|
|
1126
|
+
//// */
|
|
1127
|
+
////- (void)PosPrintAndPushPageRow:(int)n{
|
|
1128
|
+
//// Byte kValue[3] = {0};
|
|
1129
|
+
//// kValue[0] = 27;
|
|
1130
|
+
//// kValue[1] = 100;
|
|
1131
|
+
//// kValue[2] = n;
|
|
1132
|
+
////
|
|
1133
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1134
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1135
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1136
|
+
//// if (commandSendMode==0)
|
|
1137
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1138
|
+
//// else
|
|
1139
|
+
//// [_commandBuffer addObject: data];
|
|
1140
|
+
////}
|
|
1141
|
+
/////**
|
|
1142
|
+
//// * 38.产生钱箱控制脉冲
|
|
1143
|
+
//// */
|
|
1144
|
+
////- (void)PosMakePulseWithCashboxWithM:(int)m t1:(int)t1 t2:(int)t2 {
|
|
1145
|
+
//// Byte kValue[5];
|
|
1146
|
+
//// kValue[0] = 27;
|
|
1147
|
+
//// kValue[1] = 112;
|
|
1148
|
+
//// kValue[2] = m;
|
|
1149
|
+
//// kValue[3] = t1;
|
|
1150
|
+
//// kValue[4] = t2;
|
|
1151
|
+
////
|
|
1152
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1153
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1154
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1155
|
+
//// if (commandSendMode==0)
|
|
1156
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1157
|
+
//// else
|
|
1158
|
+
//// [_commandBuffer addObject: data];
|
|
1159
|
+
////}
|
|
1160
|
+
/////**
|
|
1161
|
+
//// * 39.选择字符代码表
|
|
1162
|
+
//// */
|
|
1163
|
+
////- (void)PosSelectCharacterTabN:(int)n {
|
|
1164
|
+
//// Byte kValue[3] = {0};
|
|
1165
|
+
//// kValue[0] = 27;
|
|
1166
|
+
//// kValue[1] = 116;
|
|
1167
|
+
//// kValue[2] = n;
|
|
1168
|
+
////
|
|
1169
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1170
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1171
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1172
|
+
//// if (commandSendMode==0)
|
|
1173
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1174
|
+
//// else
|
|
1175
|
+
//// [_commandBuffer addObject: data];
|
|
1176
|
+
////}
|
|
1177
|
+
/////**
|
|
1178
|
+
//// * 40.选择/取消倒置打印模式
|
|
1179
|
+
//// */
|
|
1180
|
+
////- (void)PosSelectOrCancelInversionPrintModel:(int)n {
|
|
1181
|
+
//// Byte kValue[3] = {0};
|
|
1182
|
+
//// kValue[0] = 27;
|
|
1183
|
+
//// kValue[1] = 123;
|
|
1184
|
+
//// kValue[2] = n;
|
|
1185
|
+
////
|
|
1186
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1187
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1188
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1189
|
+
//// if (commandSendMode==0)
|
|
1190
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1191
|
+
//// else
|
|
1192
|
+
//// [_commandBuffer addObject: data];
|
|
1193
|
+
////}
|
|
1194
|
+
////
|
|
1195
|
+
/////**
|
|
1196
|
+
//// * 41.打印下载到FLASH中的位图
|
|
1197
|
+
//// */
|
|
1198
|
+
////- (void)PosPrintFlashBitmapWithN:(int)n m:(int)m {
|
|
1199
|
+
//// Byte kValue[4] = {0};
|
|
1200
|
+
//// kValue[0] = 28;
|
|
1201
|
+
//// kValue[1] = 112;
|
|
1202
|
+
//// kValue[2] = n;
|
|
1203
|
+
//// kValue[3] = m;
|
|
1204
|
+
////
|
|
1205
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1206
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1207
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1208
|
+
//// if (commandSendMode==0)
|
|
1209
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1210
|
+
//// else
|
|
1211
|
+
//// [_commandBuffer addObject: data];
|
|
1212
|
+
////}
|
|
1213
|
+
/////**
|
|
1214
|
+
//// * 42.定义FLASH位图
|
|
1215
|
+
//// */
|
|
1216
|
+
////- (void)PosDefinFlashBitmapWithN:(int)n Points:(NSArray *)points {
|
|
1217
|
+
//// int length = points.count;
|
|
1218
|
+
//// Byte kValue[3+length];
|
|
1219
|
+
//// kValue[0] = 28;
|
|
1220
|
+
//// kValue[1] = 113;
|
|
1221
|
+
//// kValue[2] = n;
|
|
1222
|
+
////
|
|
1223
|
+
//// for (int i = 0; i<points.count; i++) {
|
|
1224
|
+
//// NSString *str = points[i];
|
|
1225
|
+
//// kValue[3+i] = str.intValue;
|
|
1226
|
+
//// }
|
|
1227
|
+
////
|
|
1228
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1229
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1230
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1231
|
+
//// if (commandSendMode==0)
|
|
1232
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1233
|
+
//// else
|
|
1234
|
+
//// [_commandBuffer addObject: data];
|
|
1235
|
+
////}
|
|
1236
|
+
/////**
|
|
1237
|
+
//// * 43.选择字符大小
|
|
1238
|
+
//// */
|
|
1239
|
+
////- (void)PosSelectCharacterSize:(int)n {
|
|
1240
|
+
//// Byte kValue[3] = {0};
|
|
1241
|
+
//// kValue[0] = 29;
|
|
1242
|
+
//// kValue[1] = 33;
|
|
1243
|
+
//// kValue[2] = n;
|
|
1244
|
+
////
|
|
1245
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1246
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1247
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1248
|
+
//// if (commandSendMode==0)
|
|
1249
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1250
|
+
//// else
|
|
1251
|
+
//// [_commandBuffer addObject: data];
|
|
1252
|
+
////}
|
|
1253
|
+
/////**
|
|
1254
|
+
//// * 44.页模式下设置纵向绝对位置
|
|
1255
|
+
//// */
|
|
1256
|
+
////- (void)PosSetVertLocationOnPageModelWithnL:(int)nL nH:(int)nH {
|
|
1257
|
+
//// Byte kValue[4] = {0};
|
|
1258
|
+
//// kValue[0] = 29;
|
|
1259
|
+
//// kValue[1] = 36;
|
|
1260
|
+
//// kValue[2] = nL;
|
|
1261
|
+
//// kValue[3] = nH;
|
|
1262
|
+
////
|
|
1263
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1264
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1265
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1266
|
+
//// if (commandSendMode==0)
|
|
1267
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1268
|
+
//// else
|
|
1269
|
+
//// [_commandBuffer addObject: data];
|
|
1270
|
+
////}
|
|
1271
|
+
/////**
|
|
1272
|
+
//// * 45.定义下载位图
|
|
1273
|
+
//// */
|
|
1274
|
+
////- (void)PosDefineLoadBitmapWithX:(int)x Y:(int)y Points:(NSArray *)points {
|
|
1275
|
+
//// Byte kValue[4+points.count];
|
|
1276
|
+
//// kValue[0] = 29;
|
|
1277
|
+
//// kValue[1] = 42;
|
|
1278
|
+
//// kValue[2] = x;
|
|
1279
|
+
//// kValue[3] = y;
|
|
1280
|
+
////
|
|
1281
|
+
//// for (int i = 0; i<points.count; i++) {
|
|
1282
|
+
//// NSString *str = points[i];
|
|
1283
|
+
//// kValue[4+i] = str.intValue;
|
|
1284
|
+
//// }
|
|
1285
|
+
////
|
|
1286
|
+
////
|
|
1287
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1288
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1289
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1290
|
+
//// if (commandSendMode==0)
|
|
1291
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1292
|
+
//// else
|
|
1293
|
+
//// [_commandBuffer addObject: data];
|
|
1294
|
+
////}
|
|
1295
|
+
/////**
|
|
1296
|
+
//// * 46.执行打印数据十六进制转储
|
|
1297
|
+
//// */
|
|
1298
|
+
////- (void)PosPrintDataAndSaveAsHexWithpL:(int)pL pH:(int)pH n:(int)n m:(int)m {
|
|
1299
|
+
//// Byte kValue[7];
|
|
1300
|
+
//// kValue[0] = 29;
|
|
1301
|
+
//// kValue[1] = 40;
|
|
1302
|
+
//// kValue[2] = 65;
|
|
1303
|
+
//// kValue[3] = pL;
|
|
1304
|
+
//// kValue[4] = pH;
|
|
1305
|
+
//// kValue[5] = n;
|
|
1306
|
+
//// kValue[6] = m;
|
|
1307
|
+
////
|
|
1308
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1309
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1310
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1311
|
+
//// if (commandSendMode==0)
|
|
1312
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1313
|
+
//// else
|
|
1314
|
+
//// [_commandBuffer addObject: data];
|
|
1315
|
+
////}
|
|
1316
|
+
/////**
|
|
1317
|
+
//// * 47.打印下载位图
|
|
1318
|
+
//// */
|
|
1319
|
+
////- (void)PosPrintLoadBitmapM:(int)m {
|
|
1320
|
+
//// Byte kValue[3] = {0};
|
|
1321
|
+
//// kValue[0] = 29;
|
|
1322
|
+
//// kValue[1] = 47;
|
|
1323
|
+
//// kValue[2] = m;
|
|
1324
|
+
////
|
|
1325
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1326
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1327
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1328
|
+
//// if (commandSendMode==0)
|
|
1329
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1330
|
+
//// else
|
|
1331
|
+
//// [_commandBuffer addObject: data];
|
|
1332
|
+
////}
|
|
1333
|
+
/////**
|
|
1334
|
+
//// * 48.开始/结束宏定义
|
|
1335
|
+
//// */
|
|
1336
|
+
////- (void)PosBeginOrEndDefine {
|
|
1337
|
+
//// Byte kValue[2] = {0};
|
|
1338
|
+
//// kValue[0] = 29;
|
|
1339
|
+
//// kValue[1] = 58;
|
|
1340
|
+
////
|
|
1341
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1342
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1343
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1344
|
+
//// if (commandSendMode==0)
|
|
1345
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1346
|
+
//// else
|
|
1347
|
+
//// [_commandBuffer addObject: data];
|
|
1348
|
+
////}
|
|
1349
|
+
/////**
|
|
1350
|
+
//// * 49.选择/取消黑白反显打印模式
|
|
1351
|
+
//// */
|
|
1352
|
+
////- (void)PosSelectORCancelBWPrintModel:(int)n {
|
|
1353
|
+
//// Byte kValue[3] = {0};
|
|
1354
|
+
//// kValue[0] = 29;
|
|
1355
|
+
//// kValue[1] = 66;
|
|
1356
|
+
//// kValue[2] = n;
|
|
1357
|
+
////
|
|
1358
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1359
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1360
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1361
|
+
//// if (commandSendMode==0)
|
|
1362
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1363
|
+
//// else
|
|
1364
|
+
//// [_commandBuffer addObject: data];
|
|
1365
|
+
////}
|
|
1366
|
+
/////**
|
|
1367
|
+
//// * 50.选择HRI字符的打印位置
|
|
1368
|
+
//// */
|
|
1369
|
+
////- (void)PosSelectHRIPrintLocation:(int)n {
|
|
1370
|
+
//// Byte kValue[3] = {0};
|
|
1371
|
+
//// kValue[0] = 29;
|
|
1372
|
+
//// kValue[1] = 72;
|
|
1373
|
+
//// kValue[2] = n;
|
|
1374
|
+
////
|
|
1375
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1376
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1377
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1378
|
+
//// if (commandSendMode==0)
|
|
1379
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1380
|
+
//// else
|
|
1381
|
+
//// [_commandBuffer addObject: data];
|
|
1382
|
+
////}
|
|
1383
|
+
/////**
|
|
1384
|
+
//// * 51.设置左边距
|
|
1385
|
+
//// */
|
|
1386
|
+
////- (void)PosSetLeftMarginWithnL:(int)nL nH:(int)nH {
|
|
1387
|
+
//// Byte kValue[4] = {0};
|
|
1388
|
+
//// kValue[0] = 29;
|
|
1389
|
+
//// kValue[1] = 76;
|
|
1390
|
+
//// kValue[2] = nL;
|
|
1391
|
+
//// kValue[3] = nH;
|
|
1392
|
+
////
|
|
1393
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1394
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1395
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1396
|
+
//// if (commandSendMode==0)
|
|
1397
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1398
|
+
//// else
|
|
1399
|
+
//// [_commandBuffer addObject: data];
|
|
1400
|
+
////}
|
|
1401
|
+
/////**
|
|
1402
|
+
//// * 52.设置横向和纵向移动单位
|
|
1403
|
+
//// */
|
|
1404
|
+
////- (void)PosSetHoriAndVertUnitXWith:(int)x y:(int)y {
|
|
1405
|
+
//// Byte kValue[4] = {0};
|
|
1406
|
+
//// kValue[0] = 29;
|
|
1407
|
+
//// kValue[1] = 80;
|
|
1408
|
+
//// kValue[2] = x;
|
|
1409
|
+
//// kValue[3] = y;
|
|
1410
|
+
////
|
|
1411
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1412
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1413
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1414
|
+
//// if (commandSendMode==0)
|
|
1415
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1416
|
+
//// else
|
|
1417
|
+
//// [_commandBuffer addObject: data];
|
|
1418
|
+
////}
|
|
1419
|
+
/////**
|
|
1420
|
+
//// * 53.选择切纸模式并切纸
|
|
1421
|
+
//// */
|
|
1422
|
+
////- (void)PosSelectCutPaperModelAndCutPaperWith:(int)m n:(int)n selectedModel:(int)model {
|
|
1423
|
+
//// Byte kValue[4] = {0};
|
|
1424
|
+
//// kValue[0] = 29;
|
|
1425
|
+
//// kValue[1] = 86;
|
|
1426
|
+
//// kValue[2] = m;
|
|
1427
|
+
//// if (model == 1) {
|
|
1428
|
+
//// kValue[3] = n;
|
|
1429
|
+
//// }
|
|
1430
|
+
////
|
|
1431
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1432
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1433
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1434
|
+
//// if (commandSendMode==0)
|
|
1435
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1436
|
+
//// else
|
|
1437
|
+
//// [_commandBuffer addObject: data];
|
|
1438
|
+
////}
|
|
1439
|
+
/////**
|
|
1440
|
+
//// * 54.设置打印区域宽高
|
|
1441
|
+
//// */
|
|
1442
|
+
////- (void)PosSetPrintLocationWith:(int)nL nH:(int)nH {
|
|
1443
|
+
//// Byte kValue[4] = {0};
|
|
1444
|
+
//// kValue[0] = 29;
|
|
1445
|
+
//// kValue[1] = 87;
|
|
1446
|
+
//// kValue[2] = nL;
|
|
1447
|
+
//// kValue[3] = nH;
|
|
1448
|
+
////
|
|
1449
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1450
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1451
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1452
|
+
//// if (commandSendMode==0)
|
|
1453
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1454
|
+
//// else
|
|
1455
|
+
//// [_commandBuffer addObject: data];
|
|
1456
|
+
////}
|
|
1457
|
+
/////**
|
|
1458
|
+
//// * 55.页模式下设置纵向相对位置
|
|
1459
|
+
//// */
|
|
1460
|
+
////- (void)PosSetVertRelativeLocationOnPageModelWith:(int)nL nH:(int)nH {
|
|
1461
|
+
//// Byte kValue[4] = {0};
|
|
1462
|
+
//// kValue[0] = 29;
|
|
1463
|
+
//// kValue[1] = 92;
|
|
1464
|
+
//// kValue[2] = nL;
|
|
1465
|
+
//// kValue[3] =nH;
|
|
1466
|
+
////
|
|
1467
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1468
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1469
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1470
|
+
//// if (commandSendMode==0)
|
|
1471
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1472
|
+
//// else
|
|
1473
|
+
//// [_commandBuffer addObject: data];
|
|
1474
|
+
////}
|
|
1475
|
+
/////**
|
|
1476
|
+
//// * 56.执行宏命令
|
|
1477
|
+
//// */
|
|
1478
|
+
////- (void)PosRunMacroMommandWith:(int)r t:(int)t m:(int)m {
|
|
1479
|
+
//// Byte kValue[5] = {0};
|
|
1480
|
+
//// kValue[0] = 29;
|
|
1481
|
+
//// kValue[1] = 94;
|
|
1482
|
+
//// kValue[2] = r;
|
|
1483
|
+
//// kValue[3] = t;
|
|
1484
|
+
//// kValue[4] = m;
|
|
1485
|
+
////
|
|
1486
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1487
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1488
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1489
|
+
//// if (commandSendMode==0)
|
|
1490
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1491
|
+
//// else
|
|
1492
|
+
//// [_commandBuffer addObject: data];
|
|
1493
|
+
////}
|
|
1494
|
+
/////**
|
|
1495
|
+
//// * 57.打开/关闭自动状态反传功能(ASB)
|
|
1496
|
+
//// */
|
|
1497
|
+
////- (void)PosOpenOrCloseASB:(int)n {
|
|
1498
|
+
//// Byte kValue[3] = {0};
|
|
1499
|
+
//// kValue[0] = 29;
|
|
1500
|
+
//// kValue[1] = 97;
|
|
1501
|
+
//// kValue[2] = n;
|
|
1502
|
+
////
|
|
1503
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1504
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1505
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1506
|
+
//// if (commandSendMode==0)
|
|
1507
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1508
|
+
//// else
|
|
1509
|
+
//// [_commandBuffer addObject: data];
|
|
1510
|
+
////}
|
|
1511
|
+
/////**
|
|
1512
|
+
//// * 58.选择HRI使用字体
|
|
1513
|
+
//// */
|
|
1514
|
+
////- (void)PosSelectHRIFontToUse:(int)n {
|
|
1515
|
+
//// Byte kValue[3] = {0};
|
|
1516
|
+
//// kValue[0] = 29;
|
|
1517
|
+
//// kValue[1] = 102;
|
|
1518
|
+
//// kValue[2] = n;
|
|
1519
|
+
////
|
|
1520
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1521
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1522
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1523
|
+
//// if (commandSendMode==0)
|
|
1524
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1525
|
+
//// else
|
|
1526
|
+
//// [_commandBuffer addObject: data];
|
|
1527
|
+
////}
|
|
1528
|
+
/////**
|
|
1529
|
+
//// * 59. 选择条码高度
|
|
1530
|
+
//// */
|
|
1531
|
+
////- (void)PosSelectBarcodeHeight:(int)n {
|
|
1532
|
+
//// Byte kValue[3] = {0};
|
|
1533
|
+
//// kValue[0] = 29;
|
|
1534
|
+
//// kValue[1] = 104;
|
|
1535
|
+
//// kValue[2] = n;
|
|
1536
|
+
////
|
|
1537
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1538
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1539
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1540
|
+
//// if (commandSendMode==0)
|
|
1541
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1542
|
+
//// else
|
|
1543
|
+
//// [_commandBuffer addObject: data];
|
|
1544
|
+
////}
|
|
1545
|
+
/////**
|
|
1546
|
+
//// * 60.打印条码
|
|
1547
|
+
//// */
|
|
1548
|
+
////- (void)PosPrintBarCodeWithPoints:(int)m n:(int)n points:(NSArray *)points selectModel:(int)model {
|
|
1549
|
+
////
|
|
1550
|
+
//// Byte kValue[4+points.count];
|
|
1551
|
+
//// kValue[0] = 29;
|
|
1552
|
+
//// kValue[1] = 107;
|
|
1553
|
+
//// kValue[2] = m;
|
|
1554
|
+
////
|
|
1555
|
+
//// if (model == 0) {
|
|
1556
|
+
//// for (int i = 0; i<points.count; i++) {
|
|
1557
|
+
//// NSString *str = points[i];
|
|
1558
|
+
//// kValue[3+i] = str.intValue;
|
|
1559
|
+
//// if (i == points.count-1) {
|
|
1560
|
+
//// kValue[4+i] = 0;
|
|
1561
|
+
//// }
|
|
1562
|
+
//// }
|
|
1563
|
+
//// }else if (model == 1) {
|
|
1564
|
+
//// kValue[3] = n;
|
|
1565
|
+
//// for (int i = 0; i<points.count; i++) {
|
|
1566
|
+
//// NSString *str = points[i];
|
|
1567
|
+
//// kValue[4+i] = str.intValue;
|
|
1568
|
+
//// }
|
|
1569
|
+
//// }
|
|
1570
|
+
////
|
|
1571
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1572
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1573
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1574
|
+
//// if (commandSendMode==0)
|
|
1575
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1576
|
+
//// else
|
|
1577
|
+
//// [_commandBuffer addObject: data];
|
|
1578
|
+
////
|
|
1579
|
+
////}
|
|
1580
|
+
/////**
|
|
1581
|
+
//// * 61.返回状态
|
|
1582
|
+
//// */
|
|
1583
|
+
////- (void)PosCallBackStatus:(int)n completion:(PosWIFICallBackBlock)block {
|
|
1584
|
+
//// self.callBackBlock = block;
|
|
1585
|
+
//// Byte kValue[3] = {0};
|
|
1586
|
+
//// kValue[0] = 29;
|
|
1587
|
+
//// kValue[1] = 114;
|
|
1588
|
+
//// kValue[2] = n;
|
|
1589
|
+
////
|
|
1590
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1591
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1592
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1593
|
+
//// if (commandSendMode==0)
|
|
1594
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1595
|
+
//// else
|
|
1596
|
+
//// [_commandBuffer addObject: data];
|
|
1597
|
+
////}
|
|
1598
|
+
/////**
|
|
1599
|
+
//// * 62.打印光栅位图
|
|
1600
|
+
//// */
|
|
1601
|
+
////- (void)PosPrintRasterBitmapWith:(int)m
|
|
1602
|
+
//// xL:(int)xL
|
|
1603
|
+
//// xH:(int)xH
|
|
1604
|
+
//// yl:(int)yL
|
|
1605
|
+
//// yh:(int)yH
|
|
1606
|
+
//// points:(NSArray *)points
|
|
1607
|
+
////{
|
|
1608
|
+
//// Byte kValue[8+points.count];
|
|
1609
|
+
//// kValue[0] = 29;
|
|
1610
|
+
//// kValue[1] = 118;
|
|
1611
|
+
//// kValue[2] = 48;
|
|
1612
|
+
//// kValue[3] = m;
|
|
1613
|
+
//// kValue[4] = xL;
|
|
1614
|
+
//// kValue[5] = xH;
|
|
1615
|
+
//// kValue[6] = yL;
|
|
1616
|
+
//// kValue[7] = yH;
|
|
1617
|
+
////
|
|
1618
|
+
//// for (int i = 0; i<points.count; i++) {
|
|
1619
|
+
//// NSString *str = points[i];
|
|
1620
|
+
//// kValue[8+i] =str.intValue;
|
|
1621
|
+
//// }
|
|
1622
|
+
////
|
|
1623
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1624
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1625
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1626
|
+
//// if (commandSendMode==0)
|
|
1627
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1628
|
+
//// else
|
|
1629
|
+
//// [_commandBuffer addObject: data];
|
|
1630
|
+
////}
|
|
1631
|
+
/////**
|
|
1632
|
+
//// * 63.设置条码宽度
|
|
1633
|
+
//// */
|
|
1634
|
+
////- (void)PosSetBarcodeWidth:(int)n {
|
|
1635
|
+
//// Byte kValue[3] = {0};
|
|
1636
|
+
//// kValue[0] = 29;
|
|
1637
|
+
//// kValue[1] = 119;
|
|
1638
|
+
//// kValue[2] = n;
|
|
1639
|
+
////
|
|
1640
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1641
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1642
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1643
|
+
//// if (commandSendMode==0)
|
|
1644
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1645
|
+
//// else
|
|
1646
|
+
//// [_commandBuffer addObject: data];
|
|
1647
|
+
////}
|
|
1648
|
+
////#pragma mark - ============汉字字符控制命令============
|
|
1649
|
+
/////**
|
|
1650
|
+
//// * 64.设置汉字字符模式
|
|
1651
|
+
//// */
|
|
1652
|
+
////- (void)PosSetChineseCharacterModel:(int)n {
|
|
1653
|
+
//// Byte kValue[3] = {0};
|
|
1654
|
+
//// kValue[0] = 28;
|
|
1655
|
+
//// kValue[1] = 33;
|
|
1656
|
+
//// kValue[2] = n;
|
|
1657
|
+
////
|
|
1658
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1659
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1660
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1661
|
+
//// if (commandSendMode==0)
|
|
1662
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1663
|
+
//// else
|
|
1664
|
+
//// [_commandBuffer addObject: data];
|
|
1665
|
+
////}
|
|
1666
|
+
/////**
|
|
1667
|
+
//// * 65.选择汉字模式
|
|
1668
|
+
//// */
|
|
1669
|
+
////- (void)PosSelectChineseCharacterModel {
|
|
1670
|
+
//// Byte kValue[2] = {0};
|
|
1671
|
+
//// kValue[0] = 28;
|
|
1672
|
+
//// kValue[1] = 38;
|
|
1673
|
+
////
|
|
1674
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1675
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1676
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1677
|
+
//// if (commandSendMode==0)
|
|
1678
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1679
|
+
//// else
|
|
1680
|
+
//// [_commandBuffer addObject: data];
|
|
1681
|
+
////}
|
|
1682
|
+
/////**
|
|
1683
|
+
//// * 66.选择/取消汉字下划线模式
|
|
1684
|
+
//// */
|
|
1685
|
+
////- (void)PosSelectOrCancelChineseUderlineModel:(int)n {
|
|
1686
|
+
//// Byte kValue[3] = {0};
|
|
1687
|
+
//// kValue[0] = 28;
|
|
1688
|
+
//// kValue[1] = 45;
|
|
1689
|
+
//// kValue[2] = n;
|
|
1690
|
+
////
|
|
1691
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1692
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1693
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1694
|
+
//// if (commandSendMode==0)
|
|
1695
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1696
|
+
//// else
|
|
1697
|
+
//// [_commandBuffer addObject: data];
|
|
1698
|
+
////}
|
|
1699
|
+
/////**
|
|
1700
|
+
//// * 67.取消汉字模式
|
|
1701
|
+
//// */
|
|
1702
|
+
////- (void)PosCancelChineseModel {
|
|
1703
|
+
//// Byte kValue[2] = {0};
|
|
1704
|
+
//// kValue[0] = 28;
|
|
1705
|
+
//// kValue[1] = 46;
|
|
1706
|
+
////
|
|
1707
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1708
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1709
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1710
|
+
//// if (commandSendMode==0)
|
|
1711
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1712
|
+
//// else
|
|
1713
|
+
//// [_commandBuffer addObject: data];
|
|
1714
|
+
////}
|
|
1715
|
+
/////**
|
|
1716
|
+
//// * 68.定义用户自定义汉字
|
|
1717
|
+
//// */
|
|
1718
|
+
////- (void)PosDefineCustomChinesePointsC1:(int)c1 c2:(int)c2 points:(NSArray *)points {
|
|
1719
|
+
//// Byte kValue[4 + points.count];
|
|
1720
|
+
//// kValue[0] = 28;
|
|
1721
|
+
//// kValue[1] = 50;
|
|
1722
|
+
//// kValue[2] = c1;
|
|
1723
|
+
//// kValue[3] = c2;
|
|
1724
|
+
////
|
|
1725
|
+
//// for (int i=0; i<points.count; i++) {
|
|
1726
|
+
//// NSString *str = points[i];
|
|
1727
|
+
//// kValue[4+i] = str.intValue;
|
|
1728
|
+
//// }
|
|
1729
|
+
////
|
|
1730
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1731
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1732
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1733
|
+
//// if (commandSendMode==0)
|
|
1734
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1735
|
+
//// else
|
|
1736
|
+
//// [_commandBuffer addObject: data];
|
|
1737
|
+
////
|
|
1738
|
+
////}
|
|
1739
|
+
/////**
|
|
1740
|
+
//// * 69.设置汉字字符左右间距
|
|
1741
|
+
//// */
|
|
1742
|
+
////- (void)PosSetChineseMarginWithLeftN1:(int)n1 n2:(int)n2 {
|
|
1743
|
+
//// Byte kValue[4] = {0};
|
|
1744
|
+
//// kValue[0] = 28;
|
|
1745
|
+
//// kValue[1] = 83;
|
|
1746
|
+
//// kValue[2] = n1;
|
|
1747
|
+
//// kValue[3] = n2;
|
|
1748
|
+
////
|
|
1749
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1750
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1751
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1752
|
+
//// if (commandSendMode==0)
|
|
1753
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1754
|
+
//// else
|
|
1755
|
+
//// [_commandBuffer addObject: data];
|
|
1756
|
+
////}
|
|
1757
|
+
/////**
|
|
1758
|
+
//// * 70.选择/取消汉字倍高倍宽
|
|
1759
|
+
//// */
|
|
1760
|
+
////- (void)PosSelectOrCancelChineseHModelAndWModel:(int)n {
|
|
1761
|
+
//// Byte kValue[3] = {0};
|
|
1762
|
+
//// kValue[0] = 28;
|
|
1763
|
+
//// kValue[1] = 87;
|
|
1764
|
+
//// kValue[2] = n;
|
|
1765
|
+
////
|
|
1766
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1767
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1768
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1769
|
+
//// if (commandSendMode==0)
|
|
1770
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1771
|
+
//// else
|
|
1772
|
+
//// [_commandBuffer addObject: data];
|
|
1773
|
+
////}
|
|
1774
|
+
////#pragma mark - ============打印机提示命令============
|
|
1775
|
+
/////**
|
|
1776
|
+
//// * 72.打印机来单打印蜂鸣提示
|
|
1777
|
+
//// */
|
|
1778
|
+
////- (void)PosPrinterSound:(int)n t:(int)t {
|
|
1779
|
+
//// Byte kValue[4] = {0};
|
|
1780
|
+
//// kValue[0] = 27;
|
|
1781
|
+
//// kValue[1] = 66;
|
|
1782
|
+
//// kValue[2] = n;
|
|
1783
|
+
//// kValue[3] = t;
|
|
1784
|
+
////
|
|
1785
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1786
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1787
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1788
|
+
//// if (commandSendMode==0)
|
|
1789
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1790
|
+
//// else
|
|
1791
|
+
//// [_commandBuffer addObject: data];
|
|
1792
|
+
////}
|
|
1793
|
+
/////**
|
|
1794
|
+
//// * 73.打印机来单打印蜂鸣提示及报警灯闪烁
|
|
1795
|
+
//// */
|
|
1796
|
+
////- (void)PosPrinterSoundAndAlarmLight:(int)m t:(int)t n:(int)n {
|
|
1797
|
+
//// Byte kValue[5] = {0};
|
|
1798
|
+
//// kValue[0] = 27;
|
|
1799
|
+
//// kValue[1] = 67;
|
|
1800
|
+
//// kValue[2] = m;
|
|
1801
|
+
//// kValue[3] = t;
|
|
1802
|
+
//// kValue[4] = n;
|
|
1803
|
+
////
|
|
1804
|
+
//// NSData *data = [NSData dataWithBytes:&kValue length:sizeof(kValue)];
|
|
1805
|
+
//// NSLog(@"%@",[NSString stringWithFormat:@"写入:%@",data]);
|
|
1806
|
+
//// //[_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1807
|
+
//// if (commandSendMode==0)
|
|
1808
|
+
//// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1809
|
+
//// else
|
|
1810
|
+
//// [_commandBuffer addObject: data];
|
|
1811
|
+
////}
|
|
1812
|
+
//
|
|
1813
|
+
//
|
|
1814
|
+
//-(NSArray*)POSGetBuffer
|
|
1815
|
+
//{
|
|
1816
|
+
// return [_commandBuffer copy];
|
|
1817
|
+
//}
|
|
1818
|
+
//
|
|
1819
|
+
//-(void)POSClearBuffer
|
|
1820
|
+
//{
|
|
1821
|
+
// [_commandBuffer removeAllObjects];
|
|
1822
|
+
//}
|
|
1823
|
+
//
|
|
1824
|
+
//-(void)sendCommand:(NSData *)data
|
|
1825
|
+
//{
|
|
1826
|
+
// [_sendSocket writeData:data withTimeout:-1 tag:0];
|
|
1827
|
+
//}
|
|
1828
|
+
//
|
|
1829
|
+
//-(void)POSSendCommandBuffer
|
|
1830
|
+
//{
|
|
1831
|
+
// float timeInterver=0.5;
|
|
1832
|
+
//
|
|
1833
|
+
// for (int t=0;t<[_commandBuffer count];t++)
|
|
1834
|
+
// {
|
|
1835
|
+
// //[self performSelectorOnMainThread:@selector(sendCommand:) withObject:_commandBuffer[t] waitUntilDone:NO ];
|
|
1836
|
+
// [self performSelector:@selector(sendCommand:) withObject:_commandBuffer[t] afterDelay:timeInterver];
|
|
1837
|
+
// timeInterver=timeInterver+0.2;
|
|
1838
|
+
// }
|
|
1839
|
+
// [_commandBuffer removeAllObjects];
|
|
1840
|
+
//}
|
|
1841
|
+
//
|
|
1842
|
+
//- (void)POSSetCommandMode:(BOOL)Mode{
|
|
1843
|
+
// commandSendMode=Mode;
|
|
1844
|
+
//}
|
|
1845
|
+
//
|
|
1846
|
+
//
|
|
1847
|
+
//@end
|