Commit 79e51822 authored by lujunye's avatar lujunye

调整GBsdk

parent 1bea2681
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
E042F74124528CD500CDFA12 /* TitleAndOnlyBtnCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E042F73F24528CD500CDFA12 /* TitleAndOnlyBtnCell.xib */; }; E042F74124528CD500CDFA12 /* TitleAndOnlyBtnCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E042F73F24528CD500CDFA12 /* TitleAndOnlyBtnCell.xib */; };
E042F74324529B7B00CDFA12 /* JiTuoWuXinXiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E042F74224529B7B00CDFA12 /* JiTuoWuXinXiView.swift */; }; E042F74324529B7B00CDFA12 /* JiTuoWuXinXiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E042F74224529B7B00CDFA12 /* JiTuoWuXinXiView.swift */; };
E042F74524529B8500CDFA12 /* JiTuoWuXinXiView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E042F74424529B8500CDFA12 /* JiTuoWuXinXiView.xib */; }; E042F74524529B8500CDFA12 /* JiTuoWuXinXiView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E042F74424529B8500CDFA12 /* JiTuoWuXinXiView.xib */; };
E048C1A225CBA0480008296F /* libGSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E048C1A125CBA0470008296F /* libGSDK.a */; }; E044B97D25E5FCAA005BE090 /* GSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E044B97425E5FCAA005BE090 /* GSDK.a */; };
E0516F772448003D00E373CE /* PayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0516F752448003D00E373CE /* PayViewController.swift */; }; E0516F772448003D00E373CE /* PayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0516F752448003D00E373CE /* PayViewController.swift */; };
E0516F782448003D00E373CE /* PayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0516F762448003D00E373CE /* PayViewController.xib */; }; E0516F782448003D00E373CE /* PayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0516F762448003D00E373CE /* PayViewController.xib */; };
E0516F7F244806C500E373CE /* MsgCenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0516F7E244806C500E373CE /* MsgCenterViewController.swift */; }; E0516F7F244806C500E373CE /* MsgCenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0516F7E244806C500E373CE /* MsgCenterViewController.swift */; };
...@@ -888,14 +888,13 @@ ...@@ -888,14 +888,13 @@
E042F73F24528CD500CDFA12 /* TitleAndOnlyBtnCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndOnlyBtnCell.xib; sourceTree = "<group>"; }; E042F73F24528CD500CDFA12 /* TitleAndOnlyBtnCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndOnlyBtnCell.xib; sourceTree = "<group>"; };
E042F74224529B7B00CDFA12 /* JiTuoWuXinXiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JiTuoWuXinXiView.swift; sourceTree = "<group>"; }; E042F74224529B7B00CDFA12 /* JiTuoWuXinXiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JiTuoWuXinXiView.swift; sourceTree = "<group>"; };
E042F74424529B8500CDFA12 /* JiTuoWuXinXiView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = JiTuoWuXinXiView.xib; sourceTree = "<group>"; }; E042F74424529B8500CDFA12 /* JiTuoWuXinXiView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = JiTuoWuXinXiView.xib; sourceTree = "<group>"; };
E048C19A25CBA0470008296F /* ReliableBurstData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReliableBurstData.h; sourceTree = "<group>"; }; E044B97425E5FCAA005BE090 /* GSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = GSDK.a; sourceTree = "<group>"; };
E048C19B25CBA0470008296F /* DeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceInfo.h; sourceTree = "<group>"; }; E044B97725E5FCAA005BE090 /* EthernetConnecter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EthernetConnecter.h; sourceTree = "<group>"; };
E048C19C25CBA0470008296F /* EscCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EscCommand.h; sourceTree = "<group>"; }; E044B97825E5FCAA005BE090 /* EscCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EscCommand.h; sourceTree = "<group>"; };
E048C19D25CBA0470008296F /* CBController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBController.h; sourceTree = "<group>"; }; E044B97925E5FCAA005BE090 /* ConnecterBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConnecterBlock.h; sourceTree = "<group>"; };
E048C19E25CBA0470008296F /* MyPeripheral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyPeripheral.h; sourceTree = "<group>"; }; E044B97A25E5FCAA005BE090 /* TscCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TscCommand.h; sourceTree = "<group>"; };
E048C19F25CBA0470008296F /* TscCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TscCommand.h; sourceTree = "<group>"; }; E044B97B25E5FCAA005BE090 /* BLEConnecter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BLEConnecter.h; sourceTree = "<group>"; };
E048C1A025CBA0470008296F /* BLKWrite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BLKWrite.h; sourceTree = "<group>"; }; E044B97C25E5FCAA005BE090 /* Connecter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Connecter.h; sourceTree = "<group>"; };
E048C1A125CBA0470008296F /* libGSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libGSDK.a; sourceTree = "<group>"; };
E0516F752448003D00E373CE /* PayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayViewController.swift; sourceTree = "<group>"; }; E0516F752448003D00E373CE /* PayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayViewController.swift; sourceTree = "<group>"; };
E0516F762448003D00E373CE /* PayViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PayViewController.xib; sourceTree = "<group>"; }; E0516F762448003D00E373CE /* PayViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PayViewController.xib; sourceTree = "<group>"; };
E0516F7E244806C500E373CE /* MsgCenterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MsgCenterViewController.swift; sourceTree = "<group>"; }; E0516F7E244806C500E373CE /* MsgCenterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MsgCenterViewController.swift; sourceTree = "<group>"; };
...@@ -1500,13 +1499,13 @@ ...@@ -1500,13 +1499,13 @@
E09B3AE324B3011B00E3B238 /* libz.1.2.5.tbd in Frameworks */, E09B3AE324B3011B00E3B238 /* libz.1.2.5.tbd in Frameworks */,
E0707DC72462457200E039A8 /* libz.tbd in Frameworks */, E0707DC72462457200E039A8 /* libz.tbd in Frameworks */,
E09B3AE024B2FE0200E3B238 /* libicucore.tbd in Frameworks */, E09B3AE024B2FE0200E3B238 /* libicucore.tbd in Frameworks */,
E048C1A225CBA0480008296F /* libGSDK.a in Frameworks */,
E039848C2468F27800DFA56F /* libsqlite3.tbd in Frameworks */, E039848C2468F27800DFA56F /* libsqlite3.tbd in Frameworks */,
E09B3ADE24B2FDC600E3B238 /* JavaScriptCore.framework in Frameworks */, E09B3ADE24B2FDC600E3B238 /* JavaScriptCore.framework in Frameworks */,
E0AA7F362589A8AA0099193F /* jpush-ios-3.4.0.a in Frameworks */, E0AA7F362589A8AA0099193F /* jpush-ios-3.4.0.a in Frameworks */,
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 */,
E044B97D25E5FCAA005BE090 /* 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 */,
...@@ -1942,27 +1941,25 @@ ...@@ -1942,27 +1941,25 @@
path = "下运单"; path = "下运单";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
E048C19825CBA0470008296F /* GprinterSDKforIOS_v1.0.8 */ = { E044B97525E5FCAA005BE090 /* include */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E048C19925CBA0470008296F /* include */, E044B97625E5FCAA005BE090 /* GSDK */,
E048C1A125CBA0470008296F /* libGSDK.a */,
); );
path = GprinterSDKforIOS_v1.0.8; path = include;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
E048C19925CBA0470008296F /* include */ = { E044B97625E5FCAA005BE090 /* GSDK */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E048C19A25CBA0470008296F /* ReliableBurstData.h */, E044B97725E5FCAA005BE090 /* EthernetConnecter.h */,
E048C19B25CBA0470008296F /* DeviceInfo.h */, E044B97825E5FCAA005BE090 /* EscCommand.h */,
E048C19C25CBA0470008296F /* EscCommand.h */, E044B97925E5FCAA005BE090 /* ConnecterBlock.h */,
E048C19D25CBA0470008296F /* CBController.h */, E044B97A25E5FCAA005BE090 /* TscCommand.h */,
E048C19E25CBA0470008296F /* MyPeripheral.h */, E044B97B25E5FCAA005BE090 /* BLEConnecter.h */,
E048C19F25CBA0470008296F /* TscCommand.h */, E044B97C25E5FCAA005BE090 /* Connecter.h */,
E048C1A025CBA0470008296F /* BLKWrite.h */,
); );
path = include; path = GSDK;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
E04DFF092490695A002A6931 /* 采购单详情 */ = { E04DFF092490695A002A6931 /* 采购单详情 */ = {
...@@ -2349,7 +2346,8 @@ ...@@ -2349,7 +2346,8 @@
E09B3AB624B2FCAF00E3B238 /* SDK */ = { E09B3AB624B2FCAF00E3B238 /* SDK */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E048C19825CBA0470008296F /* GprinterSDKforIOS_v1.0.8 */, E044B97425E5FCAA005BE090 /* GSDK.a */,
E044B97525E5FCAA005BE090 /* include */,
E09B3AB724B2FCAF00E3B238 /* ShareSDK */, E09B3AB724B2FCAF00E3B238 /* ShareSDK */,
E09B3ACD24B2FCAF00E3B238 /* Required */, E09B3ACD24B2FCAF00E3B238 /* Required */,
); );
...@@ -4571,6 +4569,7 @@ ...@@ -4571,6 +4569,7 @@
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/ShareSDK/Support/PlatformSDK/WeChatSDK", "$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/ShareSDK/Support/PlatformSDK/WeChatSDK",
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/GPrinter", "$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/GPrinter",
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/GprinterSDKforIOS_v1.0.8", "$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/GprinterSDKforIOS_v1.0.8",
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK",
); );
MARKETING_VERSION = 1.7.2; MARKETING_VERSION = 1.7.2;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
...@@ -4705,6 +4704,7 @@ ...@@ -4705,6 +4704,7 @@
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/ShareSDK/Support/PlatformSDK/WeChatSDK", "$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/ShareSDK/Support/PlatformSDK/WeChatSDK",
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/GPrinter", "$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/GPrinter",
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/GprinterSDKforIOS_v1.0.8", "$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK/GprinterSDKforIOS_v1.0.8",
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/SDK",
); );
MARKETING_VERSION = 1.7.2; MARKETING_VERSION = 1.7.2;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
......
/* /*
shareSDK账号&密码 shareSDK账号&密码
17322010717 17322010717
gelifood81338860 gelifood81338860
融云账号&融云密码 融云账号&融云密码
18924107259 18924107259
81338860geLI 81338860geLI
苹果账号&密码 苹果账号&密码
notice@gelifood.com notice@gelifood.com
81338860^geLi 81338860^geLi
极光密码 极光密码
GeliFood GeliFood
81338860geLI 81338860geLI
高德地图 高德地图
18924107259 18924107259
81338860geli 81338860geli
微信开发平台 微信开发平台
GELIFOOD123@126.com GELIFOOD123@126.com
81338860geli 81338860geli
微信分享 id & secret 微信分享 id & secret
wx26b371b279064098 wx26b371b279064098
55343eb2b2c2329860ad8545715ae9f3 55343eb2b2c2329860ad8545715ae9f3
测试账号&密码 测试账号&密码
Liangyuepf Liangyuepf
zxcvbnm zxcvbnm
*/ */
import UIKit import UIKit
import ESTabBarController_swift import ESTabBarController_swift
...@@ -38,14 +38,15 @@ import ESTabBarController_swift ...@@ -38,14 +38,15 @@ import ESTabBarController_swift
@available(iOS 10.0, *) @available(iOS 10.0, *)
@UIApplicationMain @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate,loginDelegate,UITabBarControllerDelegate, JPUSHRegisterDelegate{
class AppDelegate: UIResponder, UIApplicationDelegate,loginDelegate,UITabBarControllerDelegate, JPUSHRegisterDelegate{
var blueToothVC:BluetoothConnectViewController!
var window:UIWindow? var window:UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// 启动图,调整展示时间为3秒 // 启动图,调整展示时间为3秒
Thread .sleep(forTimeInterval: 2.0) Thread .sleep(forTimeInterval: 2.0)
blueToothVC = BluetoothConnectViewController()
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
if UserToken == nil { if UserToken == nil {
......
...@@ -26,4 +26,8 @@ ...@@ -26,4 +26,8 @@
#import "JZLocationConverter.h" #import "JZLocationConverter.h"
//#import "TscCommand.h"
//#import "BLEConnecter.h"
//#import "EthernetConnecter.h"
//#import "Connecter.h"
#endif /* Bridge_Header_h */ #endif /* Bridge_Header_h */
//
// BLKWrite.h
// Gprinter
//
// Created by Wind on 14/12/20.
// Copyright (c) 2014年 JiaBo. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MyPeripheral.h"
/*
调用Wi-Fi模式
1 [BLKWrite Instance].bWiFiMode = YES
2 [BLKWrite Instance] 设置ServerIP、port
3 [[BLKWrite Instance] initWiFiClient];
4 TSC:-(void) writeTscData:(NSData*) data withResponse;
5 ESC:-(void) writeEscData:(NSData*) data withResponse;
获取打印机纸张宽度
1 校验后
2[[BLKWrite Instance] PrintWidth];
*/
@interface BLKWrite : NSObject<MyPeripheralDelegate>
@property (nonatomic, strong) MyPeripheral *connectedPeripheral;
@property (nonatomic, assign) BOOL bWiFiMode; //YES: Wi-Fi模式;NO:蓝牙模式
@property (nonatomic, strong) NSString *serverIP;
@property (nonatomic, assign) int port;
+(BLKWrite*) Instance;
-(void) writeTscData:(NSData*) data withResponse:(BOOL) flag;
-(void) writeEscData:(NSData*) data withResponse:(BOOL) flag;
-(BOOL) isConnecting;
-(void) setPeripheral:(MyPeripheral*) peripheral;
#pragma mark-Wi-Fi Mode
-(void) initWiFiClient;
#pragma mark-
-(int) PrintWidth;
@end
//
// CBController.h
// BLETR
//
// Created by user D500 on 12/2/15.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import "MyPeripheral.h"
enum {
LE_STATUS_IDLE = 0,
LE_STATUS_SCANNING,
LE_STATUS_CONNECTING,
LE_STATUS_CONNECTED
};
@interface MultiDevice : NSObject
@property(nonatomic, assign) NSInteger index;//0:ISSC;1:红果
@property(nonatomic, assign) BOOL connected;//是否已经连接
@end
@protocol CBControllerDelegate;
@interface CBController : UIViewController<CBCentralManagerDelegate, CBPeripheralDelegate,ReliableBurstDataDelegate>
{
CBCentralManager *manager;
NSMutableArray *devicesList;
BOOL notifyState;
NSMutableArray *_connectedPeripheralList;
CBUUID *_transServiceUUID;
CBUUID *_transTxUUID;
CBUUID *_transRxUUID;
CBUUID *_disUUID1;
CBUUID *_disUUID2;
BOOL isISSCPeripheral;
}
@property(assign) id<CBControllerDelegate> delegate;
@property (retain) NSMutableArray *devicesList;
- (void) startScan;
- (void) stopScan;
- (void)connectDevice:(MyPeripheral *) myPeripheral;
- (void)disconnectDevice:(MyPeripheral *) aPeripheral;
- (NSMutableData *) hexStrToData: (NSString *)hexStr;
- (BOOL) isLECapableHardware;
- (void)addDiscoverPeripheral:(CBPeripheral *)aPeripheral advName:(NSString *)advName;
- (void)updateDiscoverPeripherals;
- (void)updateMyPeripheralForDisconnect:(MyPeripheral *)myPeripheral;
- (void)updateMyPeripheralForNewConnected:(MyPeripheral *)myPeripheral;
- (void)storeMyPeripheral: (CBPeripheral *)aPeripheral;
- (MyPeripheral *)retrieveMyPeripheral: (CBPeripheral *)aPeripheral;
- (void)removeMyPeripheral: (CBPeripheral *) aPeripheral;
- (void)configureTransparentServiceUUID: (NSString *)serviceUUID txUUID:(NSString *)txUUID rxUUID:(NSString *)rxUUID;
- (void)configureDeviceInformationServiceUUID: (NSString *)UUID1 UUID2:(NSString *)UUID2;
@end
@protocol CBControllerDelegate
@required
- (void)didUpdatePeripheralList:(NSArray *)peripherals;
- (void)didConnectPeripheral:(MyPeripheral *)peripheral;
- (void)didDisconnectPeripheral:(MyPeripheral *)peripheral;
@end
\ No newline at end of file
//
// DeviceInfo.h
// BLETR
//
// Created by d500_MacMini on 13/6/19.
// Copyright (c) 2013年 ISSC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "CBController.h"
@interface DeviceInfo : NSObject
@property(retain) MyPeripheral *myPeripheral;
//@property(retain) ViewController *mainViewController;
@end
//
// MyPeripheral.h
// BLETR
//
// Created by D500 user on 13/5/30.
// Copyright (c) 2013年 ISSC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import "ReliableBurstData.h"
#define AIR_PATCH_COMMAND_VENDOR_MP_ENABLE 0x03
#define AIR_PATCH_COMMAND_XMEMOTY_READ 0x08
#define AIR_PATCH_COMMAND_XMEMOTY_WRITE 0x09
#define AIR_PATCH_COMMAND_E2PROM_READ 0x0a
#define AIR_PATCH_COMMAND_E2PROM_WRITE 0x0b
#define AIR_PATCH_COMMAND_READ 0x24
#define AIR_PATCH_SUCCESS 0x00
#define AIR_PATCH_ACTION_CHANGE_DEVICE_NAME 0X01
#define AIR_PATCH_ACTION_READ_ADVERTISE_DATA1 0X02
#define AIR_PATCH_ACTION_READ_ADVERTISE_DATA2 0X03
#define AIR_PATCH_ACTION_UPDATE_ADVERTISE_DATA 0X04
#define AIR_PATCH_ACTION_CHANGE_DEVICE_NAME_MEMORY 0X05
#define AIR_PATCH_ACTION_READ 0X24
#define ADVERTISE_DATA_TYPE_COMPLETE_DEVICE_NAME 0X09
#define ADVERTISE_DATA_TYPE_SHORTEN_DEVICE_NAME 0X08
enum {
MYPERIPHERAL_CONNECT_STATUS_IDLE = 0,
MYPERIPHERAL_CONNECT_STATUS_CONNECTING,
MYPERIPHERAL_CONNECT_STATUS_CONNECTED,
};
enum {
UPDATE_PARAMETERS_STEP_PREPARE = 0,
UPDATE_PARAMETERS_STEP_CHECK_RESULT,
};
typedef struct _AIR_PATCH_COMMAND_FORMAT
{
unsigned char commandID;
char parameters[19];
}__attribute__((packed)) AIR_PATCH_COMMAND_FORMAT;
typedef struct _AIR_PATCH_EVENT_FORMAT
{
char status;
unsigned char commandID;
char parameters[16];
}__attribute__((packed)) AIR_PATCH_EVENT_FORMAT;
typedef struct _WRITE_EEPROM_COMMAND_FORMAT
{
unsigned char addr[2];
unsigned char length;
char data[16];
}__attribute__((packed)) WRITE_EEPROM_COMMAND_FORMAT;
typedef struct _CONNECTION_PARAMETER_FORMAT
{
unsigned char status;
unsigned short minInterval;
unsigned short maxInterval;
unsigned short latency;
unsigned short connectionTimeout;
}__attribute__((packed)) CONNECTION_PARAMETER_FORMAT;
@protocol MyPeripheralDelegate;
@interface MyPeripheral : NSObject
{
@private
char advData[25];
char deviceName[16];
NSMutableArray *queuedTask;
}
@property(assign) id<MyPeripheralDelegate> transDataDelegate;
@property(assign) id<MyPeripheralDelegate> proprietaryDelegate;
@property(assign) id<MyPeripheralDelegate> deviceInfoDelegate;
@property (retain) CBPeripheral *peripheral;
@property(copy) NSString *advName;
@property(assign) uint8_t connectStaus;
@property (assign) BOOL canSendData;
//DIS
@property(retain) CBCharacteristic *manufactureNameChar;
@property(retain) CBCharacteristic *modelNumberChar;
@property(retain) CBCharacteristic *serialNumberChar;
@property(retain) CBCharacteristic *hardwareRevisionChar;
@property(retain) CBCharacteristic *firmwareRevisionChar;
@property(retain) CBCharacteristic *softwareRevisionChar;
@property(retain) CBCharacteristic *systemIDChar;
@property(retain) CBCharacteristic *certDataListChar;
@property(retain) CBCharacteristic *specificChar1;
@property(retain) CBCharacteristic *specificChar2;
//Proprietary
@property(retain) CBCharacteristic *airPatchChar;
@property(retain) CBCharacteristic *transparentDataWriteChar;
@property(retain) CBCharacteristic *transparentDataReadChar;
@property(retain) CBCharacteristic *connectionParameterChar;
@property(assign) uint8_t updateConnectionParameterStep;
@property(readonly) ReliableBurstData *transmit;
@property(assign) CONNECTION_PARAMETER_FORMAT connectionParameter;
@property(assign) CONNECTION_PARAMETER_FORMAT backupConnectionParameter;
@property(assign) BOOL vendorMPEnable;
@property(assign) short airPatchAction;
@property(assign) BOOL isNotifying;
- (CONNECTION_PARAMETER_FORMAT *)retrieveBackupConnectionParameter;
- (void)updateBackupConnectionParameter:(CONNECTION_PARAMETER_FORMAT *)parameter;
- (BOOL)compareBackupConnectionParameter:(CONNECTION_PARAMETER_FORMAT *)parameter;
- (void)checkConnectionParameterStatus;
- (void)sendVendorMPEnable;
- (void)updateAirPatchEvent: (NSData *)returnEvent;
- (void)writeE2promValue: (short)address length:(short)length data:(char *)data;
- (void)readE2promValue: (short)address length:(short)length;
- (void)writeMemoryValue: (short)address length:(short)length data:(char *)data;
- (void)readMemoryValue: (short)address length:(short)length;
- (CBCharacteristicWriteType)sendTransparentData:(NSData *)data type:(CBCharacteristicWriteType)type;
- (void)setTransDataNotification:(BOOL)notify;
- (NSError *)setMaxConnectionInterval:(unsigned short)maxInterval connectionTimeout:(unsigned short)connectionTimeout connectionLatency:(unsigned short)connectionLatency;
- (void)checkIsAllowUpdateConnectionParameter;
- (void)changePeripheralName: (NSString *)name;
- (void)readManufactureName;
- (void)readModelNumber;
- (void)readSerialNumber;
- (void)readHardwareRevision;
- (void)readFirmwareRevision;
- (void)readSoftwareRevison;
- (void)readSystemID;
- (void)readCertificationData;
- (void)readSpecificUUID1;
- (void)readSpecificUUID2;
@end
@protocol MyPeripheralDelegate<NSObject>
@optional
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateConnectionParameterAllowStatus:(BOOL)status;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateConnectionParameterStatus:(BOOL)status interval:(unsigned short)interval timeout:(unsigned short)timeout latency:(unsigned short)latency;
- (void)MyPeripheral:(MyPeripheral *)peripheral didChangePeripheralName:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didReceiveTransparentData:(NSData *)data;
- (void)MyPeripheral:(MyPeripheral *)peripheral didReceiveMemoryAddress:(NSData *)address length:(short)length data:(NSData *)data;
- (void)MyPeripheral:(MyPeripheral *)peripheral didWriteMemoryAddress:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didSendTransparentDataStatus:(NSError *) error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateTransDataNotifyStatus:(BOOL)notify;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateManufactureName:(NSString *)name error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateModelNumber:(NSString *)modelNumber error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateSerialNumber:(NSString *)serialNumber error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateHardwareRevision:(NSString *)hardwareRevision error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateFirmwareRevision:(NSString *)firmwareRevision error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateSoftwareRevision:(NSString *)softwareRevision error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateSystemId:(NSData *)systemId error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateIEEE_11073_20601:(NSData *)IEEE_11073_20601 error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateSpecificUUID1:(NSData *)value error:(NSError *)error;
- (void)MyPeripheral:(MyPeripheral *)peripheral didUpdateSpecificUUID2:(NSData *)value error:(NSError *)error;
@end
//
// ReliableBurstData.h
// ReliableBurstData
//
// Created by Rick on 14/2/19.
// Copyright (c) 2014 ISSC Technologies Corporation. All rights reserved.
//
/*!
* @file ReliableBurstData.h
* @framework ReliableBurstData
*
* @discussion Entry point to the ReliableBurstTransmit.
*
* @copyright 2014 ISSC Technologies Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
@protocol ReliableBurstDataDelegate;
@interface ReliableBurstData : NSObject
/*!
* @method transmitSize
*
* @return Max package size to transmit
*/
- (NSUInteger)transmitSize;
/*!
* @method reliableBurstTransmit:withTransparentCharacteristic:
*
* @discussion Send reliableBurstTransmit with special characteristic
*
* @param data Data to transmit
* @param transparentDataWriteChar Characteristic to transmit
*/
- (void)reliableBurstTransmit:(NSData *)data withTransparentCharacteristic:(CBCharacteristic *)transparentDataWriteChar;
/*!
* @method canSendReliableBurstTransmit
*
* @return YES if the data can be sent, or NO if the transmission queue is full. If NO was returned,
* wait for it return YES to send new data.
*/
- (BOOL)canSendReliableBurstTransmit;
/*!
*
*
* @return YES if the accessory can disconnect now, or NO if the transmission is busy.
* If NO was returned, wait for it return YES to disconnect.
* @discussion
* For example:
* int count = 0;
while (![reliableBurstData canDisconnect]) {
sleep(1);
count++;
if (count >= 10) {
break;
}
}
dispatch_async(dispatch_get_main_queue(), ^{
[manager cancelPeripheralConnection:peripheral];
});
*/
- (BOOL)canDisconnect;
/*!
* @method decodeReliableBurstTransmitEvent:
*
* @param eventData The eventData need to decode for reliableBurstTransmit
*
* @discussion This method decodes the events of reliable burst transmition, it should parse all the values
* of air patch characteristic first when receiving notifications.
* For example:
* - (void)updateAirPatchEvent: (NSData *)returnEvent {
[reliableBurstData decodeReliableBurstTransmitEvent:returnEvent];
...
}
*/
- (void)decodeReliableBurstTransmitEvent:(NSData *)eventData;
/*!
* @method enableReliableBurstTransmit:andAirPatchCharacteristic:
*
* @param peripheral CBPeripheral to enable ReliableBurstTransmit
* @param airPatchCharacteristic CBCharacteristic with airPatch characteristic
*
* @discussion Ues this method to enable ReliableBurstTransmit.
* This method have to be called before sending data.
*
* For example:
* - (void) peripheral:(CBPeripheral *)aPeripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error {
if ([service.UUID isEqual:[CBUUID UUIDWithString:UUIDSTR_ISSC_PROPRIETARY_SERVICE]])
for (aChar in service.characteristics)
{
if ([aChar.UUID isEqual:[CBUUID UUIDWithString:UUIDSTR_AIR_PATCH_CHAR]]) {
[reliableBurstData enableReliableBurstTransmit:aPeripheral andAirPatchCharacteristic:aChar];
}
}
}
*/
- (void)enableReliableBurstTransmit:(CBPeripheral *)peripheral andAirPatchCharacteristic:(CBCharacteristic *)airPatchCharacteristic;
/*!
* @method isReliableBurstTransmit:
*
* @param transparentDataWriteChar The parameter should input the CBCharacteristic object of didWriteValueForCharacteristic: delegate
*
* @return YES if writeValue:forCharacteristic:type: with CBCharacteristicWriteWithResponse type is call by ReliableBurstTransmit.
*
* @discussion This library will use CBCharacteristicWriteWithResponse type when accessory doesn't
* support ReliableBurstTransmit feature. This method informs library the data have been sent.
*
* For example:
* - (void) peripheral:(CBPeripheral *)aPeripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
{
if ([reliableBurstData isReliableBurstTransmit:characteristic]) {
return;
}
// Other code
}
*
*/
- (BOOL)isReliableBurstTransmit:(CBCharacteristic *)transparentDataWriteChar;
/*!
* @method version
*
* @return Version number with major.minor format.
*/
- (NSString *)version;
@property (nonatomic,weak)id<ReliableBurstDataDelegate>delegate;
@end
@protocol ReliableBurstDataDelegate <NSObject>
/*!
* @method reliableBurstData:didSendDataWithCharacteristic:
*
* @discussion This method is invoked when the data has been sent.
*
*/
- (void)reliableBurstData:(ReliableBurstData *)reliableBurstData didSendDataWithCharacteristic:(CBCharacteristic *)transparentDataWriteChar;
@end
//
// 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
//
// 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;
/**发现设备*/
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 error);
#endif /* ConnecterBlock_h */
...@@ -7,11 +7,10 @@ ...@@ -7,11 +7,10 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface EscCommand : NSObject @interface EscCommand : NSObject
@property(nonatomic, assign) BOOL hasResponse;
/** /**
* 方法说明:打印UPCA条码 * 方法说明:打印UPCA条码
* @param content 数据范围0-9,长度为11位 * @param content 数据范围0-9,长度为11位
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
/** /**
* 方法说明:插入文字 * 方法说明:插入文字
* @param text * @param text 文本
*/ */
-(void) addText:(NSString*) text; -(void) addText:(NSString*) text;
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
/** /**
* 方法说明:将字符串转成十六进制码 * 方法说明:将字符串转成十六进制码
* @param str 命令字符串 * @param str 命令字符串
* @return void
*/ */
-(void) addStrToCommand:(NSString *) str; -(void) addStrToCommand:(NSString *) str;
...@@ -48,24 +46,24 @@ ...@@ -48,24 +46,24 @@
*/ */
-(void) addPrintAndFeedLines:(int) n; -(void) addPrintAndFeedLines:(int) n;
/**
* 方法说明:换行
*/
-(void)addPrintAndLineFeed;
/** /**
* 方法说明:设置打印模式,0x1B 0x21 n(0-255),根据n的值设置字符打印模式 * 方法说明:设置打印模式,0x1B 0x21 n(0-255),根据n的值设置字符打印模式
* @param font 选择FONTA or FONTB *@param n 二进制默认为00000000(0X0),10001000(0X88)表示下划线和加粗,00001000(0X08)表示加粗,10000000(0X80)表示下划线
* @param emphasized 是否加粗
* @param doubleheight 是否倍高,当倍宽和倍高模式同时选择时,字符同时在横向和纵向放大两倍。
* @param doublewidth 是否倍宽
* @param underline 是否下划线
*参数n二进制默认为00000000(0X0),10001000(0X88)表示下划线和加粗,00001000(0X08)表示加粗,10000000(0X80)表示下划线
*/ */
-(void) addPrintMode:(int) n; -(void) addPrintMode:(int) n;
/** /**
* 方法说明:设置国际字符集,默认为美国0 * 方法说明:设置国际字符集,默认为美国0
* @param set 字符集编号 * @param n 字符集编号
*/ */
-(void) addSetInternationalCharacterSet:(int) n; -(void) addSetInternationalCharacterSet:(int) n;
/** /**
* 方法说明:设置字符是否旋转90°,默认为0 * 方法说明:设置字符是否旋转90°,默认为0
* @param enabel 是否旋转 * @param n 是否旋转
*/ */
-(void) addSet90ClockWiseRotatin:(int) n; -(void) addSet90ClockWiseRotatin:(int) n;
...@@ -99,26 +97,26 @@ ...@@ -99,26 +97,26 @@
/** /**
* 方法说明:设置倒置模式 选择/取消倒置打印模式。 * 方法说明:设置倒置模式 选择/取消倒置打印模式。
* @param enable 是否倒置,默认为0, 0 ≤n ≤255 当n的最低位为0时,取消倒置打印模式。当n的最低位为1时,选择倒置打印模式。只有n的最低位有效; * @param n 是否倒置,默认为0, 0 ≤n ≤255 当n的最低位为0时,取消倒置打印模式。当n的最低位为1时,选择倒置打印模式。只有n的最低位有效;
*/ */
-(void) addSetUpsideDownMode:(int) n; -(void) addSetUpsideDownMode:(int) n;
/** /**
* 方法说明:设置字符放大,限制为不放大和放大2倍,n=0x11 * 方法说明:设置字符放大,限制为不放大和放大2倍,n=0x11
* @param n= width | height 宽度放大倍数,0 ≤n ≤255 (1 ≤ 纵向放大倍数 ≤8,1 ≤ 横向放达倍数 ≤8)[描述] 用0 到2 位选择字符高度,4 到7 位选择字符宽度 * @param n = width | height 宽度放大倍数,0 ≤n ≤255 (1 ≤ 纵向放大倍数 ≤8,1 ≤ 横向放达倍数 ≤8)[描述] 用0 到2 位选择字符高度,4 到7 位选择字符宽度
*/ */
-(void) addSetCharcterSize:(int) n; -(void) addSetCharcterSize:(int) n;
/** /**
* 方法说明:设置反白模式,黑白反显打印模式 * 方法说明:设置反白模式,黑白反显打印模式
* @param enable 是否反白,当n的最低位为0时,取消反显打印模式。当n的最低位为1时,选择反显打印模式。只有n的最低位有效; * @param n 是否反白,当n的最低位为0时,取消反显打印模式。当n的最低位为1时,选择反显打印模式。只有n的最低位有效;
*/ */
-(void) addSetReverseMode:(int) n; -(void) addSetReverseMode:(int) n;
/** /**
* 方法说明:打印机实时状态请求 * 方法说明:打印机实时状态请求
* @param status PRINTER_STATUS 打印机状态 1 ≤n ≤4 * @param n PRINTER_STATUS 打印机状态 1 ≤n ≤4
* PRINTER_OFFLINE 脱机状态 * PRINTER_OFFLINE 脱机状态
* PRINTER_ERROR 错误状态 * PRINTER_ERROR 错误状态
* PRINTER_PAPER 纸张状态 * PRINTER_PAPER 纸张状态
...@@ -127,7 +125,7 @@ ...@@ -127,7 +125,7 @@
/** /**
* 方法说明:设置切纸后走纸 * 方法说明:设置切纸后走纸
* @param length 走纸距离 * @param n 走纸距离
*/ */
-(void) addCutPaperAndFeed:(int) n; -(void) addCutPaperAndFeed:(int) n;
...@@ -143,7 +141,6 @@ ...@@ -143,7 +141,6 @@
/** /**
* 方法说明:设置条码字符种类,选择HRI使用字体 * 方法说明:设置条码字符种类,选择HRI使用字体
* @param n 固定为0 0,48 标准ASCII码字符 (12 × 24) 1,49 压缩ASCII码字符 (9 × 17)
*/ */
-(void) addSetBarcodeHRIFont; -(void) addSetBarcodeHRIFont;
/** /**
...@@ -210,7 +207,7 @@ ...@@ -210,7 +207,7 @@
/** /**
* 方法说明:addNVLOGO * 方法说明:addNVLOGO
* @param n序号,1<=n<=20 m默认为0 * @param n 序号,1<=n<=20 m默认为0
*/ */
-(void) addNVLOGO:(int) n :(int) m; -(void) addNVLOGO:(int) n :(int) m;
...@@ -236,6 +233,19 @@ ...@@ -236,6 +233,19 @@
-(void) addESCBitmapwithM:(int) m withxL:(int) xL withxH:(int) xH withyL:(int) yL -(void) addESCBitmapwithM:(int) m withxL:(int) xL withxH:(int) xH withyL:(int) yL
withyH:(int) yH withData:(NSData*) data; withyH:(int) yH withData:(NSData*) data;
/**
* 方法说明:打印光栅位图
* @param image 图片
* @param width 图片宽度
*/
-(void)addOriginrastBitImage:(UIImage *)image width:(int)width;
/**
* 方法说明:打印光栅位图
* @param image 图片
*/
-(void)addOriginrastBitImage:(UIImage *)image;
/* /*
正确的ESC指令下QRCode打印流程为四步: 正确的ESC指令下QRCode打印流程为四步:
1、设定QRCode大小;(可以省略) 1、设定QRCode大小;(可以省略)
...@@ -243,7 +253,7 @@ ...@@ -243,7 +253,7 @@
3、将QRCode对应的文字信息存入打印机缓存中;(必须要有) 3、将QRCode对应的文字信息存入打印机缓存中;(必须要有)
4、发送打印QRCode命令。 4、发送打印QRCode命令。
一共有四个命令对应上述四步。 一共有四个命令对应上述四步。
*/ */
/* /*
1、设定QRCode大小;(可以省略) 1、设定QRCode大小;(可以省略)
[格式] ASCII码 GS ( K pL pH cn fn n [格式] ASCII码 GS ( K pL pH cn fn n
...@@ -253,7 +263,7 @@ ...@@ -253,7 +263,7 @@
fn=67 fn=67
1 ≤n≤16 1 ≤n≤16
[默认值] n=3 [默认值] n=3
*/ */
-(void) addQRCodeSizewithpL:(int) pL withpH:(int) pH withcn:(int) cn -(void) addQRCodeSizewithpL:(int) pL withpH:(int) pH withcn:(int) cn
withyfn:(int) fn withn:(int) n; withyfn:(int) fn withn:(int) n;
...@@ -266,7 +276,7 @@ ...@@ -266,7 +276,7 @@
fn=69 fn=69
48≤n≤51 48≤n≤51
[默认值] n=48 [默认值] n=48
*/ */
-(void) addQRCodeLevelwithpL:(int) pL withpH:(int) pH withcn:(int) cn -(void) addQRCodeLevelwithpL:(int) pL withpH:(int) pH withcn:(int) cn
withyfn:(int) fn withn:(int) n; withyfn:(int) fn withn:(int) n;
...@@ -282,7 +292,7 @@ ...@@ -282,7 +292,7 @@
[描述] 存储QR CODE数据(d1...dk)到符号存储区 [描述] 存储QR CODE数据(d1...dk)到符号存储区
[注释] • 将QRCode的数据存储到打印机中 [注释] • 将QRCode的数据存储到打印机中
• 执行esc @或打印机掉电后,恢复默认值 • 执行esc @或打印机掉电后,恢复默认值
*/ */
-(void) addQRCodeSavewithpL:(int) pL withpH:(int) pH withcn:(int) cn -(void) addQRCodeSavewithpL:(int) pL withpH:(int) pH withcn:(int) cn
withyfn:(int) fn withm:(int) m withData:(NSData*) data; withyfn:(int) fn withm:(int) m withData:(NSData*) data;
...@@ -295,90 +305,140 @@ ...@@ -295,90 +305,140 @@
fn=81 fn=81
m=48 m=48
[描述] 打印QRCode条码,在发送此命令之前,需通过( K< Function 180)命令将QRCode数据存储在打印机中。 [描述] 打印QRCode条码,在发送此命令之前,需通过( K< Function 180)命令将QRCode数据存储在打印机中。
*/ */
-(void) addQRCodePrintwithpL:(int) pL withpH:(int) pH withcn:(int) cn -(void) addQRCodePrintwithpL:(int) pL withpH:(int) pH withcn:(int) cn
withyfn:(int) fn withm:(int) m; withyfn:(int) fn withm:(int) m;
/** /**
* 方法说明:设置是否汉字字体 * 方法说明:设置是否汉字字体
* @param n 是否倍宽 是否倍高 是否下划线 * @param n 是否倍宽 是否倍高 是否下划线
*/ */
-(void) addSetKanjiFontMode:(int) n; -(void) addSetKanjiFontMode:(int) n;
/** /**
* 方法说明:设置汉字有效 * 方法说明:设置汉字有效
*/ */
-(void) addSelectKanjiMode; -(void) addSelectKanjiMode;
/** /**
* 方法说明:设置汉字下划线 * 方法说明:设置汉字下划线
* @param n 根据 n 的值,选择或取消汉字的下划线: * @param n 根据 n 的值,选择或取消汉字的下划线:
* n 功能 * n 功能
* 0, 48 取消汉字下划线 * 0, 48 取消汉字下划线
* 1, 49 选择汉字下划线(1 点宽) * 1, 49 选择汉字下划线(1 点宽)
* 2, 50 选择汉字下划线(2点宽) * 2, 50 选择汉字下划线(2点宽)
*/ */
-(void)addSetKanjiUnderLine:(int) n; -(void)addSetKanjiUnderLine:(int) n;
/** /**
* 方法说明:设置汉字无效 * 方法说明:设置汉字无效
*/ */
-(void) addCancelKanjiMode; -(void) addCancelKanjiMode;
/** /**
* 方法说明:设置字符右间距 * 方法说明:设置字符右间距
* @param n 间距长度 * @param n 间距长度
* 0 ≤ n≤255 * 0 ≤ n≤255
* [描述] 设置字符的右间距为[n×横向移动单位或纵向移动单位]英寸。 * [描述] 设置字符的右间距为[n×横向移动单位或纵向移动单位]英寸。
* [注释] • 当字符放大时,右间距随之放大相同的倍数。 * [注释] • 当字符放大时,右间距随之放大相同的倍数。
* • 此命令设置的值在页模式和标准模式下是相互独立的。 * • 此命令设置的值在页模式和标准模式下是相互独立的。
* • 横向或纵向移动单位由GS P指定。改变横向或纵向移动单位不改变当前右间距。 * • 横向或纵向移动单位由GS P指定。改变横向或纵向移动单位不改变当前右间距。
* • GS P 命令可改变水平(和垂直)运动单位。但是该值不得小于最小水平移动量, * • GS P 命令可改变水平(和垂直)运动单位。但是该值不得小于最小水平移动量,
* 并且必须为最小水平移动量的偶数单位。 * 并且必须为最小水平移动量的偶数单位。
* • 标准模式下,使用横向移动单位。 * • 标准模式下,使用横向移动单位。
* • 最大右间距是31 .91 毫米(255/203 英寸) 。 任何超过这个值的设置都自动转换为最 * • 最大右间距是31 .91 毫米(255/203 英寸) 。 任何超过这个值的设置都自动转换为最
* 大右间距。 * 大右间距。
* [默认值] n = 0 * [默认值] n = 0
*/ */
-(void) addSetCharacterRightSpace:(int) n; -(void) addSetCharacterRightSpace:(int) n;
/** /**
* 方法说明:设置汉字左右间距 * 方法说明:设置汉字左右间距
* @param n1 左间距 0 ≤ n1 ≤ 255 * @param n1 左间距 0 ≤ n1 ≤ 255
* @param n2 右间距 0 ≤ n2 ≤ 255 * @param n2 右间距 0 ≤ n2 ≤ 255
*/ */
-(void) addSetKanjiLefttandRightSpace:(int) n1 :(int) n2; -(void) addSetKanjiLefttandRightSpace:(int) n1 :(int) n2;
/** /**
* 方法说明:设置加粗模式 * 方法说明:设置加粗模式
* @param n 是否加粗 * @param n 是否加粗
* 0 ≤ n ≤ 255 * 0 ≤ n ≤ 255
* [描述] 选择或取消加粗模式 * [描述] 选择或取消加粗模式
* 当n的最低位为0时,取消加粗模式。 * 当n的最低位为0时,取消加粗模式。
* 当n的最低位为1 时,选择加粗模式。 * 当n的最低位为1 时,选择加粗模式。
* [注释] • n只有最低位有效。 * [注释] • n只有最低位有效。
* • ESC ! 同样可以选择/取消加粗模式,最后接收的命令有效。 * • ESC ! 同样可以选择/取消加粗模式,最后接收的命令有效。
* [默认值] n = 0 * [默认值] n = 0
*/ */
-(void) addTurnEmphasizedModeOnOrOff:(int) n; -(void) addTurnEmphasizedModeOnOrOff:(int) n;
/** /**
* 方法说明:设置加重模式 * 方法说明:设置加重模式
* @param n 是否加重 * @param n 是否加重
* 0 ≤ n ≤ 255 * 0 ≤ n ≤ 255
* [描述] 选择/取消双重打印模式。 * [描述] 选择/取消双重打印模式。
* • 当n的最低位为0时,取消双重打印模式。 * • 当n的最低位为0时,取消双重打印模式。
* • 当n的最低位为1 时,选择双重打印模式。 * • 当n的最低位为1 时,选择双重打印模式。
* [注释] • n只有最低位有效。 * [注释] • n只有最低位有效。
* • 该命令与加粗打印效果相同。 * • 该命令与加粗打印效果相同。
* [默认值] n = 0 * [默认值] n = 0
*/ */
-(void) addTurnDoubleStrikeOnOrOff:(int) n; -(void) addTurnDoubleStrikeOnOrOff:(int) n;
/** /**
* 方法说明:发送16进制数据,例如data=0x0A或data=0x0D * 方法说明:发送16进制数据,例如data=0x0A或data=0x0D
*/ */
-(void) addNSDataToCommand:(NSData*) data; -(void) addNSDataToCommand:(NSData*) data;
/**
* 方法说明:设置水平和垂直单位距离
* @param x 水平单位
* @param y 垂直单位
*/
-(void)addSetHorAndVerMotionUnitsX:(int)x Y:(int)y;
/**
* 方法说明:设置绝对打印位置
* @param n 与起始打印位置距离
*/
-(void)addSetAbsolutePrintPosition:(int)n;
/**
* 方法说明:设置打印宽度
*
* @param width
* 打印宽度
*/
-(void)addSetPrintingAreaWidth:(int)width;
/**
* 方法说明: 票据默认倍高(重启不失效)
* @param n1 宽 默认为0,翻倍为1
* @param n2 高 默认为0,翻倍为1
* @param n3 汉字宽 默认为0,翻倍为1
* @param n4 汉字高 默认为0,翻倍为1
*/
-(void)receiptDoubleHeightOrDefaultPrintN1:(int)n1 N2:(int)n2 N3:(int)n3 N4:(int)n4;
/**
* 方法说明: 设置默认代码页
* @param n 代码页 n的参数范围为(0-10,16-32,50-89)
*/
-(void)setDefaultCodePage:(int)n;
/**
* 方法说明: 波特率
* @param baudRate 波特率
*/
-(void)setBaudRate:(int)baudRate;
/**
* 方法说明: 查询打印机电量。
* <p>返回值: 31(低电量);32 (中电量);33 (高电量);35 (正在充电)</p>
*
*/
-(void)queryElectricity;
@end @end
//
// 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
...@@ -2,21 +2,25 @@ ...@@ -2,21 +2,25 @@
// TscCommand.h // TscCommand.h
// Gprinter // Gprinter
// //
// Created by Wind on 14/12/22. // Created by Wind on 2018/6/15.
// Copyright (c) 2014年 JiaBo. All rights reserved. // Copyright (c) 2018年 Smarnet. All rights reserved.
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface TscCommand : NSObject typedef NS_ENUM (NSUInteger,Response){
OFF = 0,//关闭自动返回状态功能
ON = 1,//打开自动返回状态功能,每打印完一张返回一次
BATCH = 2,//打开自动返回状态功能,打印完毕后返回一次
};
@property(nonatomic, assign) BOOL hasResponse; @interface TscCommand : NSObject
/** /**
* 方法说明:设置标签尺寸的宽和高 * 方法说明:设置标签尺寸的宽和高
* @param width 标签宽度 * @param width 标签宽度
* @param height 标签高度 * @param height 标签高度
* @return void
*/ */
-(void) addSize:(int) width :(int) height; -(void) addSize:(int) width :(int) height;
...@@ -24,7 +28,6 @@ ...@@ -24,7 +28,6 @@
* 方法说明:设置标签间隙尺寸 单位mm * 方法说明:设置标签间隙尺寸 单位mm
* @param m 间隙长度 * @param m 间隙长度
* @param n 间隙偏移 * @param n 间隙偏移
* @return void
*/ */
-(void) addGapWithM:(int) m withN:(int) n; -(void) addGapWithM:(int) m withN:(int) n;
...@@ -32,34 +35,29 @@ ...@@ -32,34 +35,29 @@
* 方法说明:设置标签原点坐标 * 方法说明:设置标签原点坐标
* @param x 横坐标 * @param x 横坐标
* @param y 纵坐标 * @param y 纵坐标
* @return void
*/ */
-(void) addReference:(int) x :(int)y; -(void) addReference:(int) x :(int)y;
/** /**
* 方法说明:设置打印速度 * 方法说明:设置打印速度
* @param speed 打印速度 * @param speed 打印速度
* @return void
*/ */
-(void) addSpeed:(int) speed; -(void) addSpeed:(int) speed;
/** /**
* 方法说明:设置打印浓度 * 方法说明:设置打印浓度
* @param density 浓度 * @param density 浓度
* @return void
*/ */
-(void) addDensity:(int) density; -(void) addDensity:(int) density;
/** /**
* 方法说明:设置打印方向 * 方法说明:设置打印方向
* @param direction 方向 * @param direction 方向
* @return void
*/ */
-(void) addDirection:(int) direction; -(void) addDirection:(int) direction;
/** /**
* 方法说明:清除打印缓冲区 * 方法说明:清除打印缓冲区
* @return void
*/ */
-(void) addCls; -(void) addCls;
...@@ -69,13 +67,11 @@ ...@@ -69,13 +67,11 @@
* @param y 纵坐标 * @param y 纵坐标
* @param font 字体类型 * @param font 字体类型
* @param rotation 旋转角度 * @param rotation 旋转角度
* @param Xscal 横向放大 * @param xScal 横向放大
* @param Yscal 纵向放大 * @param yScal 纵向放大
* @param text 文字字符串 * @param text 文字字符串
* @return void
*/ */
-(void) addTextwithX:(int)x withY:(int) y withFont:(NSString*) font -(void) addTextwithX:(int)x withY:(int)y withFont:(NSString*)font withRotation:(int)rotation withXscal:(int)xScal withYscal:(int)yScal withText:(NSString*) text;
withRotation:(int) rotation withXscal:(int) Xscal withYscal:(int) Yscal withText:(NSString*) text;
/* /*
BITMAP X, Y, width, height, mode, bitmap data BITMAP X, Y, width, height, mode, bitmap data
...@@ -90,21 +86,23 @@ ...@@ -90,21 +86,23 @@
2 XOR 2 XOR
bitmap data 影像数据 bitmap data 影像数据
*/ */
-(void) addBitmapwithX:(int)x withY:(int) y withWidth:(int) width -(void) addBitmapwithX:(int)x withY:(int) y withWidth:(int) width withHeight:(int) height withMode:(int) mode withData:(NSData*) data;
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 x 横坐标
* @param y 纵坐标 * @param y 纵坐标
* @param barcodetype 条码类型 * @param barcodeType 条码类型
* @param height 条码高度,默认为40 * @param height 条码高度,默认为40
* @param readable 是否可识别,0: 人眼不可识,1: 人眼可识 * @param readable 是否可识别,0: 人眼不可识,1: 人眼可识
* @param rotation 旋转角度,条形码旋转角度,顺时钟方向,0不旋转,90顺时钟方向旋转90度,180顺时钟方向旋转180度,270顺时钟方向旋转270度 * @param rotation 旋转角度,条形码旋转角度,顺时钟方向,0不旋转,90顺时钟方向旋转90度,180顺时钟方向旋转180度,270顺时钟方向旋转270度
* @param Narrow 默认值2,窄 bar 宽度,以点(dot)表示 * @param narrow 默认值2,窄 bar 宽度,以点(dot)表示
* @param Wide 默认值4,宽 bar 宽度,以点(dot)表示 * @param wide 默认值4,宽 bar 宽度,以点(dot)表示
* @param content 条码内容 * @param content 条码内容
* @return void
BARCODE X,Y,"code type",height,human readable,rotation,narrow,wide,"code" BARCODE X,Y,"code type",height,human readable,rotation,narrow,wide,"code"
BARCODE 100,100,"39",40,1,0,2,4,"1000" BARCODE 100,100,"39",40,1,0,2,4,"1000"
BARCODE 10,10,"128",40,1,0,2,2,"124096ABCDEFZ$%+-./*" BARCODE 10,10,"128",40,1,0,2,2,"124096ABCDEFZ$%+-./*"
...@@ -116,8 +114,7 @@ ...@@ -116,8 +114,7 @@
CODE39("39"), CODE39("39"),
CODE128("128"), CODE128("128"),
*/ */
-(void) add1DBarcode:(int)x :(int)y :(NSString*)barcodetype :(int)height -(void) add1DBarcode:(int)x :(int)y :(NSString*)barcodeType :(int)height :(int)readable :(int)rotation :(int)narrow :(int)wide :(NSString*)content;
:(int)readable :(int)rotation :(int)Narrow :(int)Wide :(NSString*)content;
/** /**
* 方法说明:在标签上绘制QRCode二维码 * 方法说明:在标签上绘制QRCode二维码
...@@ -128,31 +125,26 @@ ...@@ -128,31 +125,26 @@
* @param mode 默认为A,A为Auto,M为Manual * @param mode 默认为A,A为Auto,M为Manual
* @param rotation 旋转角度,QRCode二维旋转角度,顺时钟方向,0不旋转,90顺时钟方向旋转90度,180顺时钟方向旋转180度,270顺时钟方向旋转270度 * @param rotation 旋转角度,QRCode二维旋转角度,顺时钟方向,0不旋转,90顺时钟方向旋转90度,180顺时钟方向旋转180度,270顺时钟方向旋转270度
* @param content 条码内容 * @param content 条码内容
* @return void
* QRCODE X,Y ,ECC LEVER ,cell width,mode,rotation, "data string" * QRCODE X,Y ,ECC LEVER ,cell width,mode,rotation, "data string"
* QRCODE 20,24,L,4,A,0,"佳博集团网站www.Gprinter.com.cn" * QRCODE 20,24,L,4,A,0,"佳博集团网站www.Gprinter.com.cn"
*/ */
-(void) addQRCode:(int)x :(int)y :(NSString*)ecclever :(int)cellwidth -(void) addQRCode:(int)x :(int)y :(NSString*)ecclever :(int)cellwidth :(NSString*)mode :(int)rotation :(NSString*)content;
:(NSString*)mode :(int)rotation :(NSString*)content;
/** /**
* 方法说明:执行打印 * 方法说明:执行打印
* @param m * @param m
* @param n * @param n
* @return void
*/ */
-(void) addPrint:(int) m :(int) n; -(void) addPrint:(int) m :(int) n;
/** /**
* 方法说明:获得打印命令 * 方法说明:获得打印命令
* @return NSData*
*/ */
-(NSData*) getCommand; -(NSData*) getCommand;
/** /**
* 方法说明:将字符串转成十六进制码 * 方法说明:将字符串转成十六进制码
* @param str 命令字符串 * @param str 命令字符串
* @return void
*/ */
-(void) addStrToCommand:(NSString *) str; -(void) addStrToCommand:(NSString *) str;
...@@ -160,55 +152,47 @@ ...@@ -160,55 +152,47 @@
/** /**
* 方法说明:发送一些TSC的固定命令,在cls命令之前发送 * 方法说明:发送一些TSC的固定命令,在cls命令之前发送
* @return void
*/ */
-(void) addComonCommand; -(void) addComonCommand;
/** /**
* 方法说明:打印自检页,打印测试页 * 方法说明:打印自检页,打印测试页
* @return void
*/ */
-(void) addSelfTest; -(void) addSelfTest;
/** /**
* 方法说明 :查询打印机型号 * 方法说明 :查询打印机型号
* @return void
*/ */
-(void) queryPrinterType; -(void) queryPrinterType;
/** /**
* 方法说明:设置打印机剥离模式 * 方法说明:设置打印机剥离模式
* @param ON/OFF 是否开启 * @param peel ON/OFF 是否开启
* @return void
*/ */
-(void) addPeel:(NSString *) strpar; -(void) addPeel:(NSString *) peel;
/** /**
* 方法说明:设置打印机撕离模式 * 方法说明:设置打印机撕离模式
* @param ON/OFF 是否开启 * @param tear ON/OFF 是否开启
* @return void
*/ */
-(void) addTear:(NSString *) strpar; -(void) addTear:(NSString *) tear;
/** /**
* 方法说明:设置切刀是否有效 * 方法说明:设置切刀是否有效
* @param 是否开启 OFF/pieces (0<=pieces<=127)设定几张标签切一次 * @param cutter 是否开启 OFF/pieces (0<=pieces<=127)设定几张标签切一次
* @return void
*/ */
-(void) addCutter:(NSString *) strpar; -(void) addCutter:(NSString *) cutter;
/** /**
* 方法说明:设置切刀半切是否有效 * 方法说明:设置切刀半切是否有效
* @param enable 是否开启 * @param cutter 是否开启
* @return void
*/ */
-(void) addPartialCutter:(NSString *) strpar; -(void) addPartialCutter:(NSString *) cutter;
/** /**
* 方法说明:设置蜂鸣器 * 方法说明:设置蜂鸣器
* @param level 频率 * @param level 频率
* @param interval 时间ms * @param interval 时间ms
* @return void
*/ */
-(void) addSound:(int) level :(int) interval; -(void) addSound:(int) level :(int) interval;
...@@ -217,7 +201,6 @@ ...@@ -217,7 +201,6 @@
* @param m 钱箱号 m 0,48 钱箱插座的引脚2 1,49 钱箱插座的引脚5 * @param m 钱箱号 m 0,48 钱箱插座的引脚2 1,49 钱箱插座的引脚5
* @param t1 高电平时间0 ≤ t1 ≤ 255输出由t1和t2设定的钱箱开启脉冲到由m指定的引脚 * @param t1 高电平时间0 ≤ t1 ≤ 255输出由t1和t2设定的钱箱开启脉冲到由m指定的引脚
* @param t2 低电平时间0 ≤ t2 ≤ 255输出由t1和t2设定的钱箱开启脉冲到由m指定的引脚 * @param t2 低电平时间0 ≤ t2 ≤ 255输出由t1和t2设定的钱箱开启脉冲到由m指定的引脚
* @return void
*/ */
-(void) addCashdrawer:(int) m :(int) t1 :(int) t2; -(void) addCashdrawer:(int) m :(int) t1 :(int) t2;
...@@ -227,37 +210,49 @@ ...@@ -227,37 +210,49 @@
* @param y 起始纵坐标 * @param y 起始纵坐标
* @param width 线宽,以点(dot)表示 * @param width 线宽,以点(dot)表示
* @param height 线高,以点(dot)表示 * @param height 线高,以点(dot)表示
* @return void
*/ */
-(void) addBar:(int) x :(int) y :(int) width :(int) height; -(void) addBar:(int) x :(int) y :(int) width :(int) height;
/** /**
* 方法说明:在标签上绘制矩形 * 方法说明:在标签上绘制矩形
* @param xstart 起始横坐标 * @param xStart 起始横坐标
* @param ystart 起始纵坐标 * @param yStart 起始纵坐标
* @param xend 终点横坐标 * @param xEnd 终点横坐标
* @param yend 终点纵坐标 * @param yEnd 终点纵坐标
* @param linethickness 矩形框线厚度或宽度,以点(dot)表示 * @param lineThickness 矩形框线厚度或宽度,以点(dot)表示
* @return void
*/ */
-(void) addBox:(int) xstart :(int) ystart :(int) xend :(int) yend :(int) linethickness; -(void) addBox:(int) xStart :(int) yStart :(int) xEnd :(int) yEnd :(int) lineThickness;
/** /**
* 方法说明:查询打印机状态<ESC>!? * 方法说明:查询打印机状态<ESC>!?
*询问打印机状态指令为立即响应型指令,该指令控制字符是以<ESC> (ASCII 27=0x1B, escape字符)为控制字符.!(ASCII 33=0x21),?(ASCII 63=0x3F) *询问打印机状态指令为立即响应型指令,该指令控制字符是以<ESC> (ASCII 27=0x1B, escape字符)为控制字符.!(ASCII 33=0x21),?(ASCII 63=0x3F)
*即使打印机在错误状态中仍能透过 RS-232 回传一个 byte 资料来表示打印机状态,若回传值为 0 则表示打印 *即使打印机在错误状态中仍能透过 RS-232 回传一个 byte 资料来表示打印机状态,若回传值为 0 则表示打印
*机处于正常的状态 *机处于正常的状态
* @return void
*/ */
-(void) queryPrinterStatus; -(void) queryPrinterStatus;
/** /**
* 方法说明:将指定的区域反向打印(黑色变成白色,白色变成黑色) * 方法说明:将指定的区域反向打印(黑色变成白色,白色变成黑色)
* @param xstart 起始横坐标 * @param xStart 起始横坐标
* @param ystart 起始横坐标 * @param yStart 起始横坐标
* @param xwidth X坐标方向宽度,dot为单位 * @param xWidth X坐标方向宽度,dot为单位
* @param yheight Y坐标方向高度,dot为单位 * @param yHeight Y坐标方向高度,dot为单位
*/ */
-(void) addReverse:(int) xstart :(int) ystart :(int) xwidth :(int) yheight; -(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 @end
...@@ -24,20 +24,38 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -24,20 +24,38 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
} }
func Print_Gprinter_View_Print(data: Array<Dictionary<String, Any>>) { func Print_Gprinter_View_Print(data: Array<Dictionary<String, Any>>) {
let dict = [ print("打印")
"user_token":UserToken as Any, let dele = UIApplication.shared.delegate as! AppDelegate
"o_type":typeSelect! + 1 as Any,
"audit_remark":remark as Any, // let tscCmd = TscCommand()
"goods_info":dataChangeString(sender: goodsInfoArr) as Any // tscCmd.hasResponse = true
] // tscCmd.addSize(50, 30)
HUD.show(.progress) // tscCmd.addGap(withM: 2, withN: 0)
GoodsOutput(dict, success: { (data) in // tscCmd.addReference(24, 24)
HUD.hide() // tscCmd.addSpeed(4)
HUD.flash(.labeledSubSuccess(subtitle: "出库成功"), delay: 1.2) // tscCmd.addDensity(8)
self.navigationController?.popViewController(animated: true) // tscCmd.addDirection(0)
}) { (error) in // tscCmd.addComonCommand()
// tscCmd.addCls()
} // tscCmd.addQRCode(20, 4, "G", 4, "L", 0, "格利IOS蓝牙打印")
// tscCmd.addPrint(1, 1)
// let dict = [
// "user_token":UserToken as Any,
// "o_type":typeSelect! + 1 as Any,
// "audit_remark":remark as Any,
// "goods_info":dataChangeString(sender: goodsInfoArr) as Any
// ]
// HUD.show(.progress)
// GoodsOutput(dict, success: { (data) in
// HUD.hide()
// HUD.flash(.labeledSubSuccess(subtitle: "出库成功"), delay: 1.2)
// self.navigationController?.popViewController(animated: true)
// }) { (error) in
//
// }
} }
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
......
...@@ -160,8 +160,8 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable ...@@ -160,8 +160,8 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
}else if indexPath.row == 1 { }else if indexPath.row == 1 {
//蓝牙设置 //蓝牙设置
let vc = BluetoothConnectViewController() let dele = UIApplication.shared.delegate as! AppDelegate
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(dele.blueToothVC, animated: true)
}else if indexPath.row == 2{ }else if indexPath.row == 2{
//权限设置-弹窗 //权限设置-弹窗
HUD.flash(.label("权限设置开发中"), delay: 1.2) HUD.flash(.label("权限设置开发中"), delay: 1.2)
......
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