新增日程管理指令
authorliangzhenying <867174124@qq.com>
Fri, 17 Jan 2025 07:16:55 +0000 (15:16 +0800)
committerliangzhenying <867174124@qq.com>
Fri, 17 Jan 2025 07:16:55 +0000 (15:16 +0800)
IOTBluetooth/IOTBluetooth/Example/Datas.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.pbxproj
IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate
IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAbility.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBChecker.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/IBParameter.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBContact.swift
IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBSchedule.swift [new file with mode: 0644]

index ca97cac..f824194 100644 (file)
@@ -11,6 +11,7 @@ import IOTBluetooth
 
 
 let datas: [(ability: IBAbility, label: String, parameters: [IBParameter])] = [
+    (.sendSchedule,"发送日程管理给手表",[.sendSchedule([IBSchedule()])]),
     (.getSosContact,"获取OS紧急联系人",[]),
     (.setSosContact,"设置SOS紧急联系人",[.setSosContact([IBContact()])]),
     
index 1e45d64..6104e9a 100644 (file)
@@ -64,6 +64,7 @@
                3F6A07CC2D2D2C3F00F4122A /* IBPassword.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F6A07CB2D2D2C3F00F4122A /* IBPassword.swift */; };
                3F9355B72D38FF2100C54DAB /* IBPush.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F9355B62D38FF1900C54DAB /* IBPush.swift */; };
                3FFAE0552D3A042900325873 /* IBContact.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFAE0542D3A03EF00325873 /* IBContact.swift */; };
+               3FFAE0572D3A2CFF00325873 /* IBSchedule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFAE0562D3A2CF800325873 /* IBSchedule.swift */; };
                8A0A39BF2B980BEF006A3B18 /* IOTBluetooth.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A0A39BE2B980BEF006A3B18 /* IOTBluetooth.h */; settings = {ATTRIBUTES = (Public, ); }; };
                8A0A39C62B980C88006A3B18 /* IBluetooth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0A39C52B980C88006A3B18 /* IBluetooth.swift */; };
                8A0A39C92B980CC2006A3B18 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8A0A39C82B980CC2006A3B18 /* CoreBluetooth.framework */; };
                3F6A07CB2D2D2C3F00F4122A /* IBPassword.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBPassword.swift; sourceTree = "<group>"; };
                3F9355B62D38FF1900C54DAB /* IBPush.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBPush.swift; sourceTree = "<group>"; };
                3FFAE0542D3A03EF00325873 /* IBContact.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBContact.swift; sourceTree = "<group>"; };
+               3FFAE0562D3A2CF800325873 /* IBSchedule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBSchedule.swift; sourceTree = "<group>"; };
                8A0A39BB2B980BEF006A3B18 /* IOTBluetooth.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = IOTBluetooth.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                8A0A39BE2B980BEF006A3B18 /* IOTBluetooth.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IOTBluetooth.h; sourceTree = "<group>"; };
                8A0A39C52B980C88006A3B18 /* IBluetooth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IBluetooth.swift; sourceTree = "<group>"; };
                                3F6A07CB2D2D2C3F00F4122A /* IBPassword.swift */,
                                3F9355B62D38FF1900C54DAB /* IBPush.swift */,
                                3FFAE0542D3A03EF00325873 /* IBContact.swift */,
+                               3FFAE0562D3A2CF800325873 /* IBSchedule.swift */,
                        );
                        path = Models;
                        sourceTree = "<group>";
                                18EF69512C45130200AA0A36 /* IBAiManager.swift in Sources */,
                                18204C022C199D0E00F94E69 /* IBFileSender+Ota.swift in Sources */,
                                18EC6E282BFF4C6D00757CA8 /* IBPhoneInfo.swift in Sources */,
+                               3FFAE0572D3A2CFF00325873 /* IBSchedule.swift in Sources */,
                                18EF69532C45136800AA0A36 /* IBPairling.swift in Sources */,
                                18C9589F2C086A9D006A5DE8 /* IBHistorySleep.swift in Sources */,
                                180220CE2C2D5D560090D34A /* IBAiResponse.swift in Sources */,
index 3c632fc..436d032 100644 (file)
Binary files a/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate and b/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcodeproj/project.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate differ
index 295d9b7..b77e291 100644 (file)
@@ -3,22 +3,4 @@
    uuid = "2CC27BE0-931D-4412-B83C-49E80F4BA55C"
    type = "1"
    version = "2.0">
-   <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "F50E648D-FC87-4335-B9B9-976A5D8720FA"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "IOTBluetooth/IBChecker.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "332"
-            endingLineNumber = "332"
-            landmarkName = "check(_:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-   </Breakpoints>
 </Bucket>
