else if data.label.isEqual("发送MP3文件"){
self.sendMp3()
}
+ else if data.label.isEqual("发送App文件"){
+ self.sendApp()
+ }
else if data.label.isEqual("发送EPO文件"){
self.sendEpo()
}
self?.activityIndicatorView.stopAnimating()
}
}
+ func sendApp(){
+ guard let path = Bundle.main.path(forResource: "word_1734702718553_hisi_signed", ofType: "bin") else {return}
+ let info = IBSendApp()
+ info.name = "com.example.watch_word_challenge.bin"
+ info.filePath = path
+
+// guard let path = Bundle.main.path(forResource: "caichengyu_1734702353793_hisi_signed", ofType: "bin") else {return}
+// let info = IBSendApp()
+// info.name = "chengyu.bin"
+// info.filePath = path
+
+// guard let path = Bundle.main.path(forResource: "com.vendor.keyinput_sample", ofType: "bin") else {return}
+// let info = IBSendApp()
+// info.name = "com.vendor.keyinput_sample.bin"
+// info.filePath = path
+// IBResponse(code: 1000,isSuccess: true, massage:操作成功, value:["com.zrgj.watch_lunar", "com.example.watch_word_challenge"])
+
+ activityIndicatorView.startAnimating()
+ IBFileSender().app(info).progress({ total, current in
+ // print("\(total) : \(current)")
+ }).response {[weak self] result in
+ print(result)
+ self?.activityIndicatorView.stopAnimating()
+ }
+ }
func sendEpo(){
}
let datas: [(ability: IBAbility, label: String, parameters: [IBParameter])] = [
- (.sendSchedule,"发送日程管理给手表",[.sendSchedule([IBSchedule()])]),
- (.getSosContact,"获取OS紧急联系人",[]),
- (.setSosContact,"设置SOS紧急联系人",[.setSosContact([IBContact()])]),
+// (.sendSchedule,"发送日程管理给手表",[.sendSchedule([IBSchedule()])]),
+// (.getSosContact,"获取OS紧急联系人",[]),
+// (.setSosContact,"设置SOS紧急联系人",[.setSosContact([IBContact()])]),
+//
+// (.getPushConfig,"获取推送配置",[]),
+// (.setPushConfig,"设置推送",[.setPush(IBPush.all)]),
+//
+// (.getPasssword,"获取密码",[]),
+// (.setPasssword,"启用密码",[.setPassword(IBPassword(type: 1, password: "123456"))]),
+// (.setPasssword,"删除密码",[.setPassword(IBPassword(type: 0, password: ""))]),
+//
+// (.userData,"设置用户数据",[.userInfo(IBUserInfo())]),
+// (.language, "设置语言", [.language(.chinese)]),
+// (.about,"关于本机内容",[]),
+// (.find, "开始查找手表", [.action(1)]),
+// (.find, "停止查找手表", [.action(0)]),
+// (.message, "开启消息推送功能", [.action(1)]),
+// (.message, "关闭消息推送功能", [.action(0)]),
+//
+// (.takePhoto, "开启手势拍照", [.action(1)]),
+// (.takePhoto, "关闭手势拍照", [.action(0)]),
+// (.restore, "恢复出厂设置", []),
+// (.reboot, "重新启动", []),
+// (.shutdown, "关机", []),
+// (.fetchScreen, "获取手表屏幕参数", []),
+// (.screen, "设置手表屏幕参数", [.screen(Config.setScreen())]),
+// (.fetchBattery, "获取电量", []),
+// (.fetchClock, "获取闹钟设置", []),
+// (.setClock, "发送闹钟设置", [.clock(IBClock())]),
+//
+// (.fetchCurrentDialId, "发送当前表盘ID", []),
+// (.switchDial, "切换表盘", [.dialID(120)]),
+// (.deleteDial, "删除表盘", [.dialID(120)]),
+// (.fetchDials, "获取所有表盘UID", []),
+// (.checkDialID, "获取某表盘ID是否已安装", [.dialID(120)]),
+//
+// (.fetchWatchState, "获取当前手表状态", []),
+// (.fetchVibrateSound, "获取手表声音与震动参数", []),
+// (.vibrateSound, "设置手表声音与震动参数", [.vibrateSound(Config.setVibrateSound())]),
+// (.fetchAuxiliary, "获取手表辅助功能参数", []),
+// (.auxiliary, "设置手表辅助功能参数", [.auxiliary(.bloodOxygen)]),
+// (.unit, "设置手表公英制单位", [.value(1)]),
+//
+//
+// (.disk, "获取SD卡剩余空间", []),
+// (.unpair, "发送解除配对消息", []),
+// (.sendUnpair, "发送取消解除配对消息", []),
+//
+//
+// (.startSport, "开启指定运动模式", [.motionMode(.walking)]),
+// (.trainPauseResume, "训练暂停", [.action(0)]),
+// (.trainPauseResume, "训练恢复", [.action(1)]),
+// (.endSport, "结束运动模式", []),
+//
+// (.heartRateMode, "开启自动获取实时心率", [.action(1)]),
+// (.heartRateMode, "关闭自动获取实时心率", [.action(0)]),
+// (.heartRateHigh, "设置最高心率提醒", [.value(180)]),
+// (.heartRateHigh, "关闭最高心率提醒", [.value(0)]),
+// (.fetchHeartRate, "获取手表心率参数", []),
+// (.heartRate, "设置手表心率参数", [.heartRate(IBHeartRate())]),
+// (.currentHeartRate, "获取实时心率", []),
+//
+// (.fetchBloodOxygen, "获取手表血氧设置", []),
+// (.bloodOxygen, "设置手表血氧参数", [.bloodOxygen(IBBloodOxygen())]),
+// (.trainFrequency, "设置训练实时数据采样频率", [.value(30)]),
+//
+// (.fetchTargetStep, "获取目标步数设置", []),
+// (.targetStep, "设置目标步数", [.targetStep(IBTargetStep())]),
+// (.fetchOtherTarget, "获取其他目标设置", []),
+// (.targetOther, "设置其他目标", [.otherTarget(IBOtherTarget())]),
+// (.trainTarget, "设置训练目标", [.trainTarget(IBTrainTarget())]),
+// (.fetchSleep, "获取睡眠设置", []),
+// (.sleep, "设置睡眠", [.sleep(IBSleep())]),
+// (.fetchWater, "获取手表喝水提醒设置", []),
+// (.water, "设置喝水提醒", [.water(IBWater())]),
+//
+//
+// (.syncHeartRate, "同步心率历史数据", [.value(0)]),
+// (.syncBloodOxygen, "同步血氧历史数据", [.value(0)]),
+// (.syncStepCount, "同步历史步数数据", [.value(0)]),
+// (.syncFatBurning, "同步燃脂时间历史数据", [.value(0)]),
+// (.syncStand, "同步站立历史数据", [.value(0)]),
+// (.syncCalorie, "同步卡路里历史数据", [.value(0)]),
+// (.syncDistance, "同步距离历史数据", [.value(0)]),
+// (.syncTrain, "同步基础训练历史数据", [.value(0)]),
+// (.syncSleep, "同步睡眠历史数据", [.value(0)]),
+// (.syncGPS, "同步路径坐标集历史数据", [.value(1654012800)]),
+// (.sendSyncEnd, "发送同步数据结束消息", []),
+// (.addressBook, "发送通讯录", [.addressBook([IBAddressBook()])]),
- (.getPushConfig,"获取推送配置",[]),
- (.setPushConfig,"设置推送",[.setPush(IBPush.all)]),
-
- (.getPasssword,"获取密码",[]),
- (.setPasssword,"启用密码",[.setPassword(IBPassword(type: 1, password: "123456"))]),
- (.setPasssword,"删除密码",[.setPassword(IBPassword(type: 0, password: ""))]),
-
- (.userData,"设置用户数据",[.userInfo(IBUserInfo())]),
- (.language, "设置语言", [.language(.chinese)]),
- (.about,"关于本机内容",[]),
- (.find, "开始查找手表", [.action(1)]),
- (.find, "停止查找手表", [.action(0)]),
- (.message, "开启消息推送功能", [.action(1)]),
- (.message, "关闭消息推送功能", [.action(0)]),
-
- (.takePhoto, "开启手势拍照", [.action(1)]),
- (.takePhoto, "关闭手势拍照", [.action(0)]),
- (.restore, "恢复出厂设置", []),
- (.reboot, "重新启动", []),
- (.shutdown, "关机", []),
- (.fetchScreen, "获取手表屏幕参数", []),
- (.screen, "设置手表屏幕参数", [.screen(Config.setScreen())]),
- (.fetchBattery, "获取电量", []),
- (.fetchClock, "获取闹钟设置", []),
- (.setClock, "发送闹钟设置", [.clock(IBClock())]),
-
- (.fetchCurrentDialId, "发送当前表盘ID", []),
- (.switchDial, "切换表盘", [.dialID(120)]),
- (.deleteDial, "删除表盘", [.dialID(120)]),
- (.fetchDials, "获取所有表盘UID", []),
- (.checkDialID, "获取某表盘ID是否已安装", [.dialID(120)]),
-
- (.fetchWatchState, "获取当前手表状态", []),
- (.fetchVibrateSound, "获取手表声音与震动参数", []),
- (.vibrateSound, "设置手表声音与震动参数", [.vibrateSound(Config.setVibrateSound())]),
- (.fetchAuxiliary, "获取手表辅助功能参数", []),
- (.auxiliary, "设置手表辅助功能参数", [.auxiliary(.bloodOxygen)]),
- (.unit, "设置手表公英制单位", [.value(1)]),
-
-
- (.disk, "获取SD卡剩余空间", []),
- (.unpair, "发送解除配对消息", []),
- (.sendUnpair, "发送取消解除配对消息", []),
-
-
- (.startSport, "开启指定运动模式", [.motionMode(.walking)]),
- (.trainPauseResume, "训练暂停", [.action(0)]),
- (.trainPauseResume, "训练恢复", [.action(1)]),
- (.endSport, "结束运动模式", []),
-
- (.heartRateMode, "开启自动获取实时心率", [.action(1)]),
- (.heartRateMode, "关闭自动获取实时心率", [.action(0)]),
- (.heartRateHigh, "设置最高心率提醒", [.value(180)]),
- (.heartRateHigh, "关闭最高心率提醒", [.value(0)]),
- (.fetchHeartRate, "获取手表心率参数", []),
- (.heartRate, "设置手表心率参数", [.heartRate(IBHeartRate())]),
- (.currentHeartRate, "获取实时心率", []),
-
- (.fetchBloodOxygen, "获取手表血氧设置", []),
- (.bloodOxygen, "设置手表血氧参数", [.bloodOxygen(IBBloodOxygen())]),
- (.trainFrequency, "设置训练实时数据采样频率", [.value(30)]),
-
- (.fetchTargetStep, "获取目标步数设置", []),
- (.targetStep, "设置目标步数", [.targetStep(IBTargetStep())]),
- (.fetchOtherTarget, "获取其他目标设置", []),
- (.targetOther, "设置其他目标", [.otherTarget(IBOtherTarget())]),
- (.trainTarget, "设置训练目标", [.trainTarget(IBTrainTarget())]),
- (.fetchSleep, "获取睡眠设置", []),
- (.sleep, "设置睡眠", [.sleep(IBSleep())]),
- (.fetchWater, "获取手表喝水提醒设置", []),
- (.water, "设置喝水提醒", [.water(IBWater())]),
-
-
- (.syncHeartRate, "同步心率历史数据", [.value(0)]),
- (.syncBloodOxygen, "同步血氧历史数据", [.value(0)]),
- (.syncStepCount, "同步历史步数数据", [.value(0)]),
- (.syncFatBurning, "同步燃脂时间历史数据", [.value(0)]),
- (.syncStand, "同步站立历史数据", [.value(0)]),
- (.syncCalorie, "同步卡路里历史数据", [.value(0)]),
- (.syncDistance, "同步距离历史数据", [.value(0)]),
- (.syncTrain, "同步基础训练历史数据", [.value(0)]),
- (.syncSleep, "同步睡眠历史数据", [.value(0)]),
- (.syncGPS, "同步路径坐标集历史数据", [.value(1654012800)]),
- (.sendSyncEnd, "发送同步数据结束消息", []),
- (.addressBook, "发送通讯录", [.addressBook([IBAddressBook()])]),
-
-// (.epo, "发送EPO文件", []),
(.ota, "发送OTA文件", []),
(.mp3, "发送MP3文件", []),
-// (.dial, "发送自定义表盘文件", []),
+ (.fetchWatchInfoH5, "获取应用商店h5配置", []),
+ (.app, "发送App文件", []),
+ (.fetchApps, "获取已安装的app列表", []),
+ (.deleteApp, "删除App", [.text("com.example.watch_word_challenge")]),
(.dial, "发送市场表盘文件", []),
(.revokeFileSend, "撤销当前文件传输", []),
18EF697A2C47A86D00AA0A36 /* IBTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18EF69782C47A86D00AA0A36 /* IBTools.swift */; };
18EFF59B2C080F14001B1E0E /* IBUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18EFF59A2C080F14001B1E0E /* IBUserInfo.swift */; };
39517247ABAC3EA28AABA92A /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A87ADBA97338BE6292016534 /* Pods_Example.framework */; };
+ 3F0D52D92DDC163D00763D50 /* word_1734702718553_hisi_signed.bin in Resources */ = {isa = PBXBuildFile; fileRef = 3F0D52D82DDC163D00763D50 /* word_1734702718553_hisi_signed.bin */; };
+ 3F0D52DB2DDC17B100763D50 /* caichengyu_1734702353793_hisi_signed.bin in Resources */ = {isa = PBXBuildFile; fileRef = 3F0D52DA2DDC17B100763D50 /* caichengyu_1734702353793_hisi_signed.bin */; };
+ 3F0D52E02DDC2DF000763D50 /* IBApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F0D52DF2DDC2DEF00763D50 /* IBApp.swift */; };
+ 3F0D52E22DDC2F8400763D50 /* IBFileSender+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F0D52E12DDC2F7900763D50 /* IBFileSender+App.swift */; };
+ 3F0D52E62DDC4F3A00763D50 /* IBFetchApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F0D52E52DDC4F2F00763D50 /* IBFetchApp.swift */; };
+ 3F0D52E92DDC50DA00763D50 /* IBWatchInfoH5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F0D52E82DDC50CA00763D50 /* IBWatchInfoH5.swift */; };
+ 3F0D52FA2DDD705D00763D50 /* 2_1736772035256.25.01135_hisi_signed.bin in Resources */ = {isa = PBXBuildFile; fileRef = 3F0D52F92DDD705D00763D50 /* 2_1736772035256.25.01135_hisi_signed.bin */; };
+ 3F0D52FD2DDD719000763D50 /* jinianri_1734702023799_hisi_signed.bin in Resources */ = {isa = PBXBuildFile; fileRef = 3F0D52FB2DDD719000763D50 /* jinianri_1734702023799_hisi_signed.bin */; };
+ 3F0D52FE2DDD719000763D50 /* nongliri_1734702102176_hisi_signed.bin in Resources */ = {isa = PBXBuildFile; fileRef = 3F0D52FC2DDD719000763D50 /* nongliri_1734702102176_hisi_signed.bin */; };
+ 3F0D53002DDD745000763D50 /* com.vendor.keyinput_sample.bin in Resources */ = {isa = PBXBuildFile; fileRef = 3F0D52FF2DDD745000763D50 /* com.vendor.keyinput_sample.bin */; };
3F2AF7F32D57106400635545 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 18EF696B2C47766400AA0A36 /* libbz2.tbd */; };
3F2AF7F42D57107100635545 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 18EF69692C47765800AA0A36 /* libiconv.tbd */; };
3F2AF7F52D57107A00635545 /* liblzma.5.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 18EF69672C47764400AA0A36 /* liblzma.5.tbd */; };
18EF69752C47A0F200AA0A36 /* AIAudio.sbc */ = {isa = PBXFileReference; lastKnownFileType = file; path = AIAudio.sbc; sourceTree = "<group>"; };
18EF69782C47A86D00AA0A36 /* IBTools.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBTools.swift; sourceTree = "<group>"; };
18EFF59A2C080F14001B1E0E /* IBUserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBUserInfo.swift; sourceTree = "<group>"; };
+ 3F0D52D82DDC163D00763D50 /* word_1734702718553_hisi_signed.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = word_1734702718553_hisi_signed.bin; sourceTree = "<group>"; };
+ 3F0D52DA2DDC17B100763D50 /* caichengyu_1734702353793_hisi_signed.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = caichengyu_1734702353793_hisi_signed.bin; sourceTree = "<group>"; };
+ 3F0D52DF2DDC2DEF00763D50 /* IBApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBApp.swift; sourceTree = "<group>"; };
+ 3F0D52E12DDC2F7900763D50 /* IBFileSender+App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IBFileSender+App.swift"; sourceTree = "<group>"; };
+ 3F0D52E52DDC4F2F00763D50 /* IBFetchApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBFetchApp.swift; sourceTree = "<group>"; };
+ 3F0D52E82DDC50CA00763D50 /* IBWatchInfoH5.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBWatchInfoH5.swift; sourceTree = "<group>"; };
+ 3F0D52F92DDD705D00763D50 /* 2_1736772035256.25.01135_hisi_signed.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = 2_1736772035256.25.01135_hisi_signed.bin; sourceTree = "<group>"; };
+ 3F0D52FB2DDD719000763D50 /* jinianri_1734702023799_hisi_signed.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = jinianri_1734702023799_hisi_signed.bin; sourceTree = "<group>"; };
+ 3F0D52FC2DDD719000763D50 /* nongliri_1734702102176_hisi_signed.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = nongliri_1734702102176_hisi_signed.bin; sourceTree = "<group>"; };
+ 3F0D52FF2DDD745000763D50 /* com.vendor.keyinput_sample.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = com.vendor.keyinput_sample.bin; sourceTree = "<group>"; };
3F2AF7F72D57109700635545 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
3F2AF7F92D57118D00635545 /* ChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatViewController.swift; sourceTree = "<group>"; };
3F2AF8342D573B5D00635545 /* ChatCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatCell.swift; sourceTree = "<group>"; };
18113B292C1318FD00E04997 /* Resource */ = {
isa = PBXGroup;
children = (
+ 3F0D52FF2DDD745000763D50 /* com.vendor.keyinput_sample.bin */,
+ 3F0D52FB2DDD719000763D50 /* jinianri_1734702023799_hisi_signed.bin */,
+ 3F0D52FC2DDD719000763D50 /* nongliri_1734702102176_hisi_signed.bin */,
+ 3F0D52F92DDD705D00763D50 /* 2_1736772035256.25.01135_hisi_signed.bin */,
+ 3F0D52D82DDC163D00763D50 /* word_1734702718553_hisi_signed.bin */,
+ 3F0D52DA2DDC17B100763D50 /* caichengyu_1734702353793_hisi_signed.bin */,
3FCFBFDD2D548D70003FC090 /* pumpkin.lzma */,
18EF69752C47A0F200AA0A36 /* AIAudio.sbc */,
18113B322C1406CB00E04997 /* 大约在冬季.mp3 */,
8A79D2242BA4278E0096A98C /* IBSender.swift */,
181441D22C115AC500CCDD46 /* IBFileSender.swift */,
18204BFF2C199B8600F94E69 /* IBFileSender+Mp3.swift */,
+ 3F0D52E12DDC2F7900763D50 /* IBFileSender+App.swift */,
18204C012C199D0E00F94E69 /* IBFileSender+Ota.swift */,
18204C032C199E7800F94E69 /* IBFileSender+Dial.swift */,
8A79D2262BA433330096A98C /* IBNotify.swift */,
18C9589A2C082FA7006A5DE8 /* IBWeather.swift */,
180CE2642C0D728F00A7006E /* IBAddressBook.swift */,
181441CE2C11571400CCDD46 /* IBMp3.swift */,
+ 3F0D52DF2DDC2DEF00763D50 /* IBApp.swift */,
+ 3F0D52E82DDC50CA00763D50 /* IBWatchInfoH5.swift */,
181441D02C11575D00CCDD46 /* IBOta.swift */,
181441D42C116AE500CCDD46 /* IBDial.swift */,
18884C452C12A4EA00E01458 /* IBEpo.swift */,
18884C432C11DBA300E01458 /* IBDeleteFile.swift */,
1839DBCF2C14442200E33B6E /* IBFetchFile.swift */,
+ 3F0D52E52DDC4F2F00763D50 /* IBFetchApp.swift */,
180220CD2C2D5D560090D34A /* IBAiResponse.swift */,
1849DC902BECD131002C2D2D /* IBCode.swift */,
182DDFD32C5CE68900D44D37 /* IBAiValid.swift */,
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 3F0D52D92DDC163D00763D50 /* word_1734702718553_hisi_signed.bin in Resources */,
8A1DFF5E2B9EB4F900B735FF /* LaunchScreen.storyboard in Resources */,
18113B312C1400D700E04997 /* 黄沙-名决.mp3 in Resources */,
8A1DFF5B2B9EB4F900B735FF /* Assets.xcassets in Resources */,
+ 3F0D52FA2DDD705D00763D50 /* 2_1736772035256.25.01135_hisi_signed.bin in Resources */,
8A1DFF592B9EB4F900B735FF /* Main.storyboard in Resources */,
+ 3F0D52FD2DDD719000763D50 /* jinianri_1734702023799_hisi_signed.bin in Resources */,
+ 3F0D52FE2DDD719000763D50 /* nongliri_1734702102176_hisi_signed.bin in Resources */,
+ 3F0D53002DDD745000763D50 /* com.vendor.keyinput_sample.bin in Resources */,
3FCFBFDE2D548D70003FC090 /* pumpkin.lzma in Resources */,
185E9C3B2C2564F60078C808 /* 20240604_155433_2_V1.0.1_20240618_113111_ota.fwpkg in Resources */,
+ 3F0D52DB2DDC17B100763D50 /* caichengyu_1734702353793_hisi_signed.bin in Resources */,
18EF69772C47A0F200AA0A36 /* AIAudio.sbc in Resources */,
18113B332C1406CB00E04997 /* 大约在冬季.mp3 in Resources */,
18113B2F2C13195900E04997 /* galaxy.lzma in Resources */,
buildActionMask = 2147483647;
files = (
8A79D2292BA43F5A0096A98C /* IBResponse.swift in Sources */,
+ 3F0D52E22DDC2F8400763D50 /* IBFileSender+App.swift in Sources */,
3F9355B72D38FF2100C54DAB /* IBPush.swift in Sources */,
189C15932C05FFA600676A80 /* IBHistoryStand.swift in Sources */,
1849DC8F2BEC8007002C2D2D /* IBVibrateSound.swift in Sources */,
8A5822CF2BA1A67700590AB6 /* IBAbility.swift in Sources */,
8A65F9652BAC271B005C1EA4 /* IBScreen.swift in Sources */,
1859DFA02BFF5A2700112E8C /* IBSendTime.swift in Sources */,
+ 3F0D52E92DDC50DA00763D50 /* IBWatchInfoH5.swift in Sources */,
3FFAE0552D3A042900325873 /* IBContact.swift in Sources */,
18EF69792C47A86D00AA0A36 /* IBTools.swift in Sources */,
8A65F9632BAC1018005C1EA4 /* IBTargetStep.swift in Sources */,
189C158F2C05F85200676A80 /* IBHistoryStep.swift in Sources */,
3FBD71C52D7E95AC009E6F3C /* IBAiManager2.swift in Sources */,
8A5822D12BA1C80700590AB6 /* LRC.swift in Sources */,
+ 3F0D52E02DDC2DF000763D50 /* IBApp.swift in Sources */,
8A0A39DA2B981037006A3B18 /* Date.swift in Sources */,
181441D52C116AE500CCDD46 /* IBDial.swift in Sources */,
18993AA22C073FED006742D2 /* IBBloodOxygen.swift in Sources */,
18884C462C12A4EA00E01458 /* IBEpo.swift in Sources */,
8A87FBB32BAA7F3900096761 /* IBLanguage.swift in Sources */,
18EF69552C45266D00AA0A36 /* IBReceiveManager.swift in Sources */,
+ 3F0D52E62DDC4F3A00763D50 /* IBFetchApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
uuid = "DE90D99F-11DF-48BC-9070-3AF484DDB28C"
type = "0"
version = "2.0">
+ <Breakpoints>
+ <BreakpointProxy
+ BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+ <BreakpointContent
+ uuid = "18AEAAD0-4F1E-45D7-97D0-B434524BC24C"
+ shouldBeEnabled = "Yes"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ filePath = "IOTBluetooth/IBParser.swift"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "361"
+ endingLineNumber = "361"
+ landmarkName = "parse(_:)"
+ landmarkType = "7">
+ </BreakpointContent>
+ </BreakpointProxy>
+ <BreakpointProxy
+ BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+ <BreakpointContent
+ uuid = "B998095E-24AC-49B2-B642-354C6D93E4E4"
+ shouldBeEnabled = "Yes"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ filePath = "Example/AbilityViewController.swift"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "83"
+ endingLineNumber = "83"
+ landmarkName = "tableView(_:didSelectRowAt:)"
+ landmarkType = "7">
+ </BreakpointContent>
+ </BreakpointProxy>
+ </Breakpoints>
</Bucket>
/// - Parameter mp3: see ``IBMp3File``
static let mp3 = IBAbility.file.id(0x07).parser(IBGeneralParser.self).checker(IBMp3Checker.self)
-// /// 发送自定义表盘文件汇总信息
-// /// - Parameter customDial: see ``IBCustomDial``
-// static let customDial = IBAbility.file.id(0x22).parser(IBGeneralParser.self).checker(IBCustomDialChecker.self)
+ /// 发送App文件信息
+ /// - Parameter app: see ``IBAppFile``
+ static let app = IBAbility.file.id(0x0c).parser(IBGeneralParser.self).checker(IBAppChecker.self)
+
+ /// 获取已安装的app列表
+ /// - Returns: [String] \n
+ /// Read from ``IBResponse``.value
+ static let fetchApps = IBAbility.file.id(0x0e).parser(IBFetchAppParser.self)
+
+ /// 获取手表信息
+ /// - Returns: IBWatchInfoH5 \n
+ /// Read from ``IBResponse``.value
+ static let fetchWatchInfoH5 = IBAbility.file.id(0x0f).parser(IBFetchWatchInfoH5Parser.self)
+
+ /// 删除app
+ /// - Parameter text: see ``String``
+ static let deleteApp = IBAbility.file.id(0x0d).parser(IBGeneralParser.self).checker(IBTextChecker.self)
/// 发送表盘文件汇总信息
/// - Parameter dial: see ``IBDial``
return data.bytes
}
}
+struct IBAppChecker: IBChecker {
+ static func check(_ parameters: [IBParameter]) -> [UInt8] {
+ guard case let .app(value) = parameters[.app] else { fatalError("缺少参数: app") }
+ guard let data = value.encode else { fatalError("json解析异常: app") }
+ Logger.log(value.jsonString ?? "")
+ return data.bytes
+ }
+}
struct IBEpoChecker: IBChecker {
static func check(_ parameters: [IBParameter]) -> [UInt8] {
guard case let .epo(list) = parameters[.epo] else { fatalError("缺少参数: epo") }
--- /dev/null
+//
+// IBFileSender_App.swift
+// IOTBluetooth
+//
+// Created by liangshi on 2025/5/20.
+//
+
+import Foundation
+
+extension IBFileSender{
+ func sendApp(_ info:IBSendApp){
+ let (list,size,lrc) = readFile(from: info.filePath)
+ if let list = list {
+ info.size = size
+ total = info.size
+ let content = IBFileSenderContent(dataList: list,lrc: lrc)
+ self.fileList = [content]
+
+ IBSender()
+ .ability(.app)
+ .parameters([.app(IBAppFile(data:info))])
+ .response {[weak self] result in
+ guard let self = self else {return}
+ if result.isSuccess{
+ self.sendContentApp()
+ }
+ else{
+ completion(result)
+ self.remove()
+ }
+ }
+ }
+ else{
+ completion(.response.code(.failure).message("读取文件失败"))
+ self.remove()
+ }
+ }
+ private func sendContentApp(){
+ if cancelSend {
+ Logger.log("已取消发送")
+ self.remove()
+ return
+ }
+
+ if let file = fileList.first,let data = file.nextData(){
+ IBBluetooth.shared.fileSender = self
+ let model = IBFileSenderData()
+ model.data = data
+ model.fileWriteHander = { [weak self] result in
+ guard let self = self else { return }
+ self.lastData = nil
+ if result.isSuccess {
+ self.current += data.count - 18
+ Logger.log("\(total) : \(current)")
+ self.progress?(self.total,self.current)
+ self.sendContentApp()
+ }
+ else{
+ completion(.response.code(.failure).message("发送文件超时,发送失败!"))
+ self.remove()
+ }
+ }
+ self.lastData = model
+ IBBluetooth.shared.send(fileData: data)
+ }
+ else{
+ Logger.log( "文件内容发送结束...")
+ startTimer()
+ }
+ }
+ func sendAppLrc(){
+ IBSender()
+ .ability(.fileCheckCode)
+ .parameters([.value(fileList.first!.lrc)])
+ .response {[weak self] result in
+ guard let self = self else {return}
+ if result.isSuccess{
+ completion(result)
+ self.remove()
+ }
+ else{
+ completion(.response.code(.failure).message("发送文件校验码失败"))
+ self.remove()
+ }
+ }
+ }
+}
var otaInfo:IBSendOta?
var mp3Info:IBSendMp3?
- var epoInfo:[IBEpo]?
- // var customInfo:IBCustomDial?
+ var appInfo:IBSendApp?
var dialInfo:IBDial?
var fileList:[IBFileSenderContent] = []
if let _ = self.mp3Info{
sendMp3Lrc()
}
+ else if let _ = self.appInfo {
+ sendAppLrc()
+ }
else if let _ = self.otaInfo {
sendOtaLrc()
}
else if let _ = self.dialInfo{
sendDialLrc()
}
- // else if let _ = self.marketInfo{
- // sendDialLrc()
- // }
- // else if let path = self.epoInfo.filePath {
- // filePath = path
- // }
}
}
if let info = self.mp3Info{
self.sendMp3(info)
}
+ else if let info = self.appInfo {
+ self.sendApp(info)
+ }
else if let info = self.otaInfo {
self.sendOta(info)
}
else if let info = self.dialInfo{
self.sendDial(info)
}
- // else if let info = self.marketInfo{
- // self.sendDial(info)
- // }
- // else if let path = self.epoInfo.filePath {
- // filePath = path
- // }
}
- // func readFile(from path:String) ->([Data]?,Int,Int){
- // let fileURL = URL(fileURLWithPath: path)
- // do {
- // let data = try Data(contentsOf:fileURL)
- // let seg = 495
- // var list = [Data]()
- // for i in stride(from: 0, to: data.count, by: seg) {
- // if i+seg < data.count {
- // list.append(data[i ... i+seg - 1])
- // }
- // else{
- // list.append(data[i ... data.count - 1])
- // }
- // }
- // let lrc = LRC.calculateLRC(data.bytes).int
- // return (list,data.count,lrc)
- // } catch {
- // return (nil,0,0)
- // }
- // }
func readFile(from path:String) ->([Data]?,Int,Int){
let fileURL = URL(fileURLWithPath: path)
/// - Returns: self
func ota(_ info:IBSendOta) ->Self{
self.otaInfo = info
+ self.dialInfo = nil
+ self.mp3Info = nil
+ self.appInfo = nil
return self
}
@discardableResult
/// - Parameter info: mp3信息
/// - Returns: Self
func mp3(_ info:IBSendMp3) ->Self{
+ self.otaInfo = nil
+ self.dialInfo = nil
self.mp3Info = info
+ self.appInfo = nil
+ return self
+ }
+ /// 发送app
+ /// - Parameter info: app信息
+ /// - Returns: Self
+ func app(_ info:IBSendApp) ->Self{
+ self.otaInfo = nil
+ self.dialInfo = nil
+ self.mp3Info = nil
+ self.appInfo = info
return self
}
-
- // /// 发送自定义表盘
- // /// - Parameter info: 表盘信息
- // /// - Returns: Self
- // func customDial(_ info:IBCustomDial) ->Self{
- // if let list = info.files,list.count > 0{
- // for i in 0...list.count - 1 {
- // list[i].index = i
- // list[i].UID = info.UID
- // }
- // }
- // self.customInfo = info
- // return self
- // }
/// 发送表盘
/// - Parameter info: 表盘信息
/// - Returns: Self
func dial(_ info:IBDial) ->Self{
- // IBMarketDial
-
if let list = info.files,list.count > 0{
for i in 0...list.count - 1{
list[i].index = i + 1
list[i].UID = info.UID
}
}
-
+ self.otaInfo = nil
self.dialInfo = info
+ self.mp3Info = nil
+ self.appInfo = nil
return self
}
-
- /// 发送EPO文件
- /// - Parameters:
- /// - filePath: 文件路径
- /// - info: epo信息
- /// - Returns: self
- // func epo(filePath:URL,info:[IBEpo]) ->Self{
- // self.filePath = filePath
- // self.epoInfo = info
- // return self
- // }
-
/// 进度
@discardableResult
func progress(_ value: @escaping IBProgressHandler) -> Self {
item.cancelSend = true
}
+ var type = IBFile.mp3
+ if self.otaInfo != nil {
+ type = .ota
+ }
+ else if self.mp3Info != nil{
+ type = .mp3
+ }
+ else if self.dialInfo != nil{
+ type = .dial
+ }
+ else if self.appInfo != nil{
+ type = .app
+ }
+ else{
+ return
+ }
+
IBSender()
.ability(.revokeFileSend)
- .parameters([.file(.mp3)])
+ .parameters([.file(type)])
.response { result in
handler(result)
self.remove()
public extension IBManager {
/// SDK 版本号
- static let version: String = "2.0.0"
+ static let version: String = "2.0.1"
/// 默认为 false
static var isDebug: Bool = false {
didSet {
case epo = "epo"
case ota = "ota"
case mp3 = "mp3"
+ case app = "app"
case dial = "dial"
case dialFile = "dialFile"
case deleteFile = "deleteFile"
case ota(IBOtaFile)
/// 发送mp3文件信息
case MP3(IBMp3File)
+ /// 发送app文件信息
+ case app(IBAppFile)
/// 发送表盘信息汇总
case dial(IBDial)
/// 发送单个表盘文件信息
case .epo(_): return .epo
case .ota(_): return .ota
case .MP3(_): return .mp3
+ case .app(_): return .app
case .dial(_): return .dial
case .dialFile(_): return .dialFile
case .deleteFile(_): return .deleteFile
case mp3
/// 表盘信息
case dial
- /// OTA(W4)
- case ota_w4
- ///EPO
- case epo
+ /// app
+ case app
}
//0:运动
//1:心率
return .response.code(.success).items(list)
}
}
-
+struct IBFetchAppParser: IBParser {
+ static func parse(_ data: Data) -> IBResponse {
+ let dataPacket = dataPacket(data)
+ Logger.log(String(data: data, encoding: .utf8) ?? "")
+ guard let model = IBFetchApp(dataPacket.data) else { return .response.code(.parseError) }
+// guard let model = JSON.decode(IBFetchApp.self, from: dataPacket.data) else { return .response.code(.parseError) }
+ Logger.log(model.jsonString ?? "")
+ return .response.code(.success).value(model.list)
+ }
+}
+struct IBFetchWatchInfoH5Parser: IBParser {
+ static func parse(_ data: Data) -> IBResponse {
+ let dataPacket = dataPacket(data)
+ Logger.log(String(data: data, encoding: .utf8) ?? "")
+ guard let model = JSON.decode(IBWatchInfoH5.self, from: dataPacket.data) else { return .response.code(.parseError) }
+ Logger.log(model.jsonString ?? "")
+ return .response.code(.success).value(model)
+ }
+}
struct IBTargetStepParser: IBParser {
static func parse(_ data: Data) -> IBResponse {
let dataPacket = dataPacket(data)
}
if let data = characteristic.value {
// Logger.log( "[receive] \(characteristic.uuid.uuidString) " + data.joined(""))
- if data.count > 100 {
+ if data.count > 500 {
Logger.log( "[receive] \(characteristic.uuid.uuidString) " + "\(data.count)")
}
else{
<key>Example.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>1</integer>
+ <integer>3</integer>
</dict>
</dict>
</dict>
<key>Pods-Example.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>6</integer>
+ <integer>1</integer>
</dict>
<key>SnapKit-SnapKit_Privacy.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>7</integer>
+ <integer>0</integer>
</dict>
<key>SnapKit.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>3</integer>
+ <integer>6</integer>
</dict>
<key>Toast-Swift.xcscheme_^#shared#^_</key>
<dict>
--- /dev/null
+//
+// Untitled.swift
+// IOTBluetooth
+//
+// Created by liangshi on 2025/5/20.
+//
+
+import Foundation
+
+/// 发送app
+public class IBSendApp:Codable {
+ /// 文件路径
+ public var filePath: String = ""
+ /// 名字
+ public var name: String = ""
+
+ /// 文件大小,单位byte
+ internal var size: Int = 0
+
+
+ public init() { }
+}
+
+
+/// app文件模型
+public class IBAppFile:Codable {
+ /// 歌曲名字
+ var name: String = ""
+ /// 文件类型,4
+ var type: Int = 4
+ /// 文件大小,单位byte
+ var size: Int = 0
+
+ internal init(data:IBSendApp) {
+ self.name = data.name
+ self.size = data.size
+ }
+}
+
--- /dev/null
+//
+// IBFetchApp.swift
+// IOTBluetooth
+//
+// Created by liangshi on 2025/5/20.
+//
+
+/// 已安装app
+class IBFetchApp:Codable {
+ var list:[IBWatchApp] = [IBWatchApp]()
+
+ init?(_ data: Data) {
+ guard let appList = data.jsonObject() as? [[String: Any]] else { return nil }
+ for item in appList {
+ let model = IBWatchApp()
+ model.appName = item["appName"] as? String ?? ""
+ model.packageName = item["packageName"] as? String ?? ""
+ list.append(model)
+ }
+ }
+
+ public init() { }
+}
+/// 已安装app
+public class IBWatchApp:Codable{
+ /// app名字
+ public var appName: String = ""
+ /// 包名
+ public var packageName: String = ""
+ public init(){
+
+ }
+}
--- /dev/null
+//
+// IBAppWatchInfo.swift
+// IOTBluetooth
+//
+// Created by liangshi on 2025/5/20.
+//
+
+import Foundation
+/// h5 应用商店手表配置
+public class IBWatchInfoH5:Codable {
+ /// 品牌商在聚合平台注册
+ public var vendorIdentity: String = ""
+ /// 消费者账号
+ public var consumerIdentity:String = ""
+ /// 消费者账号类型,0:品牌商注册账号,1:聚合平台注册账号
+ public var consumerType:String = ""
+ /// 设备序列号,从表端获取,需要品牌商提前将序列号在聚合平台注册
+ public var deviceSn:String = ""
+ /// H5页面主题, 模式:light(浅色)(默认)/dark(深色)
+ public var themeMode:String = "light"
+ /// 片平台,如:hisi
+ public var chipPlatform:String = ""
+ /// 芯片型号, 如:300
+ public var chipModel:String = ""
+ /// watch系统,如: openharmony等
+ public var os:String = ""
+ /// watch系统版本,如: 5.0.1
+ public var osVersion:String = ""
+ /// sdk版本号,如: 13
+ public var sdkVersion:String = ""
+ /// watch分辨率,格式:宽*高,如:466*466
+ public var resolution:String = ""
+
+ public init() { }
+}