Commit 506b3e59 authored by lujunye's avatar lujunye

清楚错误包

parent fe236e05
...@@ -435,7 +435,6 @@ ...@@ -435,7 +435,6 @@
E0F1BE4924692379003015B2 /* ItemCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F1BE4724692379003015B2 /* ItemCell.xib */; }; E0F1BE4924692379003015B2 /* ItemCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F1BE4724692379003015B2 /* ItemCell.xib */; };
E0F3C2CB24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F3C2C924590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift */; }; E0F3C2CB24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F3C2C924590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift */; };
E0F3C2CC24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F3C2CA24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib */; }; E0F3C2CC24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F3C2CA24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib */; };
E0F6002C25E77D6600B9BF34 /* GSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0F6002B25E77D6600B9BF34 /* GSDK.a */; };
E0F8E91B248737F100817A08 /* NewOnlyRKCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F8E919248737F100817A08 /* NewOnlyRKCell.swift */; }; E0F8E91B248737F100817A08 /* NewOnlyRKCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F8E919248737F100817A08 /* NewOnlyRKCell.swift */; };
E0F8E91C248737F100817A08 /* NewOnlyRKCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F8E91A248737F100817A08 /* NewOnlyRKCell.xib */; }; E0F8E91C248737F100817A08 /* NewOnlyRKCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F8E91A248737F100817A08 /* NewOnlyRKCell.xib */; };
E0F8E91F248747D200817A08 /* NewCKVc.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F8E91D248747D200817A08 /* NewCKVc.swift */; }; E0F8E91F248747D200817A08 /* NewCKVc.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F8E91D248747D200817A08 /* NewCKVc.swift */; };
...@@ -1171,16 +1170,6 @@ ...@@ -1171,16 +1170,6 @@
E0F1BE4724692379003015B2 /* ItemCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ItemCell.xib; sourceTree = "<group>"; }; E0F1BE4724692379003015B2 /* ItemCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ItemCell.xib; sourceTree = "<group>"; };
E0F3C2C924590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XinZengAndBianJiKeHuViewController.swift; sourceTree = "<group>"; }; E0F3C2C924590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XinZengAndBianJiKeHuViewController.swift; sourceTree = "<group>"; };
E0F3C2CA24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XinZengAndBianJiKeHuViewController.xib; sourceTree = "<group>"; }; E0F3C2CA24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XinZengAndBianJiKeHuViewController.xib; sourceTree = "<group>"; };
E0F6002225E77D6600B9BF34 /* EthernetConnecter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EthernetConnecter.h; sourceTree = "<group>"; };
E0F6002325E77D6600B9BF34 /* GPUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUtils.h; sourceTree = "<group>"; };
E0F6002425E77D6600B9BF34 /* EscCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EscCommand.h; sourceTree = "<group>"; };
E0F6002525E77D6600B9BF34 /* CPCLData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPCLData.h; sourceTree = "<group>"; };
E0F6002625E77D6600B9BF34 /* ConnecterBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConnecterBlock.h; sourceTree = "<group>"; };
E0F6002725E77D6600B9BF34 /* TscCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TscCommand.h; sourceTree = "<group>"; };
E0F6002825E77D6600B9BF34 /* BLEConnecter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BLEConnecter.h; sourceTree = "<group>"; };
E0F6002925E77D6600B9BF34 /* Connecter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Connecter.h; sourceTree = "<group>"; };
E0F6002A25E77D6600B9BF34 /* CPCLCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPCLCommand.h; sourceTree = "<group>"; };
E0F6002B25E77D6600B9BF34 /* GSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = GSDK.a; sourceTree = "<group>"; };
E0F8E919248737F100817A08 /* NewOnlyRKCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewOnlyRKCell.swift; sourceTree = "<group>"; }; E0F8E919248737F100817A08 /* NewOnlyRKCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewOnlyRKCell.swift; sourceTree = "<group>"; };
E0F8E91A248737F100817A08 /* NewOnlyRKCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NewOnlyRKCell.xib; sourceTree = "<group>"; }; E0F8E91A248737F100817A08 /* NewOnlyRKCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NewOnlyRKCell.xib; sourceTree = "<group>"; };
E0F8E91D248747D200817A08 /* NewCKVc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewCKVc.swift; sourceTree = "<group>"; }; E0F8E91D248747D200817A08 /* NewCKVc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewCKVc.swift; sourceTree = "<group>"; };
...@@ -1508,7 +1497,6 @@ ...@@ -1508,7 +1497,6 @@
F96A581D24790D9A0070A057 /* libxml2.2.tbd in Frameworks */, F96A581D24790D9A0070A057 /* libxml2.2.tbd in Frameworks */,
E09B3AD424B2FCAF00E3B238 /* ShareSDKConfigFile.framework in Frameworks */, E09B3AD424B2FCAF00E3B238 /* ShareSDKConfigFile.framework in Frameworks */,
E09B3ADA24B2FCAF00E3B238 /* ShareSDK.framework in Frameworks */, E09B3ADA24B2FCAF00E3B238 /* ShareSDK.framework in Frameworks */,
E0F6002C25E77D6600B9BF34 /* GSDK.a in Frameworks */,
E09B3AD924B2FCAF00E3B238 /* WechatConnector.framework in Frameworks */, E09B3AD924B2FCAF00E3B238 /* WechatConnector.framework in Frameworks */,
E02870C7258C547E00271055 /* MAMapKit.framework in Frameworks */, E02870C7258C547E00271055 /* MAMapKit.framework in Frameworks */,
F93E32092473CD6500524DFC /* libresolv.tbd in Frameworks */, F93E32092473CD6500524DFC /* libresolv.tbd in Frameworks */,
...@@ -2328,8 +2316,6 @@ ...@@ -2328,8 +2316,6 @@
E09B3AB624B2FCAF00E3B238 /* SDK */ = { E09B3AB624B2FCAF00E3B238 /* SDK */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E0F6002125E77D6600B9BF34 /* GSDK */,
E0F6002B25E77D6600B9BF34 /* GSDK.a */,
E09B3AB724B2FCAF00E3B238 /* ShareSDK */, E09B3AB724B2FCAF00E3B238 /* ShareSDK */,
E09B3ACD24B2FCAF00E3B238 /* Required */, E09B3ACD24B2FCAF00E3B238 /* Required */,
); );
...@@ -2746,22 +2732,6 @@ ...@@ -2746,22 +2732,6 @@
path = PurchaseModel; path = PurchaseModel;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
E0F6002125E77D6600B9BF34 /* GSDK */ = {
isa = PBXGroup;
children = (
E0F6002225E77D6600B9BF34 /* EthernetConnecter.h */,
E0F6002325E77D6600B9BF34 /* GPUtils.h */,
E0F6002425E77D6600B9BF34 /* EscCommand.h */,
E0F6002525E77D6600B9BF34 /* CPCLData.h */,
E0F6002625E77D6600B9BF34 /* ConnecterBlock.h */,
E0F6002725E77D6600B9BF34 /* TscCommand.h */,
E0F6002825E77D6600B9BF34 /* BLEConnecter.h */,
E0F6002925E77D6600B9BF34 /* Connecter.h */,
E0F6002A25E77D6600B9BF34 /* CPCLCommand.h */,
);
path = GSDK;
sourceTree = "<group>";
};
E0F97B05245161E6001BD600 /* 商品详情 */ = { E0F97B05245161E6001BD600 /* 商品详情 */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
......
...@@ -26,6 +26,6 @@ ...@@ -26,6 +26,6 @@
#import "JZLocationConverter.h" #import "JZLocationConverter.h"
//#import "BLEConnecter.h"
#endif /* Bridge_Header_h */ #endif /* Bridge_Header_h */
//
// Connecter.h
// GSDK
//
// Created by 猿史森林 on 2018/6/15.
// Copyright © 2018年 Smarnet. All rights reserved.
//
#import "Connecter.h"
#import <CoreBluetooth/CoreBluetooth.h>
@interface BLEConnecter :Connecter
@property(nonatomic,strong)CBCharacteristic *airPatchChar;
@property(nonatomic,strong)CBCharacteristic *transparentDataWriteChar;
@property(nonatomic,strong)CBCharacteristic *transparentDataReadOrNotifyChar;
@property(nonatomic,strong)CBCharacteristic *connectionParameterChar;
@property(nonatomic,strong)CBUUID *transServiceUUID;
@property(nonatomic,strong)CBUUID *transTxUUID;
@property(nonatomic,strong)CBUUID *transRxUUID;
@property(nonatomic,strong)CBUUID *disUUID1;
@property(nonatomic,strong)CBUUID *disUUID2;
@property(nonatomic,strong)NSArray *serviceUUID;
@property(nonatomic,copy)DiscoverDevice discover;
@property(nonatomic,copy)UpdateState updateState;
@property(nonatomic,copy)WriteProgress writeProgress;
/**数据包大小,默认130个字节*/
@property(nonatomic,assign)NSUInteger datagramSize;
@property(nonatomic,strong)CBPeripheral *connPeripheral;
//+(instancetype)sharedInstance;
/**
* 方法说明:设置特定的Service UUID,以及Service对应的具有读、写特征值
* @param serviceUUID 蓝牙模块的service uuid
* @param txUUID 具有写入权限特征值
* @param rxUUID 具有读取权限特征值
*/
- (void)configureTransparentServiceUUID: (NSString *)serviceUUID txUUID:(NSString *)txUUID rxUUID:(NSString *)rxUUID;
/**
* 方法说明:扫描外设
* @param serviceUUIDs 需要连接的外设UUID
* @param options 其它可选操作
* @param discover 发现设备
* peripheral 发现的外设
* advertisementData
* RSSI 外设信号强度
*/
-(void)scanForPeripheralsWithServices:(nullable NSArray<CBUUID *> *)serviceUUIDs options:(nullable NSDictionary<NSString *, id> *)options discover:(void(^_Nullable)(CBPeripheral *_Nullable peripheral,NSDictionary<NSString *, id> *_Nullable advertisementData,NSNumber *_Nullable RSSI))discover;
/**
* 方法说明:停止扫描蓝牙外设
*/
-(void)stopScan;
/**
* 方法说明:更新蓝牙状态
* @param state 更新蓝牙状态
*/
-(void)didUpdateState:(void(^_Nullable)(NSInteger state))state;
/**
* 方法说明:连接外设
* @param peripheral 需要连接的外设
* @param options 其它可选操作
* @param timeout 连接超时
* @param connectState 连接状态
*/
-(void)connectPeripheral:(CBPeripheral *_Nullable)peripheral options:(nullable NSDictionary<NSString *,id> *)options timeout:(NSUInteger)timeout connectBlack:(void(^_Nullable)(ConnectState state)) connectState;
/**
* 方法说明:连接外设
* @param peripheral 需要连接的外设
* @param options 其它可选操作
*/
-(void)connectPeripheral:(CBPeripheral * _Nullable)peripheral options:(nullable NSDictionary<NSString *,id> *)options;
/**
* 方法说明:断开连接
* @param peripheral 需要断开连接的外设
*/
-(void)closePeripheral:(nonnull CBPeripheral *)peripheral;
/**
* 方法说明: 往蓝牙模块中写入数据
* @param data 往蓝牙模块中写入的数据
* @param progress 写入数据的进度
* @param callBack 读取蓝牙模块返回数据
*/
-(void)write:(NSData *_Nullable)data progress:(void(^_Nullable)(NSUInteger total,NSUInteger progress))progress receCallBack:(void (^_Nullable)(NSData *_Nullable))callBack;
/**
* 方法说明: 往蓝牙模块中写入数据
* @param characteristic 特征值
* @param data 往蓝牙模块中写入的数据
* @param type 写入方式<b>CBCharacteristicWriteWithResponse</b>写入方式是带流控写入方式。<b>CBCharacteristicWriteWithoutResponse</b>不带流控写入方式 <p><b>@see CBCharacteristicWriteType</b></p>
*/
-(void)writeValue:(NSData *)data forCharacteristic:(nonnull CBCharacteristic *)characteristic type:(CBCharacteristicWriteType)type;
@end
//
// CPCLCommand.h
// GPSDKDemo
//
// Created by max on 2020/7/22.
// Copyright © 2020 max. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
// 字体枚举
typedef enum {
FONT_00 = 0,
FONT_01 = 1,
FONT_02 = 2,
FONT_03 = 3,
FONT_04 = 4,
FONT_05 = 5,
FONT_06 = 6,
FONT_07 = 7,
FONT_08 = 8,
FONT_010 = 10,
FONT_011 = 11,
FONT_013 = 13,
FONT_020 = 20,
FONT_024 = 24,
FONT_041 = 41,
FONT_042 = 42,
FONT_043 = 43,
FONT_044 = 44,
FONT_045 = 45,
FONT_046 = 46,
FONT_047 = 47,
FONT_048_00 = 48,
FONT_048_01 = 48,
FONT_055 = 55,
}TEXTFONT;
// 打印图片方式枚举
typedef NS_ENUM (NSUInteger,GRAPHICS){
EXPANDED = 0,//横向打印扩展图形
COMPRESSED = 1,//横向打印压缩图形
};
// 条码种类枚举
typedef NS_ENUM (NSUInteger,CPCLBARCODETYPE) {
Code128=1,
Upc_A = 2,
Upc_E = 3,
Ean13 = 4,
Ean8 = 5,
Code39 = 6,
Code93 = 7,
Codebar = 8,
};
// 速度枚举
typedef enum {
SPEED00 = 0,
SPEED01 = 1,
SPEED02 = 2,
SPEED03 = 3,
SPEED04 = 4,
SPEED05 = 5,
}CPCLSPEED;
// 字段的对齐方式枚举
typedef NS_ENUM (NSUInteger,ALIGNMENT) {
CENTER = 0,
LEFT = 1,
RIGHT = 2,
};
// 字体指令枚举
typedef NS_ENUM (NSUInteger,TEXTCOMMAND) {
T = 0, // 横向打印文本。
VT = 1, // 逆时针旋转 90 度,纵向打印文本。
T90 = 2, // 同上
T180 = 3, // 逆时针旋转 80 度,反转打印文本。
T270 = 4, // 逆时针旋转 270 度,纵向打印文本。
};
// 宽窄比枚举
typedef enum {
Point0 = 0,//1.5:1
Point1 = 1,//2.0:1
Point2 = 2,//2.5:1
Point3 = 3,//3.0:1
Point4 = 4,//3.5:1
Point20 = 20,//2.0:1
Point21 = 21,//2.1:1
Point22 = 22,//2.2:1
Point23 = 23,//2.3:1
Point24 = 24,//2.4:1
Point25 = 25,//2.5:1
Point26 = 26,//2.6:1
Point27 = 27,//2.7:1
Point28 = 28,//2.8:1
Point29 = 29,//2.9:1
Point30 = 30,//3.0:1
}BARCODERATIO;//宽窄比
// 横向或纵向打印枚举
typedef NS_ENUM (NSUInteger,COMMAND){
BARCODE = 0,
VBARCODE = 1,
};
@interface CPCLCommand : NSObject
/**
* 方法说明:初始化
* @param offset 标签横向偏移量
* @param height 标签最大高度
* @param qty 打印标签的张数
*/
-(void)addInitializePrinterwithOffset:(int)offset withHeight:(int)height withQTY:(int)qty;
/**
* 方法说明:打印标签
*/
-(void)addPrint;
/**
* 方法说明:获得打印命令
* @return NSData
*/
-(NSData*)getCommand;
/**
* 方法说明:在标签上添加文本
* @param type 指令
* @param font 字体类型
* @param x 横向起始位置
* @param y 纵向起始位置
* @param text 打印的文本
*/
-(void)addText:(TEXTCOMMAND)type withFont:(TEXTFONT)font withXstart:(int)x withYstart:(int)y withContent:(NSString*)text;
/**
* 方法说明:将字体放大指定的放大倍数
* @param w 宽度放大倍数,有效放大倍数为 1 到 16
* @param h 高度放大倍数,有效放大倍数为 1 到 16
*/
-(void)addSetmagWithWidthScale:(int)w withHeightScale:(int)h;
/**
* 方法说明:以指定的宽度和高度纵向和横向打印条码
* @param command 横向或纵向打印
* @param type 条码种类
* @param width 条码窄条的单位宽度
* @param ratio 条码宽条与窄条的比率
* @param height 条码的单位高度
* @param x 横向起始位置
* @param y 纵向起始位置
* @param text 条码内容
*/
-(void)addBarcode:(COMMAND)command withType:(CPCLBARCODETYPE)type withWidth:(int)width withRatio:(BARCODERATIO)ratio withHeight:(int)height withXstart:(int)x withYstart:(int)y withString:(NSString*)text;
/**
* 方法说明:打印二维码
* @param command 横向或纵向打印
* @param x 横向起始位置
* @param y 纵向起始位置
* @param n QR Code 规范编号,1 或 2,默认推荐为 2
* @param u 模块的单位宽度/单位高度 1-32,默认为 6
* @param text 二维码内容
*/
-(void)addQrcode:(COMMAND)command withXstart:(int)x withYstart:(int)y with:(int)n with:(int)u withString:(NSString*)text;
/**
* 方法说明:添加条码注释
* @param font 注释条码时要使用的字体号
* @param offset 文本距离条码的单位偏移量
*/
-(void)addBarcodeTextWithFont:(int)font withOffset:(int)offset;
/**
* 方法说明:禁用条码注释
*/
-(void)addBarcodeTextOff;
/**
* 方法说明:打印图片
* @param command 指令
* @param x 起始点的X 坐标
* @param y 起始点的 Y 坐标
* @param img 图片
* @param maxWidth 最大宽度
*/
-(void)addGraphics:(GRAPHICS)command WithXstart:(int)x withYstart:(int)y withImage:(UIImage*)img withMaxWidth:(int)maxWidth;
/**
* 方法说明:打印任何长度、宽度和角度方向的线条
* @param x 起始点的X 坐标
* @param y 起始点的 Y 坐标
* @param xend 终止点的 X 坐标
* @param yend 终止点的 Y 坐标
* @param width 线条的单位宽度
*/
-(void)addLineWithXstart:(int)x withYstart:(int)y withXend:(int)xend withYend:(int)yend withWidth:(int)width;
/**
* 方法说明:打印指定线条宽度的矩形
* @param x 左上角的X 坐标
* @param y 左上角的 Y 坐标
* @param xend 右下角的 X 坐标
* @param yend 右下角的 Y 坐标
* @param thickness 形成矩形框的线条的单位宽度
*/
-(void)addBoxWithXstart:(int)x withYstart:(int)y withXend:(int)xend withYend:(int)yend withThickness:(int)thickness;
/**
* 方法说明:绘制反显区域,应先添加内容后再添加反显区域
* @param x 起始点的X 坐标
* @param y 起始点的 Y 坐标
* @param xend 终止点的 X 坐标
* @param yend 终止点的 Y 坐标
* @param width 反色区域高度
*/
-(void)addInverseLineWithXstart:(int)x withYstart:(int)y withXend:(int)xend withYend:(int)yend withWidth:(int)width;
/**
* 方法说明:控制字段的对齐方式
* @param align 对齐方式
*/
-(void)addJustification:(ALIGNMENT)align;
/**
* 方法说明:设置打印宽度
* @param width 页面的单位宽度
*/
-(void)addPagewidth:(int)width;
/**
* 方法说明:设置打印速度
* @param level 打印速度
*/
-(void)addSpeed:(CPCLSPEED)level;
/**
* 方法说明:让蜂鸣器发出给定时间长度的声音
* @param beep_length 蜂鸣持续时间,以 1/8 秒为单位递增
*/
-(void)addBeep:(int)beep_length;
/**
* 方法说明:查询打印机状态
*/
-(void)queryPrinterStatus;
@end
//
// CPCLData.h
// GPSDKDemo
//
// Created by max on 2020/7/23.
// Copyright © 2020 max. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface BitmapImage : NSObject
@property(nonatomic,strong)NSData* bitmap;
@property(nonatomic,assign)NSInteger width;
@property(nonatomic,assign)NSInteger height;
@end
@interface CPCLData : NSObject
@property(nonatomic,assign)NSInteger w;
@property(nonatomic,assign)NSInteger h;
- (id)initWithUIImage:(UIImage *)image maxWidth:(int)maxWidth;
-(NSData *)printCPCLData;
@end
//
// Connecter.h
// GSDK
//
// Created by 猿史森林 on 2018/6/16.
// Copyright © 2018年 Smarnet. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ConnecterBlock.h"
@interface Connecter:NSObject
//读取数据
@property(nonatomic,copy)ReadData readData;
//连接状态
@property(nonatomic,copy)ConnectDeviceState state;
/**
* 方法说明: 连接
*/
-(void)connect;
/**
* 方法说明: 连接到指定设备
* @param connectState 连接状态
*/
-(void)connect:(void(^)(ConnectState state))connectState;
/**
* 方法说明: 关闭连接
*/
-(void)close;
/**
* 发送数据
* 向输出流中写入数据
*/
-(void)write:(NSData *)data receCallBack:(void(^)(NSData *data))callBack;
-(void)write:(NSData *)data;
/**
* 读取数据
* @parma data 读取到的数据
*/
-(void)read:(void(^)(NSData *data))data;
@end
//
// ConnecterBlock.h
// GSDK
//
// Created by 猿史森林 on 2018/6/16.
// Copyright © 2018年 Smarnet. All rights reserved.
//
#ifndef ConnecterBlock_h
#define ConnecterBlock_h
#import <CoreBluetooth/CBPeripheral.h>
/**
* @enum ConnectState
* @discussion 连接状态
* @constant CONNECT_STATE_DISCONNECT ConnectDeviceState返回state为该状态是表示已断开连接
* @constant CONNECT_STATE_CONNECTING ConnectDeviceState返回state为该状态是表示正在连接中
* @constant CONNECT_STATE_CONNECTED ConnectDeviceState返回state为该状态是表示连接成功
* @constant CONNECT_STATE_TIMEOUT ConnectDeviceState返回state为该状态是表示连接超时
* @constant CONNECT_STATE_FAILT ConnectDeviceState返回state为该状态是表示连接失败
*/
typedef enum : NSUInteger{
NOT_FOUND_DEVICE,//未找到设备
CONNECT_STATE_DISCONNECT,//断开连接
CONNECT_STATE_CONNECTING,//连接中
CONNECT_STATE_CONNECTED,//连接上
CONNECT_STATE_TIMEOUT,//连接超时
CONNECT_STATE_FAILT//连接失败
}ConnectState;
/**
* @enum PrinterDPI
* @discussion 打印机DPI
* @constant PRINTER_200DPI 200dpi以8个点为单位传输图片数据
* @constant PRINTER_300DPI 300dpi以12个点为单位传输图片数据
*/
typedef enum PrinterDPI{
PRINTER_200DPI,
PRINTER_300DPI
}PrinterDPI;
/**发现设备*/
typedef void(^DiscoverDevice)(CBPeripheral *_Nullable peripheral,NSDictionary<NSString *, id> * _Nullable advertisementData,NSNumber * _Nullable RSSI);
/**蓝牙状态更新*/
typedef void(^UpdateState)(NSInteger state);
/**连接状态*/
typedef void(^ConnectDeviceState)(ConnectState state);
/**读取数据*/
typedef void(^ReadData)(NSData * _Nullable data);
/**发送数据进度 只适用于蓝牙发送数据*/
typedef void(^WriteProgress)(NSUInteger total,NSUInteger progress);
typedef void (^Error)(id _Nonnull error);//old:typedef void (^Error)(id error);
#endif /* ConnecterBlock_h */
This diff is collapsed.
//
// EthernetConnecter.h
// GSDK
//
// Created by 猿史森林 on 2018/6/16.
// Copyright © 2018年 猿史森林. All rights reserved.
//
#import "Connecter.h"
@interface EthernetConnecter :Connecter
/**连接设备的ip地址*/
@property(nonatomic,strong)NSString *ip;
/**连接设备的端口号*/
@property(nonatomic,assign)int port;
//+(instancetype)sharedInstance;
/**
* 方法说明: 连接设备
* @param ip 连接设备的ip地址
* @param port 连接设备的端口号
* @param connectState 连接状态 @see ConnectState
* @param callback 输入流数据回调
*/
-(void)connectIP:(NSString *)ip port:(int)port connectState:(void (^)(ConnectState state))connectState callback:(void(^)(NSData *data))callback;
-(void)connectIP:(NSString *)ip port:(int)port connectState:(void (^)(ConnectState))connectState;
@end
//
// Utils.h
// GSDK
//
// Created by 猿史森林 on 2018/6/22.
// Copyright © 2018年 Smarnet. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface GPUtils : NSObject
/**
* 方法说明:图片缩放
* @return 缩放后图片
*/
+(UIImage *)imageWithScaleImage:(UIImage *)image andScaleWidth:(int)width;
+(NSData *)printEscData:(UIImage *)image;
+(NSData *)printTscData:(UIImage *)image;
/**
* 方法说明:Tsc指令图片数据
* @param image 图片
* @param mode 打印机图片打印模式
* @return Tsc图片数据
*/
+(NSData *)printTscData:(UIImage *)image andMode:(int)mode;
/**
* 图像二值化处理
*/
+(UIImage *)binaryzation:(UIImage *)image;
/**
* 图像灰度化处理
* @param image 原图像
*/
+(UIImage *)grayImage:(UIImage *)image;
@end
//
// TscCommand.h
// Gprinter
//
// Created by Wind on 2018/6/15.
// Copyright (c) 2018年 Smarnet. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef NS_ENUM (NSUInteger,Response){
OFF = 0,//关闭自动返回状态功能
ON = 1,//打开自动返回状态功能,每打印完一张返回一次
BATCH = 2,//打开自动返回状态功能,打印完毕后返回一次
};
@interface TscCommand : NSObject
/**
* 方法说明:设置标签尺寸的宽和高
* @param width 标签宽度
* @param height 标签高度
*/
-(void) addSize:(int) width :(int) height;
/**
* 方法说明:设置标签间隙尺寸 单位mm
* @param m 间隙长度
* @param n 间隙偏移
*/
-(void) addGapWithM:(int) m withN:(int) n;
/**
* 方法说明:设置标签原点坐标
* @param x 横坐标
* @param y 纵坐标
*/
-(void) addReference:(int) x :(int)y;
/**
* 方法说明:设置打印速度
* @param speed 打印速度
*/
-(void) addSpeed:(int) speed;
/**
* 方法说明:设置打印速度,保留小数点后1位
* @param speed 打印速度
*/
-(void) addSpeedF:(float) speed;
/**
* 方法说明:设置打印浓度
* @param density 浓度
*/
-(void) addDensity:(int) density;
/**
* 方法说明:设置打印方向
* @param direction 方向
*/
-(void) addDirection:(int) direction;
/**
* 方法说明:清除打印缓冲区
*/
-(void) addCls;
/**
* 方法说明:在标签上绘制文字
* @param x 横坐标
* @param y 纵坐标
* @param font 字体类型
* @param rotation 旋转角度
* @param xScal 横向放大
* @param yScal 纵向放大
* @param text 文字字符串
*/
-(void) addTextwithX:(int)x withY:(int)y withFont:(NSString*)font withRotation:(int)rotation withXscal:(int)xScal withYscal:(int)yScal withText:(NSString*) text;
/*
BITMAP X, Y, width, height, mode, bitmap data
参 数 说 明
x 点阵影像的水平启始位置
y 点阵影像的垂直启始位置
width 影像的宽度,以 byte 表示
height 影像的高度,以点(dot)表示
mode 影像绘制模式
0 OVERWRITE
1 OR
2 XOR
bitmap data 影像数据
*/
-(void) addBitmapwithX:(int)x withY:(int) y withWidth:(int) width withHeight:(int) height withMode:(int) mode withData:(NSData*) data;
-(void)addBitmapwithX:(int)x withY:(int)y withMode:(int)mode withWidth:(int)width withImage:(UIImage *)image;
-(void)addBitmapwithX:(int)x withY:(int)y withMode:(int)mode withImage:(UIImage *)image;
/**
* 方法说明:在标签上绘制一维条码
* @param x 横坐标
* @param y 纵坐标
* @param barcodeType 条码类型
* @param height 条码高度,默认为40
* @param readable 是否可识别,0: 人眼不可识,1: 人眼可识
* @param rotation 旋转角度,条形码旋转角度,顺时钟方向,0不旋转,90顺时钟方向旋转90度,180顺时钟方向旋转180度,270顺时钟方向旋转270度
* @param narrow 默认值2,窄 bar 宽度,以点(dot)表示
* @param wide 默认值4,宽 bar 宽度,以点(dot)表示
* @param content 条码内容
BARCODE X,Y,"code type",height,human readable,rotation,narrow,wide,"code"
BARCODE 100,100,"39",40,1,0,2,4,"1000"
BARCODE 10,10,"128",40,1,0,2,2,"124096ABCDEFZ$%+-./*"
"code type":
EAN13("EAN13"),
EAN8("EAN8"),
UPCA("UPCA"),
ITF14("ITF14"),
CODE39("39"),
CODE128("128"),
*/
-(void) add1DBarcode:(int)x :(int)y :(NSString*)barcodeType :(int)height :(int)readable :(int)rotation :(int)narrow :(int)wide :(NSString*)content;
/**
* 方法说明:在标签上绘制QRCode二维码
* @param x 横坐标
* @param y 纵坐标
* @param ecclever 选择QRCODE纠错等级,L为7%,M为15%,Q为25%,H为30%
* @param cellwidth 二维码宽度1~10,默认为4
* @param mode 默认为A,A为Auto,M为Manual
* @param rotation 旋转角度,QRCode二维旋转角度,顺时钟方向,0不旋转,90顺时钟方向旋转90度,180顺时钟方向旋转180度,270顺时钟方向旋转270度
* @param content 条码内容
* QRCODE X,Y ,ECC LEVER ,cell width,mode,rotation, "data string"
* QRCODE 20,24,L,4,A,0,"佳博集团网站www.Gprinter.com.cn"
*/
-(void) addQRCode:(int)x :(int)y :(NSString*)ecclever :(int)cellwidth :(NSString*)mode :(int)rotation :(NSString*)content;
/**
* 方法说明:执行打印
* @param m
* @param n
*/
-(void) addPrint:(int) m :(int) n;
/**
* 方法说明:获得打印命令
*/
-(NSData*) getCommand;
/**
* 方法说明:将字符串转成十六进制码
* @param str 命令字符串
*/
-(void) addStrToCommand:(NSString *) str;
-(void) addNSDataToCommand:(NSData*) data;
/**
* 方法说明:发送一些TSC的固定命令,在cls命令之前发送
*/
-(void) addComonCommand;
/**
* 方法说明:打印自检页,打印测试页
*/
-(void) addSelfTest;
/**
* 方法说明 :查询打印机型号
*/
-(void) queryPrinterType;
/**
* 方法说明:设定黑标高度及定义标签印完后标签额外送出的长度
* @param m 黑标高度(0≤m≤1(inch),0≤m≤25.4(mm))
* @param n 额外送出纸张长度 n≤标签纸纸张长度(inch或mm)
*/
-(void)addBLine:(int)m :(int)n;
/**
* 方法说明:设定黑标高度及定义标签印完后标签额外送出的长度
* @param m 黑标高度(0≤m≤1(inch),0≤m≤25.4(mm))
* @param n 额外送出纸张长度 n≤标签纸纸张长度(inch或mm)
*/
-(void)addNewBLine:(int)m :(int)n;
/**
* 方法说明:设置打印机剥离模式
* @param peel ON/OFF 是否开启
*/
-(void) addPeel:(NSString *) peel;
/**
* 方法说明:设置打印机撕离模式
* @param tear ON/OFF 是否开启
*/
-(void) addTear:(NSString *) tear;
/**
* 方法说明:设置切刀是否有效
* @param cutter 是否开启 OFF/pieces (0<=pieces<=127)设定几张标签切一次
*/
-(void) addCutter:(NSString *) cutter;
/**
* 方法说明:设置切刀半切是否有效
* @param cutter 是否开启
*/
-(void) addPartialCutter:(NSString *) cutter;
/**
* 方法说明:设置蜂鸣器
* @param level 频率
* @param interval 时间ms
*/
-(void) addSound:(int) level :(int) interval;
/**
* 方法说明:打开钱箱命令,CASHDRAWER m,t1,t2
* @param m 钱箱号 m 0,48 钱箱插座的引脚2 1,49 钱箱插座的引脚5
* @param t1 高电平时间0 ≤ t1 ≤ 255输出由t1和t2设定的钱箱开启脉冲到由m指定的引脚
* @param t2 低电平时间0 ≤ t2 ≤ 255输出由t1和t2设定的钱箱开启脉冲到由m指定的引脚
*/
-(void) addCashdrawer:(int) m :(int) t1 :(int) t2;
/**
* 方法说明:在标签上绘制黑块,画线
* @param x 起始横坐标
* @param y 起始纵坐标
* @param width 线宽,以点(dot)表示
* @param height 线高,以点(dot)表示
*/
-(void) addBar:(int) x :(int) y :(int) width :(int) height;
/**
* 方法说明:在标签上绘制矩形
* @param xStart 起始横坐标
* @param yStart 起始纵坐标
* @param xEnd 终点横坐标
* @param yEnd 终点纵坐标
* @param lineThickness 矩形框线厚度或宽度,以点(dot)表示
*/
-(void) addBox:(int) xStart :(int) yStart :(int) xEnd :(int) yEnd :(int) lineThickness;
/**
* 方法说明:查询打印机状态<ESC>!?
*询问打印机状态指令为立即响应型指令,该指令控制字符是以<ESC> (ASCII 27=0x1B, escape字符)为控制字符.!(ASCII 33=0x21),?(ASCII 63=0x3F)
*即使打印机在错误状态中仍能透过 RS-232 回传一个 byte 资料来表示打印机状态,若回传值为 0 则表示打印
*机处于正常的状态
*/
-(void) queryPrinterStatus;
/**
* 方法说明:将指定的区域反向打印(黑色变成白色,白色变成黑色)
* @param xStart 起始横坐标
* @param yStart 起始横坐标
* @param xWidth X坐标方向宽度,dot为单位
* @param yHeight Y坐标方向高度,dot为单位
*/
-(void) addReverse:(int) xStart :(int) yStart :(int) xWidth :(int) yHeight;
/**
* 方法说明: 打印机打印完成时,自动返回状态。可用于实现连续打印功能
* @param response 自动返回状态 <a>@see Response</a>
* OFF 关闭自动返回状态功能
* ON 开启自动返回状态功能
* BATCH 全部打印完成后返回状态
*/
-(void)addQueryPrinterStatus:(Response)response;
/**
* 方法说明: 查询打印机电量。
* <p>返回值: 31(低电量);32 (中电量);33 (高电量);35 (正在充电)</p>
*
*/
-(void)queryElectricity;
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment