删除表盘调试
authorliangzhenying <867174124@qq.com>
Wed, 26 Jun 2024 02:29:50 +0000 (10:29 +0800)
committerliangzhenying <867174124@qq.com>
Wed, 26 Jun 2024 02:29:50 +0000 (10:29 +0800)
Doc/【230】蓝牙手表通讯协议.docx [new file with mode: 0644]
IOTBluetooth/IOTBluetooth/Example/Datas.swift
IOTBluetooth/IOTBluetooth/Example/ViewController.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.pbxproj
IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate
IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAbility.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBManager.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBNotify.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBParser.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBluetooth.swift

diff --git a/Doc/【230】蓝牙手表通讯协议.docx b/Doc/【230】蓝牙手表通讯协议.docx
new file mode 100644 (file)
index 0000000..86a8bf8
Binary files /dev/null and "b/Doc/\343\200\220230\343\200\221\350\223\235\347\211\231\346\211\213\350\241\250\351\200\232\350\256\257\345\215\217\350\256\256.docx" differ
index 145944e..437c280 100644 (file)
@@ -29,10 +29,10 @@ let datas: [(ability: IBAbility, label: String, parameters: [IBParameter])] = [
     (.setClock, "发送闹钟设置", [.clock(IBClock())]),
     
     (.fetchCurrentDialId, "发送当前表盘ID", []),
-    (.switchDial, "切换表盘", [.dialID(26112)]),
-    (.deleteDial, "删除表盘", [.dialID(7168)]),
+    (.switchDial, "切换表盘", [.dialID(1028)]),
+    (.deleteDial, "删除表盘", [.dialID(10001)]),
     (.fetchDials, "获取所有表盘UID", []),
-    (.checkDialID, "获取某表盘ID是否已安装", [.dialID(12)]),
+    (.checkDialID, "获取某表盘ID是否已安装", [.dialID(10001)]),
     
     (.fetchWatchState, "获取当前手表状态", []),
     (.fetchVibrateSound, "获取手表声音与震动参数", []),
index 8e63674..1d6af06 100644 (file)
@@ -44,8 +44,6 @@ class ViewController: BaseViewController {
     }
     
     @IBAction func startScan(_ sender:  UIButton) {
-//        IBFileSender().readFile()
-//        return
         title = "正在扫描蓝牙设备..."
         IBManager.scan { [unowned self] peripheral in
             if let _ = datas.filter({ $0.uuid == peripheral.uuid }).last {
index 3ca006b..85d1a71 100644 (file)
                                SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
                                SWIFT_EMIT_LOC_STRINGS = YES;
                                SWIFT_OPTIMIZATION_LEVEL = "-Onone";
-                               SWIFT_VERSION = 5.0;
+                               SWIFT_VERSION = 4.2;
                                TARGETED_DEVICE_FAMILY = 1;
                        };
                        name = Debug;
                                SUPPORTS_MACCATALYST = NO;
                                SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
                                SWIFT_EMIT_LOC_STRINGS = YES;
-                               SWIFT_VERSION = 5.0;
+                               SWIFT_VERSION = 4.2;
                                TARGETED_DEVICE_FAMILY = 1;
                        };
                        name = Release;
index 0136190..55cf124 100644 (file)
Binary files a/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate and b/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate differ
index dd854dd..a476c2f 100644 (file)
             landmarkType = "0">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "15271F91-F8E0-49AE-BF64-74ED164A3C3C"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "IOTBluetooth/Models/IBFetchFile.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "19"
+            endingLineNumber = "19"
+            landmarkName = "init?(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "47EB3A2E-F088-471D-8274-DC421A2A67BF"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "IOTBluetooth/IBluetooth.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "370"
+            endingLineNumber = "370"
+            landmarkName = "peripheral(_:didUpdateValueFor:error:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>
index 52797a6..91d0daf 100644 (file)
@@ -487,11 +487,9 @@ public extension IBAbility {
 }
 
 extension IBAbility {
-    
     //
     //
     //    // MARK: - 私有
-    
     //
     //    /// 获取当前数据(jSON格式)【不使用】
     //    static let var681B9E92 = IBAbility.short.id(0x06)
index 5de8c13..06c43b0 100644 (file)
@@ -31,7 +31,7 @@ public class IBManager {
 
 public extension IBManager {
     /// SDK 版本号
-    static let version: String = "1.0.11"
+    static let version: String = "1.0.14"
     /// 默认为 false
     static var isDebug: Bool = false {
         didSet { Logger.isDebug = isDebug }
index a8da2b2..8bad54a 100644 (file)
@@ -166,7 +166,6 @@ public extension IBNotify.Name {
 }
 
 extension IBNotify {
-    
     /// 处理手表推送过来的通知
     static func handle(_ data: Data) -> Bool {
         //拍照
@@ -215,6 +214,14 @@ extension IBNotify {
             return true
         }
         //配对
+        if checkPairing(data){
+            return true
+        }
+    
+        return false
+    }
+    
+    static func checkPairing(_ data:Data)->Bool{
         if data.bytes[1] == 0x05 && data.bytes[2] == 0x11 {
             let result = IBGeneralParser.dataPacket(data)
             let code = result[0].int
@@ -223,6 +230,7 @@ extension IBNotify {
             return true
         }
         if data.bytes[1] == 0x05 && data.bytes[2] == 0x1 {
+            //解绑
             let result = IBGeneralParser.dataPacket(data)
             let code = result[0].int
             let desc = ["拒绝解绑","确认解绑"]
@@ -230,6 +238,7 @@ extension IBNotify {
             return true
         }
         if data.bytes[1] == 0x05 && data.bytes[2] == 0x10 {
+            //配对结果
             var result = IBGeneralParser.dataPacket(data)
             let code = result[0].int
             if code == 1{
index 4ae93e7..2895572 100644 (file)
@@ -277,9 +277,11 @@ struct IBFetchDialsParser: IBParser {
     static func parse(_ data: Data) -> IBResponse {
         let dataPacket = dataPacket(data)
         let num = dataPacket[0].int
+        
         var list:[Int] = []
         for i in 0..<num {
-            list.append(dataPacket.data.subdata(in: 2*i..<2*i + 2).int)
+            var value = dataPacket.data[2*i + 1...2*i + 2].int
+            list.append(value)
         }
         return .response.code(.success).items(list)
     }
index c0d0d2a..3d27b94 100644 (file)
@@ -161,7 +161,6 @@ class IBBluetooth: NSObject {
     func send(fileData data: Data) {
 //        Thread.sleep(forTimeInterval:0.02)
         startTimer()
-//        Logger.log("\(writeFileCharacteristicUUID) Write:", data.joined(" "), "Bytes(\(data.count))")
         Logger.log("\(writeFileCharacteristicUUID) Write:", data)
         currentConnected.peripheral.writeValue(data, for: writeFileCharacteristic, type: .withResponse)
     }