| CustomiOSApi 1.09

CommPort.h
1//
2// CommPort.h
3// CustomiOSApi
4//
5// Created by CUSTOM on 03/07/13.
6// Copyright (c) 2013 CUSTOM. All rights reserved.
7//
8
9#import <Foundation/Foundation.h>
10#import <ExternalAccessory/ExternalAccessory.h>
11#import "CustomPrinter.h"
12#import "LibConst.h"
13#import <CoreBluetooth/CoreBluetooth.h>
14
15//Hide it in the documentation
16// @cond PRIVATE
17@interface CommPort : NSObject <NSStreamDelegate>
18{
19 @public
20
24 enum CommPortStatus
25 {
26 CPORT_STS_CLOSED = 0,
27 CPORT_STS_OPEN = 1,
28 };
29
30 NSInteger readTimeout; // READ Timeout
31 NSInteger writeTimeout; // WRITE Timeout
32 NSInteger connectTimeout; // CONNECT Timeout
33
34 @protected
35
36 @private
37
38}
39
40//***********************************************
41// COMMON FUNCTIONS
42//***********************************************
43
44//@Override
45- (void) Close:(NSError**)error;
46
47//@Override
48- (enum CommPortType) GetPortType;
49
50//@Override
51- (NSInteger) GetPortMaxPacketSize;
52
53//@Override
54- (bool) IsCommunicationOpen:(NSError**)error;
55
56//@Override
57- (void) WriteDataToDevice:(NSData *)data :(NSError**)error;
58
59//@Override
60- (void) WriteDataToDeviceGR:(NSData *)data :(NSError**)error;
61
62//@Override
63- (void) ClearReadBuffer:(NSError**)error;
64
65//@Override
66- (NSData *) ReadDataFromDevice:(NSError**)error;
67
68//@Override
69- (NSData *) WriteDataForResponse:(NSData *)data :(NSInteger)readSize :(NSError**)error;
70
71//@Override
72- (NSInteger) GetPrinterId:(NSError**)error;
73
74//@Override
75- (NSInteger) GetPrinterId5:(NSError**)error;
76
77//@Override
78- (NSInteger)GetWriteTimeout;
79
80//@Override
81- (void)SetWriteTimeout:(NSInteger)msec;
82
83//@Override
84- (NSInteger)GetReadTimeout;
85
86//@Override
87- (void)SetReadTimeout:(NSInteger)msec;
88
89//***********************************************
90// BLUETOOTH FUNCTIONS
91//***********************************************
92- (int) BluetoothConnect:(EAAccessory *)btdevice :(NSError**)error;
93
94//***********************************************
95// ETHERNET/WIFI FUNCTIONS
96//***********************************************
97- (int) WIFIConnect:(NSString*)printerIpAddr :(NSInteger)printerIpPort :(NSError**)error;
98
99//***********************************************
100// BLE FUNCTIONS
101//***********************************************
102- (Boolean)InitBLE;
103- (int) BluetoothLowEnergyConnect:(CBPeripheral *)bleperipheral :(NSError**)error;
104
105@end