index 292bfb6..c96c932 100644 (file)
@@ -108,7 +108,9 @@ public extension IBAbility {
     /// - Parameter setSosContact: see ``[IBContact]``
     static let setSosContact = IBAbility.long.id(0x25).parser(IBGeneralParser.self).checker(IBSetSosChecker.self)
     
-    
+    /// 发送日程管理给手表
+    /// - Parameter sendSchedule: see ``[IBSchedule]``
+    static let sendSchedule = IBAbility.long.id(0x24).parser(IBGeneralParser.self).checker(IBSendScheduleChecker.self)
     
     
     /// 设置用户数据
index 20f1890..a6715ee 100644 (file)
@@ -267,7 +267,7 @@ struct IBSetPasswordChecker: IBChecker {
         guard case let .setPassword(value) = parameters[.setPassword] else { fatalError("缺少参数: SetPassword") }
 
         Logger.log(value.description)
-        var psd = value.password
+        let psd = value.password
         var data:[UInt8] = [UInt8(value.type)]
         if value.type == 1 {
             for i in 0..<psd.count{
@@ -314,7 +314,7 @@ struct IBPushChecker: IBChecker {
 }
 struct IBSetSosChecker: IBChecker {
     static func check(_ parameters: [IBParameter]) -> [UInt8] {
-        guard case let .setSosContact(value) = parameters[.setSosContact] else { fatalError("缺少参数: setpush") }
+        guard case let .setSosContact(value) = parameters[.setSosContact] else { fatalError("缺少参数: setSosContact") }
         Logger.log(value.description)
         var data = [UInt8]()
         data += [value.count.byte]
@@ -332,7 +332,30 @@ struct IBSetSosChecker: IBChecker {
         return data
     }
 }
-
+struct IBSendScheduleChecker: IBChecker {
+    static func check(_ parameters: [IBParameter]) -> [UInt8] {
+        guard case let .sendSchedule(value) = parameters[.sendSchedule] else { fatalError("缺少参数: sendSchedule") }
+        Logger.log(value.description)
+        var data = [UInt8]()
+        for item in value {
+            data += item.id.byte2
+            if let value = item.title.data(using: .utf8),!value.isEmpty  {
+                data += value.count.byte2
+                data += value.bytes
+            }
+            data += item.begin.byte4
+            data += item.end.byte4
+            if let value = item.content?.data(using: .utf8),!value.isEmpty  {
+                data += value.count.byte2
+                data += value.bytes
+            }
+            else{
+                data += 0.byte2
+            }
+        }
+        return data
+    }
+}
 
 struct IBClockChecker: IBChecker {
     static func check(_ parameters: [IBParameter]) -> [UInt8] {
index 04d3a82..87a20f4 100644 (file)
@@ -43,6 +43,7 @@ enum IBKey: String {
     case setPassword = "setPassword"
     case setPush = "setPushConfig"
     case setSosContact = "setSosContact"
+    case sendSchedule = "sendSchedule"
 }
 
 /// 参数
@@ -115,6 +116,8 @@ public enum IBParameter {
     case setPush([IBPush])
     /// 设置SOS紧急联系人
     case setSosContact([IBContact])
+    /// 向手表发送日程
+    case sendSchedule([IBSchedule])
     
     var key: IBKey {
         switch self {
@@ -152,6 +155,7 @@ public enum IBParameter {
         case .setPassword(_): return .setPassword
         case .setPush(_): return .setPush
         case .setSosContact(_): return .setSosContact
+        case .sendSchedule(_):  return .sendSchedule
         }
     }
 }
index c20764e..57973ff 100644 (file)
@@ -11,9 +11,9 @@ public class IBContact {
     /// 性别 0:男性 1:女性
     public var gender: Int = 0
     /// 名称
-    public var name:String = "广州"
+    public var name:String = ""
     /// 电话
-    public var tel:String = "13480000000"
+    public var tel:String = ""
     
     public init() { }
     
diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBSchedule.swift b/IOTBluetooth/IOTBluetooth/IOTBluetooth/Models/IBSchedule.swift
new file mode 100644 (file)
index 0000000..0e52a40
--- /dev/null
@@ -0,0 +1,29 @@
+//
+//  IBSchedule.swift
+//  IOTBluetooth
+//
+//  Created by liangshi on 2025/1/17.
+//
+
+import Foundation
+/// 日程
+public class IBSchedule {
+    /// 日程id
+    public var id:Int = 0
+    /// 标题
+    public var title: String = ""
+    /// 开始时间戳
+    public var begin:Int = 1737196185
+    /// 结束时间戳
+    public var end:Int = 1737396185
+    /// 备注内容
+    public var content: String?
+    
+    public init() { }
+    
+    var description: String  {
+        let str = "IBSchedule(title: \(title),begin:\(begin),end:\(end),content:\(content ?? ""))"
+        return str
+    }
+    
+}