Commit e1d93a92 authored by lujunye's avatar lujunye

接入热敏打印机。

parent 506b3e59
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
E01EA1A1245A5D6B00F019D5 /* YunDanXiangQingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E01EA19F245A5D6B00F019D5 /* YunDanXiangQingViewController.xib */; }; E01EA1A1245A5D6B00F019D5 /* YunDanXiangQingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E01EA19F245A5D6B00F019D5 /* YunDanXiangQingViewController.xib */; };
E01EA1A4245A60E000F019D5 /* XiaDanChengGongViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E01EA1A2245A60E000F019D5 /* XiaDanChengGongViewController.swift */; }; E01EA1A4245A60E000F019D5 /* XiaDanChengGongViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E01EA1A2245A60E000F019D5 /* XiaDanChengGongViewController.swift */; };
E01EA1A5245A60E000F019D5 /* XiaDanChengGongViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E01EA1A3245A60E000F019D5 /* XiaDanChengGongViewController.xib */; }; E01EA1A5245A60E000F019D5 /* XiaDanChengGongViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E01EA1A3245A60E000F019D5 /* XiaDanChengGongViewController.xib */; };
E01FD9CC25E7A46C00964A20 /* Bt_Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = E01FD9CA25E7A46C00964A20 /* Bt_Cell.m */; };
E01FD9CD25E7A46C00964A20 /* Bt_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E01FD9CB25E7A46C00964A20 /* Bt_Cell.xib */; };
E0206327246CD84A007A40C4 /* TitleAndLblView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0206326246CD84A007A40C4 /* TitleAndLblView.swift */; }; E0206327246CD84A007A40C4 /* TitleAndLblView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0206326246CD84A007A40C4 /* TitleAndLblView.swift */; };
E0206329246CD855007A40C4 /* TitleAndLblView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0206328246CD855007A40C4 /* TitleAndLblView.xib */; }; E0206329246CD855007A40C4 /* TitleAndLblView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0206328246CD855007A40C4 /* TitleAndLblView.xib */; };
E020632B246CDD36007A40C4 /* OrderDViewFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E020632A246CDD36007A40C4 /* OrderDViewFooterView.swift */; }; E020632B246CDD36007A40C4 /* OrderDViewFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E020632A246CDD36007A40C4 /* OrderDViewFooterView.swift */; };
...@@ -316,6 +318,9 @@ ...@@ -316,6 +318,9 @@
E0AA7F352589A8AA0099193F /* jcore-ios-2.4.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0AA7F302589A8AA0099193F /* jcore-ios-2.4.0.a */; }; E0AA7F352589A8AA0099193F /* jcore-ios-2.4.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0AA7F302589A8AA0099193F /* jcore-ios-2.4.0.a */; };
E0AA7F362589A8AA0099193F /* jpush-ios-3.4.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0AA7F332589A8AA0099193F /* jpush-ios-3.4.0.a */; }; E0AA7F362589A8AA0099193F /* jpush-ios-3.4.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0AA7F332589A8AA0099193F /* jpush-ios-3.4.0.a */; };
E0AACC76255BB03C00FC9010 /* TitleAndSelectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AACC75255BB03C00FC9010 /* TitleAndSelectCell.swift */; }; E0AACC76255BB03C00FC9010 /* TitleAndSelectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AACC75255BB03C00FC9010 /* TitleAndSelectCell.swift */; };
E0AC418025E88B0700805AE3 /* ConnectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E0AC417E25E88B0700805AE3 /* ConnectViewController.m */; };
E0AC418125E88B0700805AE3 /* ConnectViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0AC417F25E88B0700805AE3 /* ConnectViewController.xib */; };
E0AC419E25E894E400805AE3 /* libGSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0AC419C25E894E400805AE3 /* libGSDK.a */; };
E0AD92E92550E50500D82C17 /* GYS_FX_Product_VC.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AD92E72550E50500D82C17 /* GYS_FX_Product_VC.swift */; }; E0AD92E92550E50500D82C17 /* GYS_FX_Product_VC.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AD92E72550E50500D82C17 /* GYS_FX_Product_VC.swift */; };
E0AD92EA2550E50500D82C17 /* GYS_FX_Product_VC.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0AD92E82550E50500D82C17 /* GYS_FX_Product_VC.xib */; }; E0AD92EA2550E50500D82C17 /* GYS_FX_Product_VC.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0AD92E82550E50500D82C17 /* GYS_FX_Product_VC.xib */; };
E0AD92F92550FD1500D82C17 /* GYS_FX_SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AD92F72550FD1500D82C17 /* GYS_FX_SearchViewController.swift */; }; E0AD92F92550FD1500D82C17 /* GYS_FX_SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AD92F72550FD1500D82C17 /* GYS_FX_SearchViewController.swift */; };
...@@ -392,8 +397,6 @@ ...@@ -392,8 +397,6 @@
E0D197C7244845FD002B080C /* PersonCenterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0D197C5244845FD002B080C /* PersonCenterViewController.xib */; }; E0D197C7244845FD002B080C /* PersonCenterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0D197C5244845FD002B080C /* PersonCenterViewController.xib */; };
E0D197CA24484D90002B080C /* PersonCenterCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D197C824484D90002B080C /* PersonCenterCell.swift */; }; E0D197CA24484D90002B080C /* PersonCenterCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D197C824484D90002B080C /* PersonCenterCell.swift */; };
E0D197CB24484D90002B080C /* PersonCenterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0D197C924484D90002B080C /* PersonCenterCell.xib */; }; E0D197CB24484D90002B080C /* PersonCenterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0D197C924484D90002B080C /* PersonCenterCell.xib */; };
E0D197CF24485649002B080C /* BluetoothConnectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D197CD24485649002B080C /* BluetoothConnectViewController.swift */; };
E0D197D024485649002B080C /* BluetoothConnectViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0D197CE24485649002B080C /* BluetoothConnectViewController.xib */; };
E0D197D5244860B1002B080C /* BlueToothCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D197D3244860B1002B080C /* BlueToothCell.swift */; }; E0D197D5244860B1002B080C /* BlueToothCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D197D3244860B1002B080C /* BlueToothCell.swift */; };
E0D197D6244860B1002B080C /* BlueToothCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0D197D4244860B1002B080C /* BlueToothCell.xib */; }; E0D197D6244860B1002B080C /* BlueToothCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0D197D4244860B1002B080C /* BlueToothCell.xib */; };
E0D4165F24482AAF008DCAB4 /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D4165D24482AAF008DCAB4 /* AccountViewController.swift */; }; E0D4165F24482AAF008DCAB4 /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D4165D24482AAF008DCAB4 /* AccountViewController.swift */; };
...@@ -774,6 +777,9 @@ ...@@ -774,6 +777,9 @@
E01EA19F245A5D6B00F019D5 /* YunDanXiangQingViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = YunDanXiangQingViewController.xib; sourceTree = "<group>"; }; E01EA19F245A5D6B00F019D5 /* YunDanXiangQingViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = YunDanXiangQingViewController.xib; sourceTree = "<group>"; };
E01EA1A2245A60E000F019D5 /* XiaDanChengGongViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XiaDanChengGongViewController.swift; sourceTree = "<group>"; }; E01EA1A2245A60E000F019D5 /* XiaDanChengGongViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XiaDanChengGongViewController.swift; sourceTree = "<group>"; };
E01EA1A3245A60E000F019D5 /* XiaDanChengGongViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XiaDanChengGongViewController.xib; sourceTree = "<group>"; }; E01EA1A3245A60E000F019D5 /* XiaDanChengGongViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XiaDanChengGongViewController.xib; sourceTree = "<group>"; };
E01FD9C925E7A46C00964A20 /* Bt_Cell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Bt_Cell.h; sourceTree = "<group>"; };
E01FD9CA25E7A46C00964A20 /* Bt_Cell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Bt_Cell.m; sourceTree = "<group>"; };
E01FD9CB25E7A46C00964A20 /* Bt_Cell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Bt_Cell.xib; sourceTree = "<group>"; };
E0206326246CD84A007A40C4 /* TitleAndLblView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleAndLblView.swift; sourceTree = "<group>"; }; E0206326246CD84A007A40C4 /* TitleAndLblView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleAndLblView.swift; sourceTree = "<group>"; };
E0206328246CD855007A40C4 /* TitleAndLblView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndLblView.xib; sourceTree = "<group>"; }; E0206328246CD855007A40C4 /* TitleAndLblView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndLblView.xib; sourceTree = "<group>"; };
E020632A246CDD36007A40C4 /* OrderDViewFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderDViewFooterView.swift; sourceTree = "<group>"; }; E020632A246CDD36007A40C4 /* OrderDViewFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderDViewFooterView.swift; sourceTree = "<group>"; };
...@@ -1042,6 +1048,17 @@ ...@@ -1042,6 +1048,17 @@
E0AA7F322589A8AA0099193F /* JPUSHService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JPUSHService.h; sourceTree = "<group>"; }; E0AA7F322589A8AA0099193F /* JPUSHService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JPUSHService.h; sourceTree = "<group>"; };
E0AA7F332589A8AA0099193F /* jpush-ios-3.4.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "jpush-ios-3.4.0.a"; sourceTree = "<group>"; }; E0AA7F332589A8AA0099193F /* jpush-ios-3.4.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "jpush-ios-3.4.0.a"; sourceTree = "<group>"; };
E0AACC75255BB03C00FC9010 /* TitleAndSelectCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TitleAndSelectCell.swift; sourceTree = "<group>"; }; E0AACC75255BB03C00FC9010 /* TitleAndSelectCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TitleAndSelectCell.swift; sourceTree = "<group>"; };
E0AC417D25E88B0700805AE3 /* ConnectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConnectViewController.h; sourceTree = "<group>"; };
E0AC417E25E88B0700805AE3 /* ConnectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConnectViewController.m; sourceTree = "<group>"; };
E0AC417F25E88B0700805AE3 /* ConnectViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConnectViewController.xib; sourceTree = "<group>"; };
E0AC419C25E894E400805AE3 /* libGSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libGSDK.a; sourceTree = "<group>"; };
E0AC41A325E8952100805AE3 /* ReliableBurstData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReliableBurstData.h; sourceTree = "<group>"; };
E0AC41A425E8952100805AE3 /* DeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceInfo.h; sourceTree = "<group>"; };
E0AC41A525E8952100805AE3 /* EscCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EscCommand.h; sourceTree = "<group>"; };
E0AC41A625E8952100805AE3 /* CBController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBController.h; sourceTree = "<group>"; };
E0AC41A725E8952100805AE3 /* MyPeripheral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyPeripheral.h; sourceTree = "<group>"; };
E0AC41A825E8952100805AE3 /* TscCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TscCommand.h; sourceTree = "<group>"; };
E0AC41A925E8952100805AE3 /* BLKWrite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BLKWrite.h; sourceTree = "<group>"; };
E0AD92E72550E50500D82C17 /* GYS_FX_Product_VC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GYS_FX_Product_VC.swift; sourceTree = "<group>"; }; E0AD92E72550E50500D82C17 /* GYS_FX_Product_VC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GYS_FX_Product_VC.swift; sourceTree = "<group>"; };
E0AD92E82550E50500D82C17 /* GYS_FX_Product_VC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GYS_FX_Product_VC.xib; sourceTree = "<group>"; }; E0AD92E82550E50500D82C17 /* GYS_FX_Product_VC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GYS_FX_Product_VC.xib; sourceTree = "<group>"; };
E0AD92F72550FD1500D82C17 /* GYS_FX_SearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GYS_FX_SearchViewController.swift; sourceTree = "<group>"; }; E0AD92F72550FD1500D82C17 /* GYS_FX_SearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GYS_FX_SearchViewController.swift; sourceTree = "<group>"; };
...@@ -1127,8 +1144,6 @@ ...@@ -1127,8 +1144,6 @@
E0D197C5244845FD002B080C /* PersonCenterViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PersonCenterViewController.xib; sourceTree = "<group>"; }; E0D197C5244845FD002B080C /* PersonCenterViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PersonCenterViewController.xib; sourceTree = "<group>"; };
E0D197C824484D90002B080C /* PersonCenterCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonCenterCell.swift; sourceTree = "<group>"; }; E0D197C824484D90002B080C /* PersonCenterCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonCenterCell.swift; sourceTree = "<group>"; };
E0D197C924484D90002B080C /* PersonCenterCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PersonCenterCell.xib; sourceTree = "<group>"; }; E0D197C924484D90002B080C /* PersonCenterCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PersonCenterCell.xib; sourceTree = "<group>"; };
E0D197CD24485649002B080C /* BluetoothConnectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BluetoothConnectViewController.swift; sourceTree = "<group>"; };
E0D197CE24485649002B080C /* BluetoothConnectViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BluetoothConnectViewController.xib; sourceTree = "<group>"; };
E0D197D3244860B1002B080C /* BlueToothCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlueToothCell.swift; sourceTree = "<group>"; }; E0D197D3244860B1002B080C /* BlueToothCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlueToothCell.swift; sourceTree = "<group>"; };
E0D197D4244860B1002B080C /* BlueToothCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BlueToothCell.xib; sourceTree = "<group>"; }; E0D197D4244860B1002B080C /* BlueToothCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BlueToothCell.xib; sourceTree = "<group>"; };
E0D4165D24482AAF008DCAB4 /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = "<group>"; }; E0D4165D24482AAF008DCAB4 /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = "<group>"; };
...@@ -1491,6 +1506,7 @@ ...@@ -1491,6 +1506,7 @@
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 */,
E0AC419E25E894E400805AE3 /* 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 */,
...@@ -2316,6 +2332,8 @@ ...@@ -2316,6 +2332,8 @@
E09B3AB624B2FCAF00E3B238 /* SDK */ = { E09B3AB624B2FCAF00E3B238 /* SDK */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E0AC41A225E8952100805AE3 /* include */,
E0AC419C25E894E400805AE3 /* libGSDK.a */,
E09B3AB724B2FCAF00E3B238 /* ShareSDK */, E09B3AB724B2FCAF00E3B238 /* ShareSDK */,
E09B3ACD24B2FCAF00E3B238 /* Required */, E09B3ACD24B2FCAF00E3B238 /* Required */,
); );
...@@ -2530,6 +2548,21 @@ ...@@ -2530,6 +2548,21 @@
path = Lib; path = Lib;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
E0AC41A225E8952100805AE3 /* include */ = {
isa = PBXGroup;
children = (
E0AC41A325E8952100805AE3 /* ReliableBurstData.h */,
E0AC41A425E8952100805AE3 /* DeviceInfo.h */,
E0AC41A525E8952100805AE3 /* EscCommand.h */,
E0AC41A625E8952100805AE3 /* CBController.h */,
E0AC41A725E8952100805AE3 /* MyPeripheral.h */,
E0AC41A825E8952100805AE3 /* TscCommand.h */,
E0AC41A925E8952100805AE3 /* BLKWrite.h */,
);
name = include;
path = ../../../../Downloads/GprinterSDKandDemoforIOS_v1.0.8/GprinterSDKforIOS_v1.0.8/include;
sourceTree = "<group>";
};
E0AD92E62550E4DD00D82C17 /* 供应商分销商品管理 */ = { E0AD92E62550E4DD00D82C17 /* 供应商分销商品管理 */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -2661,8 +2694,12 @@ ...@@ -2661,8 +2694,12 @@
E0D197CC244855F5002B080C /* 蓝牙连接 */ = { E0D197CC244855F5002B080C /* 蓝牙连接 */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E0D197CD24485649002B080C /* BluetoothConnectViewController.swift */, E0AC417D25E88B0700805AE3 /* ConnectViewController.h */,
E0D197CE24485649002B080C /* BluetoothConnectViewController.xib */, E0AC417E25E88B0700805AE3 /* ConnectViewController.m */,
E0AC417F25E88B0700805AE3 /* ConnectViewController.xib */,
E01FD9C925E7A46C00964A20 /* Bt_Cell.h */,
E01FD9CA25E7A46C00964A20 /* Bt_Cell.m */,
E01FD9CB25E7A46C00964A20 /* Bt_Cell.xib */,
); );
path = "蓝牙连接"; path = "蓝牙连接";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3689,7 +3726,6 @@ ...@@ -3689,7 +3726,6 @@
E02EE11C259ACC0500733764 /* FXSY_ViewController.xib in Resources */, E02EE11C259ACC0500733764 /* FXSY_ViewController.xib in Resources */,
E0516F782448003D00E373CE /* PayViewController.xib in Resources */, E0516F782448003D00E373CE /* PayViewController.xib in Resources */,
E02FD9ED2455627300E10E27 /* ChuKuViewController.xib in Resources */, E02FD9ED2455627300E10E27 /* ChuKuViewController.xib in Resources */,
E0D197D024485649002B080C /* BluetoothConnectViewController.xib in Resources */,
F969BF1F244EE67900C79953 /* GoodsManageListVC.xib in Resources */, F969BF1F244EE67900C79953 /* GoodsManageListVC.xib in Resources */,
F94A316024629DDD00FEC38E /* WorkBannerTableViewCell.xib in Resources */, F94A316024629DDD00FEC38E /* WorkBannerTableViewCell.xib in Resources */,
F95567AC2453E40B009674AB /* OrderListViewController.xib in Resources */, F95567AC2453E40B009674AB /* OrderListViewController.xib in Resources */,
...@@ -3834,6 +3870,7 @@ ...@@ -3834,6 +3870,7 @@
E0336DD6244EC40000380BE9 /* CreatNewSpecsViewController.xib in Resources */, E0336DD6244EC40000380BE9 /* CreatNewSpecsViewController.xib in Resources */,
E0E7CB6224C17B9F00A26D3F /* GLKHCell.xib in Resources */, E0E7CB6224C17B9F00A26D3F /* GLKHCell.xib in Resources */,
E0C4F4B6244EE9EE00CC7E2F /* YuShouCell.xib in Resources */, E0C4F4B6244EE9EE00CC7E2F /* YuShouCell.xib in Resources */,
E0AC418125E88B0700805AE3 /* ConnectViewController.xib in Resources */,
F95A9EDE24557CD500867849 /* GuanLianKehuVC.xib in Resources */, F95A9EDE24557CD500867849 /* GuanLianKehuVC.xib in Resources */,
E07B1E6C245926330055BA3C /* GYSGLCell.xib in Resources */, E07B1E6C245926330055BA3C /* GYSGLCell.xib in Resources */,
E0974D5825C12DE100E3C86B /* one_title_cell.xib in Resources */, E0974D5825C12DE100E3C86B /* one_title_cell.xib in Resources */,
...@@ -3845,6 +3882,7 @@ ...@@ -3845,6 +3882,7 @@
E00D85E5244561FE00F5F816 /* Assets.xcassets in Resources */, E00D85E5244561FE00F5F816 /* Assets.xcassets in Resources */,
E0206331246CE303007A40C4 /* OrderDViewSumFooter.xib in Resources */, E0206331246CE303007A40C4 /* OrderDViewSumFooter.xib in Resources */,
E0706EF924B4796400D8251C /* CGDListCell2.xib in Resources */, E0706EF924B4796400D8251C /* CGDListCell2.xib in Resources */,
E01FD9CD25E7A46C00964A20 /* Bt_Cell.xib in Resources */,
E0A320C72456D01D00AF321C /* DaiKeXiaDanFooterView.xib in Resources */, E0A320C72456D01D00AF321C /* DaiKeXiaDanFooterView.xib in Resources */,
F94A315824628AC600FEC38E /* WorkItemCollectionViewCell.xib in Resources */, F94A315824628AC600FEC38E /* WorkItemCollectionViewCell.xib in Resources */,
); );
...@@ -4034,6 +4072,7 @@ ...@@ -4034,6 +4072,7 @@
F9A0E1DF246D1B1E00D7F26F /* GetGoodsInfoModel.swift in Sources */, F9A0E1DF246D1B1E00D7F26F /* GetGoodsInfoModel.swift in Sources */,
F94A314B246250DB00FEC38E /* GoodsDetailModel.swift in Sources */, F94A314B246250DB00FEC38E /* GoodsDetailModel.swift in Sources */,
E02DDD85244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift in Sources */, E02DDD85244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift in Sources */,
E01FD9CC25E7A46C00964A20 /* Bt_Cell.m in Sources */,
E0F3C2CB24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift in Sources */, E0F3C2CB24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift in Sources */,
F956D5B4246A2D9C003FF510 /* UIImage+LMNStore.m in Sources */, F956D5B4246A2D9C003FF510 /* UIImage+LMNStore.m in Sources */,
F9531F412465108800724BEE /* JXPhotoBrowserView.swift in Sources */, F9531F412465108800724BEE /* JXPhotoBrowserView.swift in Sources */,
...@@ -4267,6 +4306,7 @@ ...@@ -4267,6 +4306,7 @@
E01E5484254FD34C00A2620C /* GYS_GuanLi_Cell.swift in Sources */, E01E5484254FD34C00A2620C /* GYS_GuanLi_Cell.swift in Sources */,
F9956B1E2463D94E001A617D /* WorkSelectTimeView.swift in Sources */, F9956B1E2463D94E001A617D /* WorkSelectTimeView.swift in Sources */,
E01313DB25C0048C006CFA5D /* Add_Report_View.swift in Sources */, E01313DB25C0048C006CFA5D /* Add_Report_View.swift in Sources */,
E0AC418025E88B0700805AE3 /* ConnectViewController.m in Sources */,
F9531F3B2465108800724BEE /* JXPhotoBrowserZoomSupportedCell.swift in Sources */, F9531F3B2465108800724BEE /* JXPhotoBrowserZoomSupportedCell.swift in Sources */,
F950FDE024518B9500C40530 /* FSCalendarExtensions.m in Sources */, F950FDE024518B9500C40530 /* FSCalendarExtensions.m in Sources */,
E09B03A32445AF9500211A51 /* NetworkRequest.swift in Sources */, E09B03A32445AF9500211A51 /* NetworkRequest.swift in Sources */,
...@@ -4305,7 +4345,6 @@ ...@@ -4305,7 +4345,6 @@
F94A314D2462582F00FEC38E /* GeneralInfoModel.swift in Sources */, F94A314D2462582F00FEC38E /* GeneralInfoModel.swift in Sources */,
E02DDD8D244FE43900ABB707 /* NewCreateFooter.swift in Sources */, E02DDD8D244FE43900ABB707 /* NewCreateFooter.swift in Sources */,
F9A4AB7324C933A700094BD1 /* XiaDanUserInfoViewController.swift in Sources */, F9A4AB7324C933A700094BD1 /* XiaDanUserInfoViewController.swift in Sources */,
E0D197CF24485649002B080C /* BluetoothConnectViewController.swift in Sources */,
E0AA3A87248F3C5E00CBFC27 /* StatisticsModel.swif.swift in Sources */, E0AA3A87248F3C5E00CBFC27 /* StatisticsModel.swif.swift in Sources */,
F93E31F724721C4200524DFC /* EditOGPAdModel.swift in Sources */, F93E31F724721C4200524DFC /* EditOGPAdModel.swift in Sources */,
F94A31642462B21700FEC38E /* EditWorkCViewController.swift in Sources */, F94A31642462B21700FEC38E /* EditWorkCViewController.swift in Sources */,
...@@ -4483,6 +4522,7 @@ ...@@ -4483,6 +4522,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements; CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4.3; CURRENT_PROJECT_VERSION = 4.3;
...@@ -4618,6 +4658,7 @@ ...@@ -4618,6 +4658,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements; CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4.3; CURRENT_PROJECT_VERSION = 4.3;
......
...@@ -40,13 +40,13 @@ import ESTabBarController_swift ...@@ -40,13 +40,13 @@ import ESTabBarController_swift
@UIApplicationMain @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate,loginDelegate,UITabBarControllerDelegate, JPUSHRegisterDelegate{ class AppDelegate: UIResponder, UIApplicationDelegate,loginDelegate,UITabBarControllerDelegate, JPUSHRegisterDelegate{
var blueToothVC:BluetoothConnectViewController! var blueToothVC:ConnectViewController!
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() blueToothVC = ConnectViewController()
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
if UserToken == nil { if UserToken == nil {
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#import "JZLocationConverter.h" #import "JZLocationConverter.h"
#import "CBController.h"
#import "DeviceInfo.h"
#import "TscCommand.h"
#import "BLKWrite.h"
#import "EscCommand.h"
#import "ConnectViewController.h"
#endif /* Bridge_Header_h */ #endif /* Bridge_Header_h */
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
<array> <array>
<string>fetch</string> <string>fetch</string>
<string>bluetooth-central</string>
<string>remote-notification</string> <string>remote-notification</string>
</array> </array>
<key>UILaunchImageFile</key> <key>UILaunchImageFile</key>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......
...@@ -154,6 +154,18 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -154,6 +154,18 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
var goodsInfoArr:Array<Any> = [] var goodsInfoArr:Array<Any> = []
@IBOutlet weak var gm_view: UIView! @IBOutlet weak var gm_view: UIView!
@IBAction func ck_action(_ sender: UIButton) { @IBAction func ck_action(_ sender: UIButton) {
print("pw = ",BLKWrite.instance()?.printWidth())
let esc = EscCommand()
esc.hasResponse = true
esc.addInitializePrinter()
esc.addText("测试")
esc.addPrintMode(0x1B)
esc.addPrintAndFeedLines(8)
BLKWrite.instance()?.writeEscData(esc.getCommand(), withResponse: esc.hasResponse)
return
if isGm { if isGm {
if typeSelect == nil { if typeSelect == nil {
HUD.flash(.label("请选择出库类型"),delay: 1.2) HUD.flash(.label("请选择出库类型"),delay: 1.2)
......
//
// BluetoothConnectViewController.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/16.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
import Dollar
class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CBPeripheralDelegate {
@IBOutlet weak var bottomView: UIView!
@IBOutlet weak var tableView: UITableView!
let baby = BabyBluetooth.share()
var peripheralDataArray : Array<CBPeripheral> = []
var selectDataArray : Array<CBPeripheral> = []
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = "蓝牙打印设置"
self.view.addSubview(navbar)
// Do any additional setup after loading the view.
tableView.separatorStyle = .none
tableView.snp.makeConstraints { (make) in
make.top.equalTo(NavCGRect.height)
make.left.right.equalTo(0)
make.bottom.equalTo(bottomView.snp_top)
}
tableView?.register(UINib(nibName: "BlueToothCell", bundle: nil), forCellReuseIdentifier: "BlueTooth")
baby?.setBlockOnDiscoverToPeripherals({ (mangan, peripheral, adv, RSSI) in
})
baby?.setFilterOnDiscoverPeripherals({ (periName, adv, RSSI) -> Bool in
if periName != nil {
print("是否需要过滤\(periName)")
return true
}
return false
})
baby?.setBlockOnDiscoverToPeripherals({ (central, peripheral, adv, RSSI) in
print("搜索到的\(peripheral?.name)")
if !self.peripheralDataArray.contains(peripheral!){
self.peripheralDataArray.insert(peripheral!, at: 0)
self.tableView.reloadData()
}
})
baby?.scanForPeripherals()
baby?.begin()
//尝试链接
baby?.setBlockOnConnected({ (central, peripheral) in
print("设备\(peripheral?.name)连接成功")
self.selectDataArray.removeAll()
if self.peripheralDataArray.contains(peripheral!){
Dollar.remove(self.peripheralDataArray, value: peripheral)
}
self.selectDataArray.insert(peripheral!, at: 0)
self.tableView.reloadData()
HUD.flash(.labeledSubSuccess(subtitle: "连接成功"),delay: 1.5)
//停在扫描?
self.baby?.cancelScan()
peripheral?.delegate = self
//[peripheral discoverServices:@[[CBUUID UUIDWithString:SERVICE_UUID]]];
//外设发现服务,传nil代表不过滤,一次性读出外设的所有服务
peripheral?.discoverServices(nil)
})
baby?.setBlockOnFailToConnect({ (central, peripheral, error) in
HUD.flash(.labeledSubError(subtitle: "连接失败"),delay: 1.5)
})
baby?.setBlockOnCancelAllPeripheralsConnectionBlock({ (cetral) in
print("断开连接2223333")
let currPeripheral:CBPeripheral = self.selectDataArray[0]
self.peripheralDataArray.insert(currPeripheral, at: 0)
self.selectDataArray.removeAll()
self.tableView.reloadData()
})
//获取外围设备服务和特征1
// baby?.discoverServices()//发现Services
// baby?.setBlockOnDiscoverServices({ (peripheral, error) in
// //遍历服务
// peripheral?.services?.forEach({ (service) in
// print("遍历发现的服务\(service)")
// peripheral?.discoverCharacteristics(nil, for: service)
// })
// })
}
//MARK:--发现外围设备服务1
func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
//遍历服务
print("-发现外围设备服务1")
peripheral.services?.forEach({ (service) in
print("遍历发现的服务\(service)")
peripheral.discoverCharacteristics(nil, for: service) //服务注册
})
}
//MARK:--发现外围设备特征2
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
print("-发现外围设备特征2")
if error == nil {
service.characteristics?.forEach({ (characteristic) in
print("遍历特征\(characteristic.uuid)") //要跟UUID
peripheral.setNotifyValue(true, for: characteristic)//特征注册
})
}
}
//MARK:--外设返回数据(回调)
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
let data = characteristic.value
let resultByte = data?.bytes
print("外设回调数据----\(data)==\(resultByte)")
if data!.count >= 1 {
if resultByte![0] == 16 {
print("---打印机打开--")
}else if resultByte![0] == 1 {
print("---打印机缺纸--")
}
}
}
func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: Error?) {
print("写入数据的回调么")
}
//MARK: -方法
@IBAction func searchAction(_ sender: Any) {
print("搜索")
//临时处理给外设写入数据
// let byte = [0x1B,0x68]
// let data = Data.init(bytes: byte, count: 3)
// let currPeripheral:CBPeripheral = self.selectDataArray[0]
//写入数据
// currPeripheral.writeValue(data, for: <#T##CBCharacteristic#>, type: CBCharacteristicWriteType)
baby?.scanForPeripherals()
baby?.begin()
}
//MARK: -Cell delegate
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 0 {
print("准备取消所有连接11")
self.baby?.cancelAllPeripheralsConnection()
}else{
HUD.show(.labeledProgress(title: "", subtitle: "连接中"))
let currPeripheral:CBPeripheral = self.peripheralDataArray[indexPath.row]
print("准备连接的设备:\(currPeripheral.name)")
self.baby?.having(currPeripheral)?.and()?.channel("peripheralView")?.then()?.connectToPeripherals()?.begin()
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0{
return self.selectDataArray.count
}
return self.peripheralDataArray.count
}
//header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
switch section {
case 0:
let view = UIView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: 46))
view.backgroundColor = UIColor.init(named: "app底色")!
let lbl = UILabel(frame: CGRect(x: 15, y: 0, width: self.view.bounds.size.width, height: 46))
lbl.text = "已连接设备"
lbl.font = UIFont.boldSystemFont(ofSize: 15)
lbl.textColor = UIColor(named:"灰色字体颜色")
view.addSubview(lbl)
return view
default:
let view = UIView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: 46))
view.backgroundColor = UIColor.init(named: "app底色")!
let lbl = UILabel(frame: CGRect(x: 15, y: 0, width: self.view.bounds.size.width, height: 46))
lbl.text = "未连接设备"
lbl.font = UIFont.boldSystemFont(ofSize: 15)
lbl.textColor = UIColor(named:"灰色字体颜色")
view.addSubview(lbl)
return view
}
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 46
}
//footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
switch section {
case 0:
let view = UIView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: 46))
view.backgroundColor = UIColor.init(named: "app底色")!
let lbl = UILabel(frame: CGRect(x: 15, y: 0, width: self.view.bounds.size.width, height: 46))
lbl.text = "选择已经连接的设备作为默认打印设备"
lbl.font = UIFont.boldSystemFont(ofSize: 11)
lbl.textColor = UIColor(named:"灰色字体颜色")
view.addSubview(lbl)
return view
default:
let view = UIView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: 46))
view.backgroundColor = UIColor.init(named: "app底色")!
let lbl = UILabel(frame: CGRect(x: 15, y: 0, width: self.view.bounds.size.width, height: 46))
lbl.text = "选择设备进行连接"
lbl.font = UIFont.boldSystemFont(ofSize: 11)
lbl.textColor = UIColor(named:"灰色字体颜色")
view.addSubview(lbl)
return view
}
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 46
}
//cell
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "BlueTooth") as! BlueToothCell
if indexPath.section == 0 {
let currPeripheral:CBPeripheral = self.selectDataArray[indexPath.row]
cell.contentLbl.text = currPeripheral.name
cell.statusIcon.isHidden = false
}else{
cell.statusIcon.isHidden = true
let currPeripheral:CBPeripheral = self.peripheralDataArray[indexPath.row]
cell.contentLbl.text = currPeripheral.name
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 49
}
override func backAction() {
print("重写back")
self.navigationController?.popViewController(animated: true)
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BluetoothConnectViewController" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="bottomView" destination="z6g-3U-Gjc" id="Kx7-8l-LwL"/>
<outlet property="tableView" destination="IoW-aR-gg0" id="Cxv-cQ-rjJ"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="IoW-aR-gg0">
<rect key="frame" x="0.0" y="44" width="414" height="768"/>
<color key="backgroundColor" name="app底色"/>
<connections>
<outlet property="dataSource" destination="-1" id="xfo-ZG-WzQ"/>
<outlet property="delegate" destination="-1" id="2c8-jb-9e5"/>
</connections>
</tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="z6g-3U-Gjc">
<rect key="frame" x="0.0" y="812" width="414" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="搜索" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bS9-xW-ajm">
<rect key="frame" x="207.5" y="15" width="35" height="20.5"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="USO-np-8G1"/>
<constraint firstAttribute="height" constant="20.5" id="Xbv-19-TDF"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="guanbi" translatesAutoresizingMaskIntoConstraints="NO" id="zmP-e7-gur">
<rect key="frame" x="179" y="15" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="TmK-Oq-Sof"/>
<constraint firstAttribute="width" constant="20" id="Xi5-pM-tII"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kxt-WC-XyY">
<rect key="frame" x="0.0" y="0.0" width="414" height="50"/>
<connections>
<action selector="searchAction:" destination="-1" eventType="touchUpInside" id="lDV-he-pEz"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="bS9-xW-ajm" firstAttribute="centerY" secondItem="z6g-3U-Gjc" secondAttribute="centerY" id="I5U-kM-DXb"/>
<constraint firstAttribute="height" constant="50" id="LW6-DI-gTT"/>
<constraint firstItem="Kxt-WC-XyY" firstAttribute="top" secondItem="z6g-3U-Gjc" secondAttribute="top" id="NJc-wO-cmv"/>
<constraint firstAttribute="bottom" secondItem="Kxt-WC-XyY" secondAttribute="bottom" id="Vtr-aJ-Rod"/>
<constraint firstItem="Kxt-WC-XyY" firstAttribute="leading" secondItem="z6g-3U-Gjc" secondAttribute="leading" id="WJR-bl-zKg"/>
<constraint firstItem="zmP-e7-gur" firstAttribute="centerX" secondItem="z6g-3U-Gjc" secondAttribute="centerX" constant="-18" id="iwy-LB-WMs"/>
<constraint firstItem="zmP-e7-gur" firstAttribute="centerY" secondItem="z6g-3U-Gjc" secondAttribute="centerY" id="j4R-HR-czB"/>
<constraint firstItem="bS9-xW-ajm" firstAttribute="centerX" secondItem="z6g-3U-Gjc" secondAttribute="centerX" constant="18" id="kn3-Ji-FaK"/>
<constraint firstAttribute="trailing" secondItem="Kxt-WC-XyY" secondAttribute="trailing" id="qu6-u0-3z0"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EhN-in-WvW">
<rect key="frame" x="0.0" y="862" width="414" height="70"/>
<color key="backgroundColor" name="白色背景色"/>
<constraints>
<constraint firstAttribute="height" constant="70" id="5Bl-jC-R6q"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="IoW-aR-gg0" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="1BX-uM-9UQ"/>
<constraint firstItem="EhN-in-WvW" firstAttribute="top" secondItem="z6g-3U-Gjc" secondAttribute="bottom" id="6eJ-il-R2H"/>
<constraint firstAttribute="trailing" secondItem="EhN-in-WvW" secondAttribute="trailing" id="EOz-ma-JQs"/>
<constraint firstItem="IoW-aR-gg0" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="Rcf-fQ-pmW"/>
<constraint firstItem="z6g-3U-Gjc" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="SEI-Ob-cTQ"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="z6g-3U-Gjc" secondAttribute="bottom" id="VTm-D3-5xc"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="z6g-3U-Gjc" secondAttribute="trailing" id="Xak-0L-zec"/>
<constraint firstItem="z6g-3U-Gjc" firstAttribute="top" secondItem="IoW-aR-gg0" secondAttribute="bottom" id="aNn-3T-lTt"/>
<constraint firstItem="EhN-in-WvW" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="b7Q-gR-cJG"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="IoW-aR-gg0" secondAttribute="trailing" id="hos-nX-fj1"/>
</constraints>
<point key="canvasLocation" x="127.53623188405798" y="111.16071428571428"/>
</view>
</objects>
<resources>
<image name="guanbi" width="37" height="18"/>
<namedColor name="app底色">
<color red="0.94509803921568625" green="0.94509803921568625" blue="0.94509803921568625" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
//
// Bt_Cell.h
// GeliBusinessPlatform
//
// Created by junye lu on 2021/2/25.
// Copyright © 2021 junye lu. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface Bt_Cell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *statusImg;
@property (weak, nonatomic) IBOutlet UILabel *title_lbl;
@end
NS_ASSUME_NONNULL_END
//
// Bt_Cell.m
// GeliBusinessPlatform
//
// Created by junye lu on 2021/2/25.
// Copyright © 2021 junye lu. All rights reserved.
//
#import "Bt_Cell.h"
@implementation Bt_Cell
- (void)awakeFromNib {
[super awakeFromNib];
self.selectionStyle = UITableViewCellSelectionStyleNone;
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="Bt_Cell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h8i-lL-wng">
<rect key="frame" x="15" y="0.0" width="270" height="44"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="yuxuan" translatesAutoresizingMaskIntoConstraints="NO" id="Dt4-SC-5RJ">
<rect key="frame" x="285" y="12" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="g4G-0M-Rxg"/>
<constraint firstAttribute="width" constant="20" id="wrQ-9R-QS0"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstItem="h8i-lL-wng" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="5aq-oo-tAy"/>
<constraint firstItem="Dt4-SC-5RJ" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="ERi-41-NCH"/>
<constraint firstAttribute="bottom" secondItem="h8i-lL-wng" secondAttribute="bottom" id="MFu-7I-Fhe"/>
<constraint firstAttribute="trailing" secondItem="Dt4-SC-5RJ" secondAttribute="trailing" constant="15" id="gU6-oH-pJf"/>
<constraint firstItem="h8i-lL-wng" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="uLg-IZ-WW5"/>
<constraint firstItem="Dt4-SC-5RJ" firstAttribute="leading" secondItem="h8i-lL-wng" secondAttribute="trailing" id="uin-js-ZxJ"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="statusImg" destination="Dt4-SC-5RJ" id="6N9-Rr-oJ6"/>
<outlet property="title_lbl" destination="h8i-lL-wng" id="fbs-kO-ZV2"/>
</connections>
<point key="canvasLocation" x="141" y="92"/>
</tableViewCell>
</objects>
<resources>
<image name="yuxuan" width="19" height="19"/>
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
//
// ConnectViewController.h
// BLETR
//
// Created by D500 user on 12/9/26.
// Copyright (c) 2012 ISSC Technologies Corporation. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CBController.h"
#import "DeviceInfo.h"
@interface ConnectViewController : CBController<UITableViewDataSource, UITextViewDelegate, UITableViewDelegate>
{
IBOutlet UITableView *devicesTableView;
UIActivityIndicatorView *activityIndicatorView;
UILabel *statusLabel;
NSTimer *refreshDeviceListTimer;
int connectionStatus;
//Derek
DeviceInfo *deviceInfo;
MyPeripheral *controlPeripheral;
NSMutableArray *connectedDeviceInfo;//stored for DeviceInfo object
NSMutableArray *connectingList;//stored for MyPeripheral object
UIBarButtonItem *refreshButton;
UIBarButtonItem *scanButton;
UIBarButtonItem *cancelButton;
UIBarButtonItem *uuidSettingButton;
}
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicatorView;
@property (nonatomic, retain) IBOutlet UILabel *statusLabel;
@property (assign) int connectionStatus;
@property (retain, nonatomic) IBOutlet UILabel *versionLabel;
- (IBAction)refreshDeviceList:(id)sender;
- (IBAction)actionButtonCancelScan:(id)sender;
- (IBAction)manualUUIDSetting:(id)sender;
- (IBAction)actionButtonDisconnect:(id)sender;
- (IBAction)actionButtonCancelConnect:(id)sender;
@end
//
// ConnectViewController.m
// BLETR
//
// Created by D500 user on 12/9/26.
// Copyright (c) 2012 ISSC Technologies Corporation. All rights reserved.
//
#import "ConnectViewController.h"
#import "BLKWrite.h"
#import "BabyBluetooth.h"
#import "Bt_Cell.h"
@interface ConnectViewController ()
@property (nonatomic, strong) BabyBluetooth *baby;
@property (nonatomic, strong) NSMutableArray *peripheralDataArray;
@property (nonatomic, strong) NSMutableArray *selectDataArray;
@property (nonatomic, strong) MyPeripheral *tempP;
@end
@implementation ConnectViewController
//@synthesize actionButton;
@synthesize activityIndicatorView;
@synthesize statusLabel;
@synthesize connectionStatus;
@synthesize versionLabel;
- (IBAction)backAction:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] init];
backButton.title = @"Back";
self.navigationItem.backBarButtonItem = backButton;
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 28, 57, 57)];
[titleLabel setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"Icon_old"]]];
[titleLabel setTextAlignment:NSTextAlignmentCenter];//aaa
self.navigationItem.titleView = titleLabel;
connectedDeviceInfo = [NSMutableArray new];
connectingList = [NSMutableArray new];
deviceInfo = [[DeviceInfo alloc]init];
refreshDeviceListTimer = nil;
}
return self;
}
-(void)insertTableView:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData type:(int)type andManger:(CBManager*)m{
switch (type) {
case 0:
{[self.selectDataArray removeAllObjects];
[self.selectDataArray addObject:peripheral];
[devicesTableView reloadData];
[_baby cancelScan];}
break;
case 1:
{
if(![_peripheralDataArray containsObject:peripheral]){
NSMutableArray *indexPaths = [[NSMutableArray alloc] init];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:_peripheralDataArray.count inSection:0];
[indexPaths addObject:indexPath];
[_peripheralDataArray addObject:peripheral];
[devicesTableView reloadData];
}
}
break;
default:
{
[self.selectDataArray removeAllObjects];
[devicesTableView reloadData];
}
break;
}
}
-(void)babyDelegate{
//设置扫描到设备的委托
[_baby setBlockOnDiscoverToPeripherals:^(CBCentralManager *central, CBPeripheral *peripheral, NSDictionary *advertisementData, NSNumber *RSSI) {
NSLog(@"搜索到了设备:%@",peripheral.name);
}];
//过滤器
//设置查找设备的过滤器
[_baby setFilterOnDiscoverPeripherals:^BOOL(NSString *peripheralName, NSDictionary *advertisementData, NSNumber *RSSI) {
//最常用的场景是查找某一个前缀开头的设备 most common usage is discover for peripheral that name has common prefix
if (peripheralName.length != 0) {
return YES;
}
return NO;
}];
__weak typeof(self) weakSelf = self;
[_baby setBlockOnDiscoverToPeripherals:^(CBCentralManager *central, CBPeripheral *peripheral, NSDictionary *advertisementData, NSNumber *RSSI) {
if (peripheral.name.length != 0) {
[weakSelf insertTableView:peripheral advertisementData:advertisementData type:1 andManger:NULL];
}
}];
[_baby setBlockOnConnected:^(CBCentralManager *central, CBPeripheral *peripheral) {
if (peripheral.name.length != 0) {
[weakSelf insertTableView:peripheral advertisementData:NULL type:0 andManger:NULL];
}
}];
[_baby setBlockOnFailToConnect:^(CBCentralManager *central, CBPeripheral *peripheral, NSError *error) {
}];
[_baby setBlockOnCancelAllPeripheralsConnectionBlock:^(CBCentralManager *centralManager) {
[weakSelf insertTableView:NULL advertisementData:NULL type:2 andManger:centralManager];
}];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[self setConnectionStatus:LE_STATUS_IDLE];
[versionLabel setText:[NSString stringWithFormat:@"BLETR %@, %s",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], __DATE__]];
[devicesTableView registerNib:[UINib nibWithNibName:@"Bt_Cell" bundle:NULL] forCellReuseIdentifier:@"Bt_Cell"];
_peripheralDataArray = [NSMutableArray array];
_selectDataArray = [NSMutableArray array];
_baby = [BabyBluetooth shareBabyBluetooth];
[_baby scanForPeripherals];
[_baby begin];
[self babyDelegate];
}
- (void)viewDidAppear:(BOOL)animated {
[self startScan];
}
- (void)viewDidUnload
{
devicesTableView = nil;
[self setVersionLabel:nil];
refreshButton = nil;
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
NSLog(@"[ConnectViewController] didReceiveMemoryWarning");
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void) displayDevicesList {
[devicesTableView reloadData];
}
- (void) switchToMainFeaturePage {
NSLog(@"[ConnectViewController] switchToMainFeaturePage");
// AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
// if ([[[appDelegate navigationController] viewControllers] containsObject:[deviceInfo mainViewController]] == FALSE) {
// [[appDelegate navigationController] pushViewController:[deviceInfo mainViewController] animated:YES];
// }
}
- (int) connectionStatus {
return connectionStatus;
}
- (void) setConnectionStatus:(int)status {
if (status == LE_STATUS_IDLE) {
statusLabel.textColor = [UIColor redColor];
}
else {
statusLabel.textColor = [UIColor blackColor];
}
connectionStatus = status;
switch (status) {
case LE_STATUS_IDLE:
statusLabel.text = @"Idle";
[activityIndicatorView stopAnimating];
break;
case LE_STATUS_SCANNING:
[devicesTableView reloadData];
statusLabel.text = @"Scanning...";
[activityIndicatorView startAnimating];
break;
default:
break;
}
[self updateButtonType];
}
- (IBAction)actionButtonCancelScan:(id)sender {
NSLog(@"[ConnectViewController] actionButtonCancelScan");
[self stopScan];
[self setConnectionStatus:LE_STATUS_IDLE];
}
- (void)startScan {
[super startScan];
if ([connectingList count] > 0) {
for (int i=0; i< [connectingList count]; i++) {
MyPeripheral *connectingPeripheral = [connectingList objectAtIndex:i];
if (connectingPeripheral.connectStaus == MYPERIPHERAL_CONNECT_STATUS_CONNECTING) {
//NSLog(@"startScan add connecting List: %@",connectingPeripheral.advName);
[devicesList addObject:connectingPeripheral];
}
else {
[connectingList removeObjectAtIndex:i];
//NSLog(@"startScan remove connecting List: %@",connectingPeripheral.advName);
}
}
}
[self setConnectionStatus:LE_STATUS_SCANNING];
}
- (void)stopScan {
[super stopScan];
if (refreshDeviceListTimer) {
[refreshDeviceListTimer invalidate];
refreshDeviceListTimer = nil;
}
}
-(void)popToRootPage {
// AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
// if (appDelegate.pageTransition == FALSE) {
// [[appDelegate navigationController] popToRootViewControllerAnimated:NO];
// }
// else {
// [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(popToRootPage) userInfo:nil repeats:NO];
// }
}
- (void)updateDiscoverPeripherals {
[super updateDiscoverPeripherals];
[devicesTableView reloadData];
}
- (void)updateMyPeripheralForDisconnect:(MyPeripheral *)myPeripheral {
NSLog(@"updateMyPeripheralForDisconnect");//, %@", myPeripheral.advName);
if (myPeripheral == controlPeripheral) {
[NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(popToRootPage) userInfo:nil repeats:NO];
}
for (int idx =0; idx< [connectedDeviceInfo count]; idx++) {
DeviceInfo *tmpDeviceInfo = [connectedDeviceInfo objectAtIndex:idx];
if (tmpDeviceInfo.myPeripheral == myPeripheral) {
[connectedDeviceInfo removeObjectAtIndex:idx];
//NSLog(@"updateMyPeripheralForDisconnect1");
break;
}
}
for (int idx =0; idx< [connectingList count]; idx++) {
MyPeripheral *tmpPeripheral = [connectingList objectAtIndex:idx];
if (tmpPeripheral == myPeripheral) {
[connectingList removeObjectAtIndex:idx];
//NSLog(@"updateMyPeripheralForDisconnect2");
break;
}
else{
//NSLog(@"updateMyPeripheralForDisconnect3 %@, %@", tmpPeripheral.advName, myPeripheral.advName);
}
}
[self displayDevicesList];
[self updateButtonType];
if(connectionStatus == LE_STATUS_SCANNING){
[self stopScan];
[self startScan];
[devicesTableView reloadData];
}
}
- (void)updateMyPeripheralForNewConnected:(MyPeripheral *)myPeripheral {
[[BLKWrite Instance] setPeripheral:myPeripheral];
NSLog(@"[ConnectViewController] updateMyPeripheralForNewConnected");
DeviceInfo *tmpDeviceInfo = [[DeviceInfo alloc]init];
// tmpDeviceInfo.mainViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
// tmpDeviceInfo.mainViewController.connectedPeripheral = myPeripheral;
tmpDeviceInfo.myPeripheral = myPeripheral;
tmpDeviceInfo.myPeripheral.connectStaus = myPeripheral.connectStaus;
/*Connected List Filter*/
bool b = FALSE;
for (int idx =0; idx< [connectedDeviceInfo count]; idx++) {
DeviceInfo *tmpDeviceInfo = [connectedDeviceInfo objectAtIndex:idx];
if (tmpDeviceInfo.myPeripheral == myPeripheral) {
b = TRUE;
break;
}
}
if (!b) {
[connectedDeviceInfo addObject:tmpDeviceInfo];
}
else{
NSLog(@"Connected List Filter!");
}
for (int idx =0; idx< [connectingList count]; idx++) {
MyPeripheral *tmpPeripheral = [connectingList objectAtIndex:idx];
if (tmpPeripheral == myPeripheral) {
//NSLog(@"connectingList removeObject:%@",tmpPeripheral.advName);
[connectingList removeObjectAtIndex:idx];
break;
}
}
for (int idx =0; idx< [devicesList count]; idx++) {
MyPeripheral *tmpPeripheral = [devicesList objectAtIndex:idx];
if (tmpPeripheral == myPeripheral) {
//NSLog(@"devicesList removeObject:%@",tmpPeripheral.advName);
[devicesList removeObjectAtIndex:idx];
break;
}
}
[self displayDevicesList];
[self updateButtonType];
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 44;
}
// DataSource methods
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//NSLog(@"[ConnectViewController] numberOfRowsInSection,device count = %d", [devicesList count]);
if (section == 0) {
return _selectDataArray.count;
}
return _peripheralDataArray.count;
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Bt_Cell *cell = [tableView dequeueReusableCellWithIdentifier:@"Bt_Cell"];
switch (indexPath.section) {
case 0:
{
CBPeripheral *tmpDeviceInfo = [_selectDataArray objectAtIndex:indexPath.row];
cell.title_lbl.text = tmpDeviceInfo.name;
cell.statusImg.hidden = NO;
}
break;
case 1:
{
CBPeripheral *tmpPeripheral = [_peripheralDataArray objectAtIndex:indexPath.row];
cell.title_lbl.text = tmpPeripheral.name;
cell.statusImg.hidden = YES;
}
break;
}
return cell;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 46)];
view.backgroundColor = [UIColor colorNamed:@"app底色"];
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, self.view.bounds.size.width, 46)];
lbl.font = [UIFont boldSystemFontOfSize:11];
lbl.textColor = [UIColor colorNamed:@"灰色字体颜色"];
[view addSubview:lbl];
switch (section) {
case 0:
{
lbl.text = @"选择已经连接的设备作为默认打印设备";
}
break;
default:
{
lbl.text = @"选择设备进行连接";
}
break;
}
return view;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 46;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 46;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 46)];
view.backgroundColor = [UIColor colorNamed:@"app底色"];
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, self.view.bounds.size.width, 46)];
lbl.font = [UIFont boldSystemFontOfSize:15];
lbl.textColor = [UIColor colorNamed:@"灰色字体颜色"];
[view addSubview:lbl];
switch (section) {
case 0:
{
lbl.text = @"已连接设备";
}
break;
default:
{
lbl.text = @"未连接设备";
}
break;
}
return view;
}
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
/*
if (indexPath.section == 0) {
[_baby cancelAllPeripheralsConnection];
}else{
CBPeripheral *p = _peripheralDataArray[indexPath.row];
[[[[[[_baby having:p]and]channel:@"peripheralView"]then]connectToPeripherals]begin];
}
*/
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.section) {
case 0:
{
//NSLog(@"[ConnectViewController] didSelectRowAtIndexPath section 0, Row = %d",[indexPath row]);
[_baby cancelAllPeripheralsConnection];
[self disconnectDevice:_tempP];
deviceInfo = [connectedDeviceInfo objectAtIndex:indexPath.row];
controlPeripheral = deviceInfo.myPeripheral;
[self stopScan];
[self setConnectionStatus:LE_STATUS_IDLE];
[activityIndicatorView stopAnimating];
if (refreshDeviceListTimer) {
[refreshDeviceListTimer invalidate];
refreshDeviceListTimer = nil;
}
}
break;
case 1:
{
CBPeripheral *p = _peripheralDataArray[indexPath.row];
[[[[[[_baby having:p]and]channel:@"peripheralView"]then]connectToPeripherals]begin];
int count = [devicesList count];
if ((count != 0) && count > indexPath.row) {
for (int i = 0; i < devicesList.count; i++) {
MyPeripheral *mp = devicesList[i];
if ([p.name isEqualToString:mp.advName]) {
MyPeripheral *tmpPeripheral = [devicesList objectAtIndex:i];
if (tmpPeripheral.connectStaus != MYPERIPHERAL_CONNECT_STATUS_IDLE) {
break;
}
[self connectDevice:tmpPeripheral];
self.tempP = tmpPeripheral;
tmpPeripheral.connectStaus = MYPERIPHERAL_CONNECT_STATUS_CONNECTING;
[devicesList replaceObjectAtIndex:i withObject:tmpPeripheral];
[connectingList addObject:tmpPeripheral];
[self displayDevicesList];
[self updateButtonType];
}
}
}
break;
}
default:
break;
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (IBAction)refreshDeviceList:(id)sender {
NSLog(@"[ConnectViewController] refreshDeviceList");
[self stopScan];
[self startScan];
[devicesTableView reloadData];
}
- (IBAction)manualUUIDSetting:(id)sender {
}
//Derek
- (IBAction)actionButtonDisconnect:(id)sender {
//NSLog(@"[ConnectViewController] actionButtonDisconnect idx = %d",[sender tag]);
int idx = [sender tag];
DeviceInfo *tmpDeviceInfo = [connectedDeviceInfo objectAtIndex:idx];
[self disconnectDevice:tmpDeviceInfo.myPeripheral];
}
//Derek
- (IBAction)actionButtonCancelConnect:(id)sender {
//NSLog(@"[ConnectViewController] actionButtonCancelConnect idx = %d",[sender tag]);
int idx = [sender tag];
MyPeripheral *tmpPeripheral = [devicesList objectAtIndex:idx];
tmpPeripheral.connectStaus = MYPERIPHERAL_CONNECT_STATUS_IDLE;
[devicesList replaceObjectAtIndex:idx withObject:tmpPeripheral];
for (int idx =0; idx< [connectingList count]; idx++) {
MyPeripheral *tmpConnectingPeripheral = [connectingList objectAtIndex:idx];
if (tmpConnectingPeripheral == tmpPeripheral) {
[connectingList removeObjectAtIndex:idx];
break;
}
}
[self disconnectDevice:tmpPeripheral];
[self displayDevicesList];
[self updateButtonType];
}
- (void) updateButtonType {
NSArray *toolbarItems = nil;
switch (connectionStatus) {
case LE_STATUS_IDLE:
if (([connectedDeviceInfo count] > 0)||([connectingList count] > 0)) {
toolbarItems = [[NSArray alloc] initWithObjects:scanButton, nil];
}
else {
toolbarItems = [[NSArray alloc] initWithObjects:scanButton, uuidSettingButton, nil];
}
[self setToolbarItems:toolbarItems animated:NO];
break;
case LE_STATUS_SCANNING:
if (([connectedDeviceInfo count] > 0)||([connectingList count] > 0)) {
toolbarItems = [[NSArray alloc] initWithObjects:refreshButton,cancelButton , nil];
}
else {
toolbarItems = [[NSArray alloc] initWithObjects: refreshButton,cancelButton, uuidSettingButton, nil];
}
[self setToolbarItems:toolbarItems animated:NO];
break;
}
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment version="4352" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ConnectViewController">
<connections>
<outlet property="devicesTableView" destination="28" id="46"/>
<outlet property="view" destination="1" id="3"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="1">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="28">
<rect key="frame" x="0.0" y="108" width="414" height="710"/>
<color key="backgroundColor" name="app底色"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="dataSource" destination="-1" id="53"/>
<outlet property="delegate" destination="-1" id="54"/>
</connections>
</tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zc7-AT-gpf">
<rect key="frame" x="0.0" y="44" width="414" height="64"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="spF-M4-7iJ">
<rect key="frame" x="0.0" y="0.0" width="414" height="64"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="蓝牙打印设置" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lgw-vw-Sbp">
<rect key="frame" x="156" y="20" width="102" height="24"/>
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="17"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="fanhui" translatesAutoresizingMaskIntoConstraints="NO" id="Mgw-x4-J8K">
<rect key="frame" x="12" y="23.5" width="10" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="10" id="Hq8-rP-LiI"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="17" id="ccw-RM-qQY"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="10" id="l7B-HV-zKn"/>
<constraint firstAttribute="height" constant="17" id="v2d-QL-B55"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="chl-ZP-eLe">
<rect key="frame" x="0.0" y="1" width="46" height="64"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="46" id="axe-wp-cmb"/>
<constraint firstAttribute="width" constant="46" id="eFl-tD-hbH"/>
</constraints>
<connections>
<action selector="backAction:" destination="-1" eventType="touchUpInside" id="Thg-CB-Z6H"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="chl-ZP-eLe" firstAttribute="top" secondItem="spF-M4-7iJ" secondAttribute="top" id="KYW-vo-glX"/>
<constraint firstItem="Mgw-x4-J8K" firstAttribute="leading" secondItem="spF-M4-7iJ" secondAttribute="leading" constant="12" id="NYw-2V-UX4"/>
<constraint firstAttribute="bottom" secondItem="chl-ZP-eLe" secondAttribute="bottom" id="OWq-2b-E9Q"/>
<constraint firstItem="Mgw-x4-J8K" firstAttribute="centerY" secondItem="spF-M4-7iJ" secondAttribute="centerY" id="PSf-91-fLa"/>
<constraint firstItem="Lgw-vw-Sbp" firstAttribute="centerX" secondItem="spF-M4-7iJ" secondAttribute="centerX" id="TVi-GH-1rj"/>
<constraint firstItem="Lgw-vw-Sbp" firstAttribute="centerY" secondItem="spF-M4-7iJ" secondAttribute="centerY" id="kJE-eX-cBy"/>
<constraint firstItem="chl-ZP-eLe" firstAttribute="leading" secondItem="spF-M4-7iJ" secondAttribute="leading" id="smr-Ef-DQk"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="64" id="MqQ-Xt-QIT"/>
<constraint firstItem="spF-M4-7iJ" firstAttribute="leading" secondItem="zc7-AT-gpf" secondAttribute="leading" id="QYV-ET-WTR"/>
<constraint firstItem="spF-M4-7iJ" firstAttribute="top" secondItem="zc7-AT-gpf" secondAttribute="top" id="aLg-iZ-MLQ"/>
<constraint firstAttribute="bottom" secondItem="spF-M4-7iJ" secondAttribute="bottom" id="hoa-Kq-MGg"/>
<constraint firstAttribute="trailing" secondItem="spF-M4-7iJ" secondAttribute="trailing" id="mIT-IF-pbd"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xke-2d-5B5">
<rect key="frame" x="0.0" y="818" width="414" height="44"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gqi-gf-0In">
<rect key="frame" x="0.0" y="-2.5" width="414" height="49"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="guanbi" translatesAutoresizingMaskIntoConstraints="NO" id="vdm-VH-b5J">
<rect key="frame" x="177" y="14.5" width="20" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="UlG-OZ-nTe"/>
<constraint firstAttribute="height" constant="20" id="WDa-RN-4J9"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="搜索" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ebL-OX-bfW">
<rect key="frame" x="207" y="14.5" width="35" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="MvF-b3-LGa"/>
<constraint firstItem="vdm-VH-b5J" firstAttribute="centerX" secondItem="gqi-gf-0In" secondAttribute="centerX" constant="-20" id="YrR-R5-xhU"/>
<constraint firstItem="ebL-OX-bfW" firstAttribute="leading" secondItem="vdm-VH-b5J" secondAttribute="trailing" constant="10" id="aKo-Gc-v3g"/>
<constraint firstItem="ebL-OX-bfW" firstAttribute="centerY" secondItem="vdm-VH-b5J" secondAttribute="centerY" id="dDG-fj-ecl"/>
<constraint firstItem="vdm-VH-b5J" firstAttribute="centerY" secondItem="gqi-gf-0In" secondAttribute="centerY" id="e6N-up-PnV"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="gqi-gf-0In" firstAttribute="centerY" secondItem="xke-2d-5B5" secondAttribute="centerY" id="CmP-w7-N0l"/>
<constraint firstItem="gqi-gf-0In" firstAttribute="centerX" secondItem="xke-2d-5B5" secondAttribute="centerX" id="UJp-R9-oW7"/>
<constraint firstItem="gqi-gf-0In" firstAttribute="leading" secondItem="xke-2d-5B5" secondAttribute="leading" id="mJE-kP-age"/>
<constraint firstAttribute="height" constant="44" id="ryw-xf-FRE"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="HXX-bU-QRe"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="zc7-AT-gpf" secondAttribute="trailing" id="07w-nU-nc9"/>
<constraint firstItem="HXX-bU-QRe" firstAttribute="trailing" secondItem="xke-2d-5B5" secondAttribute="trailing" id="3mx-8t-3LC"/>
<constraint firstItem="28" firstAttribute="leading" secondItem="HXX-bU-QRe" secondAttribute="leading" id="4ci-2j-lSW"/>
<constraint firstItem="HXX-bU-QRe" firstAttribute="bottom" secondItem="xke-2d-5B5" secondAttribute="bottom" id="KP1-r0-TPX"/>
<constraint firstItem="zc7-AT-gpf" firstAttribute="top" secondItem="HXX-bU-QRe" secondAttribute="top" id="Znt-J0-udl"/>
<constraint firstItem="xke-2d-5B5" firstAttribute="leading" secondItem="HXX-bU-QRe" secondAttribute="leading" id="aQn-pW-pMy"/>
<constraint firstItem="28" firstAttribute="trailing" secondItem="HXX-bU-QRe" secondAttribute="trailing" id="naT-s9-z71"/>
<constraint firstItem="zc7-AT-gpf" firstAttribute="leading" secondItem="1" secondAttribute="leading" id="pcg-rj-Zej"/>
<constraint firstItem="28" firstAttribute="top" secondItem="zc7-AT-gpf" secondAttribute="bottom" id="rwk-gj-md2"/>
<constraint firstItem="xke-2d-5B5" firstAttribute="top" secondItem="28" secondAttribute="bottom" id="ttm-3p-BSZ"/>
</constraints>
<point key="canvasLocation" x="98.550724637681171" y="118.52678571428571"/>
</view>
</objects>
<resources>
<image name="fanhui" width="18" height="35"/>
<image name="guanbi" width="37" height="18"/>
<namedColor name="app底色">
<color red="0.94509803921568625" green="0.94509803921568625" blue="0.94509803921568625" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
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