diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index 5f2243a..dc42e08 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -2175,19 +2175,6 @@ 88F23F2D1EA9D18700E4D298 /* live_label_v.png in Resources */ = {isa = PBXBuildFile; fileRef = 88F23F211EA9D18700E4D298 /* live_label_v.png */; }; 88F23F2E1EA9D18700E4D298 /* live_label_v@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88F23F221EA9D18700E4D298 /* live_label_v@2x.png */; }; 88F23F2F1EA9D18700E4D298 /* live_label_v@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88F23F231EA9D18700E4D298 /* live_label_v@3x.png */; }; - 88F5EE4C1D48CA2800CC7CAF /* ESP_ByteUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECC11D48CA2800CC7CAF /* ESP_ByteUtil.m */; }; - 88F5EE4D1D48CA2800CC7CAF /* ESP_CRC8.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECC31D48CA2800CC7CAF /* ESP_CRC8.m */; }; - 88F5EE4E1D48CA2800CC7CAF /* ESP_NetUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECC51D48CA2800CC7CAF /* ESP_NetUtil.m */; }; - 88F5EE4F1D48CA2800CC7CAF /* IPAddress.c in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECC61D48CA2800CC7CAF /* IPAddress.c */; }; - 88F5EE501D48CA2800CC7CAF /* ESPTouchResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECCB1D48CA2800CC7CAF /* ESPTouchResult.m */; }; - 88F5EE511D48CA2800CC7CAF /* ESPTouchTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECCD1D48CA2800CC7CAF /* ESPTouchTask.m */; }; - 88F5EE521D48CA2800CC7CAF /* ESPTouchTaskParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECCF1D48CA2800CC7CAF /* ESPTouchTaskParameter.m */; }; - 88F5EE531D48CA2800CC7CAF /* ESPUDPSocketClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECD11D48CA2800CC7CAF /* ESPUDPSocketClient.m */; }; - 88F5EE541D48CA2800CC7CAF /* ESPUDPSocketServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECD31D48CA2800CC7CAF /* ESPUDPSocketServer.m */; }; - 88F5EE551D48CA2800CC7CAF /* ESPDataCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECD61D48CA2800CC7CAF /* ESPDataCode.m */; }; - 88F5EE561D48CA2800CC7CAF /* ESPDatumCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECD81D48CA2800CC7CAF /* ESPDatumCode.m */; }; - 88F5EE571D48CA2800CC7CAF /* ESPGuideCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECDA1D48CA2800CC7CAF /* ESPGuideCode.m */; }; - 88F5EE581D48CA2800CC7CAF /* ESPTouchGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5ECDC1D48CA2800CC7CAF /* ESPTouchGenerator.m */; }; 88F5EFA91D48D08100CC7CAF /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EEEC1D48D08000CC7CAF /* AFHTTPRequestOperation.m */; }; 88F5EFAA1D48D08100CC7CAF /* AFHTTPRequestOperationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EEEE1D48D08000CC7CAF /* AFHTTPRequestOperationManager.m */; }; 88F5EFAB1D48D08100CC7CAF /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EEF01D48D08000CC7CAF /* AFHTTPSessionManager.m */; }; @@ -2234,6 +2221,8 @@ 88F5EFD81D48D08100CC7CAF /* MMVectorImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EF591D48D08100CC7CAF /* MMVectorImage.m */; }; 88F5EFD91D48D08100CC7CAF /* MyControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EF5C1D48D08100CC7CAF /* MyControl.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 88F740C01ECC28E800876AED /* ShopAddGoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F740BF1ECC28E800876AED /* ShopAddGoodsViewController.m */; }; + C017B1E2245ED2D4003151DF /* UIImage+WaterMark.h in Headers */ = {isa = PBXBuildFile; fileRef = C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */; }; + C017B1E3245ED2D4003151DF /* UIImage+WaterMark.m in Sources */ = {isa = PBXBuildFile; fileRef = C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */; }; C024B79E2379668B00509424 /* NSArray+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = C024B78A2379668B00509424 /* NSArray+AvoidCrash.m */; }; C024B79F2379668B00509424 /* AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B78B2379668B00509424 /* AvoidCrash.h */; }; C024B7A02379668B00509424 /* NSString+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = C024B78C2379668B00509424 /* NSString+AvoidCrash.m */; }; @@ -2254,6 +2243,48 @@ C024B7AF2379668B00509424 /* NSMutableString+AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B79B2379668B00509424 /* NSMutableString+AvoidCrash.h */; }; C024B7B02379668B00509424 /* NSMutableAttributedString+AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B79C2379668B00509424 /* NSMutableAttributedString+AvoidCrash.h */; }; C024B7B12379668B00509424 /* NSMutableArray+AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B79D2379668B00509424 /* NSMutableArray+AvoidCrash.h */; }; + C02ED596249E3B7300CAC37D /* InfoByImageViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C02ED594249E3B7300CAC37D /* InfoByImageViewController.h */; }; + C02ED597249E3B7300CAC37D /* InfoByImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */; }; + C0837A57244FF5510034FEC5 /* EGOCache.m in Sources */ = {isa = PBXBuildFile; fileRef = C0837A55244FF5500034FEC5 /* EGOCache.m */; }; + C0837A58244FF5510034FEC5 /* EGOCache.h in Headers */ = {isa = PBXBuildFile; fileRef = C0837A56244FF5500034FEC5 /* EGOCache.h */; }; + C0873EE12491060000D47D34 /* ESPUDPSocketClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EBE249105FF00D47D34 /* ESPUDPSocketClient.h */; }; + C0873EE22491060000D47D34 /* ESPUDPSocketServer.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873EBF249105FF00D47D34 /* ESPUDPSocketServer.m */; }; + C0873EE32491060000D47D34 /* ESPUDPSocketClient.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873EC0249105FF00D47D34 /* ESPUDPSocketClient.m */; }; + C0873EE42491060000D47D34 /* ESPUDPSocketServer.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EC1249105FF00D47D34 /* ESPUDPSocketServer.h */; }; + C0873EE52491060000D47D34 /* ESPGuideCode.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873EC3249105FF00D47D34 /* ESPGuideCode.m */; }; + C0873EE62491060000D47D34 /* ESPTouchGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873EC4249105FF00D47D34 /* ESPTouchGenerator.m */; }; + C0873EE72491060000D47D34 /* ESPDataCode.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EC5249105FF00D47D34 /* ESPDataCode.h */; }; + C0873EE82491060000D47D34 /* ESPDatumCode.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EC6249105FF00D47D34 /* ESPDatumCode.h */; }; + C0873EE92491060000D47D34 /* ESPGuideCode.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EC7249105FF00D47D34 /* ESPGuideCode.h */; }; + C0873EEA2491060000D47D34 /* ESPDataCode.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873EC8249105FF00D47D34 /* ESPDataCode.m */; }; + C0873EEB2491060000D47D34 /* ESPTouchGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EC9249105FF00D47D34 /* ESPTouchGenerator.h */; }; + C0873EEC2491060000D47D34 /* ESPDatumCode.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873ECA249105FF00D47D34 /* ESPDatumCode.m */; }; + C0873EED2491060000D47D34 /* ESPTools.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873ECC249105FF00D47D34 /* ESPTools.m */; }; + C0873EEE2491060000D47D34 /* ESP_NetUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873ECD249105FF00D47D34 /* ESP_NetUtil.m */; }; + C0873EEF2491060000D47D34 /* ESP_ByteUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873ECE249105FF00D47D34 /* ESP_ByteUtil.m */; }; + C0873EF02491060000D47D34 /* ESP_WifiUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873ECF249105FF00D47D34 /* ESP_WifiUtil.m */; }; + C0873EF12491060000D47D34 /* ESP_CRC8.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873ED0249105FF00D47D34 /* ESP_CRC8.m */; }; + C0873EF22491060000D47D34 /* ESPVersionMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873ED1249105FF00D47D34 /* ESPVersionMacro.h */; }; + C0873EF32491060000D47D34 /* ESPAES.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873ED2249105FF00D47D34 /* ESPAES.h */; }; + C0873EF42491060000D47D34 /* ESP_NetUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873ED3249105FF00D47D34 /* ESP_NetUtil.h */; }; + C0873EF52491060000D47D34 /* ESP_ByteUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873ED4249105FF00D47D34 /* ESP_ByteUtil.h */; }; + C0873EF62491060000D47D34 /* ESPTools.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873ED5249105FF00D47D34 /* ESPTools.h */; }; + C0873EF72491060000D47D34 /* ESP_CRC8.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873ED6249105FF00D47D34 /* ESP_CRC8.h */; }; + C0873EF82491060000D47D34 /* ESP_WifiUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873ED7249105FF00D47D34 /* ESP_WifiUtil.h */; }; + C0873EF92491060000D47D34 /* ESPAES.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873ED8249105FF00D47D34 /* ESPAES.m */; }; + C0873EFA2491060000D47D34 /* ESPTouchResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873EDA2491060000D47D34 /* ESPTouchResult.m */; }; + C0873EFB2491060000D47D34 /* ESPTouchTaskParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EDB2491060000D47D34 /* ESPTouchTaskParameter.h */; }; + C0873EFC2491060000D47D34 /* ESPTouchTask.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EDC2491060000D47D34 /* ESPTouchTask.h */; }; + C0873EFD2491060000D47D34 /* ESPTouchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EDD2491060000D47D34 /* ESPTouchResult.h */; }; + C0873EFE2491060000D47D34 /* ESPTouchDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EDE2491060000D47D34 /* ESPTouchDelegate.h */; }; + C0873EFF2491060000D47D34 /* ESPTouchTaskParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873EDF2491060000D47D34 /* ESPTouchTaskParameter.m */; }; + C0873F002491060000D47D34 /* ESPTouchTask.m in Sources */ = {isa = PBXBuildFile; fileRef = C0873EE02491060000D47D34 /* ESPTouchTask.m */; }; + C0B2F541244C6FE3001079AA /* PetStoresViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C0B2F53E244C6FE3001079AA /* PetStoresViewController.h */; }; + C0B2F542244C6FE3001079AA /* PetStoresViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C0B2F53F244C6FE3001079AA /* PetStoresViewController.m */; }; + C0B2F543244C6FE3001079AA /* PetStoresViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0B2F540244C6FE3001079AA /* PetStoresViewController.xib */; }; + C0B2F55D244D5577001079AA /* StoreNameView.h in Headers */ = {isa = PBXBuildFile; fileRef = C0B2F55B244D5577001079AA /* StoreNameView.h */; }; + C0B2F55E244D5577001079AA /* StoreNameView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0B2F55C244D5577001079AA /* StoreNameView.m */; }; + C0B2F560244D568E001079AA /* StoreNameView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0B2F55F244D568E001079AA /* StoreNameView.xib */; }; C0E746D5239E4A7D001BCD6D /* wechatlogin.png in Resources */ = {isa = PBXBuildFile; fileRef = C0E746D4239E4A7C001BCD6D /* wechatlogin.png */; }; C0E7D6C023A1D11500256A10 /* WXApiRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E7D6BC23A1D11200256A10 /* WXApiRequestHandler.h */; }; C0E7D6C123A1D11500256A10 /* WXApiManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E7D6BD23A1D11200256A10 /* WXApiManager.h */; }; @@ -2305,6 +2336,8 @@ C0EA8A3023AF74F4003DC53B /* UIButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = C0EA8A0F23AF74F3003DC53B /* UIButton+WebCache.m */; }; C0EA8A3123AF74F4003DC53B /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = C0EA8A1023AF74F3003DC53B /* UIImage+GIF.h */; }; C0F0400C23756F3C00B61D3B /* ExternalAccessory.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0F0400B23756F3C00B61D3B /* ExternalAccessory.framework */; }; + C0F6E1C0243B0A840071ECB9 /* xuanduo3fModel.h in Headers */ = {isa = PBXBuildFile; fileRef = C0F6E1BE243B0A840071ECB9 /* xuanduo3fModel.h */; }; + C0F6E1C1243B0A840071ECB9 /* xuanduo3fModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C0F6E1BF243B0A840071ECB9 /* xuanduo3fModel.m */; }; CB0F4E8622951A130091C76D /* SVRadialGradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0F4E7B22951A130091C76D /* SVRadialGradientLayer.m */; }; CB0F4E8722951A130091C76D /* SVIndefiniteAnimatedView.h in Headers */ = {isa = PBXBuildFile; fileRef = CB0F4E7C22951A130091C76D /* SVIndefiniteAnimatedView.h */; }; CB0F4E8822951A130091C76D /* SVProgressHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = CB0F4E7D22951A130091C76D /* SVProgressHUD.h */; }; @@ -5549,33 +5582,6 @@ 88F23F211EA9D18700E4D298 /* live_label_v.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_label_v.png; sourceTree = ""; }; 88F23F221EA9D18700E4D298 /* live_label_v@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "live_label_v@2x.png"; sourceTree = ""; }; 88F23F231EA9D18700E4D298 /* live_label_v@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "live_label_v@3x.png"; sourceTree = ""; }; - 88F5ECC01D48CA2800CC7CAF /* ESP_ByteUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESP_ByteUtil.h; sourceTree = ""; }; - 88F5ECC11D48CA2800CC7CAF /* ESP_ByteUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESP_ByteUtil.m; sourceTree = ""; }; - 88F5ECC21D48CA2800CC7CAF /* ESP_CRC8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESP_CRC8.h; sourceTree = ""; }; - 88F5ECC31D48CA2800CC7CAF /* ESP_CRC8.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESP_CRC8.m; sourceTree = ""; }; - 88F5ECC41D48CA2800CC7CAF /* ESP_NetUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESP_NetUtil.h; sourceTree = ""; }; - 88F5ECC51D48CA2800CC7CAF /* ESP_NetUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESP_NetUtil.m; sourceTree = ""; }; - 88F5ECC61D48CA2800CC7CAF /* IPAddress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = IPAddress.c; sourceTree = ""; }; - 88F5ECC71D48CA2800CC7CAF /* IPAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IPAddress.h; sourceTree = ""; }; - 88F5ECC91D48CA2800CC7CAF /* ESPTouchDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchDelegate.h; sourceTree = ""; }; - 88F5ECCA1D48CA2800CC7CAF /* ESPTouchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchResult.h; sourceTree = ""; }; - 88F5ECCB1D48CA2800CC7CAF /* ESPTouchResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTouchResult.m; sourceTree = ""; }; - 88F5ECCC1D48CA2800CC7CAF /* ESPTouchTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchTask.h; sourceTree = ""; }; - 88F5ECCD1D48CA2800CC7CAF /* ESPTouchTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTouchTask.m; sourceTree = ""; }; - 88F5ECCE1D48CA2800CC7CAF /* ESPTouchTaskParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchTaskParameter.h; sourceTree = ""; }; - 88F5ECCF1D48CA2800CC7CAF /* ESPTouchTaskParameter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTouchTaskParameter.m; sourceTree = ""; }; - 88F5ECD01D48CA2800CC7CAF /* ESPUDPSocketClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPUDPSocketClient.h; sourceTree = ""; }; - 88F5ECD11D48CA2800CC7CAF /* ESPUDPSocketClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPUDPSocketClient.m; sourceTree = ""; }; - 88F5ECD21D48CA2800CC7CAF /* ESPUDPSocketServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPUDPSocketServer.h; sourceTree = ""; }; - 88F5ECD31D48CA2800CC7CAF /* ESPUDPSocketServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPUDPSocketServer.m; sourceTree = ""; }; - 88F5ECD51D48CA2800CC7CAF /* ESPDataCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPDataCode.h; sourceTree = ""; }; - 88F5ECD61D48CA2800CC7CAF /* ESPDataCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPDataCode.m; sourceTree = ""; }; - 88F5ECD71D48CA2800CC7CAF /* ESPDatumCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPDatumCode.h; sourceTree = ""; }; - 88F5ECD81D48CA2800CC7CAF /* ESPDatumCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPDatumCode.m; sourceTree = ""; }; - 88F5ECD91D48CA2800CC7CAF /* ESPGuideCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPGuideCode.h; sourceTree = ""; }; - 88F5ECDA1D48CA2800CC7CAF /* ESPGuideCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPGuideCode.m; sourceTree = ""; }; - 88F5ECDB1D48CA2800CC7CAF /* ESPTouchGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchGenerator.h; sourceTree = ""; }; - 88F5ECDC1D48CA2800CC7CAF /* ESPTouchGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTouchGenerator.m; sourceTree = ""; }; 88F5EEEB1D48D08000CC7CAF /* AFHTTPRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPRequestOperation.h; sourceTree = ""; }; 88F5EEEC1D48D08000CC7CAF /* AFHTTPRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPRequestOperation.m; sourceTree = ""; }; 88F5EEED1D48D08000CC7CAF /* AFHTTPRequestOperationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPRequestOperationManager.h; sourceTree = ""; }; @@ -5674,6 +5680,8 @@ 88F5EF5C1D48D08100CC7CAF /* MyControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyControl.m; sourceTree = ""; }; 88F740BE1ECC28E800876AED /* ShopAddGoodsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopAddGoodsViewController.h; sourceTree = ""; }; 88F740BF1ECC28E800876AED /* ShopAddGoodsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopAddGoodsViewController.m; sourceTree = ""; }; + C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+WaterMark.h"; sourceTree = ""; }; + C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+WaterMark.m"; sourceTree = ""; }; C024B78A2379668B00509424 /* NSArray+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+AvoidCrash.m"; sourceTree = ""; }; C024B78B2379668B00509424 /* AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvoidCrash.h; sourceTree = ""; }; C024B78C2379668B00509424 /* NSString+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+AvoidCrash.m"; sourceTree = ""; }; @@ -5694,6 +5702,48 @@ C024B79B2379668B00509424 /* NSMutableString+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableString+AvoidCrash.h"; sourceTree = ""; }; C024B79C2379668B00509424 /* NSMutableAttributedString+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableAttributedString+AvoidCrash.h"; sourceTree = ""; }; C024B79D2379668B00509424 /* NSMutableArray+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+AvoidCrash.h"; sourceTree = ""; }; + C02ED594249E3B7300CAC37D /* InfoByImageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoByImageViewController.h; sourceTree = ""; }; + C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoByImageViewController.m; sourceTree = ""; }; + C0837A55244FF5500034FEC5 /* EGOCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EGOCache.m; sourceTree = ""; }; + C0837A56244FF5500034FEC5 /* EGOCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EGOCache.h; sourceTree = ""; }; + C0873EBE249105FF00D47D34 /* ESPUDPSocketClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPUDPSocketClient.h; sourceTree = ""; }; + C0873EBF249105FF00D47D34 /* ESPUDPSocketServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPUDPSocketServer.m; sourceTree = ""; }; + C0873EC0249105FF00D47D34 /* ESPUDPSocketClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPUDPSocketClient.m; sourceTree = ""; }; + C0873EC1249105FF00D47D34 /* ESPUDPSocketServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPUDPSocketServer.h; sourceTree = ""; }; + C0873EC3249105FF00D47D34 /* ESPGuideCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPGuideCode.m; sourceTree = ""; }; + C0873EC4249105FF00D47D34 /* ESPTouchGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTouchGenerator.m; sourceTree = ""; }; + C0873EC5249105FF00D47D34 /* ESPDataCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPDataCode.h; sourceTree = ""; }; + C0873EC6249105FF00D47D34 /* ESPDatumCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPDatumCode.h; sourceTree = ""; }; + C0873EC7249105FF00D47D34 /* ESPGuideCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPGuideCode.h; sourceTree = ""; }; + C0873EC8249105FF00D47D34 /* ESPDataCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPDataCode.m; sourceTree = ""; }; + C0873EC9249105FF00D47D34 /* ESPTouchGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchGenerator.h; sourceTree = ""; }; + C0873ECA249105FF00D47D34 /* ESPDatumCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPDatumCode.m; sourceTree = ""; }; + C0873ECC249105FF00D47D34 /* ESPTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTools.m; sourceTree = ""; }; + C0873ECD249105FF00D47D34 /* ESP_NetUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESP_NetUtil.m; sourceTree = ""; }; + C0873ECE249105FF00D47D34 /* ESP_ByteUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESP_ByteUtil.m; sourceTree = ""; }; + C0873ECF249105FF00D47D34 /* ESP_WifiUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESP_WifiUtil.m; sourceTree = ""; }; + C0873ED0249105FF00D47D34 /* ESP_CRC8.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESP_CRC8.m; sourceTree = ""; }; + C0873ED1249105FF00D47D34 /* ESPVersionMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPVersionMacro.h; sourceTree = ""; }; + C0873ED2249105FF00D47D34 /* ESPAES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPAES.h; sourceTree = ""; }; + C0873ED3249105FF00D47D34 /* ESP_NetUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESP_NetUtil.h; sourceTree = ""; }; + C0873ED4249105FF00D47D34 /* ESP_ByteUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESP_ByteUtil.h; sourceTree = ""; }; + C0873ED5249105FF00D47D34 /* ESPTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTools.h; sourceTree = ""; }; + C0873ED6249105FF00D47D34 /* ESP_CRC8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESP_CRC8.h; sourceTree = ""; }; + C0873ED7249105FF00D47D34 /* ESP_WifiUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESP_WifiUtil.h; sourceTree = ""; }; + C0873ED8249105FF00D47D34 /* ESPAES.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPAES.m; sourceTree = ""; }; + C0873EDA2491060000D47D34 /* ESPTouchResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTouchResult.m; sourceTree = ""; }; + C0873EDB2491060000D47D34 /* ESPTouchTaskParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchTaskParameter.h; sourceTree = ""; }; + C0873EDC2491060000D47D34 /* ESPTouchTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchTask.h; sourceTree = ""; }; + C0873EDD2491060000D47D34 /* ESPTouchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchResult.h; sourceTree = ""; }; + C0873EDE2491060000D47D34 /* ESPTouchDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPTouchDelegate.h; sourceTree = ""; }; + C0873EDF2491060000D47D34 /* ESPTouchTaskParameter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTouchTaskParameter.m; sourceTree = ""; }; + C0873EE02491060000D47D34 /* ESPTouchTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESPTouchTask.m; sourceTree = ""; }; + C0B2F53E244C6FE3001079AA /* PetStoresViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PetStoresViewController.h; sourceTree = ""; }; + C0B2F53F244C6FE3001079AA /* PetStoresViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PetStoresViewController.m; sourceTree = ""; }; + C0B2F540244C6FE3001079AA /* PetStoresViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PetStoresViewController.xib; sourceTree = ""; }; + C0B2F55B244D5577001079AA /* StoreNameView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StoreNameView.h; sourceTree = ""; }; + C0B2F55C244D5577001079AA /* StoreNameView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StoreNameView.m; sourceTree = ""; }; + C0B2F55F244D568E001079AA /* StoreNameView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StoreNameView.xib; sourceTree = ""; }; C0E746D4239E4A7C001BCD6D /* wechatlogin.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = wechatlogin.png; sourceTree = ""; }; C0E7D6BC23A1D11200256A10 /* WXApiRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXApiRequestHandler.h; sourceTree = ""; }; C0E7D6BD23A1D11200256A10 /* WXApiManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXApiManager.h; sourceTree = ""; }; @@ -5745,6 +5795,8 @@ C0EA8A0F23AF74F3003DC53B /* UIButton+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+WebCache.m"; sourceTree = ""; }; C0EA8A1023AF74F3003DC53B /* UIImage+GIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+GIF.h"; sourceTree = ""; }; C0F0400B23756F3C00B61D3B /* ExternalAccessory.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExternalAccessory.framework; path = System/Library/Frameworks/ExternalAccessory.framework; sourceTree = SDKROOT; }; + C0F6E1BE243B0A840071ECB9 /* xuanduo3fModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xuanduo3fModel.h; sourceTree = ""; }; + C0F6E1BF243B0A840071ECB9 /* xuanduo3fModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = xuanduo3fModel.m; sourceTree = ""; }; CB0F4E7B22951A130091C76D /* SVRadialGradientLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVRadialGradientLayer.m; sourceTree = ""; }; CB0F4E7C22951A130091C76D /* SVIndefiniteAnimatedView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVIndefiniteAnimatedView.h; sourceTree = ""; }; CB0F4E7D22951A130091C76D /* SVProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVProgressHUD.h; sourceTree = ""; }; @@ -9263,6 +9315,7 @@ 883E76461D48A5E50030E075 /* controllers */ = { isa = PBXGroup; children = ( + C0B2F53D244C6FAF001079AA /* pets */, CB4820462334B37100A50C92 /* ConnectAauariumVC */, CBA615F6228E526C00ED380D /* message */, 3D1C4F00221A9EDD0096AE43 /* IfishYooseeFile */, @@ -9486,6 +9539,8 @@ 883E76A31D48A5E50030E075 /* XutoBackMsgModel.m */, FA0892E7226B22C90084A609 /* Xuanduo2Model.h */, FA0892E8226B22C90084A609 /* Xuanduo2Model.m */, + C0F6E1BE243B0A840071ECB9 /* xuanduo3fModel.h */, + C0F6E1BF243B0A840071ECB9 /* xuanduo3fModel.m */, FAA732D6227C1DA80062C252 /* Xuanduo2TimerModel.h */, FAA732D7227C1DA80062C252 /* Xuanduo2TimerModel.m */, FA0892EB226C15000084A609 /* Xuanduo2DataUtility.h */, @@ -9614,6 +9669,8 @@ E5212234210760A600BA24C5 /* SettingResetViewController.xib */, CB7D6ABA229660370014E5C7 /* IfishConnectUsViewController.h */, CB7D6ABB229660370014E5C7 /* IfishConnectUsViewController.m */, + C02ED594249E3B7300CAC37D /* InfoByImageViewController.h */, + C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */, ); path = mineControllers; sourceTree = ""; @@ -9868,6 +9925,7 @@ 883E791A1D48ACFF0030E075 /* Utinitys */ = { isa = PBXGroup; children = ( + C0837A54244FF5500034FEC5 /* EGOCache */, 885BD30E1E260B3C00CDB65A /* shuomingshu.html */, 887495541DAE1B2D00F8F4E2 /* IfishUtils */, 883E791B1D48ACFF0030E075 /* DataCenter */, @@ -9974,6 +10032,7 @@ 883E79451D48B0280030E075 /* views */ = { isa = PBXGroup; children = ( + C0B2F55A244D552A001079AA /* petsStoreName */, CB4820532334E2E800A50C92 /* HKPieChartView */, 887491D31E78CCA000CDA284 /* IifshSegmentView */, 8869B3701E6939FE0010F099 /* NJKWebViewProgress */, @@ -11873,83 +11932,17 @@ 88F5ECA41D48C9C400CC7CAF /* ThirdPartUnity */ = { isa = PBXGroup; children = ( + C0873EBC249105FF00D47D34 /* ESPTouch */, 18C54F032350541400DF4E7D /* AlibcTradeSDK-3.1.1.96 */, CB8B646A230FAD250032EB24 /* Bugly */, 88C6860D1EA60A40004CDFD9 /* TalkingDataV2.2.88 */, 88C685C81EA603A8004CDFD9 /* UMSocial */, 883E7BC81EA5FA1A00ED5D89 /* SMS_SDK */, - 88F5ECBD1D48CA2800CC7CAF /* ESPTouch */, 88F5ECE51D48CA2800CC7CAF /* UMCommunity */, ); name = ThirdPartUnity; sourceTree = ""; }; - 88F5ECBD1D48CA2800CC7CAF /* ESPTouch */ = { - isa = PBXGroup; - children = ( - 88F5ECBE1D48CA2800CC7CAF /* ESPTouAPI */, - ); - path = ESPTouch; - sourceTree = ""; - }; - 88F5ECBE1D48CA2800CC7CAF /* ESPTouAPI */ = { - isa = PBXGroup; - children = ( - 88F5ECBF1D48CA2800CC7CAF /* Esptouchdata */, - 88F5ECC81D48CA2800CC7CAF /* Esptouchtask */, - 88F5ECD41D48CA2800CC7CAF /* protocol */, - ); - path = ESPTouAPI; - sourceTree = ""; - }; - 88F5ECBF1D48CA2800CC7CAF /* Esptouchdata */ = { - isa = PBXGroup; - children = ( - 88F5ECC01D48CA2800CC7CAF /* ESP_ByteUtil.h */, - 88F5ECC11D48CA2800CC7CAF /* ESP_ByteUtil.m */, - 88F5ECC21D48CA2800CC7CAF /* ESP_CRC8.h */, - 88F5ECC31D48CA2800CC7CAF /* ESP_CRC8.m */, - 88F5ECC41D48CA2800CC7CAF /* ESP_NetUtil.h */, - 88F5ECC51D48CA2800CC7CAF /* ESP_NetUtil.m */, - 88F5ECC61D48CA2800CC7CAF /* IPAddress.c */, - 88F5ECC71D48CA2800CC7CAF /* IPAddress.h */, - ); - path = Esptouchdata; - sourceTree = ""; - }; - 88F5ECC81D48CA2800CC7CAF /* Esptouchtask */ = { - isa = PBXGroup; - children = ( - 88F5ECC91D48CA2800CC7CAF /* ESPTouchDelegate.h */, - 88F5ECCA1D48CA2800CC7CAF /* ESPTouchResult.h */, - 88F5ECCB1D48CA2800CC7CAF /* ESPTouchResult.m */, - 88F5ECCC1D48CA2800CC7CAF /* ESPTouchTask.h */, - 88F5ECCD1D48CA2800CC7CAF /* ESPTouchTask.m */, - 88F5ECCE1D48CA2800CC7CAF /* ESPTouchTaskParameter.h */, - 88F5ECCF1D48CA2800CC7CAF /* ESPTouchTaskParameter.m */, - 88F5ECD01D48CA2800CC7CAF /* ESPUDPSocketClient.h */, - 88F5ECD11D48CA2800CC7CAF /* ESPUDPSocketClient.m */, - 88F5ECD21D48CA2800CC7CAF /* ESPUDPSocketServer.h */, - 88F5ECD31D48CA2800CC7CAF /* ESPUDPSocketServer.m */, - ); - path = Esptouchtask; - sourceTree = ""; - }; - 88F5ECD41D48CA2800CC7CAF /* protocol */ = { - isa = PBXGroup; - children = ( - 88F5ECD51D48CA2800CC7CAF /* ESPDataCode.h */, - 88F5ECD61D48CA2800CC7CAF /* ESPDataCode.m */, - 88F5ECD71D48CA2800CC7CAF /* ESPDatumCode.h */, - 88F5ECD81D48CA2800CC7CAF /* ESPDatumCode.m */, - 88F5ECD91D48CA2800CC7CAF /* ESPGuideCode.h */, - 88F5ECDA1D48CA2800CC7CAF /* ESPGuideCode.m */, - 88F5ECDB1D48CA2800CC7CAF /* ESPTouchGenerator.h */, - 88F5ECDC1D48CA2800CC7CAF /* ESPTouchGenerator.m */, - ); - path = protocol; - sourceTree = ""; - }; 88F5ECE51D48CA2800CC7CAF /* UMCommunity */ = { isa = PBXGroup; children = ( @@ -12180,6 +12173,108 @@ path = AvoidCrash; sourceTree = ""; }; + C0837A54244FF5500034FEC5 /* EGOCache */ = { + isa = PBXGroup; + children = ( + C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */, + C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */, + C0837A55244FF5500034FEC5 /* EGOCache.m */, + C0837A56244FF5500034FEC5 /* EGOCache.h */, + ); + path = EGOCache; + sourceTree = ""; + }; + C0873EBC249105FF00D47D34 /* ESPTouch */ = { + isa = PBXGroup; + children = ( + C0873EBD249105FF00D47D34 /* udp */, + C0873EC2249105FF00D47D34 /* protocol */, + C0873ECB249105FF00D47D34 /* ESPUtils */, + C0873ED92491060000D47D34 /* task */, + ); + path = ESPTouch; + sourceTree = ""; + }; + C0873EBD249105FF00D47D34 /* udp */ = { + isa = PBXGroup; + children = ( + C0873EBE249105FF00D47D34 /* ESPUDPSocketClient.h */, + C0873EBF249105FF00D47D34 /* ESPUDPSocketServer.m */, + C0873EC0249105FF00D47D34 /* ESPUDPSocketClient.m */, + C0873EC1249105FF00D47D34 /* ESPUDPSocketServer.h */, + ); + path = udp; + sourceTree = ""; + }; + C0873EC2249105FF00D47D34 /* protocol */ = { + isa = PBXGroup; + children = ( + C0873EC3249105FF00D47D34 /* ESPGuideCode.m */, + C0873EC4249105FF00D47D34 /* ESPTouchGenerator.m */, + C0873EC5249105FF00D47D34 /* ESPDataCode.h */, + C0873EC6249105FF00D47D34 /* ESPDatumCode.h */, + C0873EC7249105FF00D47D34 /* ESPGuideCode.h */, + C0873EC8249105FF00D47D34 /* ESPDataCode.m */, + C0873EC9249105FF00D47D34 /* ESPTouchGenerator.h */, + C0873ECA249105FF00D47D34 /* ESPDatumCode.m */, + ); + path = protocol; + sourceTree = ""; + }; + C0873ECB249105FF00D47D34 /* ESPUtils */ = { + isa = PBXGroup; + children = ( + C0873ECC249105FF00D47D34 /* ESPTools.m */, + C0873ECD249105FF00D47D34 /* ESP_NetUtil.m */, + C0873ECE249105FF00D47D34 /* ESP_ByteUtil.m */, + C0873ECF249105FF00D47D34 /* ESP_WifiUtil.m */, + C0873ED0249105FF00D47D34 /* ESP_CRC8.m */, + C0873ED1249105FF00D47D34 /* ESPVersionMacro.h */, + C0873ED2249105FF00D47D34 /* ESPAES.h */, + C0873ED3249105FF00D47D34 /* ESP_NetUtil.h */, + C0873ED4249105FF00D47D34 /* ESP_ByteUtil.h */, + C0873ED5249105FF00D47D34 /* ESPTools.h */, + C0873ED6249105FF00D47D34 /* ESP_CRC8.h */, + C0873ED7249105FF00D47D34 /* ESP_WifiUtil.h */, + C0873ED8249105FF00D47D34 /* ESPAES.m */, + ); + path = ESPUtils; + sourceTree = ""; + }; + C0873ED92491060000D47D34 /* task */ = { + isa = PBXGroup; + children = ( + C0873EDA2491060000D47D34 /* ESPTouchResult.m */, + C0873EDB2491060000D47D34 /* ESPTouchTaskParameter.h */, + C0873EDC2491060000D47D34 /* ESPTouchTask.h */, + C0873EDD2491060000D47D34 /* ESPTouchResult.h */, + C0873EDE2491060000D47D34 /* ESPTouchDelegate.h */, + C0873EDF2491060000D47D34 /* ESPTouchTaskParameter.m */, + C0873EE02491060000D47D34 /* ESPTouchTask.m */, + ); + path = task; + sourceTree = ""; + }; + C0B2F53D244C6FAF001079AA /* pets */ = { + isa = PBXGroup; + children = ( + C0B2F53E244C6FE3001079AA /* PetStoresViewController.h */, + C0B2F53F244C6FE3001079AA /* PetStoresViewController.m */, + C0B2F540244C6FE3001079AA /* PetStoresViewController.xib */, + ); + path = pets; + sourceTree = ""; + }; + C0B2F55A244D552A001079AA /* petsStoreName */ = { + isa = PBXGroup; + children = ( + C0B2F55B244D5577001079AA /* StoreNameView.h */, + C0B2F55C244D5577001079AA /* StoreNameView.m */, + C0B2F55F244D568E001079AA /* StoreNameView.xib */, + ); + name = petsStoreName; + sourceTree = ""; + }; C0E7D6C423A1D16C00256A10 /* Helper */ = { isa = PBXGroup; children = ( @@ -12755,6 +12850,7 @@ CB484E0422B8C8C80075F050 /* bprint.h in Headers */, FAFC08232279CB5900B5A07B /* SetTimerCell.h in Headers */, CB7D6AA122953BEB0014E5C7 /* YYKVStorage.h in Headers */, + C0873EF42491060000D47D34 /* ESP_NetUtil.h in Headers */, CB484DE522B8C8C80075F050 /* rational.h in Headers */, CB484DE922B8C8C80075F050 /* avutil.h in Headers */, 3D1C508C221A9EDF0096AE43 /* Utils.h in Headers */, @@ -12776,6 +12872,7 @@ 3D1C50BB221A9EE00096AE43 /* RegisterResult.h in Headers */, CBA6167F228F9AB100ED380D /* MASViewConstraint.h in Headers */, C024B7A22379668B00509424 /* NSAttributedString+AvoidCrash.h in Headers */, + C0873EF62491060000D47D34 /* ESPTools.h in Headers */, CB8B6468230F7F980032EB24 /* IfishMainInfoCell.h in Headers */, C0EA8A2A23AF74F4003DC53B /* SDWebImageOperation.h in Headers */, CB484E1122B8C8C90075F050 /* version.h in Headers */, @@ -12808,6 +12905,7 @@ CB7D6AA322953BEB0014E5C7 /* YYMemoryCache.h in Headers */, 3D1C50E6221A9EE00096AE43 /* ParamDao.h in Headers */, CB484DFC22B8C8C80075F050 /* bswap.h in Headers */, + C02ED596249E3B7300CAC37D /* InfoByImageViewController.h in Headers */, 3D1C5134221A9EE10096AE43 /* YooseeNextConnectViewController.h in Headers */, CB484DFF22B8C8C80075F050 /* audioconvert.h in Headers */, CB484DED22B8C8C80075F050 /* file.h in Headers */, @@ -12827,6 +12925,7 @@ 3D1C50B7221A9EDF0096AE43 /* YTargetAndAction.h in Headers */, 3D1C510A221A9EE00096AE43 /* PlayBaseViewController.h in Headers */, CB484DE222B8C8C80075F050 /* samplefmt.h in Headers */, + C0873EF72491060000D47D34 /* ESP_CRC8.h in Headers */, 3D1C50AA221A9EDF0096AE43 /* CyclePickerView.h in Headers */, CB484DE322B8C8C80075F050 /* pixdesc.h in Headers */, CB48204D2334D0A200A50C92 /* ConAquarChooseWiFiVC.h in Headers */, @@ -12866,6 +12965,7 @@ 3D1C50B4221A9EDF0096AE43 /* YTheNaviBar.h in Headers */, 3D1C5121221A9EE00096AE43 /* CameraBottomCollectionViewCell.h in Headers */, CB484E1222B8C8C90075F050 /* vdpau.h in Headers */, + C0B2F55D244D5577001079AA /* StoreNameView.h in Headers */, C0EA8A1323AF74F4003DC53B /* UIImageView+WebCache.h in Headers */, CB4820962334E99700A50C92 /* IQUIView+Hierarchy.h in Headers */, FA0892E9226B22C90084A609 /* Xuanduo2Model.h in Headers */, @@ -12888,16 +12988,21 @@ CB484DFA22B8C8C80075F050 /* log.h in Headers */, CB48207F2334E99700A50C92 /* IQPreviousNextView.h in Headers */, FA0893152275F7CF0084A609 /* XuanduoSelectHeader.h in Headers */, + C0837A58244FF5510034FEC5 /* EGOCache.h in Headers */, 3D1C50D1221A9EE00096AE43 /* SVPullToRefresh.h in Headers */, CB7D6AB022954DE20014E5C7 /* CommonUtils.h in Headers */, 3D1C513C221A9EE10096AE43 /* FishControlFourthCell.h in Headers */, + C0873EF82491060000D47D34 /* ESP_WifiUtil.h in Headers */, 3D1C5086221A9EDF0096AE43 /* KTThumbView.h in Headers */, 3D1C50E5221A9EE00096AE43 /* ShakeManager.h in Headers */, 3D1C5088221A9EDF0096AE43 /* KTThumbsView.h in Headers */, + C0F6E1C0243B0A840071ECB9 /* xuanduo3fModel.h in Headers */, 3D1C513F221A9EE10096AE43 /* FishControlThreedViewCell.h in Headers */, FA0892F52270BED00084A609 /* XuanduoHuliModel.h in Headers */, C024B79F2379668B00509424 /* AvoidCrash.h in Headers */, C024B7AE2379668B00509424 /* NSObject+AvoidCrash.h in Headers */, + C0B2F541244C6FE3001079AA /* PetStoresViewController.h in Headers */, + C0873EFE2491060000D47D34 /* ESPTouchDelegate.h in Headers */, 3D1C50C7221A9EE00096AE43 /* LocalDevice.h in Headers */, 3D1C50A0221A9EDF0096AE43 /* TouchButton.h in Headers */, CBB0243723517947002900D5 /* MJExtension.h in Headers */, @@ -12914,6 +13019,7 @@ 3D1C509D221A9EDF0096AE43 /* GetContactMessageResult.h in Headers */, CBB0243923517947002900D5 /* MJPropertyKey.h in Headers */, CBA61681228F9AB100ED380D /* NSLayoutConstraint+MASDebugAdditions.h in Headers */, + C0873EE72491060000D47D34 /* ESPDataCode.h in Headers */, 3D1C5109221A9EE00096AE43 /* P2PPlaybackController.h in Headers */, C024B7B02379668B00509424 /* NSMutableAttributedString+AvoidCrash.h in Headers */, C0E7D6D323A1D16D00256A10 /* UIAlertView+WX.h in Headers */, @@ -12927,6 +13033,7 @@ C0EA8A1C23AF74F4003DC53B /* UIButton+WebCache.h in Headers */, C024B7AC2379668B00509424 /* NSArray+AvoidCrash.h in Headers */, CB48207D2334E99700A50C92 /* IQUIView+IQKeyboardToolbar.h in Headers */, + C0873EF52491060000D47D34 /* ESP_ByteUtil.h in Headers */, C024B7AF2379668B00509424 /* NSMutableString+AvoidCrash.h in Headers */, C0EA8A2023AF74F4003DC53B /* UIView+WebCacheOperation.h in Headers */, CB48208A2334E99700A50C92 /* IQKeyboardReturnKeyHandler.h in Headers */, @@ -12934,8 +13041,11 @@ 3D1C5095221A9EDF0096AE43 /* Alarm.h in Headers */, CB4820872334E99700A50C92 /* IQKeyboardManagerConstantsInternal.h in Headers */, C0EA8A2D23AF74F4003DC53B /* SDWebImagePrefetcher.h in Headers */, + C0873EEB2491060000D47D34 /* ESPTouchGenerator.h in Headers */, 3D1C5145221A9EE10096AE43 /* BootomViewSoketBackMasgConreol.h in Headers */, + C0873EF22491060000D47D34 /* ESPVersionMacro.h in Headers */, 3D1C5146221A9EE10096AE43 /* FishTankBootmDataHelper.h in Headers */, + C0873EE92491060000D47D34 /* ESPGuideCode.h in Headers */, CB484DF522B8C8C80075F050 /* hmac.h in Headers */, CB484E0922B8C8C80075F050 /* intreadwrite.h in Headers */, CB484E0122B8C8C80075F050 /* imgutils.h in Headers */, @@ -12946,6 +13056,7 @@ 3D1C5101221A9EE00096AE43 /* IfishP2PMonitorController.h in Headers */, 3D1C50F5221A9EE00096AE43 /* CameraManager.h in Headers */, C0EA8A2423AF74F4003DC53B /* UIImageView+HighlightedWebCache.h in Headers */, + C0873EE82491060000D47D34 /* ESPDatumCode.h in Headers */, CB484DF422B8C8C80075F050 /* common.h in Headers */, 3D1C50A3221A9EDF0096AE43 /* WaitingPageView.h in Headers */, CB484DEB22B8C8C80075F050 /* xtea.h in Headers */, @@ -12961,13 +13072,16 @@ 3D1C50F0221A9EE00096AE43 /* RecommendInfo.h in Headers */, 3D1C509C221A9EDF0096AE43 /* ModifyLoginPasswordResult.h in Headers */, C0EA8A2E23AF74F4003DC53B /* SDWebImageCompat.h in Headers */, + C0873EFB2491060000D47D34 /* ESPTouchTaskParameter.h in Headers */, CBA61680228F9AB100ED380D /* MASConstraint.h in Headers */, + C0873EE42491060000D47D34 /* ESPUDPSocketServer.h in Headers */, CB484E0622B8C8C80075F050 /* timestamp.h in Headers */, 3D1C512E221A9EE10096AE43 /* CameraBottomHView.h in Headers */, C0EA8A2223AF74F4003DC53B /* UIImage+WebP.h in Headers */, CB484E0E22B8C8C80075F050 /* version.h in Headers */, 3D1C50E4221A9EE00096AE43 /* config.h in Headers */, CBB0243223517947002900D5 /* NSObject+MJProperty.h in Headers */, + C017B1E2245ED2D4003151DF /* UIImage+WaterMark.h in Headers */, 3D1C5104221A9EE00096AE43 /* YooseConnectFirstViewController.h in Headers */, CB484E1E22B8C8C90075F050 /* P2PCInterface.h in Headers */, 3D1C5127221A9EE00096AE43 /* IfishCameraRecordSecondCell.h in Headers */, @@ -13002,6 +13116,7 @@ 3D1C511B221A9EE00096AE43 /* ShootImgDataSource.h in Headers */, 3D1C5132221A9EE10096AE43 /* CameraRecordViewController.h in Headers */, CB48208B2334E99700A50C92 /* IQKeyboardManager.h in Headers */, + C0873EE12491060000D47D34 /* ESPUDPSocketClient.h in Headers */, CB484DF122B8C8C80075F050 /* adler32.h in Headers */, 3D1C50A9221A9EDF0096AE43 /* MXSCycleScrollView.h in Headers */, CB484E0322B8C8C80075F050 /* parseutils.h in Headers */, @@ -13014,7 +13129,9 @@ CB484DEE22B8C8C80075F050 /* md5.h in Headers */, FAA732D4227BE2B80062C252 /* ReadTimerModel.h in Headers */, C0EA8A1923AF74F4003DC53B /* SDImageCache.h in Headers */, + C0873EFC2491060000D47D34 /* ESPTouchTask.h in Headers */, CBA61676228F9AB100ED380D /* MASConstraint+Private.h in Headers */, + C0873EF32491060000D47D34 /* ESPAES.h in Headers */, CB484DF022B8C8C80075F050 /* attributes.h in Headers */, 3D1C508B221A9EDF0096AE43 /* KTPhotoScrollViewController.h in Headers */, 3D1C50DB221A9EE00096AE43 /* YAudioStreamPlayer.h in Headers */, @@ -13026,6 +13143,7 @@ 3D1C5108221A9EE00096AE43 /* P2PPlayingbackVC.h in Headers */, 3D1C50AD221A9EDF0096AE43 /* FXBlurView.h in Headers */, CB0F4E8A22951A130091C76D /* SVRadialGradientLayer.h in Headers */, + C0873EFD2491060000D47D34 /* ESPTouchResult.h in Headers */, 404D7CEB2238CF77005655F5 /* UIViewController+Swizzling.h in Headers */, CB0F4E8E22951A130091C76D /* SVProgressAnimatedView.h in Headers */, FA0892FD2275A1B30084A609 /* Xuanduo2SettingController.h in Headers */, @@ -13935,6 +14053,7 @@ E51D7D58208CE121001FF053 /* CustomModeSetCell.xib in Resources */, 882956A61DBDA3A200E9DDD7 /* community_left@2x.png in Resources */, 883E79181D48A74F0030E075 /* scanscanBg.png in Resources */, + C0B2F543244C6FE3001079AA /* PetStoresViewController.xib in Resources */, 3D1C50D5221A9EE00096AE43 /* SVPullToRefresh.bundle in Resources */, 8871C4981E6D507B000AA49F /* signin_condition_await@3x.png in Resources */, 883283481EAEE60500A47157 /* ifish_look_on.png in Resources */, @@ -14211,6 +14330,7 @@ 8871C4A41E6D507B000AA49F /* signin_condition_gift_conduct@3x.png in Resources */, 881672121EA5DE2B00BEBF23 /* FZLanTingHei-L-GBK-M.TTF in Resources */, 881478121E712A2700BFB79C /* task_choiceLookShops@3x.png in Resources */, + C0B2F560244D568E001079AA /* StoreNameView.xib in Resources */, 882956211DBDA3A100E9DDD7 /* neves0036.png in Resources */, 8865120C1E979BF100BABDF1 /* personal_iocn_share@3x.png in Resources */, 8814781B1E712A2700BFB79C /* task_ifishDoctorpng.png in Resources */, @@ -14520,12 +14640,11 @@ 8816719E1EA5DE2B00BEBF23 /* UMComCommentListDataController.m in Sources */, 88591EE61D655B9E00A1316E /* ChinaPlckerView.m in Sources */, 883E763B1D4897570030E075 /* huifushebeiruwnagModel.m in Sources */, - 88F5EE551D48CA2800CC7CAF /* ESPDataCode.m in Sources */, 886F4E011D76BFF8001EDA34 /* KanHuBaoGaoModel.m in Sources */, 883E79C21D48B0280030E075 /* InfoCell.m in Sources */, CBA6169A22924F1E00ED380D /* MessageAlertView.m in Sources */, C0EA8A1F23AF74F4003DC53B /* SDWebImagePrefetcher.m in Sources */, - 88F5EE531D48CA2800CC7CAF /* ESPUDPSocketClient.m in Sources */, + C0B2F55E244D5577001079AA /* StoreNameView.m in Sources */, 883E78561D48A5E50030E075 /* IfishBlackListCenterViewController.m in Sources */, CB484E1A22B8C8C90075F050 /* RtspInterface.mm in Sources */, 883A3D181EC44EF300DA84FF /* IfishUsersActivityListController.m in Sources */, @@ -14655,6 +14774,7 @@ 881672031EA5DE2B00BEBF23 /* UMComRefreshView.m in Sources */, 3D34479A212CF71C00CF3941 /* IfishHotBarVc.m in Sources */, 881672211EA5DE2B00BEBF23 /* UMComBriefEditView.m in Sources */, + C0873EEF2491060000D47D34 /* ESP_ByteUtil.m in Sources */, 881A1D4F1DD41AB000BA1AF4 /* MineKanEditSec1ThredCell.m in Sources */, 885C43BC1E89F79D00685A2E /* WMPageController.m in Sources */, CBB0243C23517947002900D5 /* NSObject+MJClass.m in Sources */, @@ -14673,6 +14793,7 @@ 881671AE1EA5DE2B00BEBF23 /* UMComUserUpdateDataController.m in Sources */, 885C43B71E89F79D00685A2E /* IfishLiveRecommendListViewController.m in Sources */, 8816721C1EA5DE2B00BEBF23 /* UMComSimplicityFindTableViewCell.m in Sources */, + C0873EEC2491060000D47D34 /* ESPDatumCode.m in Sources */, 88597ABD1E56BAF1003D0E5C /* WBSPopShareView.m in Sources */, 8816720E1EA5DE2B00BEBF23 /* UMComProgressHUD.m in Sources */, 886185C11EF2228000459AD1 /* ThreeControlNameViewController.m in Sources */, @@ -14683,6 +14804,7 @@ 886185C71EF228E100459AD1 /* FourControlName.m in Sources */, CBB0243523517947002900D5 /* NSString+MJExtension.m in Sources */, 881672251EA5DE2B00BEBF23 /* UMComSelectTopicViewController.m in Sources */, + C0873EEE2491060000D47D34 /* ESP_NetUtil.m in Sources */, 3D1C5140221A9EE10096AE43 /* BootomViewSoketBackMasgConreol.m in Sources */, 883E78601D48A5E50030E075 /* LeftViewController.m in Sources */, 3D1C511A221A9EE00096AE43 /* ShotScreenImgViewController.m in Sources */, @@ -14700,6 +14822,7 @@ 8815D11E1DF7A0E300BEA2DA /* NSTimer+Convenience.m in Sources */, 3D1C50A4221A9EDF0096AE43 /* ProgressImageView.m in Sources */, CB7D6AA022953BEB0014E5C7 /* YYDiskCache.m in Sources */, + C0873EE62491060000D47D34 /* ESPTouchGenerator.m in Sources */, 883E793E1D48ACFF0030E075 /* AFHttpTool.m in Sources */, 3DD7AB5121E2F2FB0064856A /* mask.c in Sources */, 883E787C1D48A5E50030E075 /* IfishMeViewController.m in Sources */, @@ -14741,11 +14864,9 @@ C0EA8A1623AF74F4003DC53B /* SDWebImageDecoder.m in Sources */, 885A376E1E6EBB67007AD930 /* QianDaoGiftView.m in Sources */, CBA61657228F9A6C00ED380D /* YYClassInfo.m in Sources */, - 88F5EE4E1D48CA2800CC7CAF /* ESP_NetUtil.m in Sources */, FA0892F2226CA3920084A609 /* NSString+Add.m in Sources */, 883E763E1D4897570030E075 /* ServerBackDeviceLogInModel.m in Sources */, C0EA8A1223AF74F4003DC53B /* MKAnnotationView+WebCache.m in Sources */, - 88F5EE511D48CA2800CC7CAF /* ESPTouchTask.m in Sources */, CBA616A822928B1700ED380D /* UIButton+button.m in Sources */, 3D1C5098221A9EDF0096AE43 /* UDManager.m in Sources */, 3D1C50EA221A9EE00096AE43 /* des2.c in Sources */, @@ -14797,7 +14918,6 @@ 3D1C174F2171BB0700A159A8 /* PNPieChart.m in Sources */, 88F5EFCB1D48D08100CC7CAF /* UIScrollView+JHExtension.m in Sources */, 88C1B1CB1DC99B0500C2C99A /* TabMineDeivceListViewCell.m in Sources */, - 88F5EE541D48CA2800CC7CAF /* ESPUDPSocketServer.m in Sources */, 8853531C1D672695009B828B /* ShopCertifyStausModel.m in Sources */, 883E79C41D48B0280030E075 /* SecondSetTimeCell.m in Sources */, 3D1C5081221A9EDF0096AE43 /* KTThumbView.m in Sources */, @@ -14825,6 +14945,7 @@ 88613F701E5C1E86008D2C69 /* IfishFeedCellHeaghtCalculator.m in Sources */, 8816722E1EA5DE2B00BEBF23 /* UMComFeedDetailCommentCell.m in Sources */, CB4820832334E99700A50C92 /* IQPreviousNextView.m in Sources */, + C0F6E1C1243B0A840071ECB9 /* xuanduo3fModel.m in Sources */, 883E78951D48A5E50030E075 /* IfishMessageViewCell.m in Sources */, 887DA78C1D547A49001DB880 /* IfishTanSuoViewCell.m in Sources */, 8816720D1EA5DE2B00BEBF23 /* UMComEmojiPageView.m in Sources */, @@ -14844,7 +14965,6 @@ 3D5C437321339F8F00E15B66 /* IfishChatView.m in Sources */, 881671FB1EA5DE2B00BEBF23 /* UMAssetsCollectionCell.m in Sources */, 88678C771E8C9E7F0043DA55 /* ifishLiveListAdViewCell.m in Sources */, - 88F5EE571D48CA2800CC7CAF /* ESPGuideCode.m in Sources */, 883E76371D4897570030E075 /* deviceLoginModel.m in Sources */, 3D1C50C1221A9EE00096AE43 /* Utils.m in Sources */, 88F5EFCC1D48D08100CC7CAF /* UIScrollView+JHRefresh.m in Sources */, @@ -14878,6 +14998,7 @@ CBB0244223517947002900D5 /* MJPropertyType.m in Sources */, 8871FAA41EBC0CE30038E99A /* ShopCerProgressHeaderView.m in Sources */, 88F5EFD81D48D08100CC7CAF /* MMVectorImage.m in Sources */, + C0873EF02491060000D47D34 /* ESP_WifiUtil.m in Sources */, CBB0243623517947002900D5 /* NSObject+MJProperty.m in Sources */, 883E79B81D48B0280030E075 /* remindCyclePic.m in Sources */, 88696FCF1E9C8872005D4AFB /* MemeberEditeViewCustomCell.m in Sources */, @@ -14885,6 +15006,7 @@ 881671AA1EA5DE2B00BEBF23 /* UMComDataOperationErrorHandler.m in Sources */, 881671D21EA5DE2B00BEBF23 /* UMComPostReplyEditView.m in Sources */, 88F5EFC71D48D08100CC7CAF /* JHRefreshBaseView.m in Sources */, + C0837A57244FF5510034FEC5 /* EGOCache.m in Sources */, 881671A51EA5DE2B00BEBF23 /* UMComLikeListDataController.m in Sources */, 88597AC21E56BAF1003D0E5C /* WFTailoringViewController.m in Sources */, 882957FD1DC0443600E9DDD7 /* IfishCardScrollView.m in Sources */, @@ -14895,7 +15017,7 @@ 883E78731D48A5E50030E075 /* SetNameTextViewController.m in Sources */, 88F5EFD51D48D08100CC7CAF /* MMProgressHUDViewController.m in Sources */, 3D1C507E221A9EDF0096AE43 /* KTPhotoBrowserGlobal.m in Sources */, - 88F5EE561D48CA2800CC7CAF /* ESPDatumCode.m in Sources */, + C0873F002491060000D47D34 /* ESPTouchTask.m in Sources */, 883E78931D48A5E50030E075 /* IfishDiscoverViewController.m in Sources */, 88696FD41E9C8B4A005D4AFB /* MemberEditeViewLocationCell.m in Sources */, 886F4DF61D753877001EDA34 /* Report3ViewCell.m in Sources */, @@ -14904,7 +15026,6 @@ 885979D31E529F64003D0E5C /* GoNetShopViewCell.m in Sources */, 881671A81EA5DE2B00BEBF23 /* UMComTopicGroupDataController.m in Sources */, 883E762C1D4897570030E075 /* setRemindWaterModel.m in Sources */, - 88F5EE501D48CA2800CC7CAF /* ESPTouchResult.m in Sources */, 88742C3D1D63FA270074F1F8 /* CertifyListFourthCell.m in Sources */, 8871FAAF1EBC2CE60038E99A /* ShopCerPatr1DetailLocationCell.m in Sources */, 88597A2B1E5597C8003D0E5C /* KanHuGuanLi1ViewCell.m in Sources */, @@ -14930,7 +15051,6 @@ 88674A691E4AEABF00C647BB /* UINavigationBar+Background.m in Sources */, 88883B191EF0DA8100CAC0AE /* SongNuo86NameViewController.m in Sources */, 885C43B61E89F79D00685A2E /* IfishLivePopularListViewController.m in Sources */, - 88F5EE581D48CA2800CC7CAF /* ESPTouchGenerator.m in Sources */, 883E79A91D48B0280030E075 /* CCMBorderView.m in Sources */, 885FBDE01E4C21FD00E0D7D1 /* WoShiShangJiaViewController.m in Sources */, 8871FAAA1EBC2CAF0038E99A /* shopCerpart1LoactionCell.m in Sources */, @@ -14948,6 +15068,7 @@ 3DD7AB9A21E474940064856A /* AsyncSocket.m in Sources */, 886B80641D62F57000E1B9B3 /* SOngNuoGuiDeng.m in Sources */, 881F0F591D73DFFF0091507E /* BaoGaoViewThirdCell.m in Sources */, + C0873EFA2491060000D47D34 /* ESPTouchResult.m in Sources */, 88653C9B1E76691E00FF973E /* IfishInformationViewController.m in Sources */, 88F5EFB81D48D08100CC7CAF /* UIRefreshControl+AFNetworking.m in Sources */, 88D3373C1DC7440C006C0ADB /* IfishConnectingView.m in Sources */, @@ -15014,7 +15135,6 @@ 881671E11EA5DE2B00BEBF23 /* UMComUserTableViewController.m in Sources */, 885FBDE91E4C3E1000E0D7D1 /* ShopAlreadyCertifyViewCell.m in Sources */, 881671D01EA5DE2B00BEBF23 /* UMComSelectTopicView.m in Sources */, - 88F5EE4D1D48CA2800CC7CAF /* ESP_CRC8.m in Sources */, 8869B3B61E696E770010F099 /* IfishUserObsever.m in Sources */, 881671EA1EA5DE2B00BEBF23 /* UMComButton.m in Sources */, 881671EF1EA5DE2B00BEBF23 /* UMComGridViewerController.m in Sources */, @@ -15034,6 +15154,7 @@ 881A1D591DD41C0700BA1AF4 /* MineKanEditSec2SecCell.m in Sources */, 888EEB5F1DC346D3003C5C5B /* FBShimmeringView.m in Sources */, 3D1C174B2171BB0700A159A8 /* PNLineChart.m in Sources */, + C02ED597249E3B7300CAC37D /* InfoByImageViewController.m in Sources */, 3D1C50E7221A9EE00096AE43 /* CameraManager.m in Sources */, 8816719F1EA5DE2B00BEBF23 /* UMComFeedEditDataController.m in Sources */, 883BCD741ED58B810046283B /* ShopDetailViewGoodsViewCell.m in Sources */, @@ -15052,6 +15173,7 @@ 881671C11EA5DE2B00BEBF23 /* UMComNavigationController.m in Sources */, 88380DB61EB1DA7B00FC7C0D /* ShopGoodsManageViewController.m in Sources */, CB484D0022B8B0D30075F050 /* Reachability.m in Sources */, + C0873EE22491060000D47D34 /* ESPUDPSocketServer.m in Sources */, 887C36281EE63F6000964ACD /* XWCountryCodeController.m in Sources */, 883E786E1D48A5E50030E075 /* infoCollectionViewCell.m in Sources */, 881671C61EA5DE2B00BEBF23 /* UMComDiscoverViewController.m in Sources */, @@ -15073,7 +15195,6 @@ 881671AF1EA5DE2B00BEBF23 /* UMComUserAlbumDataController.m in Sources */, 881671B01EA5DE2B00BEBF23 /* UMComLoginManager.m in Sources */, C024B7A12379668B00509424 /* NSDictionary+AvoidCrash.m in Sources */, - 88F5EE4C1D48CA2800CC7CAF /* ESP_ByteUtil.m in Sources */, 883E79C61D48B0280030E075 /* SetCell.m in Sources */, 881671E71EA5DE2B00BEBF23 /* UMComAddedImageCellView.m in Sources */, 881672181EA5DE2B00BEBF23 /* UMComSimpleGridViewerController.m in Sources */, @@ -15115,7 +15236,6 @@ 881672201EA5DE2B00BEBF23 /* UINavigationBar+ChangeBackgroundColor.m in Sources */, 881672171EA5DE2B00BEBF23 /* UMComSimpleGridView.m in Sources */, 88F5EFCF1D48D08100CC7CAF /* MMHud.m in Sources */, - 88F5EE521D48CA2800CC7CAF /* ESPTouchTaskParameter.m in Sources */, 8871FB0C1EBC7EC90038E99A /* IfishBindDeviceSelectViewController.m in Sources */, 8876A58E1BB83447007A4B54 /* ViewController.m in Sources */, 8891330B1ECE999A00F52EBC /* IfishVideoModel.m in Sources */, @@ -15135,6 +15255,7 @@ CBB0243023517947002900D5 /* MJFoundation.m in Sources */, 883E76451D4897570030E075 /* ZeroControlBackmsgModel.m in Sources */, 889133041ECE999A00F52EBC /* ArtPlayerView.m in Sources */, + C0873EE32491060000D47D34 /* ESPUDPSocketClient.m in Sources */, 881A1D371DD3025400BA1AF4 /* MineKankanEditViewController.m in Sources */, 883E79BE1D48B0280030E075 /* ChangeWaterCell.m in Sources */, 88696FDE1E9C8D51005D4AFB /* MemberDetailMarkDetailViewCell.m in Sources */, @@ -15177,6 +15298,7 @@ 881671FC1EA5DE2B00BEBF23 /* UMAssetsCollectionCheckMarkView.m in Sources */, 881477E61E71091300BFB79C /* IfishTaskModel.m in Sources */, 88C1B2BE1DD1749F00C2C99A /* IfishKanKanListViewController.m in Sources */, + C0873EFF2491060000D47D34 /* ESPTouchTaskParameter.m in Sources */, 8868FE511E66BDB4002F7F33 /* DengJiShuoMingViewCell.m in Sources */, 3D1C511D221A9EE00096AE43 /* IfishCameraRecordfirstCell.m in Sources */, 885C43B91E89F79D00685A2E /* WMMenuView.m in Sources */, @@ -15193,6 +15315,7 @@ CB7D6AB122954DE20014E5C7 /* CommonUtils.m in Sources */, 883E78EA1D48A5E50030E075 /* BookViewController.m in Sources */, 3D1C17552171BB0700A159A8 /* PNScatterChart.m in Sources */, + C0873EEA2491060000D47D34 /* ESPDataCode.m in Sources */, 883E79AB1D48B0280030E075 /* UIViewController+MaryPopin.m in Sources */, CB48204A2334B46100A50C92 /* ConAquarNowWiFiPwdVC.m in Sources */, 881671B81EA5DE2B00BEBF23 /* UMComMessageManager.m in Sources */, @@ -15254,6 +15377,7 @@ 88591EEC1D65B8B500A1316E /* ShopCertifyFailViewController.m in Sources */, 883E793C1D48ACFF0030E075 /* IfishDBHelper.m in Sources */, 886B807D1D63116E00E1B9B3 /* CertificationViewFourthCell.m in Sources */, + C0873EED2491060000D47D34 /* ESPTools.m in Sources */, 8867F5C51E656D0300AF021C /* IfishDengjiProgress.m in Sources */, 3D1C17502171BB0700A159A8 /* PNRadarChart.m in Sources */, 8870694A1D4EE89200BCF675 /* DXPopover.m in Sources */, @@ -15287,9 +15411,11 @@ 883E78381D48A5E50030E075 /* MorShopViewController.m in Sources */, 881671A21EA5DE2B00BEBF23 /* UMComNoticeListDataController..m in Sources */, 883E78431D48A5E50030E075 /* KeLiAiBackMassage.m in Sources */, + C0873EF92491060000D47D34 /* ESPAES.m in Sources */, 3D3447A0212D113D00CF3941 /* IFishHotBarCell.m in Sources */, 8871FB101EBC80850038E99A /* FishSelectDeviceListViewCell.m in Sources */, 881672421EA5DE2B00BEBF23 /* UMComSimplicityUserCenterViewController.m in Sources */, + C0B2F542244C6FE3001079AA /* PetStoresViewController.m in Sources */, 3D8F649A21571D7C00F04BD3 /* HitbarWifeVc.m in Sources */, 8861258F1E2731CC004A6097 /* JuNengSoketBackUtls.m in Sources */, 88F5EFD11D48D08100CC7CAF /* MMProgressHUD+Animations.m in Sources */, @@ -15322,6 +15448,7 @@ 882A75FD1EBAF2DB00AD1D15 /* IfishShopCerNewViewController.m in Sources */, 8816721E1EA5DE2B00BEBF23 /* UMComSimplicityUserInfoBar.m in Sources */, 883E76251D4897570030E075 /* ChatroomModel.m in Sources */, + C0873EF12491060000D47D34 /* ESP_CRC8.m in Sources */, 3D1C5082221A9EDF0096AE43 /* KTPhotoScrollViewController.m in Sources */, 881671FA1EA5DE2B00BEBF23 /* UMComPageControlView.m in Sources */, 3D1C174A2171BB0700A159A8 /* PNBarChart.m in Sources */, @@ -15382,6 +15509,7 @@ 3D1C5143221A9EE10096AE43 /* ifishdeviceListCell.m in Sources */, 881671DF1EA5DE2B00BEBF23 /* UMComUserTableViewCell.m in Sources */, 881671EE1EA5DE2B00BEBF23 /* UMComGridView.m in Sources */, + C0873EE52491060000D47D34 /* ESPGuideCode.m in Sources */, 881672281EA5DE2B00BEBF23 /* UMComFeedImageCollectionViewCell.m in Sources */, 88742C381D63FA060074F1F8 /* CertifyListThridCell.m in Sources */, 889C25E91E1C83F6004F745D /* RuSunBackMessageUtils.m in Sources */, @@ -15403,6 +15531,7 @@ E51D7D5B208CF4E7001FF053 /* RuiMeiInputViewController.m in Sources */, 881672241EA5DE2B00BEBF23 /* UMComSelectTopicCell.m in Sources */, FAFC08242279CB5900B5A07B /* SetTimerCell.m in Sources */, + C017B1E3245ED2D4003151DF /* UIImage+WaterMark.m in Sources */, 3D1C5097221A9EDF0096AE43 /* TabView.m in Sources */, 88696FBD1E9C7215005D4AFB /* MemberDetailViewController.m in Sources */, 8816722C1EA5DE2B00BEBF23 /* UMComSimpleFeedTableViewController.m in Sources */, @@ -15426,7 +15555,6 @@ 883E78641D48A5E50030E075 /* CellModel.m in Sources */, 888EEB5E1DC346D3003C5C5B /* FBShimmeringLayer.m in Sources */, 883E78F81D48A5E50030E075 /* ForgetViewController.m in Sources */, - 88F5EE4F1D48CA2800CC7CAF /* IPAddress.c in Sources */, 885979F31E5422B8003D0E5C /* IfishShopEdite1Cell.m in Sources */, 3D1C5133221A9EE10096AE43 /* YooseeCenterViewCell.m in Sources */, 88597A011E5427FB003D0E5C /* IfishSHopEdite3ViewCell.m in Sources */, @@ -15622,11 +15750,11 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "compiler-default"; CODE_SIGN_ENTITLEMENTS = Ifish/Ifish.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; - DEVELOPMENT_TEAM = ""; + CURRENT_PROJECT_VERSION = 29; + DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -15743,7 +15871,7 @@ CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 29; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; @@ -15829,7 +15957,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.shyuying.Ifish8; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - PROVISIONING_PROFILE_SPECIFIER = production2; + PROVISIONING_PROFILE_SPECIFIER = fishdis11; TARGETED_DEVICE_FAMILY = 1; USER_HEADER_SEARCH_PATHS = ""; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Ifish/.DS_Store b/Ifish/.DS_Store index 94c50d3..d1242e8 100644 Binary files a/Ifish/.DS_Store and b/Ifish/.DS_Store differ diff --git a/Ifish/Assets.xcassets/.DS_Store b/Ifish/Assets.xcassets/.DS_Store index d561c4b..91d1bd6 100644 Binary files a/Ifish/Assets.xcassets/.DS_Store and b/Ifish/Assets.xcassets/.DS_Store differ diff --git a/Ifish/Assets.xcassets/HotBar/apmodeInfo.imageset/Contents.json b/Ifish/Assets.xcassets/HotBar/apmodeInfo.imageset/Contents.json new file mode 100644 index 0000000..5567633 --- /dev/null +++ b/Ifish/Assets.xcassets/HotBar/apmodeInfo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "apmodeInfo.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/HotBar/apmodeInfo.imageset/apmodeInfo.png b/Ifish/Assets.xcassets/HotBar/apmodeInfo.imageset/apmodeInfo.png new file mode 100644 index 0000000..75bf320 Binary files /dev/null and b/Ifish/Assets.xcassets/HotBar/apmodeInfo.imageset/apmodeInfo.png differ diff --git a/Ifish/Assets.xcassets/HotBar/hotbarInfo.imageset/Contents.json b/Ifish/Assets.xcassets/HotBar/hotbarInfo.imageset/Contents.json new file mode 100644 index 0000000..e3388fb --- /dev/null +++ b/Ifish/Assets.xcassets/HotBar/hotbarInfo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "hotbarInfo.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/HotBar/hotbarInfo.imageset/hotbarInfo.png b/Ifish/Assets.xcassets/HotBar/hotbarInfo.imageset/hotbarInfo.png new file mode 100644 index 0000000..92e5bd7 Binary files /dev/null and b/Ifish/Assets.xcassets/HotBar/hotbarInfo.imageset/hotbarInfo.png differ diff --git a/Ifish/Assets.xcassets/HotBar/加热系统.imageset/加热系统.png b/Ifish/Assets.xcassets/HotBar/加热系统.imageset/加热系统.png index 10cde86..45001e8 100644 Binary files a/Ifish/Assets.xcassets/HotBar/加热系统.imageset/加热系统.png and b/Ifish/Assets.xcassets/HotBar/加热系统.imageset/加热系统.png differ diff --git a/Ifish/Assets.xcassets/HotBar/摄像头.imageset/摄像头.png b/Ifish/Assets.xcassets/HotBar/摄像头.imageset/摄像头.png index 4048bd3..3c3065c 100644 Binary files a/Ifish/Assets.xcassets/HotBar/摄像头.imageset/摄像头.png and b/Ifish/Assets.xcassets/HotBar/摄像头.imageset/摄像头.png differ diff --git a/Ifish/Assets.xcassets/HotBar/敬请期待.imageset/敬请期待.png b/Ifish/Assets.xcassets/HotBar/敬请期待.imageset/敬请期待.png index 361fef9..43d54f8 100644 Binary files a/Ifish/Assets.xcassets/HotBar/敬请期待.imageset/敬请期待.png and b/Ifish/Assets.xcassets/HotBar/敬请期待.imageset/敬请期待.png differ diff --git a/Ifish/Assets.xcassets/HotBar/智能宠物系统.imageset/Contents.json b/Ifish/Assets.xcassets/HotBar/智能宠物系统.imageset/Contents.json new file mode 100644 index 0000000..2b9eb4f --- /dev/null +++ b/Ifish/Assets.xcassets/HotBar/智能宠物系统.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "智能宠物系统.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/HotBar/智能宠物系统.imageset/智能宠物系统.png b/Ifish/Assets.xcassets/HotBar/智能宠物系统.imageset/智能宠物系统.png new file mode 100644 index 0000000..a856466 Binary files /dev/null and b/Ifish/Assets.xcassets/HotBar/智能宠物系统.imageset/智能宠物系统.png differ diff --git a/Ifish/Assets.xcassets/HotBar/水族控制系统.imageset/水族控制系统.png b/Ifish/Assets.xcassets/HotBar/水族控制系统.imageset/水族控制系统.png index 9f2ae2c..bd36c16 100644 Binary files a/Ifish/Assets.xcassets/HotBar/水族控制系统.imageset/水族控制系统.png and b/Ifish/Assets.xcassets/HotBar/水族控制系统.imageset/水族控制系统.png differ diff --git a/Ifish/Assets.xcassets/petimage/Contents.json b/Ifish/Assets.xcassets/petimage/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/firstlogo.dataset/Contents.json b/Ifish/Assets.xcassets/petimage/firstlogo.dataset/Contents.json new file mode 100644 index 0000000..4b71af6 --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/firstlogo.dataset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "data" : [ + { + "idiom" : "universal", + "filename" : "firstlogo" + } + ] +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/firstlogo.dataset/firstlogo b/Ifish/Assets.xcassets/petimage/firstlogo.dataset/firstlogo new file mode 100644 index 0000000..800ad1d Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/firstlogo.dataset/firstlogo differ diff --git a/Ifish/Assets.xcassets/petimage/logo.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/logo.imageset/Contents.json new file mode 100644 index 0000000..8463aca --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/logo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "logo.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/logo.imageset/logo.png b/Ifish/Assets.xcassets/petimage/logo.imageset/logo.png new file mode 100644 index 0000000..bbad3aa Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/logo.imageset/logo.png differ diff --git a/Ifish/Assets.xcassets/petimage/pet.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/pet.imageset/Contents.json new file mode 100644 index 0000000..4bd009a --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/pet.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "pet.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/pet.imageset/pet.png b/Ifish/Assets.xcassets/petimage/pet.imageset/pet.png new file mode 100644 index 0000000..7bfd03f Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/pet.imageset/pet.png differ diff --git a/Ifish/Assets.xcassets/petimage/petsImage.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/petsImage.imageset/Contents.json new file mode 100644 index 0000000..e4bbb16 --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/petsImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "petsImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/petsImage.imageset/petsImage.png b/Ifish/Assets.xcassets/petimage/petsImage.imageset/petsImage.png new file mode 100644 index 0000000..800ad1d Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/petsImage.imageset/petsImage.png differ diff --git a/Ifish/Assets.xcassets/petimage/xialasanjiao.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/xialasanjiao.imageset/Contents.json new file mode 100644 index 0000000..dd738dc --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/xialasanjiao.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "xialasanjiao.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/xialasanjiao.imageset/xialasanjiao.png b/Ifish/Assets.xcassets/petimage/xialasanjiao.imageset/xialasanjiao.png new file mode 100644 index 0000000..f3fdf36 Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/xialasanjiao.imageset/xialasanjiao.png differ diff --git a/Ifish/Assets.xcassets/petimage/恒温关.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/恒温关.imageset/Contents.json new file mode 100644 index 0000000..1b4b31b --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/恒温关.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "恒温关.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/恒温关.imageset/恒温关.png b/Ifish/Assets.xcassets/petimage/恒温关.imageset/恒温关.png new file mode 100644 index 0000000..63a3bdd Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/恒温关.imageset/恒温关.png differ diff --git a/Ifish/Assets.xcassets/petimage/恒温开.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/恒温开.imageset/Contents.json new file mode 100644 index 0000000..2af8939 --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/恒温开.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "恒温开.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/恒温开.imageset/恒温开.png b/Ifish/Assets.xcassets/petimage/恒温开.imageset/恒温开.png new file mode 100644 index 0000000..23be987 Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/恒温开.imageset/恒温开.png differ diff --git a/Ifish/Assets.xcassets/petimage/换气关.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/换气关.imageset/Contents.json new file mode 100644 index 0000000..ad5dfb5 --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/换气关.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "换气关.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/换气关.imageset/换气关.png b/Ifish/Assets.xcassets/petimage/换气关.imageset/换气关.png new file mode 100644 index 0000000..0d4b688 Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/换气关.imageset/换气关.png differ diff --git a/Ifish/Assets.xcassets/petimage/换气开.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/换气开.imageset/Contents.json new file mode 100644 index 0000000..d3c9deb --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/换气开.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "换气开.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/换气开.imageset/换气开.png b/Ifish/Assets.xcassets/petimage/换气开.imageset/换气开.png new file mode 100644 index 0000000..53b75e0 Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/换气开.imageset/换气开.png differ diff --git a/Ifish/Assets.xcassets/petimage/杀菌关.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/杀菌关.imageset/Contents.json new file mode 100644 index 0000000..d1b59ef --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/杀菌关.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "杀菌关.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/杀菌关.imageset/杀菌关.png b/Ifish/Assets.xcassets/petimage/杀菌关.imageset/杀菌关.png new file mode 100644 index 0000000..97368d2 Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/杀菌关.imageset/杀菌关.png differ diff --git a/Ifish/Assets.xcassets/petimage/杀菌开.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/杀菌开.imageset/Contents.json new file mode 100644 index 0000000..e7b1847 --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/杀菌开.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "杀菌开.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/杀菌开.imageset/杀菌开.png b/Ifish/Assets.xcassets/petimage/杀菌开.imageset/杀菌开.png new file mode 100644 index 0000000..6f8039a Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/杀菌开.imageset/杀菌开.png differ diff --git a/Ifish/Assets.xcassets/petimage/照明关.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/照明关.imageset/Contents.json new file mode 100644 index 0000000..c386348 --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/照明关.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "照明关.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/照明关.imageset/照明关.png b/Ifish/Assets.xcassets/petimage/照明关.imageset/照明关.png new file mode 100644 index 0000000..fb60075 Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/照明关.imageset/照明关.png differ diff --git a/Ifish/Assets.xcassets/petimage/照明开.imageset/Contents.json b/Ifish/Assets.xcassets/petimage/照明开.imageset/Contents.json new file mode 100644 index 0000000..6dbea22 --- /dev/null +++ b/Ifish/Assets.xcassets/petimage/照明开.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "照明开.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/petimage/照明开.imageset/照明开.png b/Ifish/Assets.xcassets/petimage/照明开.imageset/照明开.png new file mode 100644 index 0000000..408bc47 Binary files /dev/null and b/Ifish/Assets.xcassets/petimage/照明开.imageset/照明开.png differ diff --git a/Ifish/Assets.xcassets/绚多设备/pets.imageset/Contents.json b/Ifish/Assets.xcassets/绚多设备/pets.imageset/Contents.json new file mode 100644 index 0000000..0a0eec3 --- /dev/null +++ b/Ifish/Assets.xcassets/绚多设备/pets.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "pets.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/绚多设备/pets.imageset/pets.png b/Ifish/Assets.xcassets/绚多设备/pets.imageset/pets.png new file mode 100644 index 0000000..780d660 Binary files /dev/null and b/Ifish/Assets.xcassets/绚多设备/pets.imageset/pets.png differ diff --git a/Ifish/ESPTouch/.DS_Store b/Ifish/ESPTouch/.DS_Store index 6fd2113..5008ddf 100644 Binary files a/Ifish/ESPTouch/.DS_Store and b/Ifish/ESPTouch/.DS_Store differ diff --git a/Ifish/ESPTouch/ESPTouAPI/.DS_Store b/Ifish/ESPTouch/ESPTouAPI/.DS_Store deleted file mode 100644 index f44bccc..0000000 Binary files a/Ifish/ESPTouch/ESPTouAPI/.DS_Store and /dev/null differ diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_NetUtil.h b/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_NetUtil.h deleted file mode 100755 index ec5eec8..0000000 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_NetUtil.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// ESPNetUtil.h -// EspTouchDemo -// -// Created by 白 桦 on 5/15/15. -// Copyright (c) 2015 白 桦. All rights reserved. -// - -#import - -@interface ESP_NetUtil : NSObject - -/** - * get the local ip address by IOS System - * - */ -+ (NSData *) getLocalInetAddress; - -/** - * parse InetAddress - */ -+ (NSData *) parseInetAddrByData: (NSData *) inetAddrData andOffset: (int) offset andCount: (int) count; - -/** - * descrpion inetAddrData for print pretty - */ -+ (NSString *) descriptionInetAddrByData: (NSData *) inetAddrData; - -/** - * parse bssid - * - * @param bssid the bssid - * @return byte converted from bssid - */ -+ (NSData *) parseBssid2bytes: (NSString *) bssid; - -@end diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_NetUtil.m b/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_NetUtil.m deleted file mode 100755 index 33ac421..0000000 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_NetUtil.m +++ /dev/null @@ -1,92 +0,0 @@ -// -// ESPNetUtil.m -// EspTouchDemo -// -// Created by 白 桦 on 5/15/15. -// Copyright (c) 2015 白 桦. All rights reserved. -// - -#import "ESP_NetUtil.h" -#include "IPAddress.h" -#include "ESP_ByteUtil.h" - -// only support ipV4 at the moment -#define IP_LEN 4 - -@implementation ESP_NetUtil - -+ (NSData *) getLocalInetAddress -{ - InitAddresses(); - GetIPAddresses(); - GetHWAddresses(); - NSData *localInetAddrData = nil; - Byte localIpBytes[IP_LEN]; - for (int i=0; i> 0; - localIpBytes[1] = (theAddr & 0xff00) >> 8; - localIpBytes[2] = (theAddr & 0xff0000) >> 16; - localIpBytes[3] = (theAddr & 0xff000000) >> 24; -// NSLog(@"ESP_NetUtil:: %d.%d.%d.%d",localIpBytes[0],localIpBytes[1],localIpBytes[2],localIpBytes[3]); - -// if (theAddr != 0) break; -// NSLog(@"ESP_NetUtil:: Name: %s MAC: %s IP: %s\n", if_names[i], hw_addrs[i], ip_names[i]); - } - - localInetAddrData = [[NSData alloc]initWithBytes:localIpBytes length:IP_LEN]; - - FreeAddresses(); - - Byte byte1 = 0; - Byte byte2 = 0; - Byte byte3 = 0; - Byte byte4 = 0; - - [localInetAddrData getBytes:&byte1 range:NSMakeRange(0, 1)]; - [localInetAddrData getBytes:&byte2 range:NSMakeRange(1, 1)]; - [localInetAddrData getBytes:&byte3 range:NSMakeRange(2, 1)]; - [localInetAddrData getBytes:&byte4 range:NSMakeRange(3, 1)]; - - - NSLog(@"ESP_NetUtil:: %d.%d.%d.%d", byte1,byte2,byte3,byte4); - - return localInetAddrData; -} - -+ (NSData *) parseInetAddrByData: (NSData *) inetAddrData andOffset: (int) offset andCount: (int) count -{ - return [inetAddrData subdataWithRange:NSMakeRange(offset, count)]; -} - -+ (NSString *) descriptionInetAddrByData: (NSData *) inetAddrData -{ - Byte inetAddrBytes[IP_LEN]; - [inetAddrData getBytes:inetAddrBytes length:IP_LEN]; - // hard coding - return [NSString stringWithFormat:@"%d.%d.%d.%d",inetAddrBytes[0],inetAddrBytes[1],inetAddrBytes[2],inetAddrBytes[3]]; -} - -+ (NSData *) parseBssid2bytes: (NSString *) bssid -{ - NSArray *bssidArray = [bssid componentsSeparatedByString:@":"]; - NSInteger size = [bssidArray count]; - Byte bssidBytes[size]; - for (NSInteger i = 0; i < size; i++) { - NSString *bssidStr = [bssidArray objectAtIndex:i]; - bssidBytes[i] = strtoul([bssidStr UTF8String], 0, 16); - } - return [[NSData alloc]initWithBytes:bssidBytes length:size]; -} - -@end diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/IPAddress.c b/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/IPAddress.c deleted file mode 100755 index f32d4b8..0000000 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/IPAddress.c +++ /dev/null @@ -1,216 +0,0 @@ -// -// IPAddress.c -// LocalIpDemo -// -// Created by 白 桦 on 5/11/15. -// Copyright (c) 2015 白 桦. All rights reserved. -// -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "IPAddress.h" - -#define min(a,b) ((a) < (b) ? (a) : (b)) -#define max(a,b) ((a) > (b) ? (a) : (b)) - -#define BUFFERSIZE 4000 - -char *if_names[MAXADDRS]; -char *ip_names[MAXADDRS]; -char *hw_addrs[MAXADDRS]; -unsigned long ip_addrs[MAXADDRS]; - -static int nextAddr = 0; - -void InitAddresses() -{ - int i; - for (i=0; iifr_addr.sa_len); - ptr += sizeof(ifr->ifr_name) + len; // for next one in buffer - - if (ifr->ifr_addr.sa_family != AF_INET) - { - continue; // ignore if not desired address family - } - - if ((cptr = (char *)strchr(ifr->ifr_name, ':')) != NULL) - { - *cptr = 0; // replace colon will null - } - - if (strncmp(lastname, ifr->ifr_name, IFNAMSIZ) == 0) - { - continue; /* already processed this interface */ - } - - memcpy(lastname, ifr->ifr_name, IFNAMSIZ); - - ifrcopy = *ifr; - ioctl(sockfd, SIOCGIFFLAGS, &ifrcopy); - flags = ifrcopy.ifr_flags; - if ((flags & IFF_UP) == 0) - { - continue; // ignore if interface not up - } - - if_names[nextAddr] = (char *)malloc(strlen(ifr->ifr_name)+1); - if (if_names[nextAddr] == NULL) - { - return; - } - strcpy(if_names[nextAddr], ifr->ifr_name); - - sin = (struct sockaddr_in *)&ifr->ifr_addr; - strcpy(temp, inet_ntoa(sin->sin_addr)); - - ip_names[nextAddr] = (char *)malloc(strlen(temp)+1); - if (ip_names[nextAddr] == NULL) - { - return; - } - strcpy(ip_names[nextAddr], temp); - - ip_addrs[nextAddr] = sin->sin_addr.s_addr; - - ++nextAddr; - } - - close(sockfd); -} - -void GetHWAddresses() -{ - struct ifconf ifc; - struct ifreq *ifr; - int i, sockfd; - char buffer[BUFFERSIZE], *cp, *cplim; - char temp[80]; - - for (i=0; iifr_addr.sa_family == AF_LINK) - { - struct sockaddr_dl *sdl = (struct sockaddr_dl *)&ifr->ifr_addr; - int a,b,c,d,e,f; - int i; - - strcpy(temp, (char *)ether_ntoa((const struct ether_addr *)LLADDR(sdl))); - sscanf(temp, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f); - sprintf(temp, "%02X:%02X:%02X:%02X:%02X:%02X",a,b,c,d,e,f); - - for (i=0; iifr_name, if_names[i]) == 0)) - { - if (hw_addrs[i] == NULL) - { - hw_addrs[i] = (char *)malloc(strlen(temp)+1); - strcpy(hw_addrs[i], temp); - break; - } - } - } - } - cp += sizeof(ifr->ifr_name) + max(sizeof(ifr->ifr_addr), ifr->ifr_addr.sa_len); - } - close(sockfd); -} diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/IPAddress.h b/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/IPAddress.h deleted file mode 100755 index fbbb49e..0000000 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/IPAddress.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// IPAddress.h -// LocalIpDemo -// -// Created by 白 桦 on 5/11/15. -// Copyright (c) 2015 白 桦. All rights reserved. -// - -#ifndef LocalIpDemo_IPAddress_h -#define LocalIpDemo_IPAddress_h - -#define MAXADDRS 32 - -extern char *if_names[MAXADDRS]; -extern char *ip_names[MAXADDRS]; -extern char *hw_addrs[MAXADDRS]; -extern unsigned long ip_addrs[MAXADDRS]; - -// Function prototypes - -void InitAddresses(); -void FreeAddresses(); -void GetIPAddresses(); -void GetHWAddresses(); - -#endif diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketServer.m b/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketServer.m deleted file mode 100755 index 020f773..0000000 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketServer.m +++ /dev/null @@ -1,197 +0,0 @@ -// -// ESPUDPSocketServer.m -// EspTouchDemo -// -// Created by 白 桦 on 4/13/15. -// Copyright (c) 2015 白 桦. All rights reserved. -// - -#import "ESPUDPSocketServer.h" -#include -#include -#include -#include -#include "ESPTouchTask.h" - -@interface ESPUDPSocketServer () - -@property(nonatomic,assign) int _sck_fd; -@property(nonatomic,assign) int _port; -// it is used to check whether the socket is closed already to prevent close more than once. -// especially, when you close the socket second time, it is created just now, it will crash. -// -// // suppose fd1 = 4, fd1 belong to obj1 -// e.g. int fd1 = socket(AF_INET,SOCK_DRAM,0); -// close(fd1); -// -// // suppose fd2 = 4 as well, fd2 belong to obj2 -// int fd2 = socket(AF_INET,SOCK_DRAM,0); -// -// // obj1's dealloc() is called by system, so -// close(fd1); -// -// // Amazing!!! at the moment, fd2 is close by others -// -@property(nonatomic,assign) volatile bool _isClosed; -// it is used to lock the close method -@property(nonatomic,strong) volatile NSLock *_lock; - -@end - -@implementation ESPUDPSocketServer - -- (id) initWithPort: (int) port AndSocketTimeout: (int) socketTimeout -{ - self = [super init]; - if (self) - { - // create local - self._lock = [[NSLock alloc]init]; - // create socket - self._isClosed = NO; - self._sck_fd = socket(AF_INET,SOCK_DGRAM,0); - if (DEBUG_ON) - { - NSLog(@"##########################server init(): _sck_fd=%d", self._sck_fd); - } - if (self._sck_fd < 0) - { - if (DEBUG_ON) - { - perror("server: _skd_fd init() fail\n"); - } - return nil; - } - // init socket params - struct sockaddr_in server_addr; - socklen_t addr_len; - memset(&server_addr, 0, sizeof(server_addr)); - server_addr.sin_family = AF_INET; - server_addr.sin_port = htons(port); - server_addr.sin_addr.s_addr = INADDR_ANY; - addr_len = sizeof(server_addr); - // set broadcast - const int opt = 1; - if (setsockopt(self._sck_fd,SOL_SOCKET,SO_BROADCAST,(char *)&opt, sizeof(opt)) < 0) - { - if (DEBUG_ON) - { - perror("server init(): setsockopt SO_BROADCAST fail\n"); - } - [self close]; - return nil; - } - // set timeout - [self setSocketTimeout:socketTimeout]; - // bind - if (bind(self._sck_fd, (struct sockaddr*)&server_addr, addr_len) < 0) - { - if (DEBUG_ON) - { - perror("server init(): bind fail\n"); - } - [self close]; - return nil; - } - } - return self; -} - -// make sure the socket will be closed sometime -- (void)dealloc -{ - if (DEBUG_ON) - { - NSLog(@"###################server dealloc()"); - } - [self close]; -} - -- (void) close -{ - [self._lock lock]; - if (!self._isClosed) - { - if (DEBUG_ON) - { - NSLog(@"###################server close() fd=%d",self._sck_fd); - } - close(self._sck_fd); - self._isClosed = true; - } - [self._lock unlock]; -} - -- (void) interrupt -{ - [self close]; -} - -- (void) setSocketTimeout: (int) timeout -{ - struct timeval tv; - tv.tv_sec = timeout/1000; - tv.tv_usec = timeout%1000*1000; - if (setsockopt(self._sck_fd,SOL_SOCKET,SO_RCVTIMEO,(char *)&tv, sizeof(tv)) < 0) - { - if (DEBUG_ON) - { - perror("server: setsockopt SO_RCVTIMEO fail\n"); - } - } -} - -- (Byte) receiveOneByte -{ - ssize_t recNumber = recv(self._sck_fd, _buffer, BUFFER_SIZE, 0); - if (recNumber > 0) - { - return _buffer[0]; - } - else if(recNumber == 0) - { - if (DEBUG_ON) - { - perror("server: receiveOneByte socket is closed by the other\n"); - } - } - else - { - if (DEBUG_ON) - { - perror("server: receiveOneByte fail\n"); - } - } - return UINT8_MAX; -} - -- (NSData *) receiveSpecLenBytes: (int)len -{ - ssize_t recNumber = recv(self._sck_fd, _buffer, BUFFER_SIZE, 0); - if (recNumber==len) - { - NSData *data = [[NSData alloc]initWithBytes:_buffer length:recNumber]; - return data; - } - else if(recNumber==0) - { - if (DEBUG_ON) - { - perror("server: receiveOneByte socket is closed by the other\n"); - } - } - else if(recNumber<0) - { - if (DEBUG_ON) - { - perror("server: receiveOneByte fail\n"); - } - } - else - { - // receive rubbish message, just ignore it - } - return nil; -} - -@end diff --git a/Ifish/ESPTouch/ESPUtils/ESPAES.h b/Ifish/ESPTouch/ESPUtils/ESPAES.h new file mode 100644 index 0000000..82e47ff --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESPAES.h @@ -0,0 +1,19 @@ +// +// ESPAES.h +// EspTouchDemo +// +// Created by AE on 2018/4/5. +// + +#import + +@interface ESPAES : NSObject { + @private NSString *key; +} + +- (instancetype)initWithKey:(NSString *)secretKey; + +- (NSData *)AES128EncryptData:(NSData *)data; +- (NSData *)AES128DecryptData:(NSData *)data; + +@end diff --git a/Ifish/ESPTouch/ESPUtils/ESPAES.m b/Ifish/ESPTouch/ESPUtils/ESPAES.m new file mode 100644 index 0000000..9a3f718 --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESPAES.m @@ -0,0 +1,66 @@ +// +// ESPAES.m +// EspTouchDemo +// +// Created by AE on 2018/4/5. +// + +#import "ESPAES.h" +#import + +@implementation ESPAES + +- (instancetype)initWithKey:(NSString *)secretKey +{ + self = [super init]; + if (self) { + key = secretKey; + } + return self; +} + +- (NSData *)AES128EncryptData:(NSData *)data { + char keyPtr[kCCKeySizeAES128+1]; + bzero(keyPtr, sizeof(keyPtr)); + [key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding]; + NSUInteger dataLength = [data length]; + size_t bufferSize = dataLength + kCCBlockSizeAES128; + void *buffer = malloc(bufferSize); + size_t numBytesEncrypted = 0; + CCCryptorStatus cryptStatus = CCCrypt(kCCEncrypt, kCCAlgorithmAES128, + kCCOptionPKCS7Padding | kCCOptionECBMode, + keyPtr, kCCBlockSizeAES128, + NULL, + [data bytes], dataLength, + buffer, bufferSize, + &numBytesEncrypted); + if (cryptStatus == kCCSuccess) { + return [NSData dataWithBytesNoCopy:buffer length:numBytesEncrypted]; + } + free(buffer); + return nil; +} + +- (NSData *)AES128DecryptData:(NSData *)data { + char keyPtr[kCCKeySizeAES128+1]; + bzero(keyPtr, sizeof(keyPtr)); + [key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding]; + NSUInteger dataLength = [data length]; + size_t bufferSize = dataLength + kCCBlockSizeAES128; + void *buffer = malloc(bufferSize); + size_t numBytesDecrypted = 0; + CCCryptorStatus cryptStatus = CCCrypt(kCCDecrypt, kCCAlgorithmAES128, + kCCOptionPKCS7Padding | kCCOptionECBMode, + keyPtr, kCCBlockSizeAES128, + NULL, + [data bytes], dataLength, + buffer, bufferSize, + &numBytesDecrypted); + if (cryptStatus == kCCSuccess) { + return [NSData dataWithBytesNoCopy:buffer length:numBytesDecrypted]; + } + free(buffer); + return nil; +} + +@end diff --git a/Ifish/ESPTouch/ESPUtils/ESPTools.h b/Ifish/ESPTouch/ESPUtils/ESPTools.h new file mode 100644 index 0000000..4a7c388 --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESPTools.h @@ -0,0 +1,22 @@ +// +// EspNetUtils.h +// Esp32Mesh +// +// Created by AE on 2018/4/19. +// Copyright © 2018年 AE. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@interface ESPTools : NSObject + ++ (nullable NSString *)getCurrentWiFiSsid; ++ (nullable NSString *)getCurrentBSSID; + ++ (NSString *)getIPAddress:(BOOL)preferIPv4; + ++ (NSDictionary *)getIPAddresses; +NS_ASSUME_NONNULL_END +@end + diff --git a/Ifish/ESPTouch/ESPUtils/ESPTools.m b/Ifish/ESPTouch/ESPUtils/ESPTools.m new file mode 100644 index 0000000..0a682d0 --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESPTools.m @@ -0,0 +1,132 @@ +// +// EspNetUtils.m +// Esp32Mesh +// +// Created by AE on 2018/4/19. +// Copyright © 2018年 AE. All rights reserved. +// + +#import "ESPTools.h" +#import +#import +#import +#import + +#define IOS_CELLULAR @"pdp_ip0" +#define IOS_WIFI @"en0" +#define IOS_VPN @"utun0" +#define IP_ADDR_IPv4 @"ipv4" +#define IP_ADDR_IPv6 @"ipv6" + +@implementation ESPTools + ++ (nullable NSString *)getCurrentWiFiSsid { + NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces(); + id info = nil; + for (NSString *ifnam in ifs) { + info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam); + if (info && [info count]) { + break; + } + } + // Key: BSSID, SSID, SSIDDATA + return [(NSDictionary*)info objectForKey:@"SSID"]; +} + ++ (nullable NSString *)getCurrentBSSID { + NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces(); + id info = nil; + for (NSString *ifnam in ifs) { + info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam); + if (info && [info count]) { + break; + } + } + // Key: BSSID, SSID, SSIDDATA + return [(NSDictionary*)info objectForKey:@"BSSID"]; +} + ++ (NSString *)getIPAddress:(BOOL)preferIPv4 { + NSArray *searchArray = preferIPv4 ? + @[ IOS_VPN @"/" IP_ADDR_IPv4, IOS_VPN @"/" IP_ADDR_IPv6, IOS_WIFI @"/" IP_ADDR_IPv4, IOS_WIFI @"/" IP_ADDR_IPv6, IOS_CELLULAR @"/" IP_ADDR_IPv4, IOS_CELLULAR @"/" IP_ADDR_IPv6 ] : + @[ IOS_VPN @"/" IP_ADDR_IPv6, IOS_VPN @"/" IP_ADDR_IPv4, IOS_WIFI @"/" IP_ADDR_IPv6, IOS_WIFI @"/" IP_ADDR_IPv4, IOS_CELLULAR @"/" IP_ADDR_IPv6, IOS_CELLULAR @"/" IP_ADDR_IPv4 ] ; + + NSDictionary *addresses = [self getIPAddresses]; + NSLog(@"addresses: %@", addresses); + + __block NSString *address; + [searchArray enumerateObjectsUsingBlock:^(NSString *key, NSUInteger idx, BOOL *stop) { + address = addresses[key]; + //筛选出IP地址格式 + if([self isValidatIP:address]) *stop = YES; + } ]; + return address ? address : @"0.0.0.0"; +} + ++ (BOOL)isValidatIP:(NSString *)ipAddress { + if (ipAddress.length == 0) { + return NO; + } + NSString *urlRegEx = @"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"; + + NSError *error; + NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:urlRegEx options:0 error:&error]; + + if (regex != nil) { + NSTextCheckingResult *firstMatch=[regex firstMatchInString:ipAddress options:0 range:NSMakeRange(0, [ipAddress length])]; + + if (firstMatch) { + NSRange resultRange = [firstMatch rangeAtIndex:0]; + NSString *result=[ipAddress substringWithRange:resultRange]; + //输出结果 + NSLog(@"ESPTools 输出结果:%@",result); + return YES; + } + } + return NO; +} + ++ (NSDictionary *)getIPAddresses { + NSMutableDictionary *addresses = [NSMutableDictionary dictionaryWithCapacity:8]; + + // retrieve the current interfaces - returns 0 on success + struct ifaddrs *interfaces; + if(!getifaddrs(&interfaces)) { + // Loop through linked list of interfaces + struct ifaddrs *interface; + for(interface=interfaces; interface; interface=interface->ifa_next) { + if(!(interface->ifa_flags & IFF_UP) /* || (interface->ifa_flags & IFF_LOOPBACK) */ ) { + continue; // deeply nested code harder to read + } + const struct sockaddr_in *addr = (const struct sockaddr_in*)interface->ifa_addr; + char addrBuf[ MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) ]; + if(addr && (addr->sin_family==AF_INET || addr->sin_family==AF_INET6)) { + NSString *name = [NSString stringWithUTF8String:interface->ifa_name]; + NSString *type; + if(addr->sin_family == AF_INET) { + if(inet_ntop(AF_INET, &addr->sin_addr, addrBuf, INET_ADDRSTRLEN)) { + type = IP_ADDR_IPv4; + } + } else { + const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6*)interface->ifa_addr; + if(inet_ntop(AF_INET6, &addr6->sin6_addr, addrBuf, INET6_ADDRSTRLEN)) { + type = IP_ADDR_IPv6; + } + } + if(type) { + NSString *key = [NSString stringWithFormat:@"%@/%@", name, type]; + addresses[key] = [NSString stringWithUTF8String:addrBuf]; + } + } + } + // Free memory + freeifaddrs(interfaces); + } + return [addresses count] ? addresses : nil; +} + +@end + diff --git a/Ifish/ESPTouch/ESPUtils/ESPVersionMacro.h b/Ifish/ESPTouch/ESPUtils/ESPVersionMacro.h new file mode 100644 index 0000000..cdb6223 --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESPVersionMacro.h @@ -0,0 +1,20 @@ +// +// ESPVersionMacro.h +// suite +// +// Created by fby on 5/16/16. +// Copyright © 2016 fby. All rights reserved. +// + +#ifndef ESPVersionMacro_h +#define ESPVersionMacro_h +#import + +#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) +#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) +#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) +#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) +#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) + + +#endif /* ESPVersionMacro_h */ diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_ByteUtil.h b/Ifish/ESPTouch/ESPUtils/ESP_ByteUtil.h old mode 100755 new mode 100644 similarity index 96% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_ByteUtil.h rename to Ifish/ESPTouch/ESPUtils/ESP_ByteUtil.h index 279fbbb..9315d8e --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_ByteUtil.h +++ b/Ifish/ESPTouch/ESPUtils/ESP_ByteUtil.h @@ -2,8 +2,8 @@ // ESP_ByteUtil.h // EspTouchDemo // -// Created by 白 桦 on 4/7/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/7/15. +// Copyright (c) 2015 fby. All rights reserved. // #import @@ -48,7 +48,6 @@ * @return the high and low bytes be split, byte[0] is high and byte[1] is * low */ - + (NSData *) splitUint8To2Bytes: (UInt8) uint8; /** @@ -60,7 +59,6 @@ * the low byte * @return the whole byte */ - + (Byte) combine2bytesToOneWithHigh: (Byte) high andLow: (Byte) low; /** diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_ByteUtil.m b/Ifish/ESPTouch/ESPUtils/ESP_ByteUtil.m old mode 100755 new mode 100644 similarity index 97% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_ByteUtil.m rename to Ifish/ESPTouch/ESPUtils/ESP_ByteUtil.m index f237d3f..dfe3307 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_ByteUtil.m +++ b/Ifish/ESPTouch/ESPUtils/ESP_ByteUtil.m @@ -2,8 +2,8 @@ // ESP_ByteUtil.m // EspTouchDemo // -// Created by 白 桦 on 4/7/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/7/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESP_ByteUtil.h" @@ -57,6 +57,7 @@ high = 0; low = [self intFromHexString:[hexString substringWithRange:NSMakeRange(0, 1)]]; } + Byte bytes[] = { high, low }; NSData *data = [[NSData alloc] initWithBytes:bytes length:2]; return data; @@ -108,7 +109,6 @@ + (NSString *) parseBssid:(Byte[]) bssidBytes Offset: (int) offset Count: (int) count { Byte bytes[count]; - for (int i = 0; i < count; i++ ) { bytes[i] = bssidBytes[i + offset]; diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_CRC8.h b/Ifish/ESPTouch/ESPUtils/ESP_CRC8.h old mode 100755 new mode 100644 similarity index 92% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_CRC8.h rename to Ifish/ESPTouch/ESPUtils/ESP_CRC8.h index 0cc4879..6c43d72 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_CRC8.h +++ b/Ifish/ESPTouch/ESPUtils/ESP_CRC8.h @@ -2,8 +2,8 @@ // ESP_CRC8.h // EspTouchDemo // -// Created by 白 桦 on 3/23/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 3/23/15. +// Copyright (c) 2015 fby. All rights reserved. // #import @@ -53,7 +53,7 @@ /** * Updates the checksum value with the given byte. * - * @param val + * @param value * the byte to update the checksum with. */ - (void)updateWithValue:(int)value; diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_CRC8.m b/Ifish/ESPTouch/ESPUtils/ESP_CRC8.m old mode 100755 new mode 100644 similarity index 94% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_CRC8.m rename to Ifish/ESPTouch/ESPUtils/ESP_CRC8.m index bf992cc..924ba4e --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchdata/ESP_CRC8.m +++ b/Ifish/ESPTouch/ESPUtils/ESP_CRC8.m @@ -2,8 +2,8 @@ // ESP_CRC8.m // EspTouchDemo // -// Created by 白 桦 on 3/23/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 3/23/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESP_CRC8.h" diff --git a/Ifish/ESPTouch/ESPUtils/ESP_NetUtil.h b/Ifish/ESPTouch/ESPUtils/ESP_NetUtil.h new file mode 100644 index 0000000..bf68708 --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESP_NetUtil.h @@ -0,0 +1,82 @@ +// +// ESPNetUtil.h +// EspTouchDemo +// +// Created by fby on 5/15/15. +// Copyright (c) 2015 fby. All rights reserved. +// + +#import + +@interface ESP_NetUtil : NSObject + +/** + * get local ip v4 or nil + * + * @return local ip v4 or nil + */ ++ (NSString *) getLocalIPv4; + +/** + * get local ip v6 or nil + * + * @return local ip v6 or nil + */ ++ (NSString *) getLocalIPv6; + +/** + * whether the ipAddr is v4 + * + * @return whether the ipAddr is v4 + */ ++ (BOOL) isIPv4Addr:(NSString *)ipAddr; + +/** + * whether the ipAddr v4 is private + * + * @return whether the ipAddr v4 is private + */ ++ (BOOL) isIPv4PrivateAddr:(NSString *)ipAddr; + +/** + * get the local ip address by local inetAddress ip4 + * + * @param localInetAddr4 local inetAddress ip4 + */ ++ (NSData *) getLocalInetAddress4ByAddr:(NSString *) localInetAddr4; + +/** + * get the invented local ip address by local port + * + */ ++ (NSData *) getLocalInetAddress6ByPort:(int) localPort; + +/** + * parse InetAddress + */ ++ (NSData *) parseInetAddrByData: (NSData *) inetAddrData andOffset: (int) offset andCount: (int) count; + +/** + * descrpion inetAddrData for print pretty IPv4 + */ ++ (NSString *) descriptionInetAddr4ByData: (NSData *) inetAddrData; + +/** + * descrpion inetAddrData for print pretty IPv6 + */ ++ (NSString *) descriptionInetAddr6ByData: (NSData *) inetAddrData; + +/** + * parse bssid + * + * @param bssid the bssid + * @return byte converted from bssid + */ ++ (NSData *) parseBssid2bytes: (NSString *) bssid; + +/** + * send a dummy GET to "https://8.8.8.8" just to get Network Permission after ios10.0(including) + */ ++ (void) tryOpenNetworkPermission; + +@end diff --git a/Ifish/ESPTouch/ESPUtils/ESP_NetUtil.m b/Ifish/ESPTouch/ESPUtils/ESP_NetUtil.m new file mode 100644 index 0000000..b2e8d60 --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESP_NetUtil.m @@ -0,0 +1,153 @@ +// +// ESPNetUtil.m +// EspTouchDemo +// +// Created by fby on 5/15/15. +// Copyright (c) 2015 fby. All rights reserved. +// + +#import "ESP_NetUtil.h" +#import "ESP_WifiUtil.h" +#import "ESP_ByteUtil.h" +#import "ESPVersionMacro.h" + +#define IP4_LEN 4 + +#define IP6_LEN 16 + +@implementation ESP_NetUtil + +/** + * get local ip v4 or nil + * + * @return local ip v4 or nil + */ ++ (NSString *) getLocalIPv4 +{ + return [ESP_WifiUtil getIPAddress4]; +} + +/** + * get local ip v6 or nil + * + * @return local ip v6 or nil + */ ++ (NSString *) getLocalIPv6 +{ + return [ESP_WifiUtil getIpAddress6]; +} + ++ (BOOL) isIPv4Addr:(NSString *)ipAddr +{ + NSArray *ip4array = [ipAddr componentsSeparatedByString:@"."]; + return [ip4array count]==4; +} + ++ (BOOL) isIPv4PrivateAddr:(NSString *)ipAddr4 +{ + NSArray *ip4array = [ipAddr4 componentsSeparatedByString:@"."]; + Byte byte0 = [[ip4array objectAtIndex:0]intValue]; + Byte byte1 = [[ip4array objectAtIndex:1]intValue]; +// Byte byte2 = [[ip4array objectAtIndex:2]intValue]; +// Byte byte3 = [[ip4array objectAtIndex:3]intValue]; + + if (byte0==10) { + // 10.0.0.0~10.255.255.255 + return YES; + } else if (byte0==172&&16<=byte1&&byte1<=31) { + // 172.16.0.0~172.31.255.255 + return YES; + } else if (byte0==192&&byte1==168) { + // 192.168.0.0~192.168.255.255 + return YES; + } + return NO; +} + ++ (NSData *) getLocalInetAddress4ByAddr:(NSString *) localInetAddr4 +{ + NSArray *ip4array = [localInetAddr4 componentsSeparatedByString:@"."]; + Byte byte0 = [[ip4array objectAtIndex:0]intValue]; + Byte byte1 = [[ip4array objectAtIndex:1]intValue]; + Byte byte2 = [[ip4array objectAtIndex:2]intValue]; + Byte byte3 = [[ip4array objectAtIndex:3]intValue]; + Byte bytes[] = {byte0,byte1,byte2,byte3}; + NSData *ip4data = [NSData dataWithBytes:bytes length:IP4_LEN]; + return ip4data; +} + ++ (NSData *) getLocalInetAddress6ByPort:(int) localPort +{ + Byte lowPort = localPort & 0xff; + Byte highPort = (localPort>>8) & 0xff; + Byte bytes[] = {highPort,lowPort,0xff,0xff}; + NSData *ip6data = [NSData dataWithBytes:bytes length:IP4_LEN]; + return ip6data; +} + ++ (NSData *) parseInetAddrByData: (NSData *) inetAddrData andOffset: (int) offset andCount: (int) count +{ + return [inetAddrData subdataWithRange:NSMakeRange(offset, count)]; +} + ++ (NSString *) descriptionInetAddr4ByData: (NSData *) inetAddrData +{ + // check whether inetAddrData is belong to IPv4 + if ([inetAddrData length]!=IP4_LEN) { + return nil; + } + Byte inetAddrBytes[IP4_LEN]; + [inetAddrData getBytes:inetAddrBytes length:IP4_LEN]; + // hard coding + return [NSString stringWithFormat:@"%d.%d.%d.%d",inetAddrBytes[0],inetAddrBytes[1],inetAddrBytes[2],inetAddrBytes[3]]; +} ++ (NSString *) descriptionInetAddr6ByData: (NSData *) inetAddrData +{ + // check whether inetAddrData is belong to IPv4 + if ([inetAddrData length]!=IP6_LEN) { + return nil; + } + Byte inetAddrBytes[IP6_LEN]; + [inetAddrData getBytes:inetAddrBytes length:IP6_LEN]; + // hard coding + return [NSString stringWithFormat:@"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",inetAddrBytes[0],inetAddrBytes[1],inetAddrBytes[2],inetAddrBytes[3],inetAddrBytes[4],inetAddrBytes[5],inetAddrBytes[6],inetAddrBytes[7],inetAddrBytes[8],inetAddrBytes[9],inetAddrBytes[10],inetAddrBytes[11],inetAddrBytes[12],inetAddrBytes[13],inetAddrBytes[14],inetAddrBytes[15]]; +} + ++ (NSData *) parseBssid2bytes: (NSString *) bssid +{ + NSArray *bssidArray = [bssid componentsSeparatedByString:@":"]; + NSInteger size = [bssidArray count]; + Byte bssidBytes[size]; + for (NSInteger i = 0; i < size; i++) { + NSString *bssidStr = [bssidArray objectAtIndex:i]; + bssidBytes[i] = strtoul([bssidStr UTF8String], 0, 16); + } + return [[NSData alloc]initWithBytes:bssidBytes length:size]; +} + ++ (NSURLSessionConfiguration *) DEFAULT_SESSION_CONFIGURATION +{ + static dispatch_once_t predicate; + static NSURLSessionConfiguration *DEFAULT_SESSION_CONFIGURATION; + dispatch_once(&predicate, ^{ + DEFAULT_SESSION_CONFIGURATION = [NSURLSessionConfiguration defaultSessionConfiguration]; + }); + return DEFAULT_SESSION_CONFIGURATION; +} + + ++ (void) tryOpenNetworkPermission +{ + // only ios 10.0 later required to try open network permission + if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) { + NSURL *url = [NSURL URLWithString:@"https://8.8.8.8"]; + NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:1000]; + + + NSURLSession *urlSession = [NSURLSession sessionWithConfiguration:[self DEFAULT_SESSION_CONFIGURATION] delegate:nil delegateQueue:[NSOperationQueue currentQueue]]; + [[urlSession dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error){ + }] resume]; + } +} + +@end diff --git a/Ifish/ESPTouch/ESPUtils/ESP_WifiUtil.h b/Ifish/ESPTouch/ESPUtils/ESP_WifiUtil.h new file mode 100644 index 0000000..becdeab --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESP_WifiUtil.h @@ -0,0 +1,33 @@ +// +// ESP_WifiUtil.h +// EspTouchDemo +// +// Created by fby on 6/15/16. +// Copyright © 2016 fby. All rights reserved. +// + +#import + +@interface ESP_WifiUtil : NSObject + +// refer to http://stackoverflow.com/questions/7072989/iphone-ipad-osx-how-to-get-my-ip-address-programmatically ++ (NSString *)getIPAddress:(BOOL)preferIPv4; + +// refer to http://stackoverflow.com/questions/7072989/iphone-ipad-osx-how-to-get-my-ip-address-programmatically ++ (NSDictionary *)getIPAddresses; + +/** + * get local ip address by IPv4 + * + * @return local ip address by IPv4(or nil when en0/ipv4 unaccessible) + */ ++ (NSString *)getIPAddress4; + +/** + * get local ip address by IPv6 + * + * @return local ip address by IPv6(or nil when en0/ipv6 unaccessible) + */ ++ (NSString *)getIpAddress6; + +@end diff --git a/Ifish/ESPTouch/ESPUtils/ESP_WifiUtil.m b/Ifish/ESPTouch/ESPUtils/ESP_WifiUtil.m new file mode 100644 index 0000000..d7dc0d9 --- /dev/null +++ b/Ifish/ESPTouch/ESPUtils/ESP_WifiUtil.m @@ -0,0 +1,95 @@ +// +// ESP_WifiUtil.m +// EspTouchDemo +// +// Created by fby on 6/15/16. +// Copyright © 2016 fby. All rights reserved. +// + +#import "ESP_WifiUtil.h" + +#include +#include +#include + +#define IOS_CELLULAR @"pdp_ip0" +#define IOS_WIFI @"en0" +#define IOS_VPN @"utun0" +#define IP_ADDR_IPv4 @"ipv4" +#define IP_ADDR_IPv6 @"ipv6" + +@implementation ESP_WifiUtil + ++ (NSString *)getIPAddress:(BOOL)preferIPv4 +{ + NSArray *searchArray = preferIPv4 ? + @[ IOS_VPN @"/" IP_ADDR_IPv4, IOS_VPN @"/" IP_ADDR_IPv6, IOS_WIFI @"/" IP_ADDR_IPv4, IOS_WIFI @"/" IP_ADDR_IPv6, IOS_CELLULAR @"/" IP_ADDR_IPv4, IOS_CELLULAR @"/" IP_ADDR_IPv6 ] : + @[ IOS_VPN @"/" IP_ADDR_IPv6, IOS_VPN @"/" IP_ADDR_IPv4, IOS_WIFI @"/" IP_ADDR_IPv6, IOS_WIFI @"/" IP_ADDR_IPv4, IOS_CELLULAR @"/" IP_ADDR_IPv6, IOS_CELLULAR @"/" IP_ADDR_IPv4 ] ; + + NSDictionary *addresses = [self getIPAddresses]; +// NSLog(@"addresses: %@", addresses); + + __block NSString *address; + [searchArray enumerateObjectsUsingBlock:^(NSString *key, NSUInteger idx, BOOL *stop) + { + address = addresses[key]; + if(address) *stop = YES; + } ]; + return address ? address : @"0.0.0.0"; +} + ++ (NSDictionary *)getIPAddresses +{ + NSMutableDictionary *addresses = [NSMutableDictionary dictionaryWithCapacity:8]; + + // retrieve the current interfaces - returns 0 on success + struct ifaddrs *interfaces; + if(!getifaddrs(&interfaces)) { + // Loop through linked list of interfaces + struct ifaddrs *interface; + for(interface=interfaces; interface; interface=interface->ifa_next) { + if(!(interface->ifa_flags & IFF_UP) /* || (interface->ifa_flags & IFF_LOOPBACK) */ ) { + continue; // deeply nested code harder to read + } + const struct sockaddr_in *addr = (const struct sockaddr_in*)interface->ifa_addr; + char addrBuf[ MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) ]; + if(addr && (addr->sin_family==AF_INET || addr->sin_family==AF_INET6)) { + NSString *name = [NSString stringWithUTF8String:interface->ifa_name]; + NSString *type; + if(addr->sin_family == AF_INET) { + if(inet_ntop(AF_INET, &addr->sin_addr, addrBuf, INET_ADDRSTRLEN)) { + type = IP_ADDR_IPv4; + } + } else { + const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6*)interface->ifa_addr; + if(inet_ntop(AF_INET6, &addr6->sin6_addr, addrBuf, INET6_ADDRSTRLEN)) { + type = IP_ADDR_IPv6; + } + } + if(type) { + NSString *key = [NSString stringWithFormat:@"%@/%@", name, type]; + addresses[key] = [NSString stringWithUTF8String:addrBuf]; + } + } + } + // Free memory + freeifaddrs(interfaces); + } + return [addresses count] ? addresses : nil; +} + ++ (NSString *)getIPAddress4 +{ + NSString *key = [NSString stringWithFormat:@"%@/%@",IOS_WIFI,IP_ADDR_IPv4]; + NSString *ipv4 = [[self getIPAddresses]objectForKey:key]; + return ipv4; +} + ++ (NSString *)getIpAddress6 +{ + NSString *key = [NSString stringWithFormat:@"%@/%@",IOS_WIFI,IP_ADDR_IPv6]; + NSString *ipv6 = [[self getIPAddresses]objectForKey:key]; + return ipv6; +} + +@end diff --git a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPDataCode.h b/Ifish/ESPTouch/protocol/ESPDataCode.h old mode 100755 new mode 100644 similarity index 89% rename from Ifish/ESPTouch/ESPTouAPI/protocol/ESPDataCode.h rename to Ifish/ESPTouch/protocol/ESPDataCode.h index 28e0de3..f8c9c02 --- a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPDataCode.h +++ b/Ifish/ESPTouch/protocol/ESPDataCode.h @@ -2,8 +2,8 @@ // ESPDataCode.h // EspTouchDemo // -// Created by 白 桦 on 4/9/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/9/15. +// Copyright (c) 2015 fby. All rights reserved. // #import diff --git a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPDataCode.m b/Ifish/ESPTouch/protocol/ESPDataCode.m old mode 100755 new mode 100644 similarity index 94% rename from Ifish/ESPTouch/ESPTouAPI/protocol/ESPDataCode.m rename to Ifish/ESPTouch/protocol/ESPDataCode.m index c4ae83a..21e2f23 --- a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPDataCode.m +++ b/Ifish/ESPTouch/protocol/ESPDataCode.m @@ -2,8 +2,8 @@ // ESPDataCode.m // EspTouchDemo // -// Created by 白 桦 on 4/9/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/9/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESPDataCode.h" diff --git a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPDatumCode.h b/Ifish/ESPTouch/protocol/ESPDatumCode.h old mode 100755 new mode 100644 similarity index 67% rename from Ifish/ESPTouch/ESPTouAPI/protocol/ESPDatumCode.h rename to Ifish/ESPTouch/protocol/ESPDatumCode.h index ca78b39..6762119 --- a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPDatumCode.h +++ b/Ifish/ESPTouch/protocol/ESPDatumCode.h @@ -2,8 +2,8 @@ // ESPDatumCode.h // EspTouchDemo // -// Created by 白 桦 on 4/9/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/9/15. +// Copyright (c) 2015 fby. All rights reserved. // #import @@ -29,7 +29,7 @@ * whether the Ap's ssid is hidden * */ -- (id) initWithSsid: (NSString *) apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString*) apPwd andInetAddrData: (NSData *) ipAddrData andIsSsidHidden: (BOOL) isSsidHidden; +- (id) initWithSsid: (NSData *) apSsid andApBssid: (NSData *) apBssid andApPwd: (NSData*) apPwd andInetAddrData: (NSData *) ipAddrData andIsSsidHidden: (BOOL) isSsidHidden; - (NSData *) getBytes; diff --git a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPDatumCode.m b/Ifish/ESPTouch/protocol/ESPDatumCode.m old mode 100755 new mode 100644 similarity index 76% rename from Ifish/ESPTouch/ESPTouAPI/protocol/ESPDatumCode.m rename to Ifish/ESPTouch/protocol/ESPDatumCode.m index dac3fda..ec812bd --- a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPDatumCode.m +++ b/Ifish/ESPTouch/protocol/ESPDatumCode.m @@ -2,8 +2,8 @@ // ESPDatumCode.m // EspTouchDemo // -// Created by 白 桦 on 4/9/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/9/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESPDatumCode.h" @@ -18,34 +18,34 @@ @implementation ESPDatumCode -- (id) initWithSsid: (NSString *) apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString*) apPwd andInetAddrData: (NSData *) ipAddrData andIsSsidHidden: (BOOL) isSsidHidden +- (id) initWithSsid: (NSData *) apSsid andApBssid: (NSData *) apBssid andApPwd: (NSData*) apPwd andInetAddrData: (NSData *) ipAddrData andIsSsidHidden: (BOOL) isSsidHidden { self = [super init]; if (self) { // Data = total len(1 byte) + apPwd len(1 byte) + SSID CRC(1 byte) + - // BSSID CRC(1 byte) + TOTAL XOR(1 byte) + ipAddress(4 byte) + apPwd + apSsid apPwdLen <= - // 105 at the moment + // BSSID CRC(1 byte) + TOTAL XOR(1 byte) + ipAddress(4 byte) + apPwd + apSsid apPwdLen <= + // 105 at the moment // total xor UInt8 totalXor = 0; - NSData *apPwdBytesData = [ESP_ByteUtil getBytesByNSString:apPwd]; - NSData *apSsidBytesData = [ESP_ByteUtil getBytesByNSString:apSsid]; + NSData *apPwdBytesData = apPwd; + NSData *apSsidBytesData = apSsid; Byte apPwdBytes[[apPwdBytesData length]]; Byte apSsidBytes[[apSsidBytesData length]]; - [apPwdBytesData getBytes:apPwdBytes]; - [apSsidBytesData getBytes:apSsidBytes]; + [apPwdBytesData getBytes:apPwdBytes length:[apPwdBytesData length]]; + [apSsidBytesData getBytes:apSsidBytes length:[apSsidBytesData length]]; Byte apPwdLen = [apPwdBytesData length]; ESP_CRC8 *crc = [[ESP_CRC8 alloc]init]; [crc updateWithBuf:apSsidBytes Nbytes:(int)sizeof(apSsidBytes)]; Byte apSsidCrc = [crc getValue]; [crc reset]; - NSData *apBssidData = [ESP_NetUtil parseBssid2bytes:apBssid]; + NSData *apBssidData = apBssid; int apBssidDataLen = (int)[apBssidData length]; Byte apBssidBytes[apBssidDataLen]; - [apBssidData getBytes:apBssidBytes]; + [apBssidData getBytes:apBssidBytes length:[apBssidData length]]; [crc updateWithBuf:apBssidBytes Nbytes:apBssidDataLen]; UInt8 apBssidCrc = [crc getValue]; @@ -54,14 +54,14 @@ // only support ipv4 at the moment UInt8 ipLen = [ipAddrData length]; Byte ipAddrUint8s[ipLen]; - [ipAddrData getBytes:ipAddrUint8s]; + [ipAddrData getBytes:ipAddrUint8s length:[ipAddrData length]]; UInt8 _totalLen = EXTRA_HEAD_LEN + ipLen + apPwdLen + apSsidLen; UInt8 totalLen = isSsidHidden ? (EXTRA_HEAD_LEN + ipLen + apPwdLen + apSsidLen):(EXTRA_HEAD_LEN + ipLen + apPwdLen); - // build data codes - _dataCodes = [[NSMutableArray alloc]initWithCapacity:totalLen]; + _dataCodes = [[NSMutableArray alloc]initWithCapacity:totalLen + apBssidDataLen]; + ESPDataCode *dataCode = [[ESPDataCode alloc]initWithU8:_totalLen andIndex:0]; [_dataCodes addObject:dataCode]; totalXor ^= _totalLen; @@ -106,6 +106,20 @@ // add total xor last dataCode = [[ESPDataCode alloc]initWithU8:totalXor andIndex:4]; [_dataCodes insertObject:dataCode atIndex:4]; + + // add bssid + NSUInteger bssidInsertIndex = EXTRA_HEAD_LEN; + for (int i = 0; i < apBssidDataLen; i++) { + int index = totalLen + i; + Byte b = apBssidBytes[i]; + ESPDataCode *dc = [[ESPDataCode alloc] initWithU8:b andIndex:index]; + if (bssidInsertIndex >= _dataCodes.count) { + [_dataCodes addObject:dc]; + } else { + [_dataCodes insertObject:dc atIndex:bssidInsertIndex]; + } + bssidInsertIndex += 4; + } } return self; } diff --git a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPGuideCode.h b/Ifish/ESPTouch/protocol/ESPGuideCode.h old mode 100755 new mode 100644 similarity index 62% rename from Ifish/ESPTouch/ESPTouAPI/protocol/ESPGuideCode.h rename to Ifish/ESPTouch/protocol/ESPGuideCode.h index e8e8cc3..6c3f28d --- a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPGuideCode.h +++ b/Ifish/ESPTouch/protocol/ESPGuideCode.h @@ -2,8 +2,8 @@ // ESPGuideCode.h // EspTouchDemo // -// Created by 白 桦 on 4/9/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/9/15. +// Copyright (c) 2015 fby. All rights reserved. // #import diff --git a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPGuideCode.m b/Ifish/ESPTouch/protocol/ESPGuideCode.m old mode 100755 new mode 100644 similarity index 86% rename from Ifish/ESPTouch/ESPTouAPI/protocol/ESPGuideCode.m rename to Ifish/ESPTouch/protocol/ESPGuideCode.m index 664505d..fb1c8bb --- a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPGuideCode.m +++ b/Ifish/ESPTouch/protocol/ESPGuideCode.m @@ -2,8 +2,8 @@ // ESPGuideCode.m // EspTouchDemo // -// Created by 白 桦 on 4/9/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/9/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESPGuideCode.h" diff --git a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPTouchGenerator.h b/Ifish/ESPTouch/protocol/ESPTouchGenerator.h old mode 100755 new mode 100644 similarity index 75% rename from Ifish/ESPTouch/ESPTouAPI/protocol/ESPTouchGenerator.h rename to Ifish/ESPTouch/protocol/ESPTouchGenerator.h index 6d4a85c..ca4306c --- a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPTouchGenerator.h +++ b/Ifish/ESPTouch/protocol/ESPTouchGenerator.h @@ -2,8 +2,8 @@ // ESPTouchGenerator.h // EspTouchDemo // -// Created by 白 桦 on 4/9/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/9/15. +// Copyright (c) 2015 fby. All rights reserved. // #import @@ -29,13 +29,12 @@ * @param isSsidHidden * whether the Ap's ssid is hidden */ -- (id) initWithSsid: (NSString *) apSsid andApBssid: (NSString *) apBssid andApPassword: (NSString *) apPwd andInetAddrData: (NSData *) ipAddrData andIsSsidHidden: (BOOL) isSsidHidden; +- (id) initWithSsid: (NSData *)apSsid andApBssid: (NSData *)apBssid andApPassword: (NSData *)apPwd andInetAddrData: (NSData *)ipAddrData andIsSsidHidden: (BOOL)isSsidHidden; /** * Get guide code by the format of byte[][] * @return guide code by the format of byte[][] */ - - (NSArray *) getGCBytes2; /** diff --git a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPTouchGenerator.m b/Ifish/ESPTouch/protocol/ESPTouchGenerator.m old mode 100755 new mode 100644 similarity index 81% rename from Ifish/ESPTouch/ESPTouAPI/protocol/ESPTouchGenerator.m rename to Ifish/ESPTouch/protocol/ESPTouchGenerator.m index 5f3de18..20e8319 --- a/Ifish/ESPTouch/ESPTouAPI/protocol/ESPTouchGenerator.m +++ b/Ifish/ESPTouch/protocol/ESPTouchGenerator.m @@ -2,8 +2,8 @@ // ESPTouchGenerator.m // EspTouchDemo // -// Created by 白 桦 on 4/9/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/9/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESPTouchGenerator.h" @@ -14,20 +14,18 @@ @implementation ESPTouchGenerator -- (id) initWithSsid: (NSString *) apSsid andApBssid: (NSString *) apBssid andApPassword: (NSString *) apPwd andInetAddrData: (NSData *) ipAddrData andIsSsidHidden: (BOOL) isSsidHidden +- (id) initWithSsid: (NSData *)apSsid andApBssid: (NSData *)apBssid andApPassword: (NSData *)apPwd andInetAddrData: (NSData *)ipAddrData andIsSsidHidden:(BOOL) isSsidHidden { self = [super init]; if (self) { // generate guide code - ESPGuideCode *gc = [[ESPGuideCode alloc]init]; NSData *gcData1 = [gc getU16s]; NSUInteger gcData1Len = [gcData1 length]; UInt16 gcU16_1[gcData1Len/2]; [gcData1 getBytes:gcU16_1 length:gcData1Len]; _gcBytes2 = [[NSMutableArray alloc]initWithCapacity:gcData1Len]; - for (int i = 0; i < gcData1Len/2; i++) { NSData* data = [ESP_ByteUtil genSpecBytesWithU16:gcU16_1[i]]; @@ -35,26 +33,19 @@ } // generate data code - ESPDatumCode *dc = [[ESPDatumCode alloc]initWithSsid:apSsid andApBssid:apBssid andApPwd:apPwd andInetAddrData:ipAddrData andIsSsidHidden:isSsidHidden]; - NSData *dcData1 = [dc getU16s]; - NSUInteger dcDataLen = [dcData1 length]; UInt16 dcU16_1[dcDataLen/2]; [dcData1 getBytes:dcU16_1 length:dcDataLen]; _dcBytes2 = [[NSMutableArray alloc]initWithCapacity:dcDataLen]; - for (int i = 0; i < dcDataLen/2; i++) { NSData* data = [ESP_ByteUtil genSpecBytesWithU16:dcU16_1[i]]; [_dcBytes2 addObject:data]; } - } - return self; - } - (NSArray *) getGCBytes2 diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchDelegate.h b/Ifish/ESPTouch/task/ESPTouchDelegate.h old mode 100755 new mode 100644 similarity index 81% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchDelegate.h rename to Ifish/ESPTouch/task/ESPTouchDelegate.h index 915e993..e04eccc --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchDelegate.h +++ b/Ifish/ESPTouch/task/ESPTouchDelegate.h @@ -2,8 +2,8 @@ // ESPTouchDelegate.h // EspTouchDemo // -// Created by 白 桦 on 8/14/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 8/14/15. +// Copyright (c) 2015 fby. All rights reserved. // #import diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchResult.h b/Ifish/ESPTouch/task/ESPTouchResult.h old mode 100755 new mode 100644 similarity index 87% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchResult.h rename to Ifish/ESPTouch/task/ESPTouchResult.h index 2b38166..198a663 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchResult.h +++ b/Ifish/ESPTouch/task/ESPTouchResult.h @@ -2,8 +2,8 @@ // ESPTouchResult.h // EspTouchDemo // -// Created by 白 桦 on 4/14/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/14/15. +// Copyright (c) 2015 fby. All rights reserved. // #import @@ -31,4 +31,6 @@ */ - (id) initWithIsSuc: (BOOL) isSuc andBssid: (NSString *) bssid andInetAddrData: (NSData *) ipAddrData; +- (NSString *) getAddressString; + @end diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchResult.m b/Ifish/ESPTouch/task/ESPTouchResult.m old mode 100755 new mode 100644 similarity index 63% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchResult.m rename to Ifish/ESPTouch/task/ESPTouchResult.m index 33869f4..d1f6c52 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchResult.m +++ b/Ifish/ESPTouch/task/ESPTouchResult.m @@ -2,8 +2,8 @@ // ESPTouchResult.m // EspTouchDemo // -// Created by 白 桦 on 4/14/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/14/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESPTouchResult.h" @@ -24,9 +24,17 @@ return self; } +- (NSString *)getAddressString { + NSString *ipAddrDataStr = [ESP_NetUtil descriptionInetAddr4ByData:self.ipAddrData]; + if (ipAddrDataStr==nil) { + ipAddrDataStr = [ESP_NetUtil descriptionInetAddr6ByData:self.ipAddrData]; + } + return ipAddrDataStr; +} + - (NSString *)description { - NSString *ipAddrDataStr = [ESP_NetUtil descriptionInetAddrByData:self.ipAddrData]; + NSString *ipAddrDataStr = [self getAddressString]; return [[NSString alloc]initWithFormat:@"[isSuc: %@,isCancelled: %@,bssid: %@,inetAddress: %@]",self.isSuc? @"YES":@"NO", self.isCancelled? @"YES":@"NO" ,self.bssid diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTask.h b/Ifish/ESPTouch/task/ESPTouchTask.h old mode 100755 new mode 100644 similarity index 60% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTask.h rename to Ifish/ESPTouch/task/ESPTouchTask.h index d05f845..1f5125e --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTask.h +++ b/Ifish/ESPTouch/task/ESPTouchTask.h @@ -2,13 +2,16 @@ // ESPTouchTask.h // EspTouchDemo // -// Created by 白 桦 on 4/14/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/14/15. +// Copyright (c) 2015 fby. All rights reserved. // #import #import "ESPTouchResult.h" #import "ESPTouchDelegate.h" +#import "ESPAES.h" + +#define ESPTOUCH_VERSION @"SDK-v1.0.0" #define DEBUG_ON YES @@ -16,19 +19,7 @@ @property (atomic,assign) BOOL isCancelled; -/** - * Constructor of EsptouchTask - * - * @param apSsid - * the Ap's ssid - * @param apBssid - * the Ap's bssid - * @param apPassword - * the Ap's password - * @param isSsidHidden - * whether the Ap's ssid is hidden - */ -- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden; +- (id)initWithApSsid:(NSString *)apSsid andApBssid:(NSString *)apBssid andApPwd:(NSString *)apPwd andAES:(ESPAES *)aes; /** * Constructor of EsptouchTask @@ -37,21 +28,49 @@ * the Ap's ssid * @param apBssid * the Ap's bssid - * @param apPassword + * @param apPwd + * the Ap's password + */ +- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd; + +/** + * Deprecated + */ +- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden __deprecated_msg("Use initWithApSsid:(NSString *) andApBssid:(NSString *) andApPwd:(NSString *) instead."); + +/** + * Constructor of EsptouchTask + * + * @param apSsid + * the Ap's ssid + * @param apBssid + * the Ap's bssid + * @param apPwd + * the Ap's password + * @param timeoutMillisecond (it should be >= 15000+6000) + * millisecond of total timeout + */ +- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andTimeoutMillisecond: (int) timeoutMillisecond; + +/** + * Constructor of EsptouchTask + * + * @param apSsid + * the Ap's ssid + * @param apBssid + * the Ap's bssid + * @param apPwd * the Ap's password * @param isSsidHidden * whether the Ap's ssid is hidden - * @param timeoutMillisecond(it should be >= 15000+6000) - * millisecond of total timeout - * @param context - * the Context of the Application + * @param timeoutMillisecond (it should be >= 15000+6000) + * millisecond of total timeout */ -- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden andTimeoutMillisecond: (int) timeoutMillisecond; +- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden andTimeoutMillisecond: (int) timeoutMillisecond __deprecated_msg("Use initWithApSsid:(NSString *) andApBssid:(NSString *) andApPwd:(NSString *) andTimeoutMillisecond:(int) instead."); /** * Interrupt the Esptouch Task when User tap back or close the Application. */ - - (void) interrupt; /** @@ -88,4 +107,9 @@ */ - (void) setEsptouchDelegate: (NSObject *) esptouchDelegate; +/** + * Set boradcast or multicast when post config info + * @param broadcast YES is boradcast, NO is multicast + */ +- (void) setPackageBroadcast: (BOOL) broadcast; @end diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTask.m b/Ifish/ESPTouch/task/ESPTouchTask.m old mode 100755 new mode 100644 similarity index 81% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTask.m rename to Ifish/ESPTouch/task/ESPTouchTask.m index b4fb317..3091af7 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTask.m +++ b/Ifish/ESPTouch/task/ESPTouchTask.m @@ -2,8 +2,8 @@ // ESPTouchTask.m // EspTouchDemo // -// Created by 白 桦 on 4/14/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/14/15. +// Copyright (c) 2015 fby. All rights reserved. // // The usage of NSCondition refer to: https://gist.github.com/prachigauriar/8118909 @@ -16,16 +16,15 @@ #import "ESP_NetUtil.h" #import "ESPTouchTaskParameter.h" -#import "AppDelegate.h" #define ONE_DATA_LEN 3 @interface ESPTouchTask () -@property (nonatomic,strong) NSString *_apSsid; +@property (nonatomic,strong) NSData *_apSsid; -@property (nonatomic,strong) NSString *_apBssid; +@property (nonatomic,strong) NSData *_apBssid; -@property (nonatomic,strong) NSString *_apPwd; +@property (nonatomic,strong) NSData *_apPwd; @property (atomic,assign) BOOL _isSuc; @@ -55,15 +54,20 @@ @property (nonatomic,strong) id _esptouchDelegate; +@property (nonatomic,strong) NSData *_localInetAddrData; + @end @implementation ESPTouchTask -- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden +- (id)initWithApSsid:(NSString *)apSsid andApBssid:(NSString *)apBssid andApPwd:(NSString *)apPwd andAES:(ESPAES *)aes { + self = [super init]; + NSLog(@"Welcome Esptouch %@",ESPTOUCH_VERSION); if (apSsid==nil||[apSsid isEqualToString:@""]) { perror("ESPTouchTask initWithApSsid() apSsid shouldn't be null or empty"); + return self; } // the apSsid should be null or empty assert(apSsid!=nil&&![apSsid isEqualToString:@""]); @@ -72,26 +76,60 @@ apPwd = @""; } - self = [super init]; if (self) { if (DEBUG_ON) { NSLog(@"ESPTouchTask init"); } - self._apSsid = apSsid; - self._apPwd = apPwd; - self._apBssid = apBssid; + if (aes == nil) { + self._apSsid = [ESP_ByteUtil getBytesByNSString:apSsid]; + self._apPwd = [ESP_ByteUtil getBytesByNSString:apPwd]; + } else { + self._apSsid = [aes AES128EncryptData:[ESP_ByteUtil getBytesByNSString:apSsid]]; + self._apPwd = [aes AES128EncryptData:[ESP_ByteUtil getBytesByNSString:apPwd]]; + } + self._apBssid = [ESP_NetUtil parseBssid2bytes:apBssid]; self._parameter = [[ESPTaskParameter alloc]init]; + + // check whether IPv4 and IPv6 is supported + NSString *localInetAddr4 = [ESP_NetUtil getLocalIPv4]; + if (![ESP_NetUtil isIPv4PrivateAddr:localInetAddr4]) { + localInetAddr4 = nil; + } + NSString *localInetAddr6 = [ESP_NetUtil getLocalIPv6]; + [self._parameter setIsIPv4Supported:localInetAddr4!=nil]; + [self._parameter setIsIPv6Supported:localInetAddr6!=nil]; + + // create udp client and udp server self._client = [[ESPUDPSocketClient alloc]init]; self._server = [[ESPUDPSocketServer alloc]initWithPort: [self._parameter getPortListening] AndSocketTimeout: [self._parameter getWaitUdpTotalMillisecond]]; + // update listening port for IPv6 + [self._parameter setListeningPort6:self._server.port]; + if (DEBUG_ON) { + NSLog(@"ESPTouchTask app server port is %d",self._server.port); + } + + if (localInetAddr4!=nil) { + self._localInetAddrData = [ESP_NetUtil getLocalInetAddress4ByAddr:localInetAddr4]; + } else { + int localPort = [self._parameter getPortListening]; + self._localInetAddrData = [ESP_NetUtil getLocalInetAddress6ByPort:localPort]; + } + + if (DEBUG_ON) + { + // for ESPTouchGenerator only receive 4 bytes for local address no matter IPv4 or IPv6 + NSLog(@"ESPTouchTask executeForResult() localInetAddr: %@", [ESP_NetUtil descriptionInetAddr4ByData:self._localInetAddrData]); + } + self._isSuc = NO; self._isInterrupt = NO; self._isWakeUp = NO; self._isExecutedAlready = NO; self._condition = [[NSCondition alloc]init]; - self._isSsidHidden = isSsidHidden; + self._isSsidHidden = YES; self._esptouchResultArray = [[NSMutableArray alloc]init]; self._bssidTaskSucCountDict = [[NSMutableDictionary alloc]init]; self._esptouchResultArrayCondition = [[NSCondition alloc]init]; @@ -99,9 +137,18 @@ return self; } -- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden andTimeoutMillisecond: (int) timeoutMillisecond +- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd { + return [self initWithApSsid:apSsid andApBssid:apBssid andApPwd:apPwd andAES:nil]; +} + +- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden { - ESPTouchTask *_self = [self initWithApSsid:apSsid andApBssid:apBssid andApPwd:apPwd andIsSsidHiden:isSsidHidden]; + return [self initWithApSsid:apSsid andApBssid:apBssid andApPwd:apPwd]; +} + +- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andTimeoutMillisecond: (int) timeoutMillisecond +{ + ESPTouchTask *_self = [self initWithApSsid:apSsid andApBssid:apBssid andApPwd:apPwd]; if (_self) { [_self._parameter setWaitUdpTotalMillisecond:timeoutMillisecond]; @@ -109,6 +156,11 @@ return _self; } +- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden andTimeoutMillisecond: (int) timeoutMillisecond +{ + return [self initWithApSsid:apSsid andApBssid:apBssid andApPwd:apPwd andTimeoutMillisecond:timeoutMillisecond]; +} + - (void) __putEsptouchResultIsSuc: (BOOL) isSuc AndBssid: (NSString *)bssid AndInetAddr:(NSData *)inetAddr { [self._esptouchResultArrayCondition lock]; @@ -174,10 +226,8 @@ esptouchResult.isCancelled = self.isCancelled; [self._esptouchResultArray addObject:esptouchResult]; } - [self._esptouchResultArrayCondition unlock]; return self._esptouchResultArray; - } @@ -216,8 +266,8 @@ NSLog(@"ESPTouchTask __listenAsyn() start an asyn listen task, current thread is: %@", [NSThread currentThread]); } NSTimeInterval startTimestamp = [[NSDate date] timeIntervalSince1970]; - NSString *apSsidAndPwd = [NSString stringWithFormat:@"%@%@",self._apSsid,self._apPwd]; - Byte expectOneByte = [ESP_ByteUtil getBytesByNSString:apSsidAndPwd].length + 9; +// NSString *apSsidAndPwd = [NSString stringWithFormat:@"%@%@",self._apSsid,self._apPwd]; + Byte expectOneByte = [self._apSsid length] + [self._apPwd length] + 9; if (DEBUG_ON) { NSLog(@"ESPTouchTask __listenAsyn() expectOneByte: %d",expectOneByte); @@ -226,7 +276,11 @@ NSData *receiveData = nil; while ([self._esptouchResultArray count] < [self._parameter getExpectTaskResultCount] && !self._isInterrupt) { - receiveData = [self._server receiveSpecLenBytes:expectDataLen]; + if ([self._parameter isIPv4Supported]) { + receiveData = [self._server receiveSpecLenBytes4:expectDataLen]; + } else { + receiveData = [self._server receiveSpecLenBytes6:expectDataLen]; + } if (receiveData != nil) { [receiveData getBytes:&receiveOneByte length:1]; @@ -396,14 +450,9 @@ [self __checkTaskValid]; - NSData *localInetAddrData = [ESP_NetUtil getLocalInetAddress]; - if (DEBUG_ON) - { - NSLog(@"ESPTouchTask executeForResult() localInetAddr: %@", [ESP_NetUtil descriptionInetAddrByData:localInetAddrData]); - } // generator the esptouch byte[][] to be transformed, which will cost // some time(maybe a bit much) - ESPTouchGenerator *generator = [[ESPTouchGenerator alloc]initWithSsid:self._apSsid andApBssid:self._apBssid andApPassword:self._apPwd andInetAddrData:localInetAddrData andIsSsidHidden:self._isSsidHidden]; + ESPTouchGenerator *generator = [[ESPTouchGenerator alloc]initWithSsid:self._apSsid andApBssid:self._apBssid andApPassword:self._apPwd andInetAddrData:self._localInetAddrData andIsSsidHidden:self._isSsidHidden]; // listen the esptouch result asyn [self __listenAsyn:[self._parameter getEsptouchResultTotalLen]]; BOOL isSuc = NO; @@ -464,4 +513,8 @@ self._esptouchDelegate = esptouchDelegate; } +- (void)setPackageBroadcast:(BOOL)broadcast { + [self._parameter setBroadcast:broadcast]; +} + @end diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTaskParameter.h b/Ifish/ESPTouch/task/ESPTouchTaskParameter.h old mode 100755 new mode 100644 similarity index 81% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTaskParameter.h rename to Ifish/ESPTouch/task/ESPTouchTaskParameter.h index b868702..2647483 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTaskParameter.h +++ b/Ifish/ESPTouch/task/ESPTouchTaskParameter.h @@ -2,8 +2,8 @@ // ESPTaskParameter.h // EspTouchDemo // -// Created by 白 桦 on 5/20/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 5/20/15. +// Copyright (c) 2015 fby. All rights reserved. // #import @@ -136,4 +136,38 @@ */ - (void) setExpectTaskResultCount: (int) expectTaskResultCount; +/** + * get whether the router support IPv4 + * @return whether the router support IPv4 + */ +- (BOOL) isIPv4Supported; + +/** + * set whether the router support IPv4 + * @param isIPv4Supported whether the router support IPv4 + */ +- (void) setIsIPv4Supported:(BOOL) isIPv4Supported; + +/** + * get whether the router support IPv6 + * @return whether the router support IPv6 + */ +- (BOOL) isIPv6Supported; + +/** + * set whether the router support IPv6 + * @param isIPv6Supported whether the router support IPv6 + */ +- (void) setIsIPv6Supported:(BOOL) isIPv6Supported; + +/** + * set listening port for IPv6 + */ +- (void) setListeningPort6:(int) listeningPort6; + +/** + * Set broadcast or multicast + */ +- (void) setBroadcast:(BOOL) broadcast; + @end diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTaskParameter.m b/Ifish/ESPTouch/task/ESPTouchTaskParameter.m old mode 100755 new mode 100644 similarity index 59% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTaskParameter.m rename to Ifish/ESPTouch/task/ESPTouchTaskParameter.m index 09ff285..cab54f1 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPTouchTaskParameter.m +++ b/Ifish/ESPTouch/task/ESPTouchTaskParameter.m @@ -2,8 +2,8 @@ // ESPTaskParameter.m // EspTouchDemo // -// Created by 白 桦 on 5/20/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 5/20/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESPTouchTaskParameter.h" @@ -17,14 +17,21 @@ @property (nonatomic,assign) int totalRepeatTime; @property (nonatomic,assign) int esptouchResultOneLen; @property (nonatomic,assign) int esptouchResultMacLen; -@property (nonatomic,assign) int esptouchResultIpLen; -@property (nonatomic,assign) int esptouchResultTotalLen; -@property (nonatomic,assign) int portListening; -@property (nonatomic,assign) int targetPort; +@property (nonatomic,assign) int esptouchResultIpLen4; +@property (nonatomic,assign) int esptouchResultIpLen6; +@property (nonatomic,assign) int esptouchResultTotalLen4; +@property (nonatomic,assign) int esptouchResultTotalLen6; +@property (nonatomic,assign) int portListening4; +@property (nonatomic,assign) int portListening6; +@property (nonatomic,assign) int targetPort4; +@property (nonatomic,assign) int targetPort6; @property (nonatomic,assign) int waitUdpReceivingMillisecond; @property (nonatomic,assign) int waitUdpSendingMillisecond; @property (nonatomic,assign) int thresholdSucBroadcastCount; @property (nonatomic,assign) int expectTaskResultCount; +@property (nonatomic,assign) BOOL isIPv4Supported0; +@property (nonatomic,assign) BOOL isIPv6Supported0; +@property (nonatomic,assign) BOOL broadcast; @end @implementation ESPTaskParameter @@ -35,22 +42,28 @@ static int _datagramCount = 0; { self = [super init]; if (self) { - self.intervalGuideCodeMillisecond = 10; - self.intervalDataCodeMillisecond = 10; + self.intervalGuideCodeMillisecond = 8; + self.intervalDataCodeMillisecond = 8; self.timeoutGuideCodeMillisecond = 2000; self.timeoutDataCodeMillisecond = 4000; self.timeoutTotalCodeMillisecond = 2000 + 4000; self.totalRepeatTime = 1; self.esptouchResultOneLen = 1; self.esptouchResultMacLen = 6; - self.esptouchResultIpLen = 4; - self.esptouchResultTotalLen = 1 + 6 + 4; - self.portListening = 18266; - self.targetPort = 7001; + self.esptouchResultIpLen4 = 4; + self.esptouchResultIpLen6 = 16; + self.esptouchResultTotalLen4 = 1 + 6 + 4; + self.esptouchResultTotalLen6 = 1 + 6 + 16; + self.portListening4 = 18266; + self.portListening6 = 0; + self.targetPort4 = 7001; + self.targetPort6 = 7001; self.waitUdpReceivingMillisecond = 15000; self.waitUdpSendingMillisecond = 45000; self.thresholdSucBroadcastCount = 1; self.expectTaskResultCount = 1; + self.isIPv4Supported0 = YES; + self.isIPv6Supported0 = YES; } return self; } @@ -105,30 +118,52 @@ static int _datagramCount = 0; - (int) getEsptouchResultIpLen { - return self.esptouchResultIpLen; + return _isIPv4Supported0 ? _esptouchResultIpLen4 : _esptouchResultIpLen6; } - (int) getEsptouchResultTotalLen { - return self.esptouchResultTotalLen; + if (_isIPv4Supported0) { + return _esptouchResultTotalLen4; + } else { + return _esptouchResultTotalLen6; + } + } - (int) getPortListening { - return self.portListening; + if (_isIPv4Supported0) { + return _portListening4; + } else { + return _portListening6; + } } -// target hostname is : 234.1.1.1, 234.2.2.2, 234.3.3.3 to 234.100.100.100 +// target hostname is : 234.1.1.1, 234.2.2.2, 234.3.3.3 to 234.100.100.100 for IPv4 +// target hostname is : ff02::1 for IPv6 - (NSString *) getTargetHostname { - int count = [self __getNextDatagramCount]; - return [NSString stringWithFormat: @"234.%d.%d.%d", count, count, count]; + if (_isIPv4Supported0) { + if (self.broadcast) { + return @"255.255.255.255"; + } else { + int count = [self __getNextDatagramCount]; + return [NSString stringWithFormat: @"234.%d.%d.%d", count, count, count]; + } + } else { + return @"ff02::1%en0"; + } } - (int) getTargetPort { - return self.targetPort; + if (_isIPv4Supported0) { + return _targetPort4; + } else { + return _targetPort6; + } } - (int) getWaitUdpReceivingMillisecond @@ -171,4 +206,34 @@ static int _datagramCount = 0; { _expectTaskResultCount = expectTaskResultCount; } + +- (BOOL) isIPv4Supported +{ + return _isIPv4Supported0; +} + +- (void) setIsIPv4Supported:(BOOL) isIPv4Supported +{ + _isIPv4Supported0 = isIPv4Supported; +} + +- (BOOL) isIPv6Supported +{ + return _isIPv6Supported0; +} + +- (void) setIsIPv6Supported:(BOOL) isIPv6Supported +{ + _isIPv6Supported0 = isIPv6Supported; +} + +- (void) setListeningPort6:(int) listeningPort6 +{ + _portListening6 = listeningPort6; +} + +- (void)setBroadcast:(BOOL)broadcast { + _broadcast = broadcast; +} + @end diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketClient.h b/Ifish/ESPTouch/udp/ESPUDPSocketClient.h old mode 100755 new mode 100644 similarity index 84% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketClient.h rename to Ifish/ESPTouch/udp/ESPUDPSocketClient.h index 40a553e..ebe08ca --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketClient.h +++ b/Ifish/ESPTouch/udp/ESPUDPSocketClient.h @@ -2,8 +2,8 @@ // ESPUDPSocketClient.h // EspTouchDemo // -// Created by 白 桦 on 4/13/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/13/15. +// Copyright (c) 2015 fby. All rights reserved. // #import @@ -17,11 +17,11 @@ /** * send the data by UDP * - * @param bytes + * @param bytesArray2 * the array of datas to be sent - * @param targetHost + * @param targetHostName * the host name of target, e.g. 192.168.1.101 - * @param targetPort + * @param port * the port of target * @param interval * the milliseconds to between each UDP sent @@ -32,15 +32,15 @@ /** * send the data by UDP * - * @param data + * @param bytesArray2 * the data to be sent * @param offset * the offset which data to be sent * @param count * the count of the data - * @param targetHost + * @param targetHostName * the host name of target, e.g. 192.168.1.101 - * @param targetPort + * @param port * the port of target * @param interval * the milliseconds to between each UDP sent diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketClient.m b/Ifish/ESPTouch/udp/ESPUDPSocketClient.m old mode 100755 new mode 100644 similarity index 50% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketClient.m rename to Ifish/ESPTouch/udp/ESPUDPSocketClient.m index 850397c..f42f481 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketClient.m +++ b/Ifish/ESPTouch/udp/ESPUDPSocketClient.m @@ -2,19 +2,24 @@ // ESPUDPSocketClient.m // EspTouchDemo // -// Created by 白 桦 on 4/13/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/13/15. +// Copyright (c) 2015 fby. All rights reserved. // #import "ESPUDPSocketClient.h" #include #include #include +#import #include "ESPTouchTask.h" +#import "ESP_NetUtil.h" + +#define SOCKET_NULL -1 @interface ESPUDPSocketClient () -@property(nonatomic, assign) int _sck_fd; +@property(nonatomic, assign) int _sck_fd4; +@property(nonatomic, assign) int _sck_fd6; @property(nonatomic, assign) BOOL _isStop; // it is used to check whether the socket is closed already to prevent close more than once. // especially, when you close the socket second time, it is created just now, it will crash. @@ -45,16 +50,31 @@ if (self) { self._isStop = NO; - self._sck_fd = socket(AF_INET,SOCK_DGRAM,0); + self._sck_fd4 = SOCKET_NULL; + self._sck_fd6 = SOCKET_NULL; + self._sck_fd4 = socket(AF_INET,SOCK_DGRAM,0); if (DEBUG_ON) { - NSLog(@"##########################client init() _sck_fd=%d",self._sck_fd); + NSLog(@"##########################client init() _sck_fd4=%d",self._sck_fd4); } - if (self._sck_fd < 0) + if (self._sck_fd4 < 0) { if (DEBUG_ON) { - perror("client: init() _skd_fd init fail\n"); + perror("client: init() _skd_fd4 init fail\n"); + } + return nil; + } + self._sck_fd6 = socket(AF_INET6,SOCK_DGRAM,0); + if (DEBUG_ON) + { + NSLog(@"##########################client init() _sck_fd6=%d",self._sck_fd6); + } + if (self._sck_fd6 < 0) + { + if (DEBUG_ON) + { + perror("client: init() _skd_fd6 init fail\n"); } return nil; } @@ -77,11 +97,22 @@ [self._lock lock]; if (!self._isClosed) { - if (DEBUG_ON) - { - NSLog(@"###################client close() fd=%d",self._sck_fd); + if (self._sck_fd4!=SOCKET_NULL) { + if (DEBUG_ON) + { + NSLog(@"###################client close() fd4=%d",self._sck_fd4); + } + close(self._sck_fd4); + self._sck_fd4 = SOCKET_NULL; + } + if (self._sck_fd6!=SOCKET_NULL) { + if (DEBUG_ON) + { + NSLog(@"###################client close() fd6=%d",self._sck_fd6); + } + close(self._sck_fd6); + self._sck_fd6 = SOCKET_NULL; } - close(self._sck_fd); self._isClosed = YES; } [self._lock unlock]; @@ -98,19 +129,9 @@ return [self sendDataWithBytesArray2:bytesArray2 Offset:0 Count:[bytesArray2 count] ToTargetHostName:targetHostName WithPort:port andInterval:interval]; } -- (void) sendDataWithBytesArray2: (NSArray *) bytesArray2 Offset: (NSUInteger) offset Count: (NSUInteger) count ToTargetHostName: (NSString *)targetHostName WithPort: (int) port +- (void) sendDataWithBytesArray2Ipv4: (NSArray *) bytesArray2 Offset: (NSUInteger) offset Count: (NSUInteger) count ToTargetHostName: (NSString *)targetHostName WithPort: (int) port andInterval: (long) interval { - // check data is valid - if (nil == bytesArray2 || 0 == [bytesArray2 count]) - { - if (DEBUG_ON) - { - perror("client: data is null or data's length equals 0, so sendData fail\n"); - } - [self close]; - return; - } // init socket parameters bool isBroadcast = [targetHostName isEqualToString:@"255.255.255.255"]; socklen_t addr_len; @@ -123,7 +144,7 @@ if (isBroadcast) { const int opt = 1; // set whether the socket is broadcast or not - if (setsockopt(self._sck_fd,SOL_SOCKET,SO_BROADCAST,(char *)&opt, sizeof(opt)) < 0) + if (setsockopt(self._sck_fd4,SOL_SOCKET,SO_BROADCAST,(char *)&opt, sizeof(opt)) < 0) { if (DEBUG_ON) { @@ -145,7 +166,7 @@ Byte bytes[dataLen]; [data getBytes:bytes length:dataLen]; // send data - if (sendto(self._sck_fd, bytes, dataLen, 0, (struct sockaddr*)&target_addr, addr_len) < 0) + if (sendto(self._sck_fd4, bytes, dataLen, 0, (struct sockaddr*)&target_addr, addr_len) < 0) { if (DEBUG_ON) { @@ -163,4 +184,81 @@ } } +- (void) sendDataWithBytesArray2Ipv6: (NSArray *) bytesArray2 Offset: (NSUInteger) offset Count: (NSUInteger) count ToTargetHostName: (NSString *)targetHostName WithPort: (int) port + andInterval: (long) interval +{ + // init socket parameters + socklen_t addr_len; + struct sockaddr_in6 target_addr6; + memset(&target_addr6, 0, sizeof(target_addr6)); + target_addr6.sin6_family = AF_INET6; + target_addr6.sin6_port = htons(port); + addr_len = sizeof(target_addr6); + + NSString *portStr = [NSString stringWithFormat:@"%hu",(uint16_t)port]; + struct addrinfo *res0,hints; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_INET6; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_protocol = IPPROTO_UDP; + + int gai_error = getaddrinfo([targetHostName UTF8String], [portStr UTF8String], &hints, &res0); + if (gai_error) { + perror("client: gai_error, stop"); + return; + } + NSData *dstData = [NSData dataWithBytes:res0->ai_addr length:res0->ai_addrlen]; + const void *dst = [dstData bytes]; + socklen_t dstSize = addr_len; + + // send data gotten from the array + for (NSUInteger i = offset; !self._isStop && i < offset + count; i++) { + // get data + NSData* data = [bytesArray2 objectAtIndex:i]; + NSUInteger dataLen = [data length]; + if (0 == dataLen) + { + continue; + } + Byte bytes[dataLen]; + [data getBytes:bytes length:dataLen]; + // send data + if (sendto(self._sck_fd6, bytes, dataLen, 0, dst, dstSize) < 0) + { + if (DEBUG_ON) + { + perror("client: sendto fail, but just ignore it\n"); + } + // for the Ap will make some troubles when the phone send too many UDP packets, + // but we don't expect the UDP packet received by others, so just ignore it + } + // sleep interval + usleep((useconds_t)(interval*1000)); + } + // check whether the client is stop + if (self._isStop) { + [self close]; + } +} + +- (void) sendDataWithBytesArray2: (NSArray *) bytesArray2 Offset: (NSUInteger) offset Count: (NSUInteger) count ToTargetHostName: (NSString *)targetHostName WithPort: (int) port + andInterval: (long) interval +{ + // check data is valid + if (nil == bytesArray2 || 0 == [bytesArray2 count]) + { + if (DEBUG_ON) + { + perror("client: data is null or data's length equals 0, so sendData fail\n"); + } + [self close]; + return; + } + if ([ESP_NetUtil isIPv4Addr:targetHostName]) { + [self sendDataWithBytesArray2Ipv4:bytesArray2 Offset:offset Count:count ToTargetHostName:targetHostName WithPort:port andInterval:interval]; + } else { + [self sendDataWithBytesArray2Ipv6:bytesArray2 Offset:offset Count:count ToTargetHostName:targetHostName WithPort:port andInterval:interval]; + } +} + @end diff --git a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketServer.h b/Ifish/ESPTouch/udp/ESPUDPSocketServer.h old mode 100755 new mode 100644 similarity index 70% rename from Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketServer.h rename to Ifish/ESPTouch/udp/ESPUDPSocketServer.h index e4ea5e2..f24a055 --- a/Ifish/ESPTouch/ESPTouAPI/Esptouchtask/ESPUDPSocketServer.h +++ b/Ifish/ESPTouch/udp/ESPUDPSocketServer.h @@ -2,8 +2,8 @@ // ESPUDPSocketServer.h // EspTouchDemo // -// Created by 白 桦 on 4/13/15. -// Copyright (c) 2015 白 桦. All rights reserved. +// Created by fby on 4/13/15. +// Copyright (c) 2015 fby. All rights reserved. // #import @@ -16,6 +16,8 @@ Byte _buffer[BUFFER_SIZE]; } +@property (nonatomic, assign) int port; + - (void) close; - (void) interrupt; @@ -25,7 +27,6 @@ * * @param timeout * the timeout in milliseconds or 0 for no timeout. - * @return true whether the timeout is set suc */ - (void) setSocketTimeout: (int) timeout; @@ -34,9 +35,13 @@ * * @return one byte receive from the port or UINT8_MAX(it impossible receive it from the socket) */ -- (Byte) receiveOneByte; +- (Byte) receiveOneByte4; -- (NSData *) receiveSpecLenBytes: (int)len; +- (NSData *) receiveSpecLenBytes4: (int)len; + +- (Byte) receiveOneByte6; + +- (NSData *) receiveSpecLenBytes6:(int)len; - (id) initWithPort: (int) port AndSocketTimeout: (int) socketTimeout; diff --git a/Ifish/ESPTouch/udp/ESPUDPSocketServer.m b/Ifish/ESPTouch/udp/ESPUDPSocketServer.m new file mode 100644 index 0000000..b0a1c32 --- /dev/null +++ b/Ifish/ESPTouch/udp/ESPUDPSocketServer.m @@ -0,0 +1,379 @@ +// +// ESPUDPSocketServer.m +// EspTouchDemo +// +// Created by fby on 4/13/15. +// Copyright (c) 2015 fby. All rights reserved. +// + +#import "ESPUDPSocketServer.h" +#include +#include +#include +#include +#include "ESPTouchTask.h" + +#define SOCKET_NULL -1 + +@interface ESPUDPSocketServer () + +@property(nonatomic,assign) int _sck_fd4; +@property(nonatomic,assign) int _sck_fd6; + +// it is used to check whether the socket is closed already to prevent close more than once. +// especially, when you close the socket second time, it is created just now, it will crash. +// +// // suppose fd1 = 4, fd1 belong to obj1 +// e.g. int fd1 = socket(AF_INET,SOCK_DRAM,0); +// close(fd1); +// +// // suppose fd2 = 4 as well, fd2 belong to obj2 +// int fd2 = socket(AF_INET,SOCK_DRAM,0); +// +// // obj1's dealloc() is called by system, so +// close(fd1); +// +// // Amazing!!! at the moment, fd2 is close by others +// +@property(nonatomic,assign) volatile bool _isClosed; +// it is used to lock the close method +@property(nonatomic,strong) volatile NSLock *_lock; + +@end + +@implementation ESPUDPSocketServer + +- (BOOL) initWithPort4: (int) port AndSocketTimeout: (int) socketTimeout +{ + self._sck_fd4 = socket(AF_INET,SOCK_DGRAM,0); + if (DEBUG_ON) + { + NSLog(@"##########################server init(): _sck_fd4=%d", self._sck_fd4); + } + if (self._sck_fd4 < 0) + { + if (DEBUG_ON) + { + perror("server: _skd_fd4 init() fail\n"); + } + return NO; + } + // init socket4 params + struct sockaddr_in server_addr; + socklen_t addr_len; + memset(&server_addr, 0, sizeof(server_addr)); + server_addr.sin_family = AF_INET; + server_addr.sin_port = htons(port); + server_addr.sin_addr.s_addr = INADDR_ANY; + addr_len = sizeof(server_addr); + // set broadcast + const int opt = 1; + if (setsockopt(self._sck_fd4,SOL_SOCKET,SO_BROADCAST,(char *)&opt, sizeof(opt)) < 0) + { + if (DEBUG_ON) + { + perror("server init() sck4: setsockopt SO_BROADCAST fail\n"); + } + [self close]; + return NO; + } + // set socket timeout + if (![self setSocketTimeout:socketTimeout SocketFd:self._sck_fd4]) { + if (DEBUG_ON) { + perror("server: sck4: setsockopt SO_RCVTIMEO fail\n"); + } + [self close]; + return NO; + } + // set SO_REUSEADDR for ipv4 + if (setsockopt(self._sck_fd4, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt))< 0) { + if (DEBUG_ON) + { + perror("server init() sck4: setsockopt SO_REUSEADDR fail\n"); + } + [self close]; + return NO; + } + // bind for ipv4 + if (bind(self._sck_fd4, (struct sockaddr*)&server_addr, addr_len) < 0) + { + if (DEBUG_ON) + { + perror("server init() sck4: bind fail\n"); + } + [self close]; + return NO; + } + + return YES; +} + +- (BOOL) initWithPort6: (int) port AndSocketTimeout: (int) socketTimeout +{ + self._sck_fd6 = socket(AF_INET6,SOCK_DGRAM,0); + if (DEBUG_ON) + { + NSLog(@"##########################server init(): _sck_fd6=%d", self._sck_fd6); + } + if (self._sck_fd6 < 0) + { + if (DEBUG_ON) + { + perror("server: _skd_fd6 init() fail\n"); + } + return NO; + } + // init socket6 params + struct sockaddr_in6 server_addr6; + socklen_t addr6_len = sizeof(server_addr6); + memset(&server_addr6, 0, addr6_len); + server_addr6.sin6_family = AF_INET6; + server_addr6.sin6_port = htons(port); + server_addr6.sin6_addr = in6addr_any; + // set socket timeout + if (![self setSocketTimeout:socketTimeout SocketFd:self._sck_fd6]) { + if (DEBUG_ON) { + perror("server: sck4: setsockopt SO_RCVTIMEO fail\n"); + } + [self close]; + return NO; + } + // set SO_REUSEADDR for ipv6 + const int opt = 1; + if (setsockopt(self._sck_fd6, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt))< 0) { + if (DEBUG_ON) + { + perror("server init() sck6: setsockopt SO_REUSEADDR fail\n"); + } + [self close]; + return NO; + } + // bind for ipv6 + if (bind(self._sck_fd6, (struct sockaddr*)&server_addr6, addr6_len) < 0) + { + if (DEBUG_ON) + { + perror("server init() sck6: bind fail\n"); + } + [self close]; + return NO; + } + + return YES; +} + +- (id) initWithPort:(int)port AndSocketTimeout:(int)socketTimeout +{ + self = [super init]; + if (self) { + // create lock + self._lock = [[NSLock alloc]init]; + // init + self._isClosed = NO; + self._sck_fd4 = SOCKET_NULL; + self._sck_fd6 = SOCKET_NULL; + // init sck4 + if (![self initWithPort4:port AndSocketTimeout:socketTimeout]) { + if (DEBUG_ON) { + NSLog(@"fail to init socket for ipv4"); + } + return nil; + } + if (port==0) { + struct sockaddr_in local_addr; + socklen_t len = sizeof(local_addr); + if (getsockname(self._sck_fd4, (struct sockaddr *)&local_addr, &len)==0) { + port = ntohs(local_addr.sin_port); + } + else { + if (DEBUG_ON) { + NSLog(@"fail to get socket port for ipv4"); + } + [self close]; + return nil; + } + } + _port = port; + // init sck6 + if (![self initWithPort6:port AndSocketTimeout:socketTimeout]) { + if (DEBUG_ON) { + NSLog(@"fail to init socket for ipv6"); + } + return nil; + } + } + return self; +} + +// make sure the socket will be closed sometime +- (void)dealloc +{ + if (DEBUG_ON) + { + NSLog(@"###################server dealloc()"); + } + [self close]; +} + +- (void) close +{ + [self._lock lock]; + if (!self._isClosed) + { + if (self._sck_fd4!=SOCKET_NULL) { + if (DEBUG_ON) + { + NSLog(@"###################server close() fd4=%d",self._sck_fd4); + } + close(self._sck_fd4); + self._sck_fd4 = SOCKET_NULL; + } + if (self._sck_fd6!=SOCKET_NULL) { + if (DEBUG_ON) + { + NSLog(@"###################server close() fd6=%d",self._sck_fd6); + } + close(self._sck_fd6); + self._sck_fd6 = SOCKET_NULL; + } + self._isClosed = true; + } + [self._lock unlock]; +} + +- (void) interrupt +{ + [self close]; +} + +- (BOOL) setSocketTimeout: (int) timeout SocketFd:(int) socketFd +{ + struct timeval tv; + tv.tv_sec = timeout/1000; + tv.tv_usec = timeout%1000*1000; + if (setsockopt(socketFd,SOL_SOCKET,SO_RCVTIMEO,(char *)&tv, sizeof(tv)) < 0) + { + if (DEBUG_ON) + { + perror("server: setsockopt SO_RCVTIMEO fail\n"); + } + return NO; + } else { + return YES; + } +} + +- (void) setSocketTimeout:(int)timeout +{ + [self setSocketTimeout:timeout SocketFd:self._sck_fd4]; + [self setSocketTimeout:timeout SocketFd:self._sck_fd6]; +} + +- (Byte) receiveOneByte4 +{ + ssize_t recNumber = recv(self._sck_fd4, _buffer, BUFFER_SIZE, 0); + if (recNumber > 0) + { + return _buffer[0]; + } + else if(recNumber == 0) + { + if (DEBUG_ON) + { + perror("server: receiveOneByte4 socket is closed by the other\n"); + } + } + else + { + if (DEBUG_ON) + { + perror("server: receiveOneByte4 fail\n"); + } + } + return UINT8_MAX; +} + +- (Byte) receiveOneByte6 +{ + ssize_t recNumber = recv(self._sck_fd6, _buffer, BUFFER_SIZE, 0); + if (recNumber > 0) + { + return _buffer[0]; + } + else if(recNumber == 0) + { + if (DEBUG_ON) + { + perror("server: receiveOneByte6 socket is closed by the other\n"); + } + } + else + { + if (DEBUG_ON) + { + perror("server: receiveOneByte6 fail\n"); + } + } + return UINT8_MAX; +} + +- (NSData *) receiveSpecLenBytes4: (int)len +{ + ssize_t recNumber = recv(self._sck_fd4, _buffer, BUFFER_SIZE, 0); + if (recNumber==len) + { + NSData *data = [[NSData alloc]initWithBytes:_buffer length:recNumber]; + return data; + } + else if(recNumber==0) + { + if (DEBUG_ON) + { + perror("server: receiveOneByte4 socket is closed by the other\n"); + } + } + else if(recNumber<0) + { + if (DEBUG_ON) + { + perror("server: receiveOneByte4 fail\n"); + } + } + else + { + // receive rubbish message, just ignore it + } + return nil; +} + +- (NSData *) receiveSpecLenBytes6:(int)len +{ + ssize_t recNumber = recv(self._sck_fd6, _buffer, BUFFER_SIZE, 0); + if (recNumber==len) + { + NSData *data = [[NSData alloc]initWithBytes:_buffer length:recNumber]; + return data; + } + else if(recNumber==0) + { + if (DEBUG_ON) + { + perror("server: receiveOneByte6 socket is closed by the other\n"); + } + } + else if(recNumber<0) + { + if (DEBUG_ON) + { + perror("server: receiveOneByte6 fail\n"); + } + } + else + { + // receive rubbish message, just ignore it + } + return nil; + +} + +@end diff --git a/Ifish/Info.plist b/Ifish/Info.plist index f9fa328..13206fc 100644 --- a/Ifish/Info.plist +++ b/Ifish/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 5.1.4 + 5.1.5 CFBundleSignature ???? CFBundleURLTypes @@ -70,7 +70,7 @@ CFBundleVersion - 19 + $(CURRENT_PROJECT_VERSION) ITSAppUsesNonExemptEncryption LSApplicationCategoryType @@ -405,6 +405,8 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIUserInterfaceStyle + Light UIViewControllerBasedStatusBarAppearance diff --git a/Ifish/Utinitys/DataCenter/DataCenter.h b/Ifish/Utinitys/DataCenter/DataCenter.h index 0f7c117..40cd180 100644 --- a/Ifish/Utinitys/DataCenter/DataCenter.h +++ b/Ifish/Utinitys/DataCenter/DataCenter.h @@ -7,7 +7,7 @@ // #import - +#import "EGOCache.h" @interface DataCenter : NSObject @@ -16,6 +16,8 @@ -(void)setValue:(id)value forKey:(NSString*)key; // 获取数据 -(id)valueForKey:(NSString*)key; +@property (nonatomic, strong) EGOCache *cache; +-(void)cacheinit:(NSString*)useid; @end diff --git a/Ifish/Utinitys/DataCenter/DataCenter.m b/Ifish/Utinitys/DataCenter/DataCenter.m index 6cedba3..8201c3c 100644 --- a/Ifish/Utinitys/DataCenter/DataCenter.m +++ b/Ifish/Utinitys/DataCenter/DataCenter.m @@ -44,9 +44,16 @@ _dict=[[NSMutableDictionary alloc]init]; } + } return self; } +-(void)cacheinit:(NSString*)useid +{ +NSArray*arr=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + self.cache = [[EGOCache alloc] initWithCacheDirectory:[arr.firstObject stringByAppendingPathComponent:[NSString stringWithFormat:@"ifish/%@",[CommonUtils getNotNilStr:useid]]]]; +[self.cache setDefaultTimeoutInterval:864000000]; +} //根据文件名 获取指定文件名的在沙盒Documents的 全路径 -(NSString*)getFullFilePathWithName:(NSString *)name{ //方法1 diff --git a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.h b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.h index c95da98..f6e2ca4 100644 --- a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.h +++ b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.h @@ -57,5 +57,6 @@ //新绚多 +(void)saveNewXuToControlName:(XuToControlName *)nameModel; +(XuToControlName *)currentNewXuToControlName:(NSString *)macaddress; ++(XuToControlName *)currentPetsXuToControlName:(NSString *)macaddress; @end diff --git a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m index 5812577..8fac588 100644 --- a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m +++ b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m @@ -241,6 +241,26 @@ return controlName; } ++(XuToControlName *)currentPetsXuToControlName:(NSString *)macaddress +{ + NSString *key = [NSString stringWithFormat:@"newXuTo%@",macaddress]; + NSString *file = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:key]; + XuToControlName *controlName = [NSKeyedUnarchiver unarchiveObjectWithFile:file]; + if (!controlName||[controlName isKindOfClass:[NSNull class]]) { + controlName = [[XuToControlName alloc] init]; + controlName.shajunLight = @"杀菌灯"; + controlName.zengyangPump = @"换气"; + controlName.light1 = @"杀菌"; + controlName.light2 = @"恒温"; + controlName.zaolangPump = @"造浪泵"; + controlName.huLiDeng = @"护理灯"; + controlName.xunhuanPump = @"照明"; + controlName.jiaRe = @"加热棒"; + controlName.macAddress = macaddress; + } + return controlName; + +} diff --git a/Ifish/Utinitys/Define.h b/Ifish/Utinitys/Define.h index 479295b..3a532ab 100644 --- a/Ifish/Utinitys/Define.h +++ b/Ifish/Utinitys/Define.h @@ -220,7 +220,7 @@ alpha:1.0] #define kShareDevice [NSString stringWithFormat:@"app.ifish7.com/api/user/shareDevice.do",JIEKOUPORT] // 扫一扫分享设备 已最新 -#define kshareDeviceByQrCode [NSString stringWithFormat:@"%@/api/users/sharingDevice/",JIEKOUPORT] +#define kshareDeviceByQrCode [NSString stringWithFormat:@"%@/api/user/shareDeviceByQrCode.do",JIEKOUPORT] // 解除分享的设备 #define kdeleteShareDevice [NSString stringWithFormat:@"%@/api/user/deleteShareDevice.do",JIEKOUPORT] diff --git a/Ifish/Utinitys/EGOCache/EGOCache.h b/Ifish/Utinitys/EGOCache/EGOCache.h new file mode 100755 index 0000000..ab84607 --- /dev/null +++ b/Ifish/Utinitys/EGOCache/EGOCache.h @@ -0,0 +1,96 @@ +// +// EGOCache.h +// enormego +// +// Created by Shaun Harrison. +// Copyright (c) 2009-2017 enormego. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import + +#if TARGET_OS_IPHONE + #import +#endif + +#if TARGET_OS_OSX + #import +#endif + +//! Project version number for EGOCache. +FOUNDATION_EXPORT double EGOCacheVersionNumber; + +//! Project version string for EGOCache. +FOUNDATION_EXPORT const unsigned char EGOCacheVersionString[]; + +#if !__has_feature(nullability) +# define nullable +# define nonnull +# define __nullable +# define __nonnull +#endif + +@interface EGOCache : NSObject + +// Global cache for easy use ++ (nonnull instancetype)globalCache; + +// Opitionally create a different EGOCache instance with it's own cache directory +- (nonnull instancetype)initWithCacheDirectory:(NSString* __nonnull)cacheDirectory; + +- (void)clearCache; +- (void)removeCacheForKey:(NSString* __nonnull)key; + +- (BOOL)hasCacheForKey:(NSString* __nonnull)key; + +- (NSData* __nullable)dataForKey:(NSString* __nonnull)key; +- (void)setData:(NSData* __nonnull)data forKey:(NSString* __nonnull)key; +- (void)setData:(NSData* __nonnull)data forKey:(NSString* __nonnull)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; + +- (NSString* __nullable)stringForKey:(NSString* __nonnull)key; +- (void)setString:(NSString* __nonnull)aString forKey:(NSString* __nonnull)key; +- (void)setString:(NSString* __nonnull)aString forKey:(NSString* __nonnull)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; + +- (NSDate* __nullable)dateForKey:(NSString* __nonnull)key; +- (NSArray* __nonnull)allKeys; + +#if TARGET_OS_IPHONE +- (UIImage* __nullable)imageForKey:(NSString* __nonnull)key; +- (void)setImage:(UIImage* __nonnull)anImage forKey:(NSString* __nonnull)key; +- (void)setImage:(UIImage* __nonnull)anImage forKey:(NSString* __nonnull)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; +#else +- (NSImage* __nullable)imageForKey:(NSString* __nonnull)key; +- (void)setImage:(NSImage* __nonnull)anImage forKey:(NSString* __nonnull)key; +- (void)setImage:(NSImage* __nonnull)anImage forKey:(NSString* __nonnull)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; +#endif + +- (NSData* __nullable)plistForKey:(NSString* __nonnull)key; +- (void)setPlist:(nonnull id)plistObject forKey:(NSString* __nonnull)key; +- (void)setPlist:(nonnull id)plistObject forKey:(NSString* __nonnull)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; + +- (void)copyFilePath:(NSString* __nonnull)filePath asKey:(NSString* __nonnull)key; +- (void)copyFilePath:(NSString* __nonnull)filePath asKey:(NSString* __nonnull)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; + +- (nullable id)objectForKey:(NSString* __nonnull)key; +- (void)setObject:(nonnull id)anObject forKey:(NSString* __nonnull)key; +- (void)setObject:(nonnull id)anObject forKey:(NSString* __nonnull)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; + +@property(nonatomic) NSTimeInterval defaultTimeoutInterval; // Default is 1 day +@end diff --git a/Ifish/Utinitys/EGOCache/EGOCache.m b/Ifish/Utinitys/EGOCache/EGOCache.m new file mode 100755 index 0000000..de8abda --- /dev/null +++ b/Ifish/Utinitys/EGOCache/EGOCache.m @@ -0,0 +1,368 @@ +// +// EGOCache.m +// enormego +// +// Created by Shaun Harrison. +// Copyright (c) 2009-2017 enormego. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import "EGOCache.h" + +#if DEBUG +# define CHECK_FOR_EGOCACHE_PLIST() if([key isEqualToString:@"EGOCache.plist"]) { \ + NSLog(@"EGOCache.plist is a reserved key and can not be modified."); \ + return; } +#else +# define CHECK_FOR_EGOCACHE_PLIST() if([key isEqualToString:@"EGOCache.plist"]) return; +#endif + +static inline NSString* cachePathForKey(NSString* directory, NSString* key) { + key = [key stringByReplacingOccurrencesOfString:@"/" withString:@"_"]; + return [directory stringByAppendingPathComponent:key]; +} + +#pragma mark - + +@interface EGOCache () { + dispatch_queue_t _cacheInfoQueue; + dispatch_queue_t _frozenCacheInfoQueue; + dispatch_queue_t _diskQueue; + NSMutableDictionary* _cacheInfo; + NSString* _directory; + BOOL _needsSave; +} + +@property(nonatomic,copy) NSDictionary* frozenCacheInfo; +@end + +@implementation EGOCache + ++ (instancetype)globalCache { + static id instance; + + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + instance = [[[self class] alloc] init]; + }); + + return instance; +} + +- (instancetype)init { + NSString* cachesDirectory = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0]; + NSString* oldCachesDirectory = [[[cachesDirectory stringByAppendingPathComponent:[[NSProcessInfo processInfo] processName]] stringByAppendingPathComponent:@"EGOCache"] copy]; + + if([[NSFileManager defaultManager] fileExistsAtPath:oldCachesDirectory]) { + [[NSFileManager defaultManager] removeItemAtPath:oldCachesDirectory error:NULL]; + } + + cachesDirectory = [[[cachesDirectory stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]] stringByAppendingPathComponent:@"EGOCache"] copy]; + return [self initWithCacheDirectory:cachesDirectory]; +} + +- (instancetype)initWithCacheDirectory:(NSString*)cacheDirectory { + if((self = [super init])) { + _cacheInfoQueue = dispatch_queue_create("com.enormego.egocache.info", DISPATCH_QUEUE_SERIAL); + dispatch_queue_t priority = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0); + dispatch_set_target_queue(priority, _cacheInfoQueue); + + _frozenCacheInfoQueue = dispatch_queue_create("com.enormego.egocache.info.frozen", DISPATCH_QUEUE_SERIAL); + priority = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0); + dispatch_set_target_queue(priority, _frozenCacheInfoQueue); + + _diskQueue = dispatch_queue_create("com.enormego.egocache.disk", DISPATCH_QUEUE_CONCURRENT); + priority = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0); + dispatch_set_target_queue(priority, _diskQueue); + + + _directory = cacheDirectory; + + _cacheInfo = [[NSDictionary dictionaryWithContentsOfFile:cachePathForKey(_directory, @"EGOCache.plist")] mutableCopy]; + + if(!_cacheInfo) { + _cacheInfo = [[NSMutableDictionary alloc] init]; + } + + [[NSFileManager defaultManager] createDirectoryAtPath:_directory withIntermediateDirectories:YES attributes:nil error:NULL]; + + NSTimeInterval now = [[NSDate date] timeIntervalSinceReferenceDate]; + NSMutableArray* removedKeys = [[NSMutableArray alloc] init]; + + for(NSString* key in _cacheInfo) { + if([_cacheInfo[key] timeIntervalSinceReferenceDate] <= now) { + [[NSFileManager defaultManager] removeItemAtPath:cachePathForKey(_directory, key) error:NULL]; + [removedKeys addObject:key]; + } + } + + [_cacheInfo removeObjectsForKeys:removedKeys]; + self.frozenCacheInfo = _cacheInfo; + [self setDefaultTimeoutInterval:86400]; + } + + return self; +} + +- (void)clearCache { + dispatch_sync(_cacheInfoQueue, ^{ + for(NSString* key in _cacheInfo) { + [[NSFileManager defaultManager] removeItemAtPath:cachePathForKey(_directory, key) error:NULL]; + } + + [_cacheInfo removeAllObjects]; + + dispatch_sync(_frozenCacheInfoQueue, ^{ + self.frozenCacheInfo = [_cacheInfo copy]; + }); + + [self setNeedsSave]; + }); +} + +- (void)removeCacheForKey:(NSString*)key { + CHECK_FOR_EGOCACHE_PLIST(); + + dispatch_async(_diskQueue, ^{ + [[NSFileManager defaultManager] removeItemAtPath:cachePathForKey(_directory, key) error:NULL]; + }); + + [self setCacheTimeoutInterval:0 forKey:key]; +} + +- (BOOL)hasCacheForKey:(NSString*)key { + NSDate* date = [self dateForKey:key]; + if(date == nil) return NO; + if([date timeIntervalSinceReferenceDate] < CFAbsoluteTimeGetCurrent()) return NO; + + return [[NSFileManager defaultManager] fileExistsAtPath:cachePathForKey(_directory, key)]; +} + +- (NSDate*)dateForKey:(NSString*)key { + __block NSDate* date = nil; + + dispatch_sync(_frozenCacheInfoQueue, ^{ + date = (self.frozenCacheInfo)[key]; + }); + + return date; +} + +- (NSArray*)allKeys { + __block NSArray* keys = nil; + + dispatch_sync(_frozenCacheInfoQueue, ^{ + keys = [self.frozenCacheInfo allKeys]; + }); + + return keys; +} + +- (void)setCacheTimeoutInterval:(NSTimeInterval)timeoutInterval forKey:(NSString*)key { + NSDate* date = timeoutInterval > 0 ? [NSDate dateWithTimeIntervalSinceNow:timeoutInterval] : nil; + + // Temporarily store in the frozen state for quick reads + dispatch_sync(_frozenCacheInfoQueue, ^{ + NSMutableDictionary* info = [self.frozenCacheInfo mutableCopy]; + + if(date) { + info[key] = date; + } else { + [info removeObjectForKey:key]; + } + + self.frozenCacheInfo = info; + }); + + // Save the final copy (this may be blocked by other operations) + dispatch_async(_cacheInfoQueue, ^{ + if(date) { + _cacheInfo[key] = date; + } else { + [_cacheInfo removeObjectForKey:key]; + } + + dispatch_sync(_frozenCacheInfoQueue, ^{ + self.frozenCacheInfo = [_cacheInfo copy]; + }); + + [self setNeedsSave]; + }); +} + +#pragma mark - +#pragma mark Copy file methods + +- (void)copyFilePath:(NSString*)filePath asKey:(NSString*)key { + [self copyFilePath:filePath asKey:key withTimeoutInterval:self.defaultTimeoutInterval]; +} + +- (void)copyFilePath:(NSString*)filePath asKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval { + dispatch_async(_diskQueue, ^{ + [[NSFileManager defaultManager] copyItemAtPath:filePath toPath:cachePathForKey(_directory, key) error:NULL]; + }); + + [self setCacheTimeoutInterval:timeoutInterval forKey:key]; +} + +#pragma mark - +#pragma mark Data methods + +- (void)setData:(NSData*)data forKey:(NSString*)key { + [self setData:data forKey:key withTimeoutInterval:self.defaultTimeoutInterval]; +} + +- (void)setData:(NSData*)data forKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval { + CHECK_FOR_EGOCACHE_PLIST(); + + NSString* cachePath = cachePathForKey(_directory, key); + + dispatch_async(_diskQueue, ^{ + [data writeToFile:cachePath atomically:YES]; + }); + + [self setCacheTimeoutInterval:timeoutInterval forKey:key]; +} + +- (void)setNeedsSave { + dispatch_async(_cacheInfoQueue, ^{ + if(_needsSave) return; + _needsSave = YES; + + double delayInSeconds = 0.5; + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); + dispatch_after(popTime, _cacheInfoQueue, ^(void){ + if(!_needsSave) return; + [_cacheInfo writeToFile:cachePathForKey(_directory, @"EGOCache.plist") atomically:YES]; + _needsSave = NO; + }); + }); +} + +- (NSData*)dataForKey:(NSString*)key { + if([self hasCacheForKey:key]) { + return [NSData dataWithContentsOfFile:cachePathForKey(_directory, key) options:0 error:NULL]; + } else { + return nil; + } +} + +#pragma mark - +#pragma mark String methods + +- (NSString*)stringForKey:(NSString*)key { + return [[NSString alloc] initWithData:[self dataForKey:key] encoding:NSUTF8StringEncoding]; +} + +- (void)setString:(NSString*)aString forKey:(NSString*)key { + [self setString:aString forKey:key withTimeoutInterval:self.defaultTimeoutInterval]; +} + +- (void)setString:(NSString*)aString forKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval { + [self setData:[aString dataUsingEncoding:NSUTF8StringEncoding] forKey:key withTimeoutInterval:timeoutInterval]; +} + +#pragma mark - +#pragma mark Image methds + +#if TARGET_OS_IPHONE + +- (UIImage*)imageForKey:(NSString*)key { + UIImage* image = nil; + + @try { + image = [NSKeyedUnarchiver unarchiveObjectWithFile:cachePathForKey(_directory, key)]; + } @catch (NSException* e) { + // Surpress any unarchiving exceptions and continue with nil + } + + return image; +} + +- (void)setImage:(UIImage*)anImage forKey:(NSString*)key { + [self setImage:anImage forKey:key withTimeoutInterval:self.defaultTimeoutInterval]; +} + +- (void)setImage:(UIImage*)anImage forKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval { + @try { + // Using NSKeyedArchiver preserves all information such as scale, orientation, and the proper image format instead of saving everything as pngs + [self setData:[NSKeyedArchiver archivedDataWithRootObject:anImage] forKey:key withTimeoutInterval:timeoutInterval]; + } @catch (NSException* e) { + // Something went wrong, but we'll fail silently. + } +} + +#else + +- (NSImage*)imageForKey:(NSString*)key { + return [[NSImage alloc] initWithData:[self dataForKey:key]]; +} + +- (void)setImage:(NSImage*)anImage forKey:(NSString*)key { + [self setImage:anImage forKey:key withTimeoutInterval:self.defaultTimeoutInterval]; +} + +- (void)setImage:(NSImage*)anImage forKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval { + [self setData:[[NSBitmapImageRep imageRepWithData:anImage.TIFFRepresentation] representationUsingType:NSPNGFileType properties:@{ }] forKey:key withTimeoutInterval:timeoutInterval]; +} + +#endif + +#pragma mark - +#pragma mark Property List methods + +- (NSData*)plistForKey:(NSString*)key; { + NSData* plistData = [self dataForKey:key]; + return [NSPropertyListSerialization propertyListWithData:plistData options:NSPropertyListImmutable format:nil error:nil]; +} + +- (void)setPlist:(id)plistObject forKey:(NSString*)key; { + [self setPlist:plistObject forKey:key withTimeoutInterval:self.defaultTimeoutInterval]; +} + +- (void)setPlist:(id)plistObject forKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; { + // Binary plists are used over XML for better performance + NSData* plistData = [NSPropertyListSerialization dataWithPropertyList:plistObject format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil]; + + if(plistData != nil) { + [self setData:plistData forKey:key withTimeoutInterval:timeoutInterval]; + } +} + +#pragma mark - +#pragma mark Object methods + +- (id)objectForKey:(NSString*)key { + if([self hasCacheForKey:key]) { + return [NSKeyedUnarchiver unarchiveObjectWithData:[self dataForKey:key]]; + } else { + return nil; + } +} + +- (void)setObject:(id)anObject forKey:(NSString*)key { + [self setObject:anObject forKey:key withTimeoutInterval:self.defaultTimeoutInterval]; +} + +- (void)setObject:(id)anObject forKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval { + [self setData:[NSKeyedArchiver archivedDataWithRootObject:anObject] forKey:key withTimeoutInterval:timeoutInterval]; +} + +@end diff --git a/Ifish/Utinitys/EGOCache/UIImage+WaterMark.h b/Ifish/Utinitys/EGOCache/UIImage+WaterMark.h new file mode 100644 index 0000000..c8de568 --- /dev/null +++ b/Ifish/Utinitys/EGOCache/UIImage+WaterMark.h @@ -0,0 +1,81 @@ +// +// UIImage+WaterMark.h +// PictureWatermark +// +// Created by AD-iOS on 15/8/3. +// Copyright (c) 2015年 Adinnet. All rights reserved. +// + +#import + +@interface UIImage (WaterMark) + +/** + * 给图片加水印图片 + * + * @param image 水印图片 + * @param imgRect 水印图片所在位置,大小 + * @param alpha 水印图片的透明度,0~1之间,透明度太大会完全遮盖被加水印图片的那一部分 + * + * @return 加完水印的图片 + */ +- (UIImage*)imageWaterMarkWithImage:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha; +/** + * 同上 + * + * @param image 同上 + * @param imgPoint 水印图片(0,0)所在位置 + * @param alpha 同上 + * + * @return 同上 + */ +- (UIImage*)imageWaterMarkWithImage:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha; + +/** + * 给图片加文字水印 + * + * @param str 水印文字 + * @param strRect 文字所在的位置大小 + * @param attri 文字的相关属性,自行设置 + * + * @return 加完水印文字的图片 + */ +- (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri; +/** + * 同上 + * + * @param str 同上 + * @param strPoint 文字(0,0)点所在位置 + * @param attri 同上 + * + * @return 同上 + */ +- (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri; +/** + * 返回加水印文字和图片的图片 + * + * @param str 水印文字 + * @param strPoint 文字(0,0)点所在位置 + * @param attri 文字属性 + * @param image 水印图片 + * @param imgPoint 图片(0,0)点所在位置 + * @param alpha 透明度 + * + * @return 加完水印的图片 + */ +- (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri image:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha; +/** + * 同上 + * + * @param str 同上 + * @param strRect 文字的位置大小 + * @param attri 同上 + * @param image 同上 + * @param imgRect 图片的位置大小 + * @param alpha 透明度 + * + * @return 同上 + */ +- (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri image:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha; + +@end diff --git a/Ifish/Utinitys/EGOCache/UIImage+WaterMark.m b/Ifish/Utinitys/EGOCache/UIImage+WaterMark.m new file mode 100644 index 0000000..e76024d --- /dev/null +++ b/Ifish/Utinitys/EGOCache/UIImage+WaterMark.m @@ -0,0 +1,70 @@ +// +// UIImage+WaterMark.m +// PictureWatermark +// +// Created by AD-iOS on 15/8/3. +// Copyright (c) 2015年 Adinnet. All rights reserved. +// + +#import "UIImage+WaterMark.h" + +@implementation UIImage (WaterMark) + +- (UIImage*)imageWaterMarkWithImage:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha +{ + return [self imageWaterMarkWithString:nil rect:CGRectZero attribute:nil image:image imageRect:imgRect alpha:alpha]; +} + +- (UIImage*)imageWaterMarkWithImage:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha +{ + return [self imageWaterMarkWithString:nil point:CGPointZero attribute:nil image:image imagePoint:imgPoint alpha:alpha]; +} + +- (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri +{ + return [self imageWaterMarkWithString:str rect:strRect attribute:attri image:nil imageRect:CGRectZero alpha:0]; +} + +- (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri +{ + return [self imageWaterMarkWithString:str point:strPoint attribute:attri image:nil imagePoint:CGPointZero alpha:0]; +} + +- (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri image:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha +{ + UIGraphicsBeginImageContext(self.size); + [self drawAtPoint:CGPointMake(0, 0) blendMode:kCGBlendModeNormal alpha:1.0]; + if (image) { + [image drawAtPoint:imgPoint blendMode:kCGBlendModeNormal alpha:alpha]; + } + + if (str) { + [str drawAtPoint:strPoint withAttributes:attri]; + } + UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return resultImage; + +} + +- (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri image:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha +{ + UIGraphicsBeginImageContext(self.size); + [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height) blendMode:kCGBlendModeNormal alpha:1.0]; + if (image) { + [image drawInRect:imgRect blendMode:kCGBlendModeNormal alpha:alpha]; + } + + if ([str isKindOfClass:[NSAttributedString class]]) + { + [(NSAttributedString*)str drawInRect:strRect]; + } + else if (str) { + [str drawInRect:strRect withAttributes:attri]; + } + UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return resultImage; +} + +@end diff --git a/Ifish/Utinitys/IfishHttpRequest/AFNOHeaderHttpTool.h b/Ifish/Utinitys/IfishHttpRequest/AFNOHeaderHttpTool.h index f62488c..48c7b6d 100644 --- a/Ifish/Utinitys/IfishHttpRequest/AFNOHeaderHttpTool.h +++ b/Ifish/Utinitys/IfishHttpRequest/AFNOHeaderHttpTool.h @@ -117,7 +117,7 @@ methodType url : (NSString *)url +(void)deviceBindCameraWith:(NSString *)cameraId userId:(NSNumber *)userId - deviceId:(NSString *)deviceId + deviceId:(DeviceModel *)device success:(void (^)(id response))success failure:(void (^)(NSError* err))failure; diff --git a/Ifish/Utinitys/IfishHttpRequest/AFNOHeaderHttpTool.m b/Ifish/Utinitys/IfishHttpRequest/AFNOHeaderHttpTool.m index ddf9693..c721128 100644 --- a/Ifish/Utinitys/IfishHttpRequest/AFNOHeaderHttpTool.m +++ b/Ifish/Utinitys/IfishHttpRequest/AFNOHeaderHttpTool.m @@ -9,6 +9,7 @@ #import "AFNOHeaderHttpTool.h" #import "AFNetworking.h" #import "SVProgressHUD.h" +#import "IfishDeviceInfo.h" #define ContentType @"text/html" @implementation AFNOHeaderHttpTool - (instancetype)init @@ -258,15 +259,20 @@ methodType url : (NSString *)url +(void)deviceBindCameraWith:(NSString *)cameraId userId:(NSNumber *)userId - deviceId:(NSString *)deviceId + deviceId:(DeviceModel *)device success:(void (^)(id response))success failure:(void (^)(NSError* err))failure { NSDictionary*para=@{ @"cameraId":cameraId, - @"deviceId":deviceId, + @"deviceId":device.deviceId, @"userId": userId }; + NSMutableDictionary*paradic=[[NSMutableDictionary alloc]initWithDictionary:para]; + if ([device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + paradic[@"type"]=@"1"; + } [AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:IfishdeviceBindCamera params:para success:success failure:failure]; } @@ -313,10 +319,24 @@ methodType url : (NSString *)url failure:(void (^)(NSError* err))failure { + NSString*macid=[[deviceId componentsSeparatedByString:@"_"] firstObject]; + + NSString*deviceType=[[deviceId componentsSeparatedByString:@"_"] lastObject]; + + NSString*type=@"0";//0换水 1杀菌 + + if ([deviceType isEqualToString:@"3f"]) + { + type=@"1"; + } + + + NSDictionary*para=@{ - @"deviceId":deviceId, + @"deviceId":macid, @"waterRemind":waterRemind, - @"remindCycle":remindCycle + @"remindCycle":remindCycle, + @"type":type }; [AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:kSetRemindWaterInf params:para success:success failure:failure]; diff --git a/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m b/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m index c76fa48..571b095 100644 --- a/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m +++ b/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m @@ -12,6 +12,7 @@ #import "IfishNewsModel.h" #import "IfishHotBarVc.h" #import "Xuanduo2fController.h" +#import "IfishP2PMonitorController.h" @implementation IfishDataUnity @@ -48,15 +49,57 @@ { + if (dataDic[@"cameraId"]) + { + IfishCameraModel *camera=[[IfishCameraModel alloc] initWithDict:dataDic]; + [deviceArry insertObject:camera atIndex:0]; + [[DataCenter defaultDtacenter]setValue:deviceArry forKey:@"cameraArr"]; + if (scanVC) + { + [scanVC dismissViewControllerAnimated:YES completion:^{ + IfishP2PMonitorController *p2pVC=[[IfishP2PMonitorController alloc] init]; + p2pVC.contact = camera; + UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:p2pVC]; + UIApplication*app=[UIApplication sharedApplication]; + AppDelegate*app1=(AppDelegate*)app.delegate; + app1.window.rootViewController=nav; + }]; + } + else + { + IfishP2PMonitorController *p2pVC=[[IfishP2PMonitorController alloc] init]; + p2pVC.contact = camera; + UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:p2pVC]; + UIApplication*app=[UIApplication sharedApplication]; + AppDelegate*app1=(AppDelegate*)app.delegate; + app1.window.rootViewController=nav; + } + } + else + { + DeviceModel*devicemodel=[[DeviceModel alloc]initWithDict:dataDic]; + //设备 + [deviceArry insertObject:devicemodel atIndex:0]; + + [[DataCenter defaultDtacenter]setValue:deviceArry forKey:@"deviceInfo"]; + + if ([devicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]) { + NSMutableDictionary*petStores=[[DataCenter defaultDtacenter] valueForKey:@"petStores"]; + for (NSMutableArray*array in petStores.allValues) { + + + [array insertObject:devicemodel atIndex:0]; + break; + } + + [[DataCenter defaultDtacenter]setValue:petStores forKey:@"petStores"]; + [[DataCenter defaultDtacenter].cache setString:devicemodel.macAddress forKey:@"currentPetDevice"]; + + } + + [self initAppCenterVcWith:devicemodel addWithdissMisVc:scanVC]; + } - DeviceModel*devicemodel=[[DeviceModel alloc]initWithDict:dataDic]; - //设备 - [deviceArry insertObject:devicemodel atIndex:0]; - - [[DataCenter defaultDtacenter]setValue:deviceArry forKey:@"deviceInfo"]; - - - [self initAppCenterVcWith:devicemodel addWithdissMisVc:scanVC]; } @@ -173,6 +216,13 @@ UINavigationController *xuanduo2fNav=[[UINavigationController alloc]initWithRootViewController:xuanduo2fVc]; [UIApplication sharedApplication].delegate.window.rootViewController = xuanduo2fNav; } + else if([devicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + //绚多新设备 + Xuanduo2fController *xuanduo2fVc = [Xuanduo2fController new]; + xuanduo2fVc.currentDevice = devicemodel; + UINavigationController *xuanduo2fNav=[[UINavigationController alloc]initWithRootViewController:xuanduo2fVc]; + [UIApplication sharedApplication].delegate.window.rootViewController = xuanduo2fNav; + } else{ int controlAmount=[devicemodel.controlAmount intValue]; diff --git a/Ifish/Utinitys/IfishHttpRequest/IfishUserDataUnity.m b/Ifish/Utinitys/IfishHttpRequest/IfishUserDataUnity.m index 0df87d6..c01477c 100644 --- a/Ifish/Utinitys/IfishHttpRequest/IfishUserDataUnity.m +++ b/Ifish/Utinitys/IfishHttpRequest/IfishUserDataUnity.m @@ -32,7 +32,9 @@ NSDictionary *userDic=dataDic[@"userInfo"]; UserModel *model=[[UserModel alloc] initWithDict:userDic]; + [[DataCenter defaultDtacenter]setValue:model forKey:@"UserLogIn"]; + [[DataCenter defaultDtacenter] cacheinit:[model.userId stringValue]]; //金币任务等级 NSDictionary *userAssetDic=dataDic[@"userAsset"]; @@ -88,6 +90,7 @@ NSDictionary *userDic=dataDic[@"userInfo"]; UserModel *model=[[UserModel alloc] initWithDict:userDic]; [[DataCenter defaultDtacenter]setValue:model forKey:@"UserLogIn"]; + [[DataCenter defaultDtacenter] cacheinit:[model.userId stringValue]]; NSUserDefaults*userdefult=[NSUserDefaults standardUserDefaults]; if (model.unionId.length) { [userdefult setObject:model.unionId forKey:@"unionId"]; diff --git a/Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h b/Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h index 39ac9f9..af59318 100644 --- a/Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h +++ b/Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h @@ -31,6 +31,7 @@ #define DECICE_TYPE_XUANDUOOF @"0f" //0x0f//无屏幕 #define DECICE_TYPE_XUANDUO1F @"1f" //0x1f//有屏幕 #define DECICE_TYPE_XUANDUO2F @"2f" //新设备 +#define DECICE_TYPE_XUANDUO3F @"3f" //宠物笼 //可丽爱 #define DECICE_TYPE_KELIAI @"aa" //0xaa diff --git a/Ifish/Utinitys/SocketSingleton/Socketsingleton.m b/Ifish/Utinitys/SocketSingleton/Socketsingleton.m index 8164107..ae2ec64 100644 --- a/Ifish/Utinitys/SocketSingleton/Socketsingleton.m +++ b/Ifish/Utinitys/SocketSingleton/Socketsingleton.m @@ -64,7 +64,8 @@ self.clientSocket.userData = SocketOfflineByUser;// 声明是由用户主动切断 - [self.clientSocket disconnect]; + [self.clientSocket disconnectAfterReadingAndWriting]; + self.clientSocket=nil; } diff --git a/Ifish/Utinitys/dataUnity/dataContorl.m b/Ifish/Utinitys/dataUnity/dataContorl.m index d9f83c0..8386350 100644 --- a/Ifish/Utinitys/dataUnity/dataContorl.m +++ b/Ifish/Utinitys/dataUnity/dataContorl.m @@ -240,6 +240,10 @@ { NSString*hexString=[NSString stringWithFormat:@"%@",[[NSString alloc]initWithFormat:@"%1x",intString]]; siWeihexString=[NSString stringWithFormat:@"00%@",hexString]; + if (hexString.length==1) + { + siWeihexString=[NSString stringWithFormat:@"000%@",hexString]; + } }else if (intString>=260) diff --git a/Ifish/Utinitys/ifishDeviceCommunicationDataUnity/DeviceCommunicateDataUnity.m b/Ifish/Utinitys/ifishDeviceCommunicationDataUnity/DeviceCommunicateDataUnity.m index 2797f87..4bba45a 100644 --- a/Ifish/Utinitys/ifishDeviceCommunicationDataUnity/DeviceCommunicateDataUnity.m +++ b/Ifish/Utinitys/ifishDeviceCommunicationDataUnity/DeviceCommunicateDataUnity.m @@ -157,7 +157,10 @@ NSString*startTimeHex1=[backModel.timer1 substringWithRange:NSMakeRange(4, 4)]; NSString*endTimeHex1=[backModel.timer1 substringWithRange:NSMakeRange(8, 4)]; - + if (!backModel.timer1) + { + return nil; + } // 十进制 NSString*startTimeTen1=[dataContorl hexStringToDateString:startTimeHex1]; NSString*endTimeTen1=[dataContorl hexStringToDateString:endTimeHex1]; diff --git a/Ifish/controllers/ConnectAauariumVC/ConAquarChooseWiFiVC.m b/Ifish/controllers/ConnectAauariumVC/ConAquarChooseWiFiVC.m index 63d2273..c31b194 100644 --- a/Ifish/controllers/ConnectAauariumVC/ConAquarChooseWiFiVC.m +++ b/Ifish/controllers/ConnectAauariumVC/ConAquarChooseWiFiVC.m @@ -124,13 +124,14 @@ Assign BOOL isGoChangeWiFi;//更换为设备的WiFi [self.view makeToast:@"请先连接设备热点"]; return; } - if ([wifiName rangeOfString:@"ifish"].location!=NSNotFound||[wifiName rangeOfString:@"GW"].location!=NSNotFound) { + if ([wifiName rangeOfString:@"ifish"].location!=NSNotFound||[wifiName rangeOfString:@"GW"].location!=NSNotFound||[wifiName.lowercaseString isEqualToString:@"wlan"]||![wifiName isEqualToString:self.wifiName]) { //wifi正确,则尝试连接设备 if(self.deviceType==DEVICECAMERA) { YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init]; nextvc.wifiName=self.wifiName; nextvc.wifiPwd=self.wifiPwd; + nextvc.conectType =conectType_ap; [self.navigationController pushViewController:nextvc animated:YES]; } @@ -141,6 +142,7 @@ Assign BOOL isGoChangeWiFi;//更换为设备的WiFi connecting.bssid = self.bssid; connecting.wifiName = self.wifiName; connecting.wifiPassword = self.wifiPwd; + connecting.deviceType=self.deviceType; [self.navigationController pushViewController:connecting animated:YES]; } diff --git a/Ifish/controllers/ConnectAauariumVC/ConAquarMethodVC.m b/Ifish/controllers/ConnectAauariumVC/ConAquarMethodVC.m index 9efb5b2..d7dbe32 100644 --- a/Ifish/controllers/ConnectAauariumVC/ConAquarMethodVC.m +++ b/Ifish/controllers/ConnectAauariumVC/ConAquarMethodVC.m @@ -9,6 +9,7 @@ #import "ConAquarMethodVC.h" #import "SecondConnectWifiController.h" #import "ConAquarNowWiFiPwdVC.h" +#import @interface ConAquarMethodVC () Strong UILabel *subTitleLabel; @@ -74,12 +75,54 @@ Strong UILabel *subTitleLabel; } self.view.backgroundColor = COLOR_Background; + if ([CLLocationManager locationServicesEnabled] && ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized)) { + + //定位功能可用 + + + + + }else if ([CLLocationManager authorizationStatus] ==kCLAuthorizationStatusDenied) { + + + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"需要定位权限才能获取wifi信息给设备配网,来添加设备" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *ok = [UIAlertAction actionWithTitle:@"打开定位" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; + + if([[UIApplication sharedApplication] canOpenURL:url]) { + if (@available(iOS 10.0, *)) { + [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; + }else { + [[UIApplication sharedApplication] openURL:url]; + } + } + }]; + UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { + [self.navigationController popViewControllerAnimated:YES]; + }]; + [alert addAction:ok]; + [alert addAction:cancel]; + + [self presentViewController:alert animated:YES completion:nil]; + + + + + + }else if([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined){ + + CLLocationManager* locationManager = [[CLLocationManager alloc] init]; + + + [locationManager requestWhenInUseAuthorization]; + + } // Do any additional setup after loading the view. } -(void)buttonClick:(UIButton *)sender{ self.hidesBottomBarWhenPushed = YES; if (sender.tag==0) { - + //智能连接 if (self.deviceType==DEVICECAMERA) { YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init]; @@ -95,7 +138,7 @@ Strong UILabel *subTitleLabel; [self.navigationController pushViewController:wifivc animated:YES]; } - + //热点链接 }else{ ConAquarNowWiFiPwdVC *vc = InitObject(ConAquarNowWiFiPwdVC); vc.deviceType=self.deviceType; diff --git a/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.h b/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.h index b120bcd..fd81b16 100644 --- a/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.h +++ b/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.h @@ -7,6 +7,8 @@ // #import "BaseViewController.h" +#import "StoreNameView.h" +#import "DXPopover.h" NS_ASSUME_NONNULL_BEGIN @@ -20,6 +22,9 @@ Copy NSString *ssid; Copy NSString *bssid; //界面复用 设备类型 @property (assign, nonatomic) SmartDeviceType deviceType; +@property (nonatomic, strong) UIView *mask; +@property (nonatomic, strong) StoreNameView *storeNameView; +@property (nonatomic, strong) NSString *storeName; @end NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m b/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m index 8cf5416..fae6f36 100644 --- a/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m +++ b/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m @@ -14,6 +14,7 @@ #import "ESPTouchResult.h" #import "ESPTouchTask.h" #import "IfishDataUnity.h" +#import "MyMD5.h" #import @interface ConnectingAquarVC () Strong HKPieChartView *progressView; @@ -68,6 +69,7 @@ Copy NSString *deviceId; self.timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timerAction) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes]; + } //AP模式配网 -(void)connectDevice{ @@ -158,8 +160,23 @@ Copy NSString *deviceId; }else if ([resultDic[@"result"] isEqualToString:@"101"]){ [self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"]; - self.HUD.labelText = @"绑定失败"; + self.bakbutton.userInteractionEnabled=YES; + NSString*msg= resultDic[@"data"]; + + if ([msg isKindOfClass:[NSString class]]&&msg.length&&![msg isEqualToString:@"null"]) + { + + } + else + { + msg=@"设备类型不匹配,请重新选择入口绑定"; + } + + [self.HUD hide:YES]; + + [self.view makeToast:msg]; + }else if ([resultDic[@"result"] isEqualToString:@"301"]){ [self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"]; @@ -263,7 +280,7 @@ Copy NSString *deviceId; BOOL networkOk = NO; AFNetworkReachabilityStatus status = [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus; - if (status == AFNetworkReachabilityStatusReachableViaWiFi) { + if (status == AFNetworkReachabilityStatusReachableViaWiFi||status == AFNetworkReachabilityStatusUnknown) { if (![[self currentWifiSSID].lowercaseString hasPrefix:@"ifish"]) { networkOk = YES; } @@ -285,9 +302,20 @@ Copy NSString *deviceId; self.bindTimer = nil; } self.retryTimes = 0; - [self bindDeviceWithSsid:self.macAddress]; + if (self.deviceType==DEVICEPETS) + { + [self showStoreNameView]; + } + else + { + [self bindDeviceWithSsid:self.macAddress]; + } } + + + + - (void)udpHelperMessage:(NSString *)msg { self.HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; self.HUD.mode = MBProgressHUDModeIndeterminate; @@ -298,15 +326,85 @@ Copy NSString *deviceId; [self.timer invalidate]; self.timer = nil; } +-(UIView *)mask +{ + if (!_mask) + { + UIView*mask=[[UIView alloc]initWithFrame:self.view.bounds]; + mask.backgroundColor=[UIColor lightGrayColor]; + mask.alpha=0.5; + _mask=mask; + UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissStore)]; + //[mask addGestureRecognizer:tap]; + } + + return _mask; +} +-(void)dismissStore +{ + [self.storeNameView removeFromSuperview]; + [self.mask removeFromSuperview]; + [self.progressView endProgressWithString:@"绑定已经取消..."]; + +} +-(void)showStoreNameView +{ + [self.HUD hide:YES]; + [self.storeNameView removeFromSuperview]; + StoreNameView*store=[[[NSBundle mainBundle] loadNibNamed:@"StoreNameView" owner:self options:nil] lastObject]; + store.frame=CGRectMake((SCREEN_WIDTH-280)/2.0, 100, 280, 280); + + self.storeNameView=store; + WEAK_SELF; + store.cancelBlock=^(){ + [weakSelf.mask removeFromSuperview]; + [weakSelf.storeNameView removeFromSuperview]; + [weakSelf.HUD show:YES]; + [weakSelf.progressView endProgressWithString:@"绑定已经取消..."]; + + }; + store.sureBlock=^(NSString*name) + { + if (!name.length) + { + [weakSelf.view makeToast:@"请设置或者选择名称!"]; + return ; + } + [weakSelf.mask removeFromSuperview]; + [weakSelf.storeNameView removeFromSuperview]; + weakSelf.storeName=name; + [self bindDeviceWithSsid:self.macAddress]; + [weakSelf.HUD show:YES]; + }; + + [self.view addSubview:self.mask]; + [self.view addSubview:self.storeNameView]; + +} #pragma mark - bind -(void)bindDeviceWithSsid:(NSString*)bssid{ NSLog(@"设备bssid_%@",bssid); + [self appendTrakContent:@"=================进入绑定函数================="]; NSString *userId = [dataContorl dataControlGetUserIdInfo]; self.HUD.labelText = @"正在绑定设备"; [self appendTrakContent:[NSString stringWithFormat:@"绑定参数 userID:%@", userId]]; [self appendTrakContent:[NSString stringWithFormat:@"绑定参数 macaddress:%@", bssid]]; - [AFHttpTool bindDeviceWithUserId:userId macAddress:bssid success:^(id response) { + NSString*url=[NSString stringWithFormat:@"%@%@",kBindDevice,userId]; + NSMutableDictionary*bind=[[NSMutableDictionary alloc]initWithDictionary:@{@"macAddress":bssid}]; + NSString* timestamp=[NSString stringWithFormat:@"%lld",[[NSDate date] timeIntervalSince1970]*1000]; + NSString*token=[MyMD5 md5:[NSString stringWithFormat:@"%@%@ifish8",userId,timestamp]]; + + if (self.deviceType==DEVICEPETS) + { + url=[NSString stringWithFormat:@"%@",[NSString stringWithFormat:@"%@/api/user/bindPetDevice.do",JIEKOUPORT]]; + bind[@"token"]=token; + bind[@"timestamp"]=timestamp; + bind[@"storeName"]=self.storeName.length?self.storeName:@"宠物店"; + bind[@"userId"]=userId; + + } + [AFHttpTool requestWihtMethod:RequestMethodTypePost url:url params:bind success:^(id response) { [self endProgress]; self.isBindingDevice = NO; self.macAddress = nil; @@ -348,8 +446,22 @@ Copy NSString *deviceId; }else if ([resultDic[@"result"] isEqualToString:@"101"]){ [self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"]; - self.HUD.labelText = @"绑定失败"; + self.bakbutton.userInteractionEnabled=YES; + NSString*msg= resultDic[@"data"]; + + if ([msg isKindOfClass:[NSString class]]&&msg.length&&![msg isEqualToString:@"null"]) + { + + } + else + { + msg=@"设备类型不匹配,请重新选择入口绑定"; + } + [self.HUD hide:YES]; + + [self.view makeToast:msg]; + }else if ([resultDic[@"result"] isEqualToString:@"301"]){ [self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"]; @@ -367,7 +479,7 @@ Copy NSString *deviceId; } failure:^(NSError *err) { - if (self.retryTimes < 3) { + if (self.retryTimes < 6) { [self bindDeviceWithSsid:self.macAddress]; self.retryTimes += 1; } else { diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/HaveHotCoolWenDuPicview.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/HaveHotCoolWenDuPicview.m index c1cdebc..f969a6c 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/HaveHotCoolWenDuPicview.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/HaveHotCoolWenDuPicview.m @@ -85,7 +85,7 @@ } -(void)dataSource{ - _picArr=@[@[@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50"]]; + _picArr=@[@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50"]]; } diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/RuSunChangeNameTitleViewCell.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/RuSunChangeNameTitleViewCell.h index db35517..a2fdeab 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/RuSunChangeNameTitleViewCell.h +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/RuSunChangeNameTitleViewCell.h @@ -10,5 +10,6 @@ @interface RuSunChangeNameTitleViewCell : UITableViewCell @property (weak, nonatomic) IBOutlet UITextField *deviceName; +@property (weak, nonatomic) IBOutlet UILabel *cNTitle; @end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/RuSunChangeNameTitleViewCell.xib b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/RuSunChangeNameTitleViewCell.xib index 7df682a..6e001ae 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/RuSunChangeNameTitleViewCell.xib +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuSunTemp/RuSunIndependence/RuSunChangeNameTitleViewCell.xib @@ -1,12 +1,11 @@ - + - - + @@ -27,7 +26,7 @@ - + @@ -57,6 +56,7 @@ + diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/ThreeControl/ThreeControlCenterViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/ThreeControl/ThreeControlCenterViewController.m index ff78375..fe6c40c 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/ThreeControl/ThreeControlCenterViewController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/ThreeControl/ThreeControlCenterViewController.m @@ -559,8 +559,12 @@ typedef NS_ENUM(NSInteger,ThreeControBackMsgTape){ [DeviceCommunicateDataUnity resetThreeControlButtonState:_light1Button addlight2:_light2Button addpump:_pumpButton withBackModel:_backmodel]; // 实时刷新设置界面 时间设置 - _SetTimeVC.timeArr=[DeviceCommunicateDataUnity refreshThreeControlTimerAddTemperatureWithBackMassageModel:_backmodel]; - [_SetTimeVC.tableView reloadData]; + if (_SetTimeVC) + { + _SetTimeVC.timeArr=[DeviceCommunicateDataUnity refreshThreeControlTimerAddTemperatureWithBackMassageModel:_backmodel]; + [_SetTimeVC.tableView reloadData]; + } + } diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.h index a875b40..ab5035c 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.h +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.h @@ -13,9 +13,11 @@ NS_ASSUME_NONNULL_BEGIN @interface SetTimerCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIButton *switchBtn; +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; +@property (weak, nonatomic) IBOutlet UILabel *timerLabel; - (void)configTitleLabel:(NSString *)title timer:(NSString *)timeStr switchStatus:(BOOL)status; - +@property (nonatomic, strong) id model; @end NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.m index 3233567..de34179 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.m @@ -9,8 +9,7 @@ #import "SetTimerCell.h" @interface SetTimerCell () -@property (weak, nonatomic) IBOutlet UILabel *titleLabel; -@property (weak, nonatomic) IBOutlet UILabel *timerLabel; + @end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.xib b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.xib index 45cfad0..601e14d 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.xib +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.xib @@ -1,11 +1,9 @@ - - - - + + - + @@ -16,11 +14,11 @@ - + - + - + diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/xuanduo3fModel.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/xuanduo3fModel.h new file mode 100644 index 0000000..d7dc937 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/xuanduo3fModel.h @@ -0,0 +1,55 @@ +// +// xuanduo3fModel.h +// Ifish +// +// Created by 祝发冬 on 2020/4/6. +// Copyright © 2020 lianlian. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +#if 0 +01 +08 +bcddc2450947 +bcddc2450947 +24 — 36字节 +0101 照明 +0201 换气 +0301 杀菌 +0401 恒温 +024e 温度 +0140 加热温度 +007d 杀菌倒计时 +01 报警开关 +00c8 最低报警温度 +012c 最高报警温度 +2244 crc16校验码 +#endif +@interface Xuanduo3fModel : NSObject +/// 换气 -- 气泵 +@property (nonatomic, strong) NSString *gasPump; +/// 灯1 +@property (nonatomic, strong) NSString *light; + +/// 杀菌灯 +@property (nonatomic, strong) NSString *uvLamp; +/// 杀菌倒计时PH +@property (nonatomic, strong) NSString *vuPHstatus; +/// 恒温 +@property (nonatomic, strong) NSString *constTmep; +///温度 +@property (nonatomic, strong) NSString *temperature; +/// 加热温度 +@property (nonatomic, strong) NSString *heatingTemperature; + +/// 报警开关 +@property (nonatomic, strong) NSString *alarmSwitch; +/// 最低温 +@property (nonatomic, strong) NSString *miniTemp; +/// 最高温 +@property (nonatomic, strong) NSString *maxTemp; +@end + +NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/xuanduo3fModel.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/xuanduo3fModel.m new file mode 100644 index 0000000..ce4c8e3 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/xuanduo3fModel.m @@ -0,0 +1,13 @@ +// +// xuanduo3fModel.m +// Ifish +// +// Created by 祝发冬 on 2020/4/6. +// Copyright © 2020 lianlian. All rights reserved. +// + +#import "xuanduo3fModel.h" + +@implementation Xuanduo3fModel + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.h b/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.h index 65f3441..4110404 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.h +++ b/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.h @@ -7,6 +7,7 @@ // #import "BaseViewController.h" +#import "IfishDeviceInfo.h" //修改设备名 及控制名 子类实现DataSource即可 typedef void (^deviceNameBlock)(NSString *); diff --git a/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.m b/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.m index 3dac136..5ecdfd8 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.m @@ -160,7 +160,12 @@ [para setValue: cell.deviceName.text forKey:@"showName"]; if (cell.deviceName.text.length <= 6) { - [mannager POST:kUpdateDeviceUser parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) { + NSString*url=kUpdateDeviceUser; + if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + url=[NSString stringWithFormat:@"%@/api/user/updatePetDeviceUser.do",JIEKOUPORT]; + } + [mannager POST:url parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) { if (responseObject) { NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil]; NSLog(@"result:%@",resultDic[@"result"]); @@ -168,7 +173,7 @@ if ([resultDic[@"result"] isEqualToString:@"100"]) { [self.view makeToast:@"修改成功"]; - + [[NSNotificationCenter defaultCenter]postNotificationName:@"updateUserInfobyValidation" object:nil]; NSString *strName =[NSString stringWithFormat:@"%@",cell.deviceName.text]; diff --git a/Ifish/controllers/HotBar/IfishHotBarVc.m b/Ifish/controllers/HotBar/IfishHotBarVc.m index 4622032..1573393 100644 --- a/Ifish/controllers/HotBar/IfishHotBarVc.m +++ b/Ifish/controllers/HotBar/IfishHotBarVc.m @@ -175,6 +175,7 @@ Assign BOOL isInitHostoryView; vo.subTitle=[NSString stringWithFormat:@"%.1f°c",[self.vo.heaterNum floatValue]]; [self.mainTableView reloadData]; [self setHeatTeapWith:temp]; + [[DataCenter defaultDtacenter].cache setString:[NSString stringWithFormat:@"%.1f°c",[self.vo.heaterNum floatValue]] forKey:@"heaterTemperature"]; } //设置预警温度 -(void)didSelectTeamptrue:(NSString *)up andDown:(NSString *)down andWarnCode:(NSString *)code{ @@ -195,7 +196,7 @@ Assign BOOL isInitHostoryView; vo.title=@"设置水温"; vo.iconUrl=@"温度图标"; vo.isShowArrow=YES; - vo.subTitle=@""; + vo.subTitle=[CommonUtils getNotNilStr:[[DataCenter defaultDtacenter].cache stringForKey:@"heaterTemperature"]]; [_datas addObject:vo]; //预警温度 add V5.0.0 @@ -355,6 +356,9 @@ Assign BOOL isInitHostoryView; [SVProgressHUD dismiss]; if ([result integerValue]==100) { self.vo=[IfishHotBarVo mj_objectWithKeyValues:dict[@"data"]]; + if (!self.vo) { + self.vo=self.datas[0]; + } if (self.vo.phs.count>0) { NSDate *curDate = [NSDate dateWithTimeInterval:self.curDay*60*60*-24 sinceDate:[NSDate date]]; NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];//创建一个日期格式化器 @@ -412,6 +416,11 @@ Assign BOOL isInitHostoryView; self.historyView.hidden=NO; }else{ + NSLog(@"index%ld___%ld",indexPath.section,indexPath.row); + if (!self.vo) + { + self.vo=self.datas[indexPath.row]; + } [self changeWaterView]; self.changeWaterView.hotVo=self.vo; self.changeWaterView.viewType=indexPath.row; diff --git a/Ifish/controllers/IfishTabControllers/我的/mineControllers/IfishConnectUsViewController.m b/Ifish/controllers/IfishTabControllers/我的/mineControllers/IfishConnectUsViewController.m index 6d96119..41ba8a2 100644 --- a/Ifish/controllers/IfishTabControllers/我的/mineControllers/IfishConnectUsViewController.m +++ b/Ifish/controllers/IfishTabControllers/我的/mineControllers/IfishConnectUsViewController.m @@ -7,10 +7,11 @@ // #import "IfishConnectUsViewController.h" +#import "InfoByImageViewController.h" -@interface IfishConnectUsViewController () +@interface IfishConnectUsViewController () Strong UIImageView *codeImage;//二维码 -Strong UIButton *telBtn; +Strong UITextView *textView; @end @implementation IfishConnectUsViewController @@ -18,34 +19,130 @@ Strong UIButton *telBtn; - (void)viewDidLoad { [super viewDidLoad]; self.titleString = @"联系我们"; + self.view.backgroundColor=[UIColor whiteColor]; [self.view addSubview:self.codeImage]; - [self.view addSubview:self.telBtn]; + [self.view addSubview:self.textView]; [self.codeImage mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(kSizeFrom750(128)); - make.width.mas_equalTo(kSizeFrom750(578)); - make.height.mas_equalTo(kSizeFrom750(770)); + make.bottom.mas_equalTo(self.view.mas_bottom).offset(-34); + make.width.mas_equalTo(kSizeFrom750(300.5)); + make.height.mas_equalTo(kSizeFrom750(400)); make.centerX.mas_equalTo(self.view); }]; - [self.telBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.centerX.mas_equalTo(self.codeImage); - make.top.mas_equalTo(self.codeImage.mas_bottom).offset(kSizeFrom750(70)); - make.height.mas_equalTo(kSizeFrom750(70)); + [self.textView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.view.mas_left).offset(10); + make.right.mas_equalTo(self.view.mas_right).offset(-10); + + make.top.mas_equalTo(self.view.mas_top).offset(0); + make.bottom.mas_equalTo(self.codeImage.mas_top); }]; // Do any additional setup after loading the view. } --(UIButton *)telBtn{ - if (!_telBtn) { - _telBtn = InitObject(UIButton); - _telBtn.titleLabel.font = SYSTEMSIZE(34); - [_telBtn setTitle:@"服务热线:18667812003" forState:UIControlStateNormal]; - [_telBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; - [_telBtn addTarget:self action:@selector(telBtnClick:) forControlEvents:UIControlEventTouchUpInside]; +-(void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + [self protocolIsSelect:YES]; +} +-(UITextView *)textView{ + if (!_textView) { + _textView = InitObject(UITextView); + _textView.adjustsFontForContentSizeCategory=YES; + + + } - return _telBtn; + return _textView; } +- (void)protocolIsSelect:(BOOL)select { + +NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"1、设备绑定不上?查看遥控器或显示屏控制插排是否正常?\na、若不正常考虑设备问题,可与购买方或厂家联系。\nb、若正常先查看手机连接路由器是否为2.4g频率wifi。若连接时提示去更改网络,则此时手机连接一定为5g网络,需更换2.4g网络重新绑定。\n2、换路由器后网络为2.4g频率WIFI,还是无法绑定?\na、若老路由器连接没问题,先用老路由器把设备绑定在线,联系爱鱼奇客服升级。\nb、两台手机开热点方法(暂时不用路由器)先把设备绑定上,设备在线后与爱鱼奇客服联系升级。手机开热点如何连接点击这里。\nc、手机开热点也连接不上,可与购买方或厂家联系。\n3、感谢您使用爱鱼奇app,连接智能设备请查看下方说明书,内含操作视频:http://u.eqxiu.com/s/KmmVl87l,插排及热流器售后服务热线点击这里。\n4、摄像头售后及爱鱼奇服务微信:18667812003"]; + +[attributedString addAttribute:NSLinkAttributeName + +value:@"apmode://" + +range:[[attributedString string] rangeOfString:@"手机开热点如何连接点击这里。"]]; + +[attributedString addAttribute:NSLinkAttributeName + +value:@"http://u.eqxiu.com/s/KmmVl87l" + +range:[[attributedString string] rangeOfString:@"http://u.eqxiu.com/s/KmmVl87l"]]; + [attributedString addAttribute:NSLinkAttributeName + + value:@"hotbar://" + + range:[[attributedString string] rangeOfString:@"插排及热流器售后服务热线点击这里。"]]; + + CGFloat fontSize=18; + if (self.view.frame.size.width>410) + { + fontSize=18; + } + else if (self.view.frame.size.width>370) + { + fontSize=15; + } + else + { + fontSize=12; + } + [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:fontSize] range:NSMakeRange(0, attributedString.length)]; + [attributedString addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:fontSize] range:[[attributedString string] rangeOfString:@"http://u.eqxiu.com/s/KmmVl87l"]]; + [attributedString addAttribute:NSLinkAttributeName value:@"tel://18667812003" range:[[attributedString string] rangeOfString:@"18667812003"]]; + + + +_textView.attributedText = attributedString; + +_textView.linkTextAttributes = @{NSForegroundColorAttributeName: [UIColor blueColor], + +NSUnderlineColorAttributeName: [UIColor lightGrayColor], + +NSUnderlineStyleAttributeName: @(NSUnderlinePatternSolid)}; + +_textView.delegate=self; + +_textView.editable=NO; + +_textView.scrollEnabled = YES; + +} +- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange { + + self.hidesBottomBarWhenPushed=YES; + +if ([[URL scheme] isEqualToString:@"apmode"]) { + + InfoByImageViewController*info=[[InfoByImageViewController alloc]init]; + info.title=@"热点连接方法"; + info.image=[UIImage imageNamed:@"apmodeInfo"]; + [self.navigationController pushViewController:info animated:YES]; + + +return NO; + +} else if ([[URL scheme] isEqualToString:@"hotbar"]) { + + InfoByImageViewController*info=[[InfoByImageViewController alloc]init]; + info.title=@"售后服务热线"; + info.type=@"service"; + info.image=[UIImage imageNamed:@"hotbarInfo"]; + [self.navigationController pushViewController:info animated:YES]; + +return NO; + +} + +return YES; + +} + + + + -(UIImageView *)codeImage { if (!_codeImage) { diff --git a/Ifish/controllers/IfishTabControllers/我的/mineControllers/IfishMeViewController.m b/Ifish/controllers/IfishTabControllers/我的/mineControllers/IfishMeViewController.m index 0881ad2..c9997f0 100644 --- a/Ifish/controllers/IfishTabControllers/我的/mineControllers/IfishMeViewController.m +++ b/Ifish/controllers/IfishTabControllers/我的/mineControllers/IfishMeViewController.m @@ -87,7 +87,7 @@ -(void)getTableData{ - self.tileArr=@[@[@"扫二维码",@"我的看护"],@[@"关于我们",@"设置"],@[@"分享爱鱼奇",@"产品说明书",@"联系爱鱼奇"]]; + self.tileArr=@[@[@"扫二维码",@"我的看护"],@[@"关于我们",@"设置"],@[@"分享爱鱼奇",@"产品说明书",@"联系我们"]]; self.headimgeArr = @[@[@"personal_iocn_scan",@"personal_iocn_care"],@[@"personal_iocn_about",@"personal_iocn_set"],@[@"personal_iocn_share",@"personal_iocn_instructions",@"personal_iocn_feedback"]]; } diff --git a/Ifish/controllers/IfishTabControllers/我的/mineControllers/InfoByImageViewController.h b/Ifish/controllers/IfishTabControllers/我的/mineControllers/InfoByImageViewController.h new file mode 100644 index 0000000..b4a8d97 --- /dev/null +++ b/Ifish/controllers/IfishTabControllers/我的/mineControllers/InfoByImageViewController.h @@ -0,0 +1,19 @@ +// +// InfoByImageViewController.h +// Ifish +// +// Created by 祝发冬 on 2020/6/20. +// Copyright © 2020 lianlian. All rights reserved. +// + +#import "BaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface InfoByImageViewController : BaseViewController +@property (nonatomic, strong) UIImageView *imageView; +@property (nonatomic, strong) UIImage *image; +@property (nonatomic, strong) NSString *type; +@end + +NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/IfishTabControllers/我的/mineControllers/InfoByImageViewController.m b/Ifish/controllers/IfishTabControllers/我的/mineControllers/InfoByImageViewController.m new file mode 100644 index 0000000..4706408 --- /dev/null +++ b/Ifish/controllers/IfishTabControllers/我的/mineControllers/InfoByImageViewController.m @@ -0,0 +1,123 @@ +// +// InfoByImageViewController.m +// Ifish +// +// Created by 祝发冬 on 2020/6/20. +// Copyright © 2020 lianlian. All rights reserved. +// + +#import "InfoByImageViewController.h" + +@interface InfoByImageViewController () + +@end + +@implementation InfoByImageViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + self.imageView=[[UIImageView alloc]initWithFrame:CGRectZero]; + [self.view addSubview:self.imageView]; + [ self.imageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(0); + make.top.mas_equalTo(0); + make.bottom.mas_equalTo(0); + make.right.mas_equalTo(0); + }]; + if (self.image) + { + self.imageView.image=self.image; + } + if (self.title) + { + self.titleString=self.title; + } + if ([self.type isEqualToString:@"service"]) + { + UIButton*xuanduo=[UIButton buttonWithType:UIButtonTypeSystem]; + [self.view addSubview:xuanduo]; + [xuanduo mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(0); + make.top.mas_equalTo(0); + make.height.mas_equalTo(self.view.frame.size.height/12); + make.right.mas_equalTo(0); + + }]; + xuanduo.tag=1; + xuanduo.backgroundColor=[UIColor clearColor]; + [xuanduo addTarget:self action:@selector(service:) forControlEvents:UIControlEventTouchUpInside]; + + + + + UIButton*reuxin=[UIButton buttonWithType:UIButtonTypeSystem]; + [self.view addSubview:reuxin]; + [reuxin mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(0); + make.top.mas_equalTo(4*self.view.frame.size.height/12-25); + make.height.mas_equalTo(self.view.frame.size.height/12); + make.right.mas_equalTo(0); + + }]; + reuxin.tag=2; + reuxin.backgroundColor=[UIColor clearColor]; + [reuxin addTarget:self action:@selector(service:) forControlEvents:UIControlEventTouchUpInside]; + + + UIButton*songnuo=[UIButton buttonWithType:UIButtonTypeSystem]; + [self.view addSubview:songnuo]; + [songnuo mas_makeConstraints:^(MASConstraintMaker *make) { + + make.left.mas_equalTo(0); + make.top.mas_equalTo(8*self.view.frame.size.height/12-25); + make.height.mas_equalTo(self.view.frame.size.height/12); + make.right.mas_equalTo(0); + + }]; + songnuo.tag=3; + songnuo.backgroundColor=[UIColor clearColor]; + [songnuo addTarget:self action:@selector(service:) forControlEvents:UIControlEventTouchUpInside]; + + } + + +} +-(void)service:(UIButton*)button +{ + NSURL*url; + if (button.tag==1) + { + url=[NSURL URLWithString:@"tel://17321129273"]; + + } + else if (button.tag==2) + { + url=[NSURL URLWithString:@"tel://4000121101"]; + } + else if (button.tag==3) + { + url=[NSURL URLWithString:@"tel://13392205468"]; + } + + + if (@available(iOS 10.0, *)) { + [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; + }else { + [[UIApplication sharedApplication] openURL:url]; + } + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/AboutUsViewController.m b/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/AboutUsViewController.m index 0077557..e7ce529 100644 --- a/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/AboutUsViewController.m +++ b/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/AboutUsViewController.m @@ -25,7 +25,7 @@ // CFShow((__bridge CFTypeRef)(infoDic)); NSString *app_Version=[infoDic objectForKey:@"CFBundleShortVersionString"]; NSLog(@"app_Version%@",app_Version); - app_Version=@"4.7.4"; + app_Version=@"4.7.5"; NSString *versionStr = [NSString stringWithFormat:@"v%@",app_Version]; NSString *buildVersion = [infoDic objectForKey:@"CFBundleVersion"]; if (buildVersion.length > 0) { diff --git a/Ifish/controllers/IfishTabControllers/探索/shopCertification/ShopCertifyCheckViewController.m b/Ifish/controllers/IfishTabControllers/探索/shopCertification/ShopCertifyCheckViewController.m index 5131a43..2f4d022 100644 --- a/Ifish/controllers/IfishTabControllers/探索/shopCertification/ShopCertifyCheckViewController.m +++ b/Ifish/controllers/IfishTabControllers/探索/shopCertification/ShopCertifyCheckViewController.m @@ -21,12 +21,12 @@ self.statusImg.image = [UIImage imageNamed:@"shop_certifycheck"]; self.statuesViewBtn.hidden = YES; - NSString *titleStr=@"工作人员正在审核,请耐心等待。详情电话:021-54131006"; + NSString *titleStr=@"工作人员正在审核,请耐心等待。详情电话:18667812003"; NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:titleStr]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; //[paragraphStyle setLineSpacing:8]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, titleStr.length)]; - [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:NSMakeRange(20,12)]; + [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:NSMakeRange(20,11)]; self.statysLabel.userInteractionEnabled = YES; [self.statysLabel setAttributedText:attributedString]; UITapGestureRecognizer *labelTapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labelTouchUpInside:)]; @@ -43,7 +43,7 @@ //拨打电话 if ([UIApplication instancesRespondToSelector:@selector(canOpenURL:)]) { - NSString *telNumber = [NSString stringWithFormat:@"telprompt://%@",@"021-54131006"]; + NSString *telNumber = [NSString stringWithFormat:@"telprompt://%@",@"18667812003"]; NSURL *aURL = [NSURL URLWithString: telNumber]; diff --git a/Ifish/controllers/IfishTabControllers/设备/FormatTankAddCamera.h b/Ifish/controllers/IfishTabControllers/设备/FormatTankAddCamera.h index c1abb40..5731375 100644 --- a/Ifish/controllers/IfishTabControllers/设备/FormatTankAddCamera.h +++ b/Ifish/controllers/IfishTabControllers/设备/FormatTankAddCamera.h @@ -15,6 +15,7 @@ @property (nonatomic,copy) NSString *imgeaName; @property (nonatomic,copy) NSString *deviceName; @property (nonatomic,strong) DeviceModel *device; +@property (nonatomic,strong) NSMutableArray *list;//设备列表 @property (nonatomic,strong) IfishCameraModel *camera; @end diff --git a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/FishSelectDeviceListViewCell.m b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/FishSelectDeviceListViewCell.m index a4ff878..fabad99 100644 --- a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/FishSelectDeviceListViewCell.m +++ b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/FishSelectDeviceListViewCell.m @@ -26,6 +26,9 @@ self.deviceImg.image = [UIImage imageNamed:@"加热系统"]; } else if (indexPath.row ==3){ + self.deviceImg.image = [UIImage imageNamed:@"智能宠物系统"]; + } + else if (indexPath.row ==4){ self.deviceImg.image = [UIImage imageNamed:@"敬请期待"]; } diff --git a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m index 16dc45c..1feb25c 100644 --- a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m +++ b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m @@ -86,7 +86,7 @@ extern BOOL isfromCameraView; -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ - return 4; + return 5; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ @@ -102,7 +102,7 @@ extern BOOL isfromCameraView; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ - return 378/2.0; + return 278/2.0; } - (void)didReceiveMemoryWarning { @@ -126,10 +126,10 @@ extern BOOL isfromCameraView; { //摄像头 NSArray * cameraArr =[[DataCenter defaultDtacenter]valueForKey:@"cameraArr"]; - if ([cameraArr count]>=5) { - [self.view makeToast:@"设备已达上限"]; - return; - } +// if ([cameraArr count]>=5) { +// [self.view makeToast:@"设备已达上限"]; +// return; +// } if ( [GWP2PClient sharedClient].linkStatus==P2PLinkStatusOK) { @@ -156,12 +156,12 @@ extern BOOL isfromCameraView; //水族箱 NSArray * deviceArr =[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"]; - if ([deviceArr count]>=5) { - - [self.view makeToast:@"设备已达上限"]; - return; - - } +// if ([deviceArr count]>=5) { +// +// [self.view makeToast:@"设备已达上限"]; +// return; +// +// } self.hidesBottomBarWhenPushed = YES; ConAquarMethodVC *methodVC = InitObject(ConAquarMethodVC); methodVC.deviceType=DEVICEAQUARIUM; @@ -190,6 +190,25 @@ extern BOOL isfromCameraView; //[self.view makeToast:@"敬请期待"]; 加热棒 + } + break; + case 3: + { + + self.hidesBottomBarWhenPushed = YES; + ConAquarMethodVC *methodVC = InitObject(ConAquarMethodVC); + methodVC.deviceType=DEVICEPETS; + methodVC.titleString=@"连接宠物笼"; + + [self.navigationController pushViewController:methodVC animated:YES]; + + // SecondConnectWifiController *wifivc=[[SecondConnectWifiController alloc]init]; + // wifivc.vcTitle=@"连接加热器"; + // [self.navigationController pushViewController:wifivc animated:YES]; + // [wifivc addTitleViewWithTitle:@"连接加热器"]; + //[self.view makeToast:@"敬请期待"]; 加热棒 + + } break; diff --git a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m index 236a04e..201d9a5 100644 --- a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m +++ b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m @@ -43,6 +43,10 @@ #import "PushMessageModel.h" #import "IfishInformationListViewCell.h"//资讯 #import "JHRefresh.h"//refresh +#import "PetStoresViewController.h" +#import "StoreNameView.h" +#import "ConnectingAquarVC.h" +#import "SecondConnectWifiController.h" @interface IfishDeviceViewController () @property(nonatomic,strong)UITableView *tableView; @@ -52,6 +56,7 @@ @property(nonatomic,strong) DXPopover *popover; @property(nonatomic,strong) NSArray *cameraArr; +@property(nonatomic,strong) NSMutableDictionary *petStores; @property(nonatomic,strong) UIButton*rightButton; @@ -261,7 +266,11 @@ Assign BOOL isPush; } NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2]; [weakSelf.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationNone]; - } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + weakSelf.tableView.backgroundColor = RGB(10, 18, 177); + + }); + } [weakSelf endRefreshing]; } failure:^(NSError *err) { [weakSelf endRefreshing]; @@ -373,18 +382,47 @@ Assign BOOL isPush; //设备信息 NSArray*deviceArray=dataDic[@"device"]; NSArray*cameraA=dataDic[@"camera"]; + //宠物店 + NSMutableDictionary*petStores=[NSMutableDictionary dictionary]; NSMutableArray *deviceArr = [[NSMutableArray alloc] init]; if ([deviceArray count]!=0) { for (NSDictionary*deviceDic in deviceArray) { DeviceModel*devicemodel=[[DeviceModel alloc] initWithDict:deviceDic]; - [deviceArr insertObject:devicemodel atIndex:0]; + + if ([devicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F])//宠物笼 + + { + + NSString*storeName=devicemodel.storeName; + if ([storeName isKindOfClass:[NSNull class]]||([storeName isKindOfClass: [NSString class]]&&storeName.length==0)) { + storeName=@"宠物店"; + } + NSMutableArray*array=petStores[storeName]; + if (!array) { + array=[NSMutableArray array]; + + } + [array insertObject:devicemodel atIndex:0]; + + petStores[storeName]=array; + } + + + { + [deviceArr insertObject:devicemodel atIndex:0]; + } + } } [[DataCenter defaultDtacenter]setValue:deviceArr forKey:@"deviceInfo"]; + + self.petStores=petStores; + [[DataCenter defaultDtacenter]setValue:petStores forKey:@"petStores"]; + //存储摄像头设备信息 NSMutableArray *camras = [[NSMutableArray alloc] init]; if (cameraA .count !=0) { @@ -425,6 +463,7 @@ Assign BOOL isPush; [weakSelf refreshUI]; + }else{ [weakSelf.view makeToast:@"户数据获取失败"]; @@ -805,10 +844,12 @@ Assign BOOL isPush; self.deviceArr =[dataContorl getallDevices]; self.cameraArr =[dataContorl getallCameras]; + self.petStores= [[DataCenter defaultDtacenter]valueForKey:@"petStores"]; [self getTotalDeviceArrWith:self.deviceArr addCameraArr:self.cameraArr]; [self.tableView reloadData]; [self getUsernameAddImg]; + } -(void)getTotalDeviceArrWith:(NSArray *)deivceArr addCameraArr:(NSArray *)cameraArr; @@ -820,12 +861,17 @@ Assign BOOL isPush; } for (DeviceModel *device in deivceArr) { - FormatTankAddCamera *deviceListModel =[[FormatTankAddCamera alloc] init]; - deviceListModel.device = device; - deviceListModel.type = @"tank"; - deviceListModel.deviceName = device.showName; - deviceListModel.imgeaName = @"home_iocn_aquarium"; - [self.totalArr addObject:deviceListModel]; + + if (![device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + FormatTankAddCamera *deviceListModel =[[FormatTankAddCamera alloc] init]; + deviceListModel.device = device; + deviceListModel.type = @"tank"; + deviceListModel.deviceName = device.showName; + deviceListModel.imgeaName = @"home_iocn_aquarium"; + [self.totalArr addObject:deviceListModel]; + + } } @@ -839,6 +885,16 @@ Assign BOOL isPush; [self.totalArr addObject:deviceListModel]; } + for (NSString *store in self.petStores) { + FormatTankAddCamera *deviceListModel =[[FormatTankAddCamera alloc] init]; + deviceListModel.list = self.petStores[store]; + deviceListModel.type = @"pets"; + deviceListModel.deviceName = store; + deviceListModel.imgeaName = @"petsImage"; + [self.totalArr addObject:deviceListModel]; + + } + } @@ -1184,7 +1240,48 @@ Assign BOOL isPush; [[Socketsingleton sharedInstance] cutOffSocket]; [[IfishDataUnity shareDataInstance] initAppCenterVcWith:model.device addWithdissMisVc:nil]; - }else if ([model.type isEqualToString:@"camera"]){ + } + else if ([model.type isEqualToString:@"pets"]) + { +// PetStoresViewController*store=[[PetStoresViewController alloc]init]; +// store.store=model; + [[DataCenter defaultDtacenter] setValue:model forKey:@"currentStore"]; + + DeviceModel*pushDevice=nil; + NSString*macid=[[DataCenter defaultDtacenter].cache stringForKey:@"currentPetDevice"]; + if (macid.length) + { + BOOL find=NO; + for (DeviceModel*de in model.list) { + if ([macid isEqualToString:de.macAddress]) + { + find=YES; + pushDevice=de; + break; + } + } + + if (find) + { + + } + else + { + pushDevice=model.list.firstObject; + } + } + else + { + pushDevice=model.list.firstObject; + } + + [[DataCenter defaultDtacenter].cache setString:pushDevice.macAddress forKey:@"currentPetDevice"]; + [[Socketsingleton sharedInstance] cutOffSocket]; + [[IfishDataUnity shareDataInstance] initAppCenterVcWith:pushDevice addWithdissMisVc:nil]; + + + } + else if ([model.type isEqualToString:@"camera"]){ // self.hidesBottomBarWhenPushed = YES; // IfishP2PPlayBackListViewController *cameraShopVC=[[IfishP2PPlayBackListViewController alloc]init]; @@ -1283,7 +1380,13 @@ Assign BOOL isPush; [self delectTankWith:deviceListModel AtIndexPath:indexPath]; - }else{ + } + else if ([deviceListModel.type isEqualToString:@"pets"]) { + + [self delectTankWith:deviceListModel AtIndexPath:indexPath]; + + } + else{ //camera @@ -1393,14 +1496,34 @@ Assign BOOL isPush; mannager.responseSerializer=[AFHTTPResponseSerializer serializer]; NSMutableDictionary * para = [NSMutableDictionary dictionary]; - NSString *priId=deviceListModel.device.deviceId; - ; - NSString*userId=deviceListModel.device.userId; + NSString*string=[NSString stringWithFormat:@"%@/api/user/deleteDeviceUser.do",JIEKOUPORT]; + + + if ([deviceListModel.type isEqualToString:@"pets"]) { + string=[NSString stringWithFormat:@"%@/api/user/deletePetDeviceUser.do",JIEKOUPORT]; + DeviceModel*model=[deviceListModel.list firstObject]; + NSString *priId=model.deviceId; + ; + NSString*userId=model.userId; + para[@"userId"]=userId; + para[@"deviceId"]=priId; + + + + } + else + { + NSString *priId=deviceListModel.device.deviceId; + ; + NSString*userId=deviceListModel.device.userId; + + [para setValue:priId forKey:@"priId.deviceId"]; + [para setValue:userId forKey:@"priId.userId"]; + } - [para setValue:priId forKey:@"priId.deviceId"]; - [para setValue:userId forKey:@"priId.userId"]; __weak typeof (self)weakSelf=self; - [mannager POST:kDeleteDeviceUser parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) { + + [mannager POST:string parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) { if (responseObject) { NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil]; @@ -1446,9 +1569,10 @@ Assign BOOL isPush; [weakSelf.tableView reloadData]; }); + [weakSelf addDataRequestQueue]; /* - 而如果有循环的调用的话,可以用dispatch_source_set_timer来实现 用到GCD的事件源和事件监听的机制 + 而如果有循环的调用的话,可以用dispatch_source_set_timer来实现 用到GCD的事件源和事件监听的机制 int interval = 2; int leeway = 0; @@ -1547,7 +1671,7 @@ Assign BOOL isPush; } NSIndexSet *asset = [NSIndexSet indexSetWithIndex:2]; - [weskSelf.tableView reloadSections:asset withRowAnimation:UITableViewRowAnimationNone]; + [weskSelf.tableView reloadSections:asset withRowAnimation:UITableViewRowAnimationAutomatic]; } [weskSelf.progressHud hide:YES]; @@ -1577,7 +1701,7 @@ Assign BOOL isPush; //rect.size.height = - offsetY; //self.tabDowloadHoldView.frame = rect; - self.tableView.backgroundColor = RGB(10, 18, 177); + } } diff --git a/Ifish/controllers/IfishTabControllers/设备/Informations/View/IfishInformationListViewCell.xib b/Ifish/controllers/IfishTabControllers/设备/Informations/View/IfishInformationListViewCell.xib index 543769d..5cd6bc9 100644 --- a/Ifish/controllers/IfishTabControllers/设备/Informations/View/IfishInformationListViewCell.xib +++ b/Ifish/controllers/IfishTabControllers/设备/Informations/View/IfishInformationListViewCell.xib @@ -1,12 +1,11 @@ - - + + - - + @@ -20,14 +19,14 @@ - + - + - + - + @@ -105,6 +104,11 @@ + + + + + diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m index de19555..5b4db33 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m @@ -64,6 +64,7 @@ #import "RuiMeiSetViewController.h" #import "Xuanduo2SettingController.h" #import "MessageAlertView.h" +#import "CreatErWeiMaController.h" //上部分视频封装 下部分分段控制器 封装 (下一步代码优化) @interface IfishP2PMonitorController () { @@ -347,12 +348,13 @@ Strong UIImage *screenShotImage;//截图 }); } ready:^{ - [self.view makeToast:@"连接成功"]; + //呼叫成功操作 NSLog(@"连接摄像头成功 当前所在线程为%@",[NSThread currentThread]); //隐藏呼叫中的UI dispatch_async(dispatch_get_main_queue(), ^{ //隐藏旋转按钮 + [self.view makeToast:@"连接成功"]; [weakSelf hiddenMonitoringUI:YES callWithErrorType:100 isReCall:NO]; // [weakSelf didHiddenMonitorUIWith:YES]; @@ -583,7 +585,47 @@ Strong UIImage *screenShotImage;//截图 CGFloat controlSegY= CGRectGetMaxY(self.canvasView.frame); IifshSegmentView *seg = [[IifshSegmentView alloc] initWithFrame:CGRectMake(0.0, controlSegY,kScreenSize.width, segMentH)]; seg.segDelegate = self; - [seg initleftTitle:@"摄像头" addRightTitle:@"水族箱" isSelectStyle:YES]; + NSString*title=@"水族箱"; + NSArray*devicearray=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"]; + + BOOL contain3F=NO; + BOOL contain2F=NO; + + for (DeviceModel*model in devicearray) + { + if ([model.type isEqualToString:DECICE_TYPE_XUANDUO2F]) + { + contain2F=YES; + } + if ([model.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + contain3F=YES; + } + + } + + if (contain2F) + { + if (contain3F) + { + title=@"设备"; + } + else + { + title=@"水族箱"; + } + } + else if(contain3F) + { + title=@"宠物笼"; + + } + else + { + title=@"水族箱"; + } + + [seg initleftTitle:@"摄像头" addRightTitle:title isSelectStyle:YES]; self.segControl = seg; [self.view addSubview:seg]; @@ -629,6 +671,11 @@ Strong UIImage *screenShotImage;//截图 [weakSelf delectCamera]; }else if (tag == 2){ + //删除摄像头 + [weakSelf fenXiangSheBei]; + + } + else if (tag == 3){ //检查设备更新 if ([weakSelf.player isPlaying]) { @@ -665,8 +712,8 @@ Strong UIImage *screenShotImage;//截图 [self.view addSubview:self.popView]; NSArray *titleImgs =nil; NSArray *titles=nil; - titleImgs = @[@"ifishdropview_edite_device",@"ifishdropview_delect_device",@"equipment_icon_equipmentupdate"]; - titles=@[@"修改名称",@"删除设备",@"设备升级"]; + titleImgs = @[@"ifishdropview_edite_device",@"ifishdropview_delect_device",@"Ifish_share_device",@"equipment_icon_equipmentupdate"]; + titles=@[@"修改名称",@"删除设备",@"分享设备",@"设备升级"]; [self.popView loadInfoWithTitle:titles Icons:titleImgs]; } @@ -747,6 +794,15 @@ Strong UIImage *screenShotImage;//截图 [self presentViewController:ac2 animated:YES completion:nil]; } +-(void)fenXiangSheBei{ + + CreatErWeiMaController*vc=[[CreatErWeiMaController alloc]init]; + vc.isNewdevice = YES; + vc.deviceid=self.contact.cameraId; + + [self.navigationController pushViewController:vc animated:YES]; + +} -(void)deleteCameraAtRequset{ @@ -998,14 +1054,14 @@ Strong UIImage *screenShotImage;//截图 }else{ UIButton *notbindBtn=[UIButton buttonWithType:UIButtonTypeCustom]; - NSString *title=@"您暂未绑定水族箱,前往绑定。"; + NSString *title=@"您暂未绑定水族箱或宠物笼,前往绑定。"; [notbindBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:title]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; - [paragraphStyle setLineSpacing:8]; + [paragraphStyle setLineSpacing:12]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [title length])]; - [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(9,4)]; - [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,9)]; + [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(13,4)]; + [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,13)]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange([title length]-1,1)]; [notbindBtn setAttributedTitle:attributedString forState:UIControlStateNormal]; [notbindBtn sizeToFit]; @@ -2211,7 +2267,15 @@ Strong UIImage *screenShotImage;//截图 [[Socketsingleton sharedInstance] cutOffSocket]; [AppDelegate sharedDefault].canFullScreen = NO; //改 tab 栏后新增 - [self setAppTabRoot]; + if ([self.navigationController.viewControllers firstObject]==self) + { + [self setAppTabRoot]; + } + else + { + [self.navigationController popViewControllerAnimated:YES]; + } + } @@ -4208,35 +4272,60 @@ GWP2PCallErrorNotSupport, -(void)selectXuanduo2Index:(NSIndexPath *)index withBackModel:(Xuanduo2Model *)backModel{ if (backModel) { - if (index.row == 3) { - //循环泵 - manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; - [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; - NSString*switchString=manulModel.description; - manulModel.lightNumber = @"04"; - if([[backModel.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) - { - manulModel.switchBtn = @"01"; - }else{ - UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"确认关闭循环泵?" preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil]; - UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - manulModel.switchBtn = @"00"; - manulModel.crc16Str = @"0000"; - NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; - NSData*manulData=[dataContorl stringToHexData:switchString2]; - [[Socketsingleton sharedInstance] soketWriteData:manulData]; - }]; - [alertController addAction:cancelAction]; - [alertController addAction:sureAction]; - [self.navigationController presentViewController:alertController animated:YES completion:nil]; - return; - } + if (index.row == 3) + { + if ([backModel isKindOfClass:[Xuanduo2Model class]]) { + //循环泵 + manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; + [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; + NSString*switchString=manulModel.description; + manulModel.lightNumber = @"04"; + if([[backModel.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + { + manulModel.switchBtn = @"01"; + }else{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"确认关闭循环泵?" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil]; + UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + manulModel.switchBtn = @"00"; + manulModel.crc16Str = @"0000"; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + [[Socketsingleton sharedInstance] soketWriteData:manulData]; + }]; + [alertController addAction:cancelAction]; + [alertController addAction:sureAction]; + [self.navigationController presentViewController:alertController animated:YES completion:nil]; + return; + } + manulModel.crc16Str = @"0000"; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + [[Socketsingleton sharedInstance] soketWriteData:manulData]; + } + else + { + //循环泵 + Xuanduo3fModel*backModel=backModel; manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; + [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; + NSString*switchString=manulModel.description; + manulModel.lightNumber = @"01"; + if([[backModel.light substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + { + manulModel.switchBtn = @"01"; + }else + { + manulModel.switchBtn = @"00"; + } + + manulModel.crc16Str = @"0000"; - NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; - NSData*manulData=[dataContorl stringToHexData:switchString2]; - [[Socketsingleton sharedInstance] soketWriteData:manulData]; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + [[Socketsingleton sharedInstance] soketWriteData:manulData]; + + } }else { _xuanduoPicView=[[HaveHotCoolWenDuPicview alloc] init]; _xuanduoPicView.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm index f6a534c..37d93c9 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm @@ -31,6 +31,7 @@ #import "MyMD5.h" #import "IfishUserDataUnity.h" #import "DeviceCameraModel.h" +#import "ConAquarChooseWiFiVC.h" typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { lodingViewdissMissSuccsess=0,// default is 0 lodingViewdissMissfail, @@ -43,6 +44,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { } @property (strong,nonatomic) NSMutableDictionary *addresses; +@property (strong,nonatomic) NSMutableDictionary *linkDict; @property (nonatomic,strong) UIButton *sBtn; @property(nonatomic)BOOL autodismiss; @property(nonatomic,assign)lodingViewdissMissStyle lodviewMissStyle; @@ -66,8 +68,10 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { //智能联机 self.isDeviceLinkIn = NO; [GWP2PDeviceLinker shareInstance].delegate=self; + self.deviceID=nil; //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillEnterForeground:) name:Noti_WillEnterForeground object:nil]; self.addresses = [[NSMutableDictionary alloc] initWithCapacity:1]; + self.linkDict = [[NSMutableDictionary alloc] initWithCapacity:1]; self.view.backgroundColor = [UIColor whiteColor]; [self addTitleViewWithTitle:@"连接摄像头"]; [self initComponent]; @@ -323,6 +327,12 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 [alert show]; return; } + if ([self.wifiName.uppercaseString isEqualToString:@"WLAN"]) { + UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"" message:@"获取到的WiFi无效" delegate:nil cancelButtonTitle:@"重试" otherButtonTitles:nil, nil]; + alert.tag=3; + [alert show]; + return; + } BOOL isRight =[dataContorl isIncludeSpecialCharact:self.wifiSecFiled.text]; if (!isRight) { @@ -396,8 +406,8 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 */ - (void)p2pDeviceLinker:(GWP2PDeviceLinker *)linker deviceLinkSuccess:(NSDictionary *)deviceDict { -// NSLog(@"扫描到设备"); -// [self deviceLinkin:deviceDict linkType:self.conectType]; + NSLog(@"扫描到设备"); + [self deviceLinkin:deviceDict linkType:self.conectType]; } -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ @@ -440,21 +450,26 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 } } + }//重试wifi + else if (alertView.tag==3){ + + [self initComponent]; } } -(void)deviceLinkin:(NSDictionary*)deviceDict linkType:(NSInteger)type { NSLog(@"声波配网成功,返回数据:%@",deviceDict); - if (self.isDeviceLinkIn) { - return; - } NSString *deviceID = [deviceDict[@"deviceID"] stringValue]; NSString *deviceIP = deviceDict[@"deviceIP"]; + if ([self.linkDict[deviceID] boolValue]) { + return; + } + //AP配网时有值 smart没有值 if ([self.deviceID isEqualToString:deviceID]||self.deviceID==nil) { - self.isDeviceLinkIn = YES; + if (type==conectType_Intelligent) { [self.view makeToast:@"声波配网成功"]; @@ -463,20 +478,30 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 else { [self.view makeToast:@"AP配网成功"]; - [[GWP2PDeviceLinker shareInstance] p2pStopAPLink]; } - + [[GWP2PDeviceLinker shareInstance] p2pStopAPLink]; + + } + // NSString *devicePassword = deviceDict[@"devicePassword"]; self.deviceID = deviceID; + self.linkDict[deviceID]=@(YES); [self resetPassWord];//初始化密码 if (![deviceDict[@"isInitPassword"] boolValue]){ //设备没有初始化密码,设置密码 [[GWP2PClient sharedClient] setDeviceInitialPassword:self.lastSetPassword withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary *dataDictionary) { NSLog(@"success:%i %@",success,dataDictionary); [self resetPassWord];//初始化密码 - [self bindCameraDevice]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self bindCameraDevice]; + + }); }]; }else{//如果已经设置过初始密码,则直接使用 - [self bindCameraDevice]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self bindCameraDevice]; + + }); } } @@ -485,20 +510,31 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 -(void)deviceLinkinTimeout:(NSInteger)type { // - if (!self.isDeviceLinkIn) {//90秒之后还未连接上,连接超时 - + if (self.deviceID.length&&![self.linkDict[self.deviceID] boolValue]) {//90秒之后还未连接上,连接超时 + [[GWP2PDeviceLinker shareInstance] p2pStopSmartLink]; [[GWP2PDeviceLinker shareInstance] p2pStopAPLink]; - [self connectNormalView]; + if ([[[CommonUtils getSSIDInfo] objectForKey:@"SSID"] isEqualToString:self.wifiName]) { - [self.view makeToast:[NSString stringWithFormat:@"请确认手机已经连接到%@",self.wifiName]]; + [self.view makeToast:@"请确保Wifi密码正确,重置设备后再试!"]; } else { - [self.view makeToast:@"WiFi连接失败"]; + [self.view makeToast:[NSString stringWithFormat:@"WiFi连接失败,请确保手机连接到%@",self.wifiName]]; } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + + [self.navigationController popViewControllerAnimated:YES]; + }); } + else if(!self.deviceID.length) + { + [self.view makeToast:@"获取设备ID失败"]; + [[GWP2PDeviceLinker shareInstance] p2pStopSmartLink]; + [[GWP2PDeviceLinker shareInstance] p2pStopAPLink]; + [self connectNormalView]; + } } -(void)apLinkConnect { @@ -518,7 +554,7 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 { weakSelf.deviceID=deviceId; - // [weakSelf.view makeToast:[NSString stringWithFormat:@"设备即将连接网络,请将手机重新连接到%@",weakSelf.wifiName]]; + [weakSelf.view makeToast:[NSString stringWithFormat:@"设备即将连接网络,请将手机自动重新连接到%@",weakSelf.wifiName]]; } @@ -537,9 +573,23 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 } //智能联机 -(void)smartLinkConnect{ + + + //拿到AVAudioSession的单例对象 + AVAudioSession *audioSession = [AVAudioSession sharedInstance]; + + //设置为听筒模式 + //[audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:nil]; + + //设置为公放模式 + [audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil]; + + //让我的App占用听筒或扬声器 + [audioSession setActive:YES error:nil]; WEAK_SELF; [[GWP2PDeviceLinker shareInstance] p2pStopSmartLink]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(100 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [[GWP2PDeviceLinker shareInstance] p2pStopSmartLink]; [self deviceLinkinTimeout:self.conectType]; }); [[GWP2PDeviceLinker shareInstance] p2pSmartLinkDeviceWithWiFiSSID:weakSelf.wifiName password:weakSelf.wifiPwd useSimpleConfig:YES deviceLinkIn:^(NSDictionary *deviceDict) { @@ -574,6 +624,7 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 contact.contactType = CONTACT_TYPE_UNKNOWN; [[FListManager sharedFList] insert:contact]; //设置密码成功后爱鱼奇用户绑定摄像头 + [self ifishUserBindcameraIdBy:self.deviceID]; } diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m index cdf2df2..6b0a4ed 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m @@ -10,6 +10,7 @@ #import "IfishDeviceInfo.h" #import "RuSunGuiDeng.h" #import "XuanduoHuliModel.h" +#import "xuanduo3fModel.h" @implementation BootomViewSoketBackMasgConreol @@ -30,7 +31,7 @@ }else if (str.length == IFISH_BACKMASGTYAP57){ //两空四定时器 返回57 字节时 - str=[str substringWithRange:NSMakeRange(88,IFISH_TEMPERATURE_BYTE2)]; + str=[str substringWithRange:NSMakeRange(88,IFISH_TEMPERATURE_BYTE2)]; }else if (str.length == IFISH_BACKMASGTYAP57){ //零控 @@ -84,7 +85,7 @@ }else if ([type isEqualToString:DECICE_TYPE_RUSUN2A]){ //睿芯 86 字节 str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)]; - + }else if ([type isEqualToString:DECICE_TYPE_RUIMEI]){ //瑞美 str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)]; @@ -92,6 +93,9 @@ }else if ([type isEqualToString:DECICE_TYPE_XUANDUO2F]){ str=[str substringWithRange:NSMakeRange(60,IFISH_TEMPERATURE_BYTE2)]; } + else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + str=[str substringWithRange:NSMakeRange(46,IFISH_TEMPERATURE_BYTE2)]; + } UInt64 mac=[dataContorl hexToTen:str]; NSLog(@"%llu",mac); @@ -198,7 +202,7 @@ NSData*manulData=[dataContorl stringToHexData:switchString2]; [[Socketsingleton sharedInstance] soketWriteData:manulData]; - + } +(void)TwoControlCommandSelectorWithBackModel57:(TwoControlBackmsgmodel *)model @@ -246,10 +250,10 @@ +(void)XuToControlCommandSelectorWithBackModel73:(XutoBackMsgModel *)model atindexPath:(NSIndexPath *) indexPath{ - NSInteger index= indexPath.row - 3; - manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; - [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; - NSString*switchString=manulModel.description; + NSInteger index= indexPath.row - 3; + manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; + [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; + NSString*switchString=manulModel.description; if (index == 0) { @@ -307,37 +311,37 @@ indexPath{ }else if (index == 4){ //水泵加热绷 设置代理 在p2p 视频界面实现 -// manulModel.lightNumber = @"05"; -// -// if([[model.waterpump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) -// { -// manulModel.switchBtn = @"01"; -// -// }else{ -// -// manulModel.switchBtn = @"00"; -// } + // manulModel.lightNumber = @"05"; + // + // if([[model.waterpump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + // { + // manulModel.switchBtn = @"01"; + // + // }else{ + // + // manulModel.switchBtn = @"00"; + // } }else if (index == 5){ -// manulModel.lightNumber = @"06"; -// //只显示不可操控 -// if([[model.heatStickState substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) -// { -// manulModel.switchBtn = @"01"; -// -// }else{ -// -// manulModel.switchBtn = @"00"; -// } + // manulModel.lightNumber = @"06"; + // //只显示不可操控 + // if([[model.heatStickState substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + // { + // manulModel.switchBtn = @"01"; + // + // }else{ + // + // manulModel.switchBtn = @"00"; + // } return; } - + manulModel.crc16Str = @"0000"; NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; NSData*manulData=[dataContorl stringToHexData:switchString2]; @@ -517,22 +521,22 @@ indexPath{ }else if (index == 7){ //加热棒 -// if([[model.jiaReBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) -// { -// manulModel.switchBtn = @"01"; -// -// }else{ -// -// manulModel.switchBtn = @"00"; -// } -// -// manulModel.lightNumber = @"08"; + // if([[model.jiaReBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + // { + // manulModel.switchBtn = @"01"; + // + // }else{ + // + // manulModel.switchBtn = @"00"; + // } + // + // manulModel.lightNumber = @"08"; return; } - - + + manulModel.crc16Str = @"0000"; NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; NSData*manulData=[dataContorl stringToHexData:switchString2]; @@ -670,7 +674,7 @@ indexPath{ NSData*manulData=[dataContorl stringToHexData:switchString2]; [[Socketsingleton sharedInstance] soketWriteData:manulData]; - + } +(void)RusunCommandSelectorWithBackMode168:(RunSun84Protocol *)model atindexPath:(NSIndexPath *)indexPath @@ -718,7 +722,7 @@ indexPath{ manulModel.switchBtn = @"00"; } - + }else if (index == 3){ @@ -748,7 +752,7 @@ indexPath{ guidengModel.onOff= @"00"; } - + NSString* guidengOrder=[NSString stringWithFormat:@"%@%@%@",guidengModel.description,guidengModel.onOff,guidengModel.crc16Str]; NSData*guidengData=[dataContorl stringToHexData:guidengOrder]; [[Socketsingleton sharedInstance] soketWriteData:guidengData]; @@ -897,7 +901,7 @@ indexPath{ manulModel.switchBtn = @"01"; }else{ - + manulModel.switchBtn = @"00"; } @@ -927,7 +931,18 @@ indexPath { if (index == 0) { //循环 manulModel.lightNumber = @"04"; - if([[model.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + + NSString*state; + if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + Xuanduo3fModel*xuan3Model=(Xuanduo3fModel*)model; + state=xuan3Model.light; + manulModel.lightNumber=@"01"; + } + else{ + state= model.waterPump; + } + if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) { manulModel.switchBtn = @"01"; @@ -939,6 +954,11 @@ indexPath { }else if (index == 1){ //增氧 manulModel.lightNumber = @"01"; + if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + manulModel.lightNumber=@"02"; + } + if([[model.gasPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) { @@ -953,7 +973,16 @@ indexPath { manulModel.lightNumber = @"02"; - if([[model.light1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + NSString*state; + if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + state=model.uvLamp; + manulModel.lightNumber=@"03"; + } + else{ + state= model.light1; + } + if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) { manulModel.switchBtn = @"01"; @@ -967,7 +996,17 @@ indexPath { manulModel.lightNumber = @"03"; - if([[model.light2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + NSString*state; + if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + state=((Xuanduo3fModel*)model).constTmep; + manulModel.lightNumber=@"04"; + } + else{ + state= model.light2; + } + + if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) { manulModel.switchBtn = @"01"; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h index 4fe9f9f..07478e1 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h @@ -154,7 +154,7 @@ @property(nonatomic,strong) RunSun84Protocol *ruSun84Back; @property (nonatomic, strong) RuiMeiProtocolModel *ruiMeiBack; @property(nonatomic,strong) SongNuoBDProtocol *songNuoBDBack; -@property(nonatomic,strong) Xuanduo2Model *xuanduoBack; +@property(nonatomic,strong) id xuanduoBack; -(void)setTabViewWithFrame:(CGRect)frame; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m index 2342975..c8e2fbc 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m @@ -31,11 +31,13 @@ #import "RuiMeiCHControl.h" #import "Xuanduo2DataUtility.h" #import "NSString+Add.h" +#import "Xuanduo2TimerModel.h" #define ktempTag 600 @implementation MonitorBootmView { NSTimer *_switchTimer; + XuanduoCycleModel * _cycleModel; } -(id)initWithFrame:(CGRect)frame @@ -237,14 +239,14 @@ UIButton *notbindBtn=[UIButton buttonWithType:UIButtonTypeCustom]; - NSString *title=@"您暂无可用的水族箱,前往绑定。"; + NSString *title=@"您暂无可用的水族箱或宠物笼,前往绑定。"; [notbindBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:title]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; - [paragraphStyle setLineSpacing:8]; + [paragraphStyle setLineSpacing:12]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [title length])]; - [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(9,5)]; + [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(13,5)]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,10)]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange([title length]-1,1)]; [notbindBtn setAttributedTitle:attributedString forState:UIControlStateNormal]; @@ -307,7 +309,7 @@ //[headerView setBackgroundColor:XBGAlpha]; [headerView setBackgroundColor:RGB(242, 242, 242)]; UILabel *readLabel=[[UILabel alloc] init ]; - readLabel.text = @"请选择一个水族箱,和摄像头建立关系"; + readLabel.text = @"请选择一个水族箱或宠物笼,和摄像头建立关系"; NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:readLabel.text ]; @@ -392,15 +394,15 @@ self.device = arr[index]; - [self bidDeviceAddCamerawithdeviceId:self.device.deviceId]; + [self bidDeviceAddCamerawithdeviceId:self.device]; } --(void)bidDeviceAddCamerawithdeviceId:(NSString *)deviceId{ +-(void)bidDeviceAddCamerawithdeviceId:(DeviceModel *)device{ NSString *usId =[dataContorl dataControlGetUserIdInfo]; NSNumber *userId =(NSNumber *)usId ; - [AFNOHeaderHttpTool deviceBindCameraWith:self.cameraId userId:userId deviceId:deviceId success:^(id response) { + [AFNOHeaderHttpTool deviceBindCameraWith:self.cameraId userId:userId deviceId:device success:^(id response) { NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil]; @@ -416,7 +418,7 @@ NSArray *devicCameraArr = [[DataCenter defaultDtacenter] valueForKey:@"devicamerArr"]; DeviceCameraModel *devicecamera=[[DeviceCameraModel alloc] init]; devicecamera.cameraId = self.cameraId; - devicecamera.deviceId = deviceId; + devicecamera.deviceId = device.deviceId; NSMutableArray *camerwIdArr = [[NSMutableArray alloc] initWithArray:devicCameraArr]; @@ -445,7 +447,7 @@ for (DeviceModel *model in deviceArry) { - if ([model.deviceId isEqual:deviceId]) { + if ([model.deviceId isEqual:device.deviceId]) { [newArr removeObject:model]; @@ -618,7 +620,11 @@ return 3 + 5; } else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){ return 3 + self.device.controlAmount.integerValue + 1; - }else { + } + else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + return 3 + self.device.controlAmount.integerValue + 1; + } + else { if (self.device.controlAmount.integerValue ==5) { @@ -708,7 +714,32 @@ if (!cell || [cell.templabel.text containsString:@"kwh"]) { return; } - UInt64 mac = [dataContorl hexToTen:_xuanduoBack.electricity]; + Xuanduo2Model*model=_xuanduoBack; + UInt64 mac = [dataContorl hexToTen:model.electricity]; + NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0]; + cell.templabel.font = [UIFont systemFontOfSize:37]; + cell.templabel.textColor = RGB(253, 188, 63); + [cell.templabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:17] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]]; + if (!_switchTimer) { + _switchTimer = [NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(changeTemp) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:_switchTimer forMode:NSRunLoopCommonModes]; + } + }else if(indexPath.row == 2) { + [self.MonitorBottomDelegate didselectXuanduo2SetttngWithData:self.device andBackModel:_xuanduoBack]; + } + } + else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + if (!_xuanduoBack) { + [self makeToast:@"暂未连接"]; + return; + } + if (indexPath.row == 1) { + FishControlSecondCell *cell = [self.collectionView viewWithTag:ktempTag]; + if (!cell || [cell.templabel.text containsString:@"kwh"]) { + return; + } + Xuanduo3fModel*model=_xuanduoBack; + UInt64 mac = [dataContorl hexToTen:model.temperature]; NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0]; cell.templabel.font = [UIFont systemFontOfSize:37]; cell.templabel.textColor = RGB(253, 188, 63); @@ -925,13 +956,13 @@ } [self makeToastActivity:CSToastPositionCenter]; - }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){ + }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]||[self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ // 新绚多 if (!_xuanduoBack) { [self makeToast:@"暂未连接"]; return; } - if (indexPath.row == 10 || indexPath.row == 3) { + if (indexPath.row == 10 || (indexPath.row == 3&&[self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F])) { //点击加热棒 [self.MonitorBottomDelegate selectXuanduo2Index:indexPath withBackModel:_xuanduoBack]; }else{ @@ -1118,10 +1149,17 @@ if (!cell) { return; } - UInt64 mac = [dataContorl hexToTen:_xuanduoBack.waterTemperature]; - NSLog(@"%llu",mac); - //float TPlabel=mac/10+(mac%10)*0.1; - float temp = mac/10.0; + UInt64 mac = 0; + NSLog(@"%llu",mac); + if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]) { + Xuanduo2Model*model=(Xuanduo2Model*)_xuanduoBack; + mac=[dataContorl hexToTen:model.waterTemperature]; + } + else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + Xuanduo3fModel*model=(Xuanduo3fModel*)_xuanduoBack; + mac=[dataContorl hexToTen:model.temperature]; + } float temp = mac/10.0; NSString *stringTemp = [NSString stringWithFormat:@"%.1f",temp]; [cell setTemWith:stringTemp]; } @@ -1243,7 +1281,7 @@ [cell setSongNuoBDControBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_songNuoBDBack]; - }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){ + }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]||[self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ if (!_xuanduoBack) { cell.controBtnImg.image = self.btnImgArr[indexPath.row - 3]; [self makeToast:@"连接设备中..."]; @@ -1487,7 +1525,21 @@ [UIImage imageNamed:@"shajun_selected"], [UIImage imageNamed:@"huli_selected"], [UIImage imageNamed:@"jiare_selected"]]; - }else{ + } + else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + self.btnNameArr = @[@"照明",@"换气",@"杀菌",@"恒温"]; + + self.btnImgArr = @[[UIImage imageNamed:@"照明关"], + [UIImage imageNamed:@"换气关"], + [UIImage imageNamed:@"杀菌关"], + [UIImage imageNamed:@"恒温关"]]; + + self.btnOnImgArr = @[[UIImage imageNamed:@"照明开"], + [UIImage imageNamed:@"换气开"], + [UIImage imageNamed:@"杀菌开"], + [UIImage imageNamed:@"恒温开"]]; + } + else{ int controlAmount=[self.device.controlAmount intValue]; @@ -1645,6 +1697,7 @@ -(void)ifishSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err{ NSLog(@"soket错误断开"); + [self hideToastActivity]; } -(BOOL)ifishSocketWillConnect:(AsyncSocket *)sock{ @@ -1686,7 +1739,12 @@ -(void)ifishDeviceLogInSuccees{ - + if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + [self readCycleWithNumber:@"03"]; + + + } } @@ -1700,7 +1758,20 @@ } +-(void)readCycleWithNumber:(NSString*)num +{ + baseModel*readModel=[[baseModel alloc]init]; + readModel.sendmacId =self.device.macAddress; + readModel.resavemacId =self.device.macAddress; + readModel.functionCode=@"19"; + readModel.massagelegth=@"12"; + NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,num,@"0000"]; + + NSData*readData=[dataContorl stringToHexData:readString]; + [[Socketsingleton sharedInstance] soketWriteData:readData]; + +} -(void)judgeBackamsgTaypeWith:(DeviceModel *)devicemoel addData:(NSData *)data{ [self hideToastActivity]; @@ -1799,10 +1870,61 @@ if (!_xuanduoBack) { _xuanduoBack = [[Xuanduo2Model alloc] init]; } - [Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data]; + [Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data type:DECICE_TYPE_XUANDUO2F]; self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_XUANDUO2F]; [self.collectionView reloadData]; - }else{ + }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + // 新绚多 + NSString*string1=[dataContorl dataToHexString:data]; + + NSString *readTimer = [string1 substringToIndex:4]; + + + + + + + + if ([readTimer isEqualToString:@"0119"]) + { + + _cycleModel=[[XuanduoCycleModel alloc]init]; + [Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.device.type]; + if (_cycleModel.lastTime.length) + { + UInt64 mac1=[dataContorl hexToTen:_cycleModel.lastTime]; + + //float TPlabel=mac/10+(mac%10)*0.1; + float temp1 = mac1; + NSString *stringTemp = [NSString stringWithFormat:@"%f℃",temp1]; + UIImage*uvNomal=[UIImage imageNamed:@"杀菌关"]; + uvNomal=[uvNomal imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}]; + + + UIImage*uvsel=[UIImage imageNamed:@"杀菌开"]; + uvsel=[uvsel imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}]; + + + } + } + else + { + if (!_xuanduoBack) { + _xuanduoBack = [[Xuanduo3fModel alloc] init]; + } + [Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data type:self.device.type]; + self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_XUANDUO3F]; + Xuanduo3fModel*model=_xuanduoBack; + //没开的时候取设置的时间 + if ([model.vuPHstatus isEqualToString:@"0000"]&&_cycleModel.lastTime) + { + model.vuPHstatus=_cycleModel.lastTime; + } + [self.collectionView reloadData]; + } + + } + else{ int controlAmount=[devicemoel.controlAmount intValue]; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFirstCell.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFirstCell.m index 79b26ac..0c7b606 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFirstCell.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFirstCell.m @@ -29,6 +29,8 @@ UIView *hengLine=[[UIView alloc] initWithFrame:CGRectMake(0,self.frame.size.height -1,self.frame.size.width, 1)]; hengLine.backgroundColor = shuLine.backgroundColor = JWUIColorFromRGB(0xdddddd); [self addSubview:hengLine]; + [self bringSubviewToFront:self.factoryIcon]; + self.factoryIcon.hidden=NO; } @@ -38,12 +40,18 @@ -(void)intiFactoryImgWith:(DeviceModel *)devicemodel{ - [self.factoryIcon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetLogUrl,devicemodel.logo]] placeholderImage:[UIImage imageNamed:@""]]; + + if (!self.factoryIcon.image) { + self.factoryIcon.image = [UIImage imageNamed:@"brandLogo_hold"]; + } + [self.factoryIcon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetLogUrl,devicemodel.logo]] placeholderImage:[UIImage imageNamed:@"brandLogo_hold"]]; if (!self.factoryIcon) { self.factoryIcon.image = [UIImage imageNamed:@"greenbtn_big"]; } - + [self bringSubviewToFront:self.factoryIcon]; + self.factoryIcon.hidden=NO; + } @end diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.h b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.h index 225f2aa..c457ece 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.h +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.h @@ -18,6 +18,7 @@ #import "RunSun84Protocol.h" #import "RuiMeiProtocolModel.h" #import "Xuanduo2Model.h" +#import "UIImage+WaterMark.h" @interface FishControlFourthCell : UICollectionViewCell diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m index 5e072ef..2513d6c 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m @@ -7,6 +7,7 @@ // #import "FishControlFourthCell.h" +#import "xuanduo3fModel.h" @implementation FishControlFourthCell - (instancetype)initWithFrame:(CGRect)frame{ @@ -258,6 +259,10 @@ atIndex:(NSIndexPath *)indexPath addBackModel:(Xuanduo2Model*)model { + if ([model isKindOfClass:[Xuanduo2Model class]]) + { + + NSInteger index = indexPath.row - 3; if (index == 0) { @@ -307,7 +312,56 @@ addOffArr:imgOffArr]; } - + } + else if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + + Xuanduo3fModel*xuan3fmodel=model; + NSInteger index = indexPath.row - 3; + if (index == 0) { + + NSString*stateString=[xuan3fmodel.light substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + }else if (index == 1){ + + NSString*stateString=[xuan3fmodel.gasPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + + }else if (index == 2){ + + NSString*stateString=[xuan3fmodel.uvLamp substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + UInt64 mac1=[dataContorl hexToTen:xuan3fmodel.vuPHstatus]; + + //float TPlabel=mac/10+(mac%10)*0.1; + NSString *lasttime = [NSString stringWithFormat:@"%lld",mac1]; + NSString *stateString1 = [xuan3fmodel.uvLamp substringWithRange:NSMakeRange(2, 2)]; + if ([stateString1 isEqualToString:@"01"]) { + self.controBtnImg.image=[self.controBtnImg.image imageWaterMarkWithString:lasttime rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:25]}]; + } + + + }else if (index == 3){ + + NSString*stateString=[xuan3fmodel.constTmep substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + UInt64 mac=[dataContorl hexToTen:xuan3fmodel.heatingTemperature]; + + //float TPlabel=mac/10+(mac%10)*0.1; + float temp = mac/10.0; + NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp]; + + self.controBtnImg.image=[ self.controBtnImg.image imageWaterMarkWithString:stringTemp rect:CGRectMake(130, 60, 80, 80) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:25]}]; + + }else + { + NSLog(@"index=%ld",indexPath.row); + } + } } diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m index b3956fe..81f47a9 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m @@ -72,7 +72,7 @@ withdeviceName:(NSString *)nameStr{ - self.deviceNameLabel.text = [NSString stringWithFormat:@"水族箱:%@",nameStr]; + self.deviceNameLabel.text = nameStr; self.deviceNameLabel.textColor = [UIColor blackColor]; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/Constants.h b/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/Constants.h index 5e4d8db..6a924a4 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/Constants.h +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/Constants.h @@ -197,7 +197,8 @@ typedef NS_ENUM(NSUInteger, SmartDeviceType) { DEVICEAQUARIUM , /// 加热 - DEVICEHEATING + DEVICEHEATING, + DEVICEPETS }; #define Ali_Push_APPKey @"26007228" #define Ali_Push_APPSecret @"87c9206424399968ba11a56a9a979cfe" diff --git a/Ifish/controllers/erweima/CreatErWeiMaController.h b/Ifish/controllers/erweima/CreatErWeiMaController.h index f255d41..7868c5a 100644 --- a/Ifish/controllers/erweima/CreatErWeiMaController.h +++ b/Ifish/controllers/erweima/CreatErWeiMaController.h @@ -14,6 +14,8 @@ @property (weak, nonatomic) IBOutlet UIImageView *erWeiMaView; @property (nonatomic,strong) DeviceModel *erdevicemodel; +@property (nonatomic, strong) NSString *deviceid; +@property (weak, nonatomic) IBOutlet UILabel *tips; @end diff --git a/Ifish/controllers/erweima/CreatErWeiMaController.m b/Ifish/controllers/erweima/CreatErWeiMaController.m index 81999cd..5030cb1 100644 --- a/Ifish/controllers/erweima/CreatErWeiMaController.m +++ b/Ifish/controllers/erweima/CreatErWeiMaController.m @@ -10,6 +10,7 @@ #import "QRCodeGenerator.h" #import "DeviceModel.h" #import "UINavigationBar+Background.h" +#import "IfishDeviceInfo.h" @interface CreatErWeiMaController () @property(nonatomic,strong)NSArray*arry; @end @@ -42,8 +43,33 @@ // } //DeviceModel*model=[_arry objectAtIndex:0];//分享选中设备 - NSString*str=[NSString stringWithFormat:@"deviceId=%@",self.erdevicemodel.deviceId]; + if ([self.erdevicemodel.deviceId isKindOfClass:[NSNumber class]]) { + self.erdevicemodel.deviceId=[NSString stringWithFormat:@"%ld",self.erdevicemodel.deviceId.integerValue]; + } + NSString*type=@"deviceId"; + if ([_erdevicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]) { + type=@"petdeviceId"; + } + else if (self.deviceid.length) + { + type=@"cameraId"; + } + NSString*str=[NSString stringWithFormat:@"%@=%@",type,self.erdevicemodel.deviceId.length?self.erdevicemodel.deviceId:[CommonUtils getNotNilStr:self.deviceid]]; self.erWeiMaView.image=[QRCodeGenerator qrImageForString:str imageSize:self.erWeiMaView.bounds.size.width]; + if ([self.erdevicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + self.tips.text=@"点击扫一扫,和我一起控制我的宠物笼吧!"; + } + else if (self.deviceid) + { + self.tips.text=@"点击扫一扫,和我一起控制我的摄像头吧!"; + } + else if (self.deviceid) + { + self.tips.text=@"点击扫一扫,和我一起控制我的水族箱吧!"; + } + + } - (void)didReceiveMemoryWarning { diff --git a/Ifish/controllers/erweima/CreatErWeiMaController.xib b/Ifish/controllers/erweima/CreatErWeiMaController.xib index ba1e335..cc65b98 100644 --- a/Ifish/controllers/erweima/CreatErWeiMaController.xib +++ b/Ifish/controllers/erweima/CreatErWeiMaController.xib @@ -1,48 +1,51 @@ - - + + + - + + + - + - - + + - - + + + + + - + - - + + - + - - - diff --git a/Ifish/controllers/erweima/ScanViewController.m b/Ifish/controllers/erweima/ScanViewController.m index 903043f..f3ee838 100644 --- a/Ifish/controllers/erweima/ScanViewController.m +++ b/Ifish/controllers/erweima/ScanViewController.m @@ -225,16 +225,24 @@ //deviceId= 水族箱设备标识 NSString*formatSting=[NSString stringWithFormat:@"%@",str]; - NSString*headstring=[formatSting substringWithRange:NSMakeRange(0,9)]; - NSString*deviceIdString=[str substringFromIndex:9]; - if ([headstring isEqualToString:@"deviceId="]){ + NSArray*array=[formatSting componentsSeparatedByString:@"="]; + NSString*headstring=@""; + NSString*deviceIdString=@""; + if (array.count==2) + { + headstring=array[0]; + deviceIdString=array[1]; + } + + //宠物笼 鱼缸 + if ([headstring isEqualToString:@"deviceId"]||[headstring isEqualToString:@"petdeviceId"]){ UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"]; NSArray*arry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"]; NSMutableArray*deviceIdArr=[[NSMutableArray alloc]init]; DeviceModel*deviceModel=[[DeviceModel alloc]init]; if ([arry count]==0) { - [self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString]; + [self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring]; }else{ @@ -256,11 +264,47 @@ }]; }else{ - [self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString]; + [self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring]; } } - }else{ + }//摄像头 + else if ([headstring isEqualToString:@"cameraId"]){ + + UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"]; + NSArray*arry=[dataContorl getallCameras]; +; + NSMutableArray*deviceIdArr=[[NSMutableArray alloc]init]; + + if ([arry count]==0) { + [self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring]; + + }else{ + + + for (IfishCameraModel* cama in arry) { + NSString*string=[NSString stringWithFormat:@"%@",cama.cameraId]; + [deviceIdArr addObject:string]; + + } + + + + BOOL isExst=[deviceIdArr containsObject:deviceIdString]; + if (isExst) { + + [self.view makeToast:@"设备已经存在"]; + [self dismissViewControllerAnimated:YES completion:^{ + + }]; + + }else{ + [self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring]; + } + } + + } + else{ if ([str hasPrefix:@"iFishCamera:"]) { @@ -294,15 +338,39 @@ #pragma mark - 扫一扫 绑定水族箱 //老版本扫一扫 绑定 接口中无请求头 已换新接口 --(void)shareDeviceWithUserId:(NSNumber*)userId addDeviceId:(NSString*)deviceId{ +-(void)shareDeviceWithUserId:(NSNumber*)userId addDeviceId:(NSString*)deviceId type:(NSString*)type{ NSString *userID =[NSString stringWithFormat:@"%@",userId]; - [AFHttpTool shareDeviceWhth:userID deviceId:deviceId success:^(id response) { + + + NSString *url = [NSString stringWithFormat:@"%@",kshareDeviceByQrCode]; + NSDictionary*para=@{ + @"deviceId":deviceId,@"userId":userID + }; + if ([type isEqualToString:@"petdeviceId"]) + { + url=[NSString stringWithFormat:@"%@/api/user/sharePetDeviceByQrCode.do",JIEKOUPORT]; + para=@{ + @"deviceId":deviceId,@"userId":userID + }; + } + else if ([type isEqualToString:@"cameraId"]) + { + url=[NSString stringWithFormat:@"%@/api/user/shareCameraByQrCode.do",JIEKOUPORT]; + para=@{ + @"cameraId":deviceId,@"userId":userID + }; + } + [AFHttpTool requestWihtMethod:RequestMethodTypePost url:url params:para success:^(id response) { NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil]; NSLog(@"result:%@",resultDic[@"result"]); if ([resultDic[@"result"] isEqualToString:@"100"]) { NSMutableArray*deviceArry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"]; + if ([type isEqualToString:@"cameraId"]) + { + deviceArry=[dataContorl getallCameras]; + } [[IfishDataUnity shareDataInstance] addDeviceByQRCodeWithDic:resultDic addWith:deviceArry dismiss:self]; }else if ([resultDic[@"result"] isEqualToString:@"101"]){ [self.view makeToast:@"分享失败"]; @@ -317,6 +385,8 @@ }]; + + } - (void)reStartScan { diff --git a/Ifish/controllers/leftcontrollers/ConnectWifiViewController.m b/Ifish/controllers/leftcontrollers/ConnectWifiViewController.m index ab77476..d4c31e4 100644 --- a/Ifish/controllers/leftcontrollers/ConnectWifiViewController.m +++ b/Ifish/controllers/leftcontrollers/ConnectWifiViewController.m @@ -472,7 +472,18 @@ extern BOOL formLogIn;//连接页面是否来自登录界面 }else if ([resultDic[@"result"] isEqualToString:@"101"]){ - [self showTitle:@"" messsage:@"绑定失败"]; + NSString*msg= resultDic[@"data"]; + + if ([msg isKindOfClass:[NSString class]]&&msg.length&&![msg isEqualToString:@"null"]) + { + + } + else + { + msg=@"绑定失败"; + } + + [self.view makeToast:msg]; self.bakbutton.userInteractionEnabled=YES; }else if ([resultDic[@"result"] isEqualToString:@"301"]){ [self showTitle:@"" messsage:@"请求验证失败,请重新登录"]; diff --git a/Ifish/controllers/leftcontrollers/SaySomethingViewController.xib b/Ifish/controllers/leftcontrollers/SaySomethingViewController.xib index d46ad6d..1fcd97f 100644 --- a/Ifish/controllers/leftcontrollers/SaySomethingViewController.xib +++ b/Ifish/controllers/leftcontrollers/SaySomethingViewController.xib @@ -1,11 +1,9 @@ - - - - - + + + - + @@ -21,21 +19,21 @@ - - + - - - + - - - - - diff --git a/Ifish/controllers/leftcontrollers/SecondConnectWifiController.h b/Ifish/controllers/leftcontrollers/SecondConnectWifiController.h index 516714f..6746cb2 100644 --- a/Ifish/controllers/leftcontrollers/SecondConnectWifiController.h +++ b/Ifish/controllers/leftcontrollers/SecondConnectWifiController.h @@ -8,12 +8,16 @@ #import "BaseViewController.h" #import "LXWaveProgressView.h" +#import "StoreNameView.h" @interface SecondConnectWifiController : BaseViewController @property (weak, nonatomic) IBOutlet UIImageView *wifigifImgView; @property (weak, nonatomic) IBOutlet UILabel *wifiNamelabel; @property (weak, nonatomic) IBOutlet UITextField *wifiTextFiled; @property (weak, nonatomic) IBOutlet UILabel *redTextLable; +@property (nonatomic, strong) UIView *mask; +@property (nonatomic, strong) StoreNameView *storeNameView; +@property (nonatomic, strong) NSString *storeName; - (IBAction)makeSureButton:(id)sender; diff --git a/Ifish/controllers/leftcontrollers/SecondConnectWifiController.m b/Ifish/controllers/leftcontrollers/SecondConnectWifiController.m index cf4f4c0..0c8a5d1 100644 --- a/Ifish/controllers/leftcontrollers/SecondConnectWifiController.m +++ b/Ifish/controllers/leftcontrollers/SecondConnectWifiController.m @@ -16,7 +16,7 @@ #import "ESPTouchTask.h" #import "ESPTouchResult.h" #import "ESPTouchDelegate.h" - +#import "MyMD5.h" #import "ChatroomModel.h" #import "MMProgressHUD.h" #import "MMProgressHUDOverlayView.h" @@ -135,6 +135,7 @@ extern BOOL isfromCameraView; [self creatConnectStateUI]; //获取WiFi名称 [self getSSid]; + } - (void)updateUI { @@ -285,6 +286,12 @@ extern BOOL isfromCameraView; [self.view addSubview:_maclabel]; [self.view bringSubviewToFront:_maclabel]; + self.bakbutton.userInteractionEnabled=YES; + [self mmPogressHUDdismiss]; + [self connectNormalView]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self.view makeToast:@"设备类型不匹配,请重新选择入口绑定"]; + }); } - (void)didReceiveMemoryWarning { @@ -565,7 +572,7 @@ extern BOOL isfromCameraView; NSUInteger count = 0; // max results to be displayed, if it is more than maxDisplayCount, // just show the count of redundant ones - const int maxDisplayCount = 5; + const int maxDisplayCount = 100000; if ([firstResult isSuc]) { @@ -573,7 +580,8 @@ extern BOOL isfromCameraView; NSArray*arry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"]; DeviceModel*model=[[DeviceModel alloc]init]; - if (arry.count<5) { + //if (arry.count<5) + { NSMutableArray*macdressArr=[[NSMutableArray alloc]init]; for (model in arry) { @@ -592,17 +600,25 @@ extern BOOL isfromCameraView; }else{ - [self bindDeviceWithSsid:_deviceBssid]; + if (self.deviceType==DEVICEPETS) { + [self showStoreNameView]; + } + else + { + [self bindDeviceWithSsid:_deviceBssid]; + } + } - }else{ - - [self.view makeToast:@"您的设备数量已超过限制"]; - [self mmPogressHUDdismiss]; - [self connectNormalView]; - - } + } +// else{ +// +// [self.view makeToast:@"您的设备数量已超过限制"]; +// [self mmPogressHUDdismiss]; +// [self connectNormalView]; +// +// } for (int i = 0; i < [esptouchResultArray count]; ++i) @@ -635,6 +651,26 @@ extern BOOL isfromCameraView; } } + else if(firstResult.isCancelled) + { + self.lodviewMissStyle=lodingViewdissMissfail; + [self mmPogressHUDdismiss]; + [self connectNormalView]; + self.bakbutton.userInteractionEnabled=YES; + [self.view makeToast:@"连接被取消"]; + + } + + else if(!esptouchResultArray.count) + { + self.lodviewMissStyle=lodingViewdissMissfail; + [self mmPogressHUDdismiss]; + [self connectNormalView]; + self.bakbutton.userInteractionEnabled=YES; + [self.view makeToast:@"未有设备响应"]; + + } + }); }); @@ -660,11 +696,81 @@ extern BOOL isfromCameraView; } +-(UIView *)mask +{ + if (!_mask) + { + UIView*mask=[[UIView alloc]initWithFrame:self.view.bounds]; + mask.backgroundColor=[UIColor lightGrayColor]; + mask.alpha=0.5; + _mask=mask; + UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissStore)]; + // [mask addGestureRecognizer:tap]; + } + + return _mask; +} +-(void)dismissStore +{ + [self.storeNameView removeFromSuperview]; + [self.mask removeFromSuperview]; + +} +-(void)showStoreNameView +{ + + [self.storeNameView removeFromSuperview]; + StoreNameView*store=[[[NSBundle mainBundle] loadNibNamed:@"StoreNameView" owner:self options:nil] lastObject]; + store.frame=CGRectMake((SCREEN_WIDTH-280)/2.0, 100, 280, 280); + self.storeNameView.center=self.mask.center; + + self.storeNameView=store; + WEAK_SELF; + store.cancelBlock=^(){ + [weakSelf.mask removeFromSuperview]; + [weakSelf.storeNameView removeFromSuperview]; + + }; + store.sureBlock=^(NSString*name) + { + if (!name.length) + { + [weakSelf.view makeToast:@"请设置或者选择名称!"]; + return ; + } + [weakSelf.mask removeFromSuperview]; + [weakSelf.storeNameView removeFromSuperview]; + weakSelf.storeName=name; + [weakSelf bindDeviceWithSsid:_deviceBssid]; + }; + + [self.view addSubview:self.mask]; + [self.view addSubview:self.storeNameView]; + +} #pragma mark 绑定设备 -(void)bindDeviceWithSsid:(NSString*)bssid{ NSLog(@"设备bssid_%@",bssid); NSString *userId = [dataContorl dataControlGetUserIdInfo]; - [AFHttpTool bindDeviceWithUserId:userId macAddress:bssid success:^(id response) { + [AFHttpTool requestWihtMethod:RequestMethodTypePost url:@"" params:@{} success:^(id response) { + + } failure:^(NSError *err) { + + }]; + NSString*url=[NSString stringWithFormat:@"%@%@",kBindDevice,userId]; + NSMutableDictionary*bind=[[NSMutableDictionary alloc]initWithDictionary:@{@"macAddress":bssid}]; + NSString* timestamp=[NSString stringWithFormat:@"%lld",[[NSDate date] timeIntervalSince1970]*1000]; + NSString*token=[MyMD5 md5:[NSString stringWithFormat:@"%@%@ifish8",userId,timestamp]]; + + if (self.deviceType==DEVICEPETS) + { + url=[NSString stringWithFormat:@"%@",[NSString stringWithFormat:@"%@/api/user/bindPetDevice.do",JIEKOUPORT]]; + bind[@"token"]=token; + bind[@"timestamp"]=timestamp; + bind[@"storeName"]=self.storeName.length?self.storeName:@"宠物店"; + bind[@"userId"]=userId; } + + [AFHttpTool requestWihtMethod:RequestMethodTypePost url:url params:bind success:^(id response) { NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil]; NSLog(@"data:%@",resultDic[@"data"]); if ([resultDic[@"result"] isEqualToString:@"100"]) { @@ -733,7 +839,18 @@ extern BOOL isfromCameraView; }else if ([resultDic[@"result"] isEqualToString:@"101"]){ - [self.view makeToast:@"绑定失败"]; + NSString*msg= resultDic[@"data"]; + + if ([msg isKindOfClass:[NSString class]]&&msg.length&&![msg isEqualToString:@"null"]) + { + + } + else + { + msg=@"绑定失败"; + } + + [self.view makeToast:msg]; self.bakbutton.userInteractionEnabled=YES; NSString *str =[NSString stringWithFormat:@"mac%@错误吗101",bssid]; [self initMacIdString:str]; diff --git a/Ifish/controllers/pets/PetStoresViewController.h b/Ifish/controllers/pets/PetStoresViewController.h new file mode 100644 index 0000000..5146a88 --- /dev/null +++ b/Ifish/controllers/pets/PetStoresViewController.h @@ -0,0 +1,19 @@ +// +// PetStoresViewController.h +// Ifish +// +// Created by 祝发冬 on 2020/4/19. +// Copyright © 2020 lianlian. All rights reserved. +// + +#import "BaseViewController.h" +#import "FormatTankAddCamera.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PetStoresViewController : BaseViewController +@property (weak, nonatomic) IBOutlet UITableView *tableView; +@property (nonatomic, strong) FormatTankAddCamera *store;//一个商店的 +@end + +NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/pets/PetStoresViewController.m b/Ifish/controllers/pets/PetStoresViewController.m new file mode 100644 index 0000000..f9c24e2 --- /dev/null +++ b/Ifish/controllers/pets/PetStoresViewController.m @@ -0,0 +1,134 @@ +// +// PetStoresViewController.m +// Ifish +// +// Created by 祝发冬 on 2020/4/19. +// Copyright © 2020 lianlian. All rights reserved. +// + +#import "PetStoresViewController.h" +#import "IfishDataUnity.h" +#import "IfishDeviceInfo.h" + +@interface PetStoresViewController () + +@end + +@implementation PetStoresViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [self addTitleViewWithTitle:self.store.deviceName]; + // Do any additional setup after loading the view from its nib. +} +-(void)addTitleViewWithTitle:(NSString *)title +{ + UIButton*button=[UIButton buttonWithType:UIButtonTypeCustom]; + button.frame=CGRectMake(0, 0, kSizeFrom750(300), 44); + [button setTitle:title forState:UIControlStateNormal]; + button.titleLabel.font=[UIFont systemFontOfSize:19]; + [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [button addTarget:self action:@selector(changeStoreName:) forControlEvents:UIControlEventTouchUpInside]; + + + + self.navigationItem.titleView=button; +} +-(void)changeStoreName:(UIButton*)button +{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"修改名称" message:nil preferredStyle:UIAlertControllerStyleAlert]; + + + //增加确定按钮; + [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + //获取第1个输入框; + UITextField *passTextField = alertController.textFields.firstObject; + + + NSString*name=passTextField.text; + if (name.length) + { + NSString*url=[NSString stringWithFormat:@"%@/api/user/updatePetStore.do",JIEKOUPORT]; + UserModel*model=[dataContorl getUserInfo]; + + + [AFHttpTool requestWihtMethod:RequestMethodTypePost url:url params:@{@"userId":model.userId,@"oldName":self.store.deviceName,@"newName":name} success:^(id response) { + + + NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil]; + NSLog(@"data:%@",resultDic[@"data"]); + ; + if ([resultDic[@"result"] isEqualToString:@"100"]) { + + [self.view makeToast:@"修改成功"]; + self.store.deviceName=name; + [self addTitleViewWithTitle:name]; + [[NSNotificationCenter defaultCenter]postNotificationName:@"updateUserInfobyValidation" object:nil]; + } + else + { + [self.view makeToast:@"修改失败"]; + } + + } failure:^(NSError *err) { + [self.view makeToast:@"修改失败"]; + }]; + } + else + { + [self.view makeToast:@"名字不能为空"]; + } + + + + + }]]; + [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + }]]; + + + + [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { + + textField.text = self.store.deviceName; + + }]; + + [self presentViewController:alertController animated:true completion:nil]; +} + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.store.list.count; +} +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"pets"]; + DeviceModel*model= self.store.list[indexPath.row]; + if (!cell) + { + cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"pets"]; + } + cell.textLabel.text=model.showName; + return cell; +} +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + DeviceModel*model= self.store.list[indexPath.row]; + [[Socketsingleton sharedInstance] cutOffSocket]; + [[IfishDataUnity shareDataInstance] initAppCenterVcWith:model addWithdissMisVc:nil]; + [[DataCenter defaultDtacenter].cache setString:model.macAddress forKey:@"currentPetDevice"]; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/Ifish/controllers/pets/PetStoresViewController.xib b/Ifish/controllers/pets/PetStoresViewController.xib new file mode 100644 index 0000000..8a42c84 --- /dev/null +++ b/Ifish/controllers/pets/PetStoresViewController.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ifish/models/ifishUserModel/DeviceModel.h b/Ifish/models/ifishUserModel/DeviceModel.h index 70f4980..8d1ffc5 100644 --- a/Ifish/models/ifishUserModel/DeviceModel.h +++ b/Ifish/models/ifishUserModel/DeviceModel.h @@ -86,6 +86,7 @@ @property(nonatomic,copy) NSString *userId; @property(nonatomic,copy) NSString *venderDto; +@property (nonatomic, strong) NSString *storeName;//宠物店 // 厂家 信息vender //厂家 diff --git a/Ifish/models/ifishUserModel/DeviceModel.m b/Ifish/models/ifishUserModel/DeviceModel.m index 7ca9f15..1eea044 100644 --- a/Ifish/models/ifishUserModel/DeviceModel.m +++ b/Ifish/models/ifishUserModel/DeviceModel.m @@ -121,6 +121,7 @@ _isPushWendu = dict[@"isPushWendu"]; _venderDto=dict[@"venderDto"]; _deviceIp=dict[@"deviceIp"]; + _storeName=dict[@"storeName"]; if ([_venderDto isEqual:[NSNull null]]) { _venderDto=@""; diff --git a/Ifish/models/ifishUserModel/UserModel.h b/Ifish/models/ifishUserModel/UserModel.h index cb2f88e..9d0a9ce 100644 --- a/Ifish/models/ifishUserModel/UserModel.h +++ b/Ifish/models/ifishUserModel/UserModel.h @@ -8,7 +8,7 @@ #import -@interface UserModel : NSObject +@interface UserModel : NSObject @property(nonatomic,copy)NSString*phoneNumber; @property(nonatomic,strong)NSNumber*userId; diff --git a/Ifish/models/ifishUserModel/UserModel.m b/Ifish/models/ifishUserModel/UserModel.m index 5ca10b6..5bb5b1c 100644 --- a/Ifish/models/ifishUserModel/UserModel.m +++ b/Ifish/models/ifishUserModel/UserModel.m @@ -16,7 +16,7 @@ [aCoder encodeObject:self.nickName forKey:@"nickName"]; [aCoder encodeObject:self.userSex forKey:@"userSex"]; [aCoder encodeObject:self.userImg forKey:@"userImg"]; - [aCoder encodeObject:self forKey:@"signature"]; + [aCoder encodeObject:self.signature forKey:@"signature"]; [aCoder encodeObject:self.P2PVerifyCode1 forKey:@"P2PVerifyCode1"]; [aCoder encodeObject:self.P2PVerifyCode2 forKey:@"P2PVerifyCode2"]; [aCoder encodeObject:self.sessionID forKey:@"sessionID"]; @@ -82,4 +82,5 @@ return self; } + @end diff --git a/Ifish/models/wifiModel/sendmaseegemodel/ReadTimerModel.m b/Ifish/models/wifiModel/sendmaseegemodel/ReadTimerModel.m index 9eee4b3..9344418 100644 --- a/Ifish/models/wifiModel/sendmaseegemodel/ReadTimerModel.m +++ b/Ifish/models/wifiModel/sendmaseegemodel/ReadTimerModel.m @@ -13,7 +13,9 @@ { self.messagetype=@"00"; self.massagelegth=@"12"; - self.functionCode=@"16"; + if (!self.functionCode.length) { + self.functionCode=@"16"; + } return [NSString stringWithFormat:@"%@%@%@%@%@",self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth]; } diff --git a/Ifish/views/IfishPopView/LXPopView.h b/Ifish/views/IfishPopView/LXPopView.h index 55b27a1..ddea168 100644 --- a/Ifish/views/IfishPopView/LXPopView.h +++ b/Ifish/views/IfishPopView/LXPopView.h @@ -13,7 +13,7 @@ @required -(void)disSelectedPopViewIndex:(NSIndexPath *)Index; - +-(UITableViewCell *)tableView:(UITableView *)tableView cellForPopViewIndexPath:(NSIndexPath *)indexPath; @end @@ -30,5 +30,7 @@ @property(nonatomic,strong) NSArray *titles; @property(nonatomic,strong) NSArray *titleImgs; @property(nonatomic,strong) UIImage *backgroundImage; +@property (nonatomic, strong) UIImageView *backImageView; +-(void)changeStyle:(NSString*)style; @end diff --git a/Ifish/views/IfishPopView/LXPopView.m b/Ifish/views/IfishPopView/LXPopView.m index 4d74ee6..39af5ed 100644 --- a/Ifish/views/IfishPopView/LXPopView.m +++ b/Ifish/views/IfishPopView/LXPopView.m @@ -34,6 +34,7 @@ UIImageView *bakc=[[UIImageView alloc] initWithFrame:CGRectMake(0, 10, self.frame.size.width, self.frame.size.height)]; bakc.image = self.backgroundImage; + self.backImageView=bakc; //bakc.backgroundColor = [UIColor redColor]; [self addSubview:bakc]; @@ -56,6 +57,12 @@ [self addSubview:self.tableView]; } +-(void)changeStyle:(NSString*)style +{ + self.backgroundColor=[UIColor whiteColor]; + [self.backImageView removeFromSuperview]; + self.tableView.backgroundColor=[UIColor whiteColor]; +} #pragma mark - Table view data source @@ -77,22 +84,30 @@ { - - PopCell *cell =[tableView dequeueReusableCellWithIdentifier:@"PopCell"]; - - if (!cell) { + UITableViewCell*realcell; + if ([self.delegate respondsToSelector:@selector(tableView:cellForPopViewIndexPath:)]) { + realcell=[self.delegate tableView:tableView cellForPopViewIndexPath:indexPath]; + } + else + { + PopCell *cell =[tableView dequeueReusableCellWithIdentifier:@"PopCell"]; - cell = [[[NSBundle mainBundle] loadNibNamed:@"PopCell" owner:self options:nil]lastObject]; + if (!cell) { + + cell = [[[NSBundle mainBundle] loadNibNamed:@"PopCell" owner:self options:nil]lastObject]; + + } + cell.nametitle.text = self.titles[indexPath.row]; + cell.backgroundColor = [UIColor colorWithRed:40.0/256.0 green:40.0/256.0 blue:40.0/256.0 alpha:1]; + cell.nametitle.textColor = [UIColor whiteColor]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.popViewHeaderImg.image = [UIImage imageNamed:self.titleImgs[indexPath.row]]; + realcell=cell; } - cell.nametitle.text = self.titles[indexPath.row]; - cell.backgroundColor = [UIColor colorWithRed:40.0/256.0 green:40.0/256.0 blue:40.0/256.0 alpha:1]; - cell.nametitle.textColor = [UIColor whiteColor]; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - cell.popViewHeaderImg.image = [UIImage imageNamed:self.titleImgs[indexPath.row]]; - return cell; + return realcell; } diff --git a/Ifish/views/StoreNameView.h b/Ifish/views/StoreNameView.h new file mode 100644 index 0000000..d0ed4d5 --- /dev/null +++ b/Ifish/views/StoreNameView.h @@ -0,0 +1,32 @@ +// +// StoreNameView.h +// Ifish +// +// Created by 祝发冬 on 2020/4/20. +// Copyright © 2020 lianlian. All rights reserved. +// + +#import +#import "LXPopView.h" +#import "DXPopover.h" +#import "AppDelegate.h" +NS_ASSUME_NONNULL_BEGIN + +@interface StoreNameView : UIView +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; +@property (weak, nonatomic) IBOutlet UILabel *createStoreLabel; +@property (weak, nonatomic) IBOutlet UITextField *storeNameField; +@property (weak, nonatomic) IBOutlet UITextField *oldStoreNameField; +@property (weak, nonatomic) IBOutlet UIButton *cancelButton; +@property (weak, nonatomic) IBOutlet UIButton *sureButton; +@property (nonatomic, copy) void(^sureBlock)(NSString*name) ; +@property (nonatomic, copy) void(^cancelBlock)() ; +@property (nonatomic, strong) DXPopover *popover; +@property (weak, nonatomic) IBOutlet UILabel *oldLabel; +@property(nonatomic,strong) UITableView *tableView; +@property (nonatomic, strong) NSArray *titles; +@property (nonatomic, weak) UIViewController *controller; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Ifish/views/StoreNameView.m b/Ifish/views/StoreNameView.m new file mode 100644 index 0000000..b5f1ffb --- /dev/null +++ b/Ifish/views/StoreNameView.m @@ -0,0 +1,156 @@ +// +// StoreNameView.m +// Ifish +// +// Created by 祝发冬 on 2020/4/20. +// Copyright © 2020 lianlian. All rights reserved. +// + +#import "StoreNameView.h" + +@implementation StoreNameView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ +-(void)awakeFromNib +{ + [super awakeFromNib]; + self.layer.borderWidth=0.5; + self.layer.borderColor=[UIColor lightGrayColor].CGColor; + self.titleLabel.layer.borderColor=[UIColor lightGrayColor].CGColor; + self.titleLabel.layer.borderWidth=0.5; + self.storeNameField.layer.borderColor=[UIColor lightGrayColor].CGColor; + self.storeNameField.layer.borderWidth=0.5; + self.autoresizingMask=UIViewAutoresizingNone; + self.autoresizesSubviews=NO; + + + UIButton*more=[UIButton buttonWithType:UIButtonTypeCustom]; + more.frame=CGRectMake(0, 0, 30, 30); + [more setImage:[UIImage imageNamed:@"xialasanjiao"] forState:UIControlStateNormal]; + [more addTarget:self action:@selector(showStoreName:) forControlEvents:UIControlEventTouchUpInside]; + self.oldStoreNameField.layer.borderColor=[UIColor lightGrayColor].CGColor; + self.oldStoreNameField.layer.borderWidth=0.5; + self.oldStoreNameField.delegate=self; + self.oldStoreNameField.clearButtonMode=UITextFieldViewModeAlways; + self.oldStoreNameField.rightViewMode=UITextFieldViewModeAlways; + self.cancelButton.layer.borderColor=[UIColor lightGrayColor].CGColor; + self.oldStoreNameField.rightView=more; + self.cancelButton.layer.borderWidth=0.5; + self.cancelButton.layer.masksToBounds=YES; + self.sureButton.layer.borderColor=[UIColor lightGrayColor].CGColor; + self.sureButton.layer.borderWidth=0.5; + self.sureButton.layer.masksToBounds=YES; + self.sureButton.layer.cornerRadius=5; + self.cancelButton.layer.cornerRadius=5; + [self.sureButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; + [self.cancelButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; + NSDictionary*dict=[[DataCenter defaultDtacenter] valueForKey:@"petStores"]; + NSArray *titles=dict.allKeys; + self.titles=titles; + self.tableView = [[UITableView alloc] init]; + + self.tableView.frame = CGRectMake(0, 0, self.frame.size.width, titles.count>3?3*44:titles.count*44); + //self.tableView.frame = CGRectMake(0,12.0, self.frame.size.width, self.frame.size.height); + self.tableView.delegate = self; + self.tableView.dataSource = self; + + + +} +-(void)click:(UIButton*)buton +{ + [self.popover dismiss]; + if (buton.tag==1) + { + if (self.cancelBlock) { + self.cancelBlock(); + } + + } + else + { + if (self.sureBlock) { + NSString*name; + if (self.storeNameField.text.length) + { + name=self.storeNameField.text; + } + else if(self.oldStoreNameField.text.length) + { + name=self.oldStoreNameField.text; + } + else + { + [self makeToast:@"请输入或者选择名称!"]; + } + if (name.length) { + self.sureBlock(name); + } + + } + + } +} +-(void)showStoreName:(UIButton*)button +{ + + self.tableView.frame = CGRectMake(0, 0, self.frame.size.width-40, self.titles.count>2?2*44:self.titles.count*44); + DXPopover *popover = [DXPopover new]; + self.tableView.layer.masksToBounds=YES; + + self.popover = popover; + self.popover.backgroundColor = [UIColor lightGrayColor]; + self.popover.cornerRadius=10; + popover.arrowSize = CGSizeMake(5,5); + + + [popover showAtPoint:CGPointMake(self.oldStoreNameField.center.x, self.oldStoreNameField.center.y+15) popoverPostion:DXPopoverPositionDown withContentView:self.tableView inView:self]; + + +} + + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + NSString*model= self.titles[indexPath.row]; + self.oldStoreNameField.text=model; + [self.popover dismiss]; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.titles.count; +} +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"storeName"]; + NSString*model= self.titles[indexPath.row]; + if (!cell) + { + cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"storeName"]; + } + cell.textLabel.text=model; + return cell; +} + + + + +-(BOOL)textFieldShouldClear:(UITextField *)textField +{ + + return YES; +} +-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField +{ + return NO; +} + +@end diff --git a/Ifish/views/StoreNameView.xib b/Ifish/views/StoreNameView.xib new file mode 100644 index 0000000..96fa511 --- /dev/null +++ b/Ifish/views/StoreNameView.xib @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ifish/views/mypicView/remindCyclePic.h b/Ifish/views/mypicView/remindCyclePic.h index e9fcf3e..d4f32bc 100644 --- a/Ifish/views/mypicView/remindCyclePic.h +++ b/Ifish/views/mypicView/remindCyclePic.h @@ -23,6 +23,7 @@ @property(nonatomic,copy)NSString*picViewResultString; @property(nonatomic,copy)NSString*picString; +@property (nonatomic, strong) NSString *type; - +-(instancetype)initWithFrame:(CGRect)frame type:(NSString*)type; @end diff --git a/Ifish/views/mypicView/remindCyclePic.m b/Ifish/views/mypicView/remindCyclePic.m index c2b1aad..ace172c 100644 --- a/Ifish/views/mypicView/remindCyclePic.m +++ b/Ifish/views/mypicView/remindCyclePic.m @@ -7,6 +7,7 @@ // #import "remindCyclePic.h" +#import "IfishDeviceInfo.h" #define CANCLE_BTN 100000100 #define SURE_BTN 100000120 @interface remindCyclePic() @@ -17,14 +18,24 @@ self=[super initWithFrame:frame]; if (self) { - [self initPic]; + [self initPictype:nil]; } return self; } --(void)initPic{ - + +-(instancetype)initWithFrame:(CGRect)frame type:(NSString*)type{ + self=[super initWithFrame:frame]; + if (self) { + + [self initPictype:type]; + + } + return self; +} +-(void)initPictype:(NSString*)type { + _type=type; CGFloat imgWid= kScreenSize.width - 40*2; CGFloat imHeight= kScreenSize.width - 60; self.backgroundColor=[UIColor colorWithWhite:0 alpha:0.5]; @@ -35,6 +46,16 @@ _picBackImg.userInteractionEnabled=YES; UILabel*title=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, _picBackImg.frame.size.width-10*2, 20)]; title.text=@"换水天数选择"; + if ([self.type isEqualToString:DECICE_TYPE_XUANDUO3F]) { + title.text=@"杀菌天数选择"; + } + else if ([self.type isEqualToString:@"temp"]) { + title.text=@"恒温设置"; + } + else if ([self.type isEqualToString:@"cycle"]) { + title.text=@"杀菌持续时长"; + } + title.textAlignment=NSTextAlignmentCenter; [_picBackImg addSubview:title]; @@ -86,6 +107,7 @@ } + -(void)dissmissView{ [self removeFromSuperview]; @@ -95,6 +117,14 @@ -(void)dataSource{ _picArr=@[@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50"]]; + if ([self.type isEqualToString:@"temp"]) + { + _picArr=@[@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59",@"60",@"61",@"62",@"63",@"64",@"65",@"66",@"67",@"68",@"69",@"70",@"71",@"72",@"73",@"74",@"75",@"76",@"77",@"78",@"79",@"80"]]; + } + else if ([self.type isEqualToString:@"cycle"]) + { + _picArr=@[@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30"]]; + } } diff --git a/Ifish/views/setViewCell/ChangeWaterCell.h b/Ifish/views/setViewCell/ChangeWaterCell.h index c4f537f..6e631ad 100644 --- a/Ifish/views/setViewCell/ChangeWaterCell.h +++ b/Ifish/views/setViewCell/ChangeWaterCell.h @@ -11,6 +11,7 @@ @interface ChangeWaterCell : UITableViewCell @property (weak, nonatomic) IBOutlet UILabel *huanshuiDaylabel; +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; @property (weak, nonatomic) IBOutlet UIButton *ChangeWaterSwitch; diff --git a/Ifish/views/setViewCell/ChangeWaterCell.xib b/Ifish/views/setViewCell/ChangeWaterCell.xib index 3e9d444..38f503e 100644 --- a/Ifish/views/setViewCell/ChangeWaterCell.xib +++ b/Ifish/views/setViewCell/ChangeWaterCell.xib @@ -1,9 +1,12 @@ - - + + + + + - - + + @@ -12,26 +15,26 @@ - +