Browse Source

添加iOS ota

weicu
tanlongsheng 1 year ago
parent
commit
765a4dbad5
  1. 78
      ios/Podfile.lock
  2. 22
      local_plugins/ota/ios/Classes/BleManager/HandleBroadcastPtl.h
  3. 53
      local_plugins/ota/ios/Classes/BleManager/HandleBroadcastPtl.m
  4. 27
      local_plugins/ota/ios/Classes/BleManager/JLBleEntity.h
  5. 25
      local_plugins/ota/ios/Classes/BleManager/JLBleEntity.m
  6. 122
      local_plugins/ota/ios/Classes/BleManager/JLBleManager.h
  7. 516
      local_plugins/ota/ios/Classes/BleManager/JLBleManager.m
  8. 22
      local_plugins/ota/ios/Classes/OtaPlugin.swift
  9. BIN
      local_plugins/ota/ios/Frameworks/DFUnits.framework/DFUnits
  10. 28
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/AESx.h
  11. 82
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFAction.h
  12. 173
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFAudio.h
  13. 123
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFCircleTextView.h
  14. 39
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFContacts.h
  15. 33
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFCrc16.h
  16. 32
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFFadeLabel.h
  17. 125
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFFile.h
  18. 25
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFGzip.h
  19. 24
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFHmacMD5.h
  20. 70
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFHttp.h
  21. 29
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFHttp1.h
  22. 57
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFImage.h
  23. 534
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFLabel.h
  24. 51
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFNetPlayer.h
  25. 56
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFNotice.h
  26. 312
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFPing.h
  27. 52
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFRing.h
  28. 32
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFSort.h
  29. 115
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFTime.h
  30. 496
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFTips.h
  31. 161
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFTools.h
  32. 21
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFUIAnimation.h
  33. 46
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFUIPullView.h
  34. 215
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFUITools.h
  35. 51
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFUnits.h
  36. 38
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFVideo.h
  37. 59
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/OPenALM.h
  38. 224
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/TPCircularBuffer.h
  39. 317
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/queue.h
  40. 97
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/queue_internal.h
  41. 26
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/tcp_client.h
  42. 29
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/tcp_server.h
  43. BIN
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Info.plist
  44. 6
      local_plugins/ota/ios/Frameworks/DFUnits.framework/Modules/module.modulemap
  45. 19
      local_plugins/ota/ios/Frameworks/JLLogHelper.framework/Headers/JLLogHelper.h
  46. 75
      local_plugins/ota/ios/Frameworks/JLLogHelper.framework/Headers/JLLogManager.h
  47. BIN
      local_plugins/ota/ios/Frameworks/JLLogHelper.framework/Info.plist
  48. BIN
      local_plugins/ota/ios/Frameworks/JLLogHelper.framework/JLLogHelper
  49. 6
      local_plugins/ota/ios/Frameworks/JLLogHelper.framework/Modules/module.modulemap
  50. BIN
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Frameworks/JLLogHelper.framework/Info.plist
  51. BIN
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Frameworks/JLLogHelper.framework/JLLogHelper
  52. 67
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLAdvParse.h
  53. 64
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLChargingBoxAdv.h
  54. 54
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLDevicesAdv.h
  55. 47
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLEarphoneAdv.h
  56. 25
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLOtaAdv.h
  57. 19
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLSoundBoxAdv.h
  58. 19
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLSoundCardAdv.h
  59. 70
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLTwsAdv.h
  60. 35
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLWatchAdv.h
  61. 27
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JL_AdvParse.h
  62. BIN
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Info.plist
  63. BIN
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/JL_AdvParse
  64. 6
      local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Modules/module.modulemap
  65. BIN
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Frameworks/JLLogHelper.framework/Info.plist
  66. BIN
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Frameworks/JLLogHelper.framework/JLLogHelper
  67. 25
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Headers/BtHash.h
  68. 54
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Headers/JLHashHandler.h
  69. 21
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Headers/JL_HashPair.h
  70. 20
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Headers/JL_ble_pair.h
  71. BIN
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Info.plist
  72. BIN
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/JL_HashPair
  73. 6
      local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Modules/module.modulemap
  74. BIN
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Frameworks/JLLogHelper.framework/Info.plist
  75. BIN
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Frameworks/JLLogHelper.framework/JLLogHelper
  76. 52
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Headers/JLOTAFile.h
  77. 20
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Headers/JL_OTALib.h
  78. 227
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Headers/JL_OTAManager.h
  79. 207
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Headers/jl_ufw.h
  80. BIN
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Info.plist
  81. BIN
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/JL_OTALib
  82. 6
      local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Modules/module.modulemap
  83. 7
      local_plugins/ota/ios/ota.podspec
  84. 4
      local_plugins/ota/lib/ota.dart
  85. 10
      local_plugins/ota/lib/ota_method_channel.dart
  86. 4
      local_plugins/ota/lib/ota_platform_interface.dart

78
ios/Podfile.lock

@ -1,21 +1,23 @@
PODS:
- amap_service (0.0.1):
- Flutter
- audio_waveforms (0.0.1):
- Flutter
- classic_bluetooth (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- FBAEMKit (18.0.0):
- FBSDKCoreKit_Basics (= 18.0.0)
- FBSDKCoreKit (18.0.0):
- FBAEMKit (= 18.0.0)
- FBSDKCoreKit_Basics (= 18.0.0)
- FBSDKCoreKit_Basics (18.0.0)
- FBSDKLoginKit (18.0.0):
- FBSDKCoreKit (= 18.0.0)
- FBAEMKit (17.1.0):
- FBSDKCoreKit_Basics (= 17.1.0)
- FBSDKCoreKit (17.1.0):
- FBAEMKit (= 17.1.0)
- FBSDKCoreKit_Basics (= 17.1.0)
- FBSDKCoreKit_Basics (17.1.0)
- FBSDKLoginKit (17.1.0):
- FBSDKCoreKit (= 17.1.0)
- Flutter (1.0.0)
- flutter_facebook_auth (7.1.2):
- FBSDKLoginKit (~> 18.0.0)
- flutter_facebook_auth (7.1.1):
- FBSDKLoginKit (~> 17.1.0)
- Flutter
- flutter_image_compress_common (1.0.0):
- Flutter
@ -36,8 +38,6 @@ PODS:
- WechatOpenSDK-XCFramework (~> 2.0.4)
- haptic_feedback (0.5.1):
- Flutter
- jl_ota (0.0.1):
- Flutter
- libwebp (1.5.0):
- libwebp/demux (= 1.5.0)
- libwebp/mux (= 1.5.0)
@ -55,6 +55,8 @@ PODS:
- Mantle/extobjc (2.2.0)
- music_service (0.0.1):
- Flutter
- ota (0.0.1):
- Flutter
- permission_handler_apple (9.3.0):
- Flutter
- QCloudCore (6.4.7):
@ -82,6 +84,7 @@ PODS:
- WechatOpenSDK-XCFramework (2.0.4)
DEPENDENCIES:
- amap_service (from `.symlinks/plugins/amap_service/ios`)
- audio_waveforms (from `.symlinks/plugins/audio_waveforms/ios`)
- classic_bluetooth (from `.symlinks/plugins/classic_bluetooth/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
@ -93,8 +96,8 @@ DEPENDENCIES:
- flutter_tts (from `.symlinks/plugins/flutter_tts/ios`)
- fluwx (from `.symlinks/plugins/fluwx/ios`)
- haptic_feedback (from `.symlinks/plugins/haptic_feedback/ios`)
- jl_ota (from `.symlinks/plugins/jl_ota/ios`)
- music_service (from `.symlinks/plugins/music_service/ios`)
- ota (from `.symlinks/plugins/ota/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- record_darwin (from `.symlinks/plugins/record_darwin/ios`)
- spotify_sdk (from `.symlinks/plugins/spotify_sdk/ios`)
@ -116,6 +119,8 @@ SPEC REPOS:
- WechatOpenSDK-XCFramework
EXTERNAL SOURCES:
amap_service:
:path: ".symlinks/plugins/amap_service/ios"
audio_waveforms:
:path: ".symlinks/plugins/audio_waveforms/ios"
classic_bluetooth:
@ -138,10 +143,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluwx/ios"
haptic_feedback:
:path: ".symlinks/plugins/haptic_feedback/ios"
jl_ota:
:path: ".symlinks/plugins/jl_ota/ios"
music_service:
:path: ".symlinks/plugins/music_service/ios"
ota:
:path: ".symlinks/plugins/ota/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
record_darwin:
@ -152,36 +157,37 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/tencentcloud_cos_sdk_plugin/ios"
SPEC CHECKSUMS:
audio_waveforms: a6dde7fe7c0ea05f06ffbdb0f7c1b2b2ba6cedcf
classic_bluetooth: c146e1618e867a47fa7ab79a3bf262e7d69d557d
device_info_plus: 71ffc6ab7634ade6267c7a93088ed7e4f74e5896
FBAEMKit: e34530df538b8eb8aeb53c35867715ba6c63ef0c
FBSDKCoreKit: d3f479a69127acebb1c6aad91c1a33907bcf6c2f
FBSDKCoreKit_Basics: 017b6dc2a1862024815a8229e75661e627ac1e29
FBSDKLoginKit: 5875762d1fe09ddcb05d03365d4f5dc34413843d
amap_service: d5482dc15e9e21dfcfaf1eea1c08b5600ccbd04f
audio_waveforms: cd736909ebc6b6a164eb74701d8c705ce3241e1c
classic_bluetooth: e42cd5bd0b7731e467c9dd4a5a74b07715a89af3
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
FBAEMKit: cb719c53575a3be86ea873279f30d6a2c4e15881
FBSDKCoreKit: ecdb980a24633ccb012700299ceb16d0235e14d2
FBSDKCoreKit_Basics: 045101c4a9ef10c845347424d73a29aae02c3e43
FBSDKLoginKit: 69eb59b2f839aba635616df6e422acd0ca88030a
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_facebook_auth: d97dc09216aebd99d7ac52360186a630f67bdf18
flutter_image_compress_common: 1697a328fd72bfb335507c6bca1a65fa5ad87df1
flutter_local_notifications: 395056b3175ba4f08480a7c5de30cd36d69827e4
flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13
flutter_tts: b88dbc8655d3dc961bc4a796e4e16a4cc1795833
fluwx: 6bf9c5a3a99ad31b0de137dd92370a0d10a60f4b
haptic_feedback: fd1d8509833f58f164fc12122c0357fa9b2750e0
jl_ota: 5fa90bf47674de0f5bce9af2219e25fa0c1425f5
flutter_facebook_auth: 48be46091bd1a5cc5a66055f1228a9d99a28bfaa
flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e
flutter_local_notifications: df98d66e515e1ca797af436137b4459b160ad8c9
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d
fluwx: daa284756ce53442b3d0417ceeda66e981906811
haptic_feedback: 8cb3ee0cb6b797946c2b0df9c99ebc8f7ed79c71
libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
music_service: 85abecc8fa21599a06907ad50d83f48a58e0dc0d
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
music_service: 9fdaa62f5ede7902d70b839f05f929e226ce1987
ota: b1a41e94aec72559f003e65df654d538cadf5f66
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
QCloudCore: 49e7571984a8e5fd8f0fd58c2f3b806255796223
QCloudCOSXML: 7205e76aa9cf613468222615483c9d7c074e4298
QCloudTrack: 3b53a7fc4fe3920e407f2aa73f2452992a61f7f3
record_darwin: fb1f375f1d9603714f55b8708a903bbb91ffdb0a
record_darwin: 3b1a8e7d5c0cbf45ad6165b4d83a6ca643d929c3
SDWebImage: f84b0feeb08d2d11e6a9b843cb06d75ebf5b8868
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
spotify_sdk: a48400bb29f70c4fe251ebfdc9135c37097ac5ca
tencentcloud_cos_sdk_plugin: 7bed564dbe72df23e7b5cacb1e51b1a20cb1639c
spotify_sdk: 93c2e7de88e7deceba91d20856f2e11c30c20a3d
tencentcloud_cos_sdk_plugin: e901a5b15dea830e640b2e3ce9ca326dd1a2947b
WechatOpenSDK-XCFramework: 36fb2bea0754266c17184adf4963d7e6ff98b69f
PODFILE CHECKSUM: c47ae1d38025d25153dc07bcb7a82393e57bb809
PODFILE CHECKSUM: 517ecd5ce5153c9609017e05f4e64ab72605e805
COCOAPODS: 1.16.2

22
local_plugins/ota/ios/Classes/BleManager/HandleBroadcastPtl.h

@ -0,0 +1,22 @@
//
// HandleBroadcastPtl.h
// JL_OTA
//
// Created by EzioChan on 2023/1/30.
// Copyright © 2023 Zhuhia Jieli Technology. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface HandleBroadcastPtl : NSObject
@property(nonatomic,strong,readonly)NSHashTable *delegates;
@property(nonatomic,strong)NSLock *delegateLock;
-(void)addDelegate:(id)delegate;
-(void)removeDelegate:(id)delegate;
-(void)removeAll;
@end
NS_ASSUME_NONNULL_END

53
local_plugins/ota/ios/Classes/BleManager/HandleBroadcastPtl.m

@ -0,0 +1,53 @@
//
// HandleBroadcastPtl.m
// JL_OTA
//
// Created by EzioChan on 2023/1/30.
// Copyright © 2023 Zhuhia Jieli Technology. All rights reserved.
//
#import "HandleBroadcastPtl.h"
@interface HandleBroadcastPtl()
@end
@implementation HandleBroadcastPtl
- (instancetype)init
{
self = [super init];
if (self) {
_delegates = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
}
return self;
}
-(NSLock *)delegateLock{
if (_delegateLock == nil) {
_delegateLock = [NSLock new];
}
return _delegateLock;
}
-(void)addDelegate:(id)delegate{
[self.delegateLock lock];
if (![self.delegates containsObject:delegate]) {
[self.delegates addObject:delegate];
}
[self.delegateLock unlock];
}
-(void)removeDelegate:(id)delegate{
[self.delegateLock lock];
if ([self.delegates containsObject:delegate]) {
[self.delegates removeObject:delegate];
}
[self.delegateLock unlock];
}
-(void)removeAll{
[self.delegateLock lock];
[self.delegates removeAllObjects];
[self.delegateLock unlock];
}
@end

27
local_plugins/ota/ios/Classes/BleManager/JLBleEntity.h

@ -0,0 +1,27 @@
//
// JLBleEntity.h
// JL_OTA
//
// Created by 凌煊峰 on 2021/10/11.
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
NS_ASSUME_NONNULL_BEGIN
@interface JLBleEntity : NSObject //蓝牙设备模型
@property (strong, nonatomic) NSNumber *mRSSI;
@property (strong, nonatomic) CBPeripheral *mPeripheral;
@property (strong, nonatomic) NSString *mName;
@property (strong, nonatomic) NSString *bleMacAddress;
@property (strong, nonatomic) NSString *edrMacAddress;
@property (assign, nonatomic) uint8_t mType;
@property (assign, nonatomic) uint16_t pid;
@property (assign, nonatomic) uint16_t uid;
@end
NS_ASSUME_NONNULL_END

25
local_plugins/ota/ios/Classes/BleManager/JLBleEntity.m

@ -0,0 +1,25 @@
//
// JLBleEntity.m
// JL_OTA
//
// Created by 凌煊峰 on 2021/10/11.
//
#import "JLBleEntity.h"
@implementation JLBleEntity
- (nonnull id)copyWithZone:(nullable NSZone *)zone {
JLBleEntity *entity = [[self class] allocWithZone:zone];
entity.mRSSI = self.mRSSI;
entity.mPeripheral = self.mPeripheral;
entity.mName = self.mName;
entity.bleMacAddress = self.bleMacAddress;
entity.edrMacAddress = self.edrMacAddress;
entity.pid = self.pid;
entity.uid = self.uid;
entity.mType = self.mType;
return entity;
}
@end

122
local_plugins/ota/ios/Classes/BleManager/JLBleManager.h

@ -0,0 +1,122 @@
//
// JLBleManager.h
// JL_OTA
//
// Created by 凌煊峰 on 2021/10/11.
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import <UIKit/UIKit.h>
#import <DFUnits/DFUnits.h>
#import "JLBleEntity.h"
#import "HandleBroadcastPtl.h"
#import <JL_OTALib/JL_OTALib.h>
#import <JL_HashPair/JL_HashPair.h>
#import <JL_AdvParse/JL_AdvParse.h>
NS_ASSUME_NONNULL_BEGIN
#pragma mark - BLE状态通知
extern NSString *kFLT_BLE_FOUND; //发现设备
extern NSString *kFLT_BLE_PAIRED; //已配对
extern NSString *kFLT_BLE_CONNECTED; //已连接
extern NSString *kFLT_BLE_DISCONNECTED; //断开连接
@protocol JLBleManagerOtaDelegate <NSObject>
@required
/**
* ota升级过程状态回调
*/
- (void)otaProgressWithOtaResult:(JL_OTAResult)result withProgress:(float)progress;
@end
@interface JLBleManager : HandleBroadcastPtl
@property (assign, nonatomic) CBManagerState mBleManagerState;
@property (strong, nonatomic) CBPeripheral *__nullable mBlePeripheral;
/// 连接蓝牙是否需要认证配对
@property (assign, nonatomic) BOOL isPaired;
/// 配对秘钥(默认为空)
@property (assign, nonatomic) NSData *pairKey;
/// 连接设备的MTU(单次最大发送数据)
@property (assign, nonatomic) NSInteger bleMtu;
/// 上一次连接的蓝牙UUID
@property (strong, nonatomic) NSString *lastUUID;
/// 上一次连接的蓝牙地址
@property (strong, nonatomic) NSString *__nullable lastBleMacAddress;
@property (strong, nonatomic) JL_OTAManager *otaManager;
@property (assign,nonatomic)BOOL isConnected;
@property (strong, nonatomic) JLBleEntity *__nullable currentEntity;
/**
* 单例
*/
+ (instancetype)sharedInstance;
/**
开始搜索
*/
-(void)startScanBLE;
/**
停止搜索
*/
-(void)stopScanBLE;
/**
连接设备
@param peripheral 蓝牙设备类
*/
-(void)connectBLE:(CBPeripheral*)peripheral;
/**
断开连接
*/
-(void)disconnectBLE;
/**
使用UUID,重连设备。
*/
-(void)connectPeripheralWithUUID:(NSString *)uuid;
/// HID设备重连
/// - Parameter uuid: 设备 identifyString
-(void)findHid:(NSString *)uuid;
#pragma mark - 杰理蓝牙库OTA流程相关业务
typedef void(^GET_DEVICE_CALLBACK)(BOOL needForcedUpgrade);
typedef void(^CANCEL_CALLBACK)(uint8_t status);
/**
* 获取已连接的蓝牙设备信息
*/
- (void)getDeviceInfo:(GET_DEVICE_CALLBACK _Nonnull)callback;
/**
* OTA升级
*/
- (void)otaFuncWithFilePath:(NSString *)otaFilePath;
- (void)otaFuncCancel:(CANCEL_CALLBACK _Nonnull)result;
@end
NS_ASSUME_NONNULL_END

516
local_plugins/ota/ios/Classes/BleManager/JLBleManager.m

@ -0,0 +1,516 @@
//
// JLBleManager.m
// JL_OTA
//
// Created by 凌煊峰 on 2021/10/11.
//
#import "JLBleManager.h"
#define SENDBYSINGLE 0 //1:通过信号检测发送 0:通过直接塞数据发送
NSString *kFLT_BLE_FOUND = @"FLT_BLE_FOUND"; //发现设备
NSString *kFLT_BLE_PAIRED = @"FLT_BLE_PAIRED"; //BLE已配对
NSString *kFLT_BLE_CONNECTED = @"FLT_BLE_CONNECTED"; //BLE已连接
NSString *kFLT_BLE_DISCONNECTED = @"FLT_BLE_DISCONNECTED"; //BLE断开连接
NSString *FLT_BLE_SERVICE = @"AE00"; //服务号
NSString *FLT_BLE_RCSP_W = @"AE01"; //命令“写”通道
NSString *FLT_BLE_RCSP_R = @"AE02"; //命令“读”通道
@interface JLBleManager() <CBCentralManagerDelegate, CBPeripheralDelegate,JL_OTAManagerDelegate,JLHashHandlerDelegate>
@property (strong, nonatomic) CBCentralManager *bleManager;
@property (strong, nonatomic) JLHashHandler *pairHash;
@property (assign, nonatomic) BOOL pairStatus;
@property (strong, nonatomic) NSMutableArray<JLBleEntity *> *blePeripheralArr;
@property (strong, nonatomic) CBPeripheral *bleCurrentPeripheral;
@property (strong, nonatomic) CBService * mService;
@property (strong, nonatomic) CBCharacteristic *mRcspWrite;
@property (strong, nonatomic) CBCharacteristic *mRcspRead;
@property (strong, nonatomic) NSString *selectedOtaFilePath;
@property (strong, nonatomic) NSString *connectByUUID;
@property (strong, nonatomic) GET_DEVICE_CALLBACK getCallback;
@end
@implementation JLBleManager
+ (instancetype)sharedInstance {
static JLBleManager *singleton = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
singleton = [[self alloc] init];
});
return singleton;
}
- (instancetype)init {
self = [super init];
if (self) {
_isPaired = YES;
_pairStatus = NO;
_bleManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
/*--- JLSDK ADD ---*/
_otaManager = [JL_OTAManager getOTAManager];
[JL_OTAManager logSDKVersion];
[JLHashHandler sdkVersion];
[_otaManager logSendData:false];
_otaManager.delegate = self;
self.pairHash = [[JLHashHandler alloc] init];
self.pairHash.delegate = self;
_connectByUUID = nil;
}
return self;
}
- (void)setIsPaired:(BOOL)isPaired {
_isPaired = isPaired;
}
#pragma mark - 扫描设备相关
#pragma mark 开始扫描
- (void)startScanBLE {
kJLLog(JLLOG_DEBUG, @"BLE ---> startScanBLE.");
_blePeripheralArr = [NSMutableArray new];
if (_bleManager) {
if (_bleManager.state == CBManagerStatePoweredOn) {
[_bleManager scanForPeripheralsWithServices:nil options:nil];
} else {
__weak typeof(self) weakSelf = self;
dispatch_after(0.5, dispatch_get_main_queue(), ^{
if (weakSelf.bleManager.state == CBManagerStatePoweredOn) {
[weakSelf.bleManager scanForPeripheralsWithServices:nil options:nil];
}
});
}
}
}
#pragma mark 停止扫描
- (void)stopScanBLE {
if (_bleManager) [_bleManager stopScan];
}
#pragma mark - 蓝牙设备连接相关
#pragma mark 断开当前蓝牙设备连接
- (void)disconnectBLE {
if (_bleCurrentPeripheral) {
kJLLog(JLLOG_DEBUG, @"BLE --->To disconnectBLE.");
[_bleManager cancelPeripheralConnection:_bleCurrentPeripheral];
self.isConnected = false;
self.currentEntity = nil;
}
}
#pragma mark 连接蓝牙设备
- (void)connectBLE:(CBPeripheral*)peripheral {
if(_bleCurrentPeripheral){
[_bleManager cancelPeripheralConnection:_bleCurrentPeripheral];
}
_bleCurrentPeripheral = peripheral;
[_bleCurrentPeripheral setDelegate:self];
[_bleManager connectPeripheral:_bleCurrentPeripheral options:@{CBConnectPeripheralOptionNotifyOnDisconnectionKey:@(YES)}];
[_bleManager stopScan];
kJLLog(JLLOG_DEBUG, @"BLE Connecting... Name ---> %@", peripheral.name);
}
- (void)connectPeripheralWithUUID:(NSString*)uuid {
_connectByUUID = uuid;
[self startScanBLE];
}
-(void)findHid:(NSString *)uuid{
NSUUID *uuidNs = [[NSUUID alloc] initWithUUIDString:uuid];
NSArray *array = [self.bleManager retrievePeripheralsWithIdentifiers:@[uuidNs]];
for (CBPeripheral *cbp in array) {
if([cbp.identifier.UUIDString isEqualToString:uuid]){
kJLLog(JLLOG_DEBUG, @"reconnect:%@",cbp);
[self connectBLE:cbp];
break;
}
}
}
-(void)connectAction{
if(self.connectByUUID == nil) return;
NSArray *uuidArr = @[[[NSUUID alloc] initWithUUIDString:self.connectByUUID]];
NSArray *phArr = [_bleManager retrievePeripheralsWithIdentifiers:uuidArr];//serviceUUID就是你首次连接配对的蓝牙
if (phArr.count == 0) {
return;
}
CBPeripheral* peripheral = phArr[0];
if (phArr.firstObject && [phArr.firstObject state] != CBPeripheralStateConnected && [phArr.firstObject state] != CBPeripheralStateConnecting) {
NSString *ble_name = peripheral.name;
NSString *ble_uuid = peripheral.identifier.UUIDString;
kJLLog(JLLOG_DEBUG, @"FLT Connecting(Last)... Name ---> %@ UUID:%@",ble_name,ble_uuid);
_bleCurrentPeripheral = peripheral;
[_bleCurrentPeripheral setDelegate:self];
[_bleManager connectPeripheral:_bleCurrentPeripheral options:@{CBConnectPeripheralOptionNotifyOnDisconnectionKey:@(YES)}];
_connectByUUID = nil;
}
}
#pragma mark - CBCentralManagerDelegate
#pragma mark 蓝牙初始化 Callback
- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
_mBleManagerState = central.state;
if (_mBleManagerState != CBManagerStatePoweredOn) {
self.mBlePeripheral = nil;
self.blePeripheralArr = [NSMutableArray array];
}
}
#pragma mark 发现设备
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral
advertisementData:(NSDictionary<NSString *,id> *)advertisementData RSSI:(NSNumber *)RSSI {
NSString *ble_name = advertisementData[@"kCBAdvDataLocalName"];
NSData *ble_AD = advertisementData[@"kCBAdvDataManufacturerData"];
NSDictionary *info = [JLAdvParse bluetoothAdvParse:self.pairKey AdvData:advertisementData];
if (ble_name.length == 0) return;
kJLLog(JLLOG_DEBUG, @"发现 ----> NAME:%@ RSSI:%@ AD:%@", ble_name,RSSI,ble_AD);
[self addPeripheral:peripheral RSSI:RSSI Name:ble_name Info:info];
[[NSNotificationCenter defaultCenter] postNotificationName:kFLT_BLE_FOUND object:_blePeripheralArr userInfo:nil];
// ota升级过程,回连使用
if ([JLAdvParse otaBleMacAddress:self.lastBleMacAddress isEqualToCBAdvDataManufacturerData:ble_AD]) {
[self connectBLE:peripheral];
}
}
- (void)addPeripheral:(CBPeripheral*)peripheral RSSI:(NSNumber *)rssi Name:(NSString*)name Info:(NSDictionary*)info{
if ([name isEqualToString:@"DeapSound"]) {
[self stopScanBLE];
[self connectBLE:peripheral];
}
}
#pragma mark 设备连接回调
- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral {
kJLLog(JLLOG_DEBUG, @"BLE Connected ---> Device %@", peripheral.name);
for (JLBleEntity *entity in self.blePeripheralArr) {
if([entity.mPeripheral.identifier.UUIDString isEqualToString:peripheral.identifier.UUIDString]){
self.currentEntity = entity;
break;
}
}
self.isConnected = YES;
_otaManager.mBLE_NAME = peripheral.name;
_otaManager.mBLE_UUID = peripheral.identifier.UUIDString;
[DFNotice post:kFLT_BLE_CONNECTED Object:peripheral];
// 连接成功后,查找服务
[peripheral discoverServices:nil];
}
- (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(nullable NSError *)error {
kJLLog(JLLOG_DEBUG, @"Err:BLE Connect FAIL ---> Device:%@ Error:%@",peripheral.name,[error description]);
}
#pragma mark 设备断开连接
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(nullable NSError *)error {
kJLLog(JLLOG_DEBUG, @"BLE Disconnect ---> Device %@ error:%d", peripheral.name, (int)error.code);
[_otaManager noteEntityDisconnected];
self.isConnected = NO;
self.pairStatus = NO;
/*--- UI刷新,设备断开 ---*/
[[NSNotificationCenter defaultCenter] postNotificationName:kFLT_BLE_DISCONNECTED object:peripheral];
}
#pragma mark - CBPeripheralDelegate
#pragma mark 设备服务回调
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(nullable NSError *)error {
if (error) { kJLLog(JLLOG_DEBUG, @"Err: Discovered services fail."); return; }
_mBlePeripheral = peripheral;
for (CBService *service in peripheral.services) {
//如果我们知道要查询的特性的CBUUID,可以在参数一中传入CBUUID数组。
//if ([service.UUID.UUIDString isEqual:FLT_BLE_SERVICE]) {
kJLLog(JLLOG_DEBUG, @"BLE Service ---> %@", service.UUID.UUIDString);
[peripheral discoverCharacteristics:nil forService:service];
//break;
//}
}
}
#pragma mark 设备特征回调
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(nullable NSError *)error {
if (error) { kJLLog(JLLOG_DEBUG, @"Err: Discovered Characteristics fail."); return; }
if ([service.UUID.UUIDString isEqual:FLT_BLE_SERVICE]) {
for (CBCharacteristic *character in service.characteristics) {
/*--- RCSP ---*/
if ([character.UUID.UUIDString isEqual:FLT_BLE_RCSP_W]) {
kJLLog(JLLOG_DEBUG, @"BLE Get Rcsp(Write) Channel ---> %@",character.UUID.UUIDString);
self.mRcspWrite = character;
}
if ([character.UUID.UUIDString isEqual:FLT_BLE_RCSP_R]) {
kJLLog(JLLOG_DEBUG, @"BLE Get Rcsp(Read) Channel ---> %@",character.UUID.UUIDString);
self.mRcspRead = character;
[peripheral setNotifyValue:YES forCharacteristic:character];
if(self.mRcspRead.properties == CBCharacteristicPropertyRead){
[peripheral readValueForCharacteristic:character];
kJLLog(JLLOG_DEBUG, @"BLE Rcsp(Read) Read Value For Characteristic.");
}
}
}
}
}
#pragma mark 更新通知特征的状态
- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(nonnull CBCharacteristic *)characteristic error:(nullable NSError *)error {
if (error) { kJLLog(JLLOG_DEBUG, @"Err: Update NotificationState For Characteristic fail."); return; }
if ([characteristic.service.UUID.UUIDString isEqual:FLT_BLE_SERVICE] &&
[characteristic.UUID.UUIDString isEqual:FLT_BLE_RCSP_R] &&
characteristic.isNotifying == YES)
{
__weak typeof(self) weakSelf = self;
self.bleMtu = [peripheral maximumWriteValueLengthForType:CBCharacteristicWriteWithoutResponse];
kJLLog(JLLOG_DEBUG, @"BLE ---> MTU:%lu",(unsigned long)self.bleMtu);
if (self.isPaired == YES) {
[_pairHash hashResetPair];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//设备认证
[self->_pairHash bluetoothPairingKey:self.pairKey Result:^(BOOL ret) {
if(ret){
weakSelf.lastUUID = peripheral.identifier.UUIDString;
weakSelf.lastBleMacAddress = nil;
[self postBlePairedNotificationWithPeripheral:peripheral];
[weakSelf.otaManager noteEntityConnected];
weakSelf.pairStatus = YES;
}else{
kJLLog(JLLOG_DEBUG, @"JL_Assist Err: bluetooth pairing fail.");
[weakSelf.bleManager cancelPeripheralConnection:peripheral];
}
}];
});
}else{
self.lastUUID = peripheral.identifier.UUIDString;
self.lastBleMacAddress = nil;
[self postBlePairedNotificationWithPeripheral:peripheral];
[self.otaManager noteEntityConnected];
}
}
self.isConnected = YES;
}
- (void)postBlePairedNotificationWithPeripheral:(CBPeripheral *)peripheral {
[[NSNotificationCenter defaultCenter] postNotificationName:kFLT_BLE_PAIRED object:peripheral];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self getDeviceInfo:^(BOOL needForcedUpgrade) {
kJLLog(JLLOG_DEBUG, @"getDeviceInfo:%d",__LINE__);
if (needForcedUpgrade) {
kJLLog(JLLOG_DEBUG, @"设备需要强制升级,请到升级界面选择ota升级文件进行升级!");
}
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
NSString *otaFilePath = [documentsPath stringByAppendingPathComponent:@"update030.ufw"];
if ([[NSFileManager defaultManager] fileExistsAtPath:otaFilePath]) {
[self otaFuncWithFilePath:otaFilePath];
} else {
kJLLog(JLLOG_DEBUG, @"OTA文件不存在: %@", otaFilePath);
}
}];
});
}
#pragma mark 设备返回的数据 GET
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
if (error) { kJLLog(JLLOG_DEBUG, @"Err: receive data fail."); return; }
if(_isPaired == YES && _pairStatus == NO){
//收到设备的认证交互数据
[_pairHash inputPairData:characteristic.value];
}else{
//收到的设备数据,正常通讯数据
[_otaManager cmdOtaDataReceive:characteristic.value];
}
}
- (void)peripheralIsReadyToSendWriteWithoutResponse:(CBPeripheral *)peripheral{
}
#pragma mark - 杰理蓝牙库OTA流程相关业务
/**
* 获取已连接的蓝牙设备信息,这里如果上次设备升级没有成功,会要求执行otaFuncWithFilePath:强制升级
*/
- (void)getDeviceInfo:(GET_DEVICE_CALLBACK _Nonnull)callback {
/*--- 获取设备信息 ---*/
_getCallback = callback;
[_otaManager cmdTargetFeature];
}
/**
* ota升级
* @param otaFilePath ota升级文件路径
*/
- (void)otaFuncWithFilePath:(NSString *)otaFilePath {
kJLLog(JLLOG_DEBUG, @"current otaFilePath ---> %@", otaFilePath);
self.selectedOtaFilePath = otaFilePath;
NSData *otaData = [[NSData alloc] initWithContentsOfFile:otaFilePath];
[_otaManager cmdOTAData:otaData Result:^(JL_OTAResult result, float progress) {
for (id<JLBleManagerOtaDelegate> objc in self.delegates) {
if([objc respondsToSelector:@selector(otaProgressWithOtaResult:withProgress:)]){
[objc otaProgressWithOtaResult:result withProgress:progress];
}
}
}];
}
- (void)otaFuncCancel:(CANCEL_CALLBACK _Nonnull)result{
[_otaManager cmdOTACancelResult:^(uint8_t status, uint8_t sn, NSData * _Nullable data) {
result(status);
}];
}
//MARK: - ota manager delegate callback
-(void)otaCancel{
//TODO: 取消OTA升级回调
}
-(void)otaUpgradeResult:(JL_OTAResult)result Progress:(float)progress{
//TODO: 设备升级过程回调,包括进度状态
kJLLog(JLLOG_DEBUG, @"otaUpgradeResult ---> %u", result);
}
-(void)otaDataSend:(NSData *)data{
[self writeDataByCbp:data];
}
-(void)otaFeatureResult:(JL_OTAManager *)manager{
kJLLog(JLLOG_DEBUG, @"getDeviceInfo:%d",__LINE__);
if (manager.otaStatus == JL_OtaStatusForce) {
kJLLog(JLLOG_DEBUG, @"---> 进入强制升级.");
if (self.selectedOtaFilePath) {
[self otaFuncWithFilePath:self.selectedOtaFilePath];
} else {
_getCallback(true);
}
return;
} else {
if (manager.otaHeadset == JL_OtaHeadsetYES) {
kJLLog(JLLOG_DEBUG, @"---> 进入强制升级: OTA另一只耳机.");
if (self.selectedOtaFilePath) {
[self otaFuncWithFilePath:self.selectedOtaFilePath];
} else {
_getCallback(true);
}
return;
}
}
kJLLog(JLLOG_DEBUG, @"---> 设备正常使用...");
dispatch_async(dispatch_get_main_queue(), ^{
/*--- 获取公共信息 ---*/
[self->_otaManager cmdSystemFunction];
self->_getCallback(false);
});
}
//MARK: - Hash pair delegate callback
-(void)hashOnPairOutputData:(NSData *)data{
[self writeDataByCbp:data];
}
//MARK: - data send manager
/// 需要分包发送
/// - Parameter data: 数据
-(void)writeDataByCbp:(NSData *)data{
// kJLLog(JLLOG_DEBUG, @"%s:data:%@",__func__,data);
if (_mBlePeripheral && self.mRcspWrite) {
if (data.length > 0 ) {
NSInteger len = data.length;
while (len>0) {
if (len <= _bleMtu) {
NSData *mtuData = [data subdataWithRange:NSMakeRange(0, data.length)];
[self selectSendAction:mtuData];
len -= data.length;
}else{
NSData *mtuData = [data subdataWithRange:NSMakeRange(0, _bleMtu)];
[self selectSendAction:mtuData];
len -= _bleMtu;
data = [data subdataWithRange:NSMakeRange(_bleMtu, len)];
}
}
}
}else{
//需要先赋值写特征的内容
kJLLog(JLLOG_DEBUG, @"need to init");
}
}
-(void)selectSendAction:(NSData *)data{
[_mBlePeripheral writeValue:data
forCharacteristic:self.mRcspWrite
type:CBCharacteristicWriteWithoutResponse];
}
//MARK: - 通过信号阀发送
- (void)singleDidSendData:(NSData *)data{
[_mBlePeripheral writeValue:data
forCharacteristic:self.mRcspWrite
type:CBCharacteristicWriteWithoutResponse];
}
@end

22
local_plugins/ota/ios/Classes/OtaPlugin.swift

@ -1,7 +1,8 @@
import Flutter
import UIKit
public class OtaPlugin: NSObject, FlutterPlugin {
let userManager = JLBleManager.sharedInstance()
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "ota", binaryMessenger: registrar.messenger())
let instance = OtaPlugin()
@ -10,10 +11,25 @@ public class OtaPlugin: NSObject, FlutterPlugin {
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch call.method {
case "getPlatformVersion":
result("iOS " + UIDevice.current.systemVersion)
case "startUpgrading":
startUpgrading()
result("")
case "onOtaClose":
onOtaClose()
result("")
default:
result(FlutterMethodNotImplemented)
}
}
private func startUpgrading() {
if userManager.mBleManagerState == CBManagerState.poweredOn {
userManager.startScanBLE()
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
self.userManager.stopScanBLE()
}
}
}
private func onOtaClose() {}
}

BIN
local_plugins/ota/ios/Frameworks/DFUnits.framework/DFUnits

Binary file not shown.

28
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/AESx.h

@ -0,0 +1,28 @@
//
// AES_DF.h
// WifiAudio
//
// Created by zhjl on 15-5-29.
// Copyright (c) 2015年 ZH-jl. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface AESx : NSObject
+(id)shared;
-(unsigned int)Dcs_EnCodeSrc:(char *)src
Des:(char *)des
Lenghts:(unsigned int)lengths
Key:(char *)key;
-(void)Dcs_DeCodeSrc:(char *)src
Des:(char *)des
Lengths:(unsigned int)lengths
Key:(char *)key;
-(unsigned int)ns_crc32Buffer:(const unsigned char *)buffer
Lenght:(unsigned int)len;
@end

82
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFAction.h

@ -0,0 +1,82 @@
//
// DFAction.h
// DFUnits
//
// Created by DFung on 16/1/25.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void(^Action)(void);
@interface DFAction : NSObject
/**
* @how:Execution block on Asynchronous thread.
*/
+(void)subTask:(Action)block;
/**
* @how:Execution block on Synchronization thread.
*/
+(void)mainTask:(Action)block;
/**
* @how:Execution some blocks asynchronousily and make a summary.
* @tasks block Array
* @block final block
*/
+(void)subTasks:(NSArray*)tasks Final:(Action)block;
/**
* @how:Execution block after a few seconds.
* @param sec Delay time
* @param block Code block
*/
+(void)delay:(double)sec Task:(Action)block;
/**
* @how:Execution block only once.
* @param block Code block
*/
+(void)taskOnce:(Action)block;
/**
* @how:Execution block N times.
* @param block Code block
* @param times N
*/
+(void)task:(Action)block Times:(int)times;
/**
* 设置执行代码的最小时间间隔gap。
* 返回 YES:大于gap,建议继续执行。
* 返回 NO: 小于gap,建议代码return。
*/
+(BOOL)setMinExecutionGap:(NSTimeInterval)gap;
/**
* @how:定时处理.
* @return NSTimer
*/
+(NSTimer*)timingStart:(SEL)sel target:(id)objc Time:(NSTimeInterval)sec;
/**
* @how:暂停定时处理.
* @return NSTimer
*/
+(void)timingPause:(__weak NSTimer*)timer;
/**
* @how:继续定时处理.
* @return NSTimer
*/
+(void)timingContinue:(__weak NSTimer*)timer;
/**
* @how:摧毁定时处理功能.
*/
+(void)timingStop:(__weak NSTimer*)timer;
@end

173
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFAudio.h

@ -0,0 +1,173 @@
//
// DFAudio.h
// DFUnits
//
// Created by DFung on 16/1/22.
// Copyright © 2016年 DFung. All rights reserved.
//
/**
* 科普: 数据量(字节/秒)= (采样频率(Hz) * 采样位数(bit) * 声道数) / 8
*/
#import <Foundation/Foundation.h>
#import <AudioUnit/AudioUnit.h>
#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h>
#include <stdio.h>
#include <stdlib.h>
/**
* 【DFAudio】状态回调
*/
#define kDFAudio_ST @"NOTE_DFAUDIO_ST"
/**
* 【DFAudio】播放进度(时间)
*/
#define kDFAudio_PG @"NOTE_DFAUDIO_PG"
/**
* 【DFAudio】录音数据
*/
#define kDFAudio_REC @"NOTE_DFAUDIO_REC"
typedef enum : NSUInteger {
DFAudio_ST_STOP, //停止状态
DFAudio_ST_PLAYING, //播放状态
DFAudio_ST_PENDING, //等待状态
DFAudio_ST_RECORDING, //录音状态
} DFAudio_ST;
struct DF_Data
{
int size;
unsigned char *data;
};
@class DFAudioFormat;
@interface DFAudio : NSObject
#pragma mark 播放
/**
* 用途:初始化【Player】
* @param size 缓存大小
* @param format (默认 采样率=8000,采样位数=16,声道数=1)
*/
-(void)setPlayerBufferSize:(int32_t)size
Format:(DFAudioFormat*)format;
/**
* 用途:输入音频数据。
* @param data 音频数据
*/
-(void)didPlayerInputBuffer:(NSData*)data;
/**
PCM缓存可用空间。
@return 大小
*/
-(uint32_t)didRingUsable;
/**
* 用途:运行【Player】
*/
-(void)didPlayerStart;
/**
* 用途:停止【Player】
*/
-(void)didPlayerStop;
/**
* 用途:关闭并释放【Player】
*/
-(void)didPlayerRelease;
#pragma mark 录音
/**
* 用途:初始化【Recorder】
* @param format (默认 采样率=8000,采样位数=16,声道数=1)
* @tips 用【kDFAudio_REC】通知回调录音数据。
*/
-(void)setRecorderFormat:(DFAudioFormat*)format;
/**
* 用途:运行【Recorder】
*/
-(void)didRecorderStart;
/**
* 用途:停止【Recorder】
*/
-(void)didRecorderStop;
/**
* 用途:完成【Recorder】
*/
-(void)didRecorderFinished;
/**
* 用途:关闭并释放【Recorder】
*/
-(void)didRecorderRelease;
#pragma mark PCM <-> WAV 互转
/**
* 用途:wav转换成pcm
*/
+(NSString*)wavToPcm:(NSString*)wavPath;
/**
* 用途:pcm转换成Wav
*/
+(NSString*)pcmToWav:(NSString*)pcmPath Format:(DFAudioFormat*)format;
#pragma mark 设置PCM参数
+(void)setPcmFormat:(DFAudioFormat *)format;
#pragma mark 检测PCM数据 音量分贝
+(double)checkPcmDB:(NSData*)pcmData;
#pragma mark super vad
/**
* return
* --> 0 : vad prepare.
* --> 1 : vad start.
* --> 2 : vad end.
*/
+(int)vadPcm:(NSData*)pcm MinDB:(float)db;
#pragma mark super vad + path
/**
* return
* --> 0 : vad prepare.
* --> 1 : vad start.
* --> 2 : vad end. (此时path为断句路径)
*/
+(int)vadPcm:(NSData*)pcm MinDB:(float)db Path:(NSString*)path;
/**
* clean vad cache
*/
+(void)vadClean;
@end
@interface DFAudioFormat : NSObject
@property(nonatomic,assign)Float64 mSampleRate;
@property(nonatomic,assign)UInt32 mBitsPerChannel;
@property(nonatomic,assign)UInt32 mChannelsPerFrame;
@property(nonatomic,assign)AudioFormatID mFormatID;
@end

123
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFCircleTextView.h

@ -0,0 +1,123 @@
//
// DFCircleTextView.h
//
// Created by DFung on 2017/6/15.
// Copyright © 2017年 DFung All rights reserved.
//
#import <UIKit/UIKit.h>
typedef enum {
DFCircleTextAlignOutside,
DFCircleTextAlignCenter,
DFCircleTextAlignInside
} DFCircleTextAlignment;
@interface DFCircleTextView : UIView
/**
* Set the text to display in the DFCircleTextView
*/
@property (strong, nonatomic) NSString *text;
/**
* Set the Text Attributes for the text.
* Refer to the Text Attributes documentation for more info.
*/
@property (strong, nonatomic) NSDictionary *textAttributes;
/**
* Align the text left, right or center reletive to the baseAngle.
*/
@property (nonatomic) NSTextAlignment textAlignment;
/**
* Align the text inside, outside or centered on the circle.
*/
@property (nonatomic) DFCircleTextAlignment circleTextAlignment;
/**
* Set the radius of the circle.
* When no radius is set, the maximum radius is calculated and used.
*/
@property (nonatomic) float radius;
/**
* Set the base angle. See textAlignment property for more information.
*/
@property (nonatomic) float baseAngle;
/**
* Adjust the spacing of the characters.
* 1 = default spacing, 0.5 = half spacing, 2 = double spacing, etc ...
*/
@property (nonatomic) float characterSpacing;
/**
* Disable the kerning cache.
*/
@property (nonatomic) BOOL disableKerningCache;
/**
* Clear the kerning cache.
* Note that this is automaticlly done when the app gives a memory warning.
*/
- (void)clearKerningCache;
/**
* Convenience function for quickly changing the textColor
* without the need of creating an NSDictionary *textAttributes
*/
- (void) setColor:(UIColor *)color;
/**
* text display from right side.
*/
-(void)showFromRight;
/**
* text display from left side.
*/
-(void)showFromLeft;
/**
* text display from outside.
*/
-(void)showFromOutside;
/**
* text display from inside.
*/
-(void)showFromInside;
/**
* text display from bothside.
*/
-(void)showFromBothSide;
/**
* text display from center.
*/
-(void)showFromCenter;
/**
* text will rotate.
*/
-(void)showRotateWise:(BOOL)wise;
@end

39
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFContacts.h

@ -0,0 +1,39 @@
//
// DFContacts.h
// DFUnits
//
// Created by DFung on 2018/4/19.
// Copyright © 2018年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
//#define JL_CONTACTS_ENABLE
#ifdef JL_CONTACTS_ENABLE
#import <Contacts/Contacts.h>
@interface DFContacts : NSObject
/**
* keys: @[CNContactPhoneNumbersKey, 手机号
* CNContactFamilyNameKey, 姓氏
* CNContactGivenNameKey 名字
* ...,nil ]; @see <Contacts/Contacts.h> 内有详情。
* 选择需要的信息。
*
* contacts:返回NSArray<CNContact>。
* flag:0=成功,-1=用户拒绝,-2=需在设置界面开启通讯录,-3=参数有误;
*/
+(void)scanContactsWithKeys:(NSArray*)keys
Result:(void(^)(NSArray*contacts,
int flag))result;
/**
* 简单解析 contacts
* {@"FamilyName":@"...",
* @"GivenName":@"...",
* @"Phones":@[@"iphone":@"110",@"home":@"456",...]}
*/
+(NSDictionary*)openContact:(CNContact*)contact;
@end
#endif

33
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFCrc16.h

@ -0,0 +1,33 @@
//
// DFCrc16.h
// DFUnits
//
// Created by DFung on 2017/3/6.
// Copyright © 2017年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
#include <unistd.h>
#include <_types.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@interface DFCrc16 : NSObject
/**
* 单独Crc16值.
*/
+(uint16_t)didCrc16:(uint8_t*)pt
Length:(uint16_t)len;
/**
* 累加Crc16值.
*/
+(uint16_t)didCrc16All:(uint8_t*)pt
Length:(uint16_t)len
CrcValue:(uint16_t)value;
/**
* 清除Crc值.
*/
+(void)didResetCrc;
@end

32
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFFadeLabel.h

@ -0,0 +1,32 @@
//
// DFFadeLabel.h
// DFUnits
//
// Created by DFung on 2017/6/15.
// Copyright © 2017年 DFung. All rights reserved.
//
#import <UIKit/UIKit.h>
/**
DFFadeLabel is a UIView subclass adds a UILabel effect when the text of a label instance outgrows the available width. Instances of `DFLabel` can be configured
for label fading or unFading toward Right、Left、Up、Down.
*/
typedef enum : NSUInteger {
DFFadeLabel_TYPE_LEFT,
DFFadeLabel_TYPE_RIGHT,
DFFadeLabel_TYPE_UP,
DFFadeLabel_TYPE_DOWN,
DFFadeLabel_TYPE_CENTER,
DFFadeLabel_TYPE_BOTHSIDE
} DFFadeLabel_TYPE;
@interface DFFadeLabel : UIView
@property(nonatomic,strong)UILabel*label;
@property(nonatomic,strong)NSString *text;
-(void)showFromDirection:(DFFadeLabel_TYPE)type;
@end

125
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFFile.h

@ -0,0 +1,125 @@
//
// DFFile.h
// DVRunning
//
// Created by Mac on 15/11/13.
// Copyright (c) 2015年 DevinVon. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DFFile : NSObject
/**
* 用途:在存在的路径上,创建一个文件。
* @param path 你喜欢的路径
*/
+(BOOL)createPath:(NSString*)path;
/**
* 用途:【创建】一个文件,在你想要的路径下。
* @param sPath 系统路径
* @param mPath 中途路径 -->> @"test1/test2/test3" <<--
* @param file 文件名
*/
+(NSString*)createOn:(NSSearchPathDirectory)sPath
MiddlePath:(NSString*)mPath
File:(NSString*)file;
/**
* 用途:生成一个文件路径字符串。
* @param sPath 系统路径
* @param mPath 中途路径 -->> @"test1/test2/test3" <<--
* @param file 文件名
*/
+(NSString*)listPath:(NSSearchPathDirectory)sPath
MiddlePath:(NSString*)mPath
File:(NSString*)file;
/**
* 用途:【查找】一个文件,在你想要的路径下。
* @param sPath 系统路径
* @param mPath 中途路径 -->> @"test1/test2/test3" <<--
* @param file 文件名
*/
+(NSString*)findPath:(NSSearchPathDirectory)sPath
MiddlePath:(NSString*)mPath
File:(NSString*)file;
/**
* 用途:Byte单位转换成KB,MB,GB
* @param byte 多少bytes?
*/
+(NSString*)fileByte:(long long)byte;
/**
* 用途:重命名。
* @param oldName 旧的文件(路径) -->> @"test1/test2/test3" <<--
* @param NewName 新的文件(路径) -->> @"test1/test2/test3" <<--
*/
+(BOOL)renameOldName:(NSString*)oldName
NewName:(NSString*)newName;
/**
* 用途:删除文件。
* @param path 文件路径
*/
+(BOOL)removePath:(NSString*)path;
/**
* 用途:把数据写进文件(覆盖)。
* @param data 数据字节
* @param path 文件路径
*/
+(BOOL)writeData:(NSData*)data fillFile:(NSString*)path;
/**
* 用途:把数据写进文件(文件末尾)。
* @param data 数据字节
* @param path 文件路径
*/
+(void)writeData:(NSData*)data endFile:(NSString*)path;
/**
* 用途:从bundle里寻找文件。
* @param bundle @"*.bundle"
* @param file 文件名
*/
+(NSString*)find:(NSString*)bundle File:(NSString*)file;
/**
* 用途:从Project资源里寻找文件。
* (先把资源文件添加至工程内的Copy Bundle Resources内。)
* @param file 文件名
* @return 该文件的路径。
*/
+(NSString*)find:(NSString *)file;
/**
* 用途:解析JSON文件。
* @param path 文件路径
*/
+(id)JsonPath:(NSString*)path;
/**
* 用途:解析JSON数据。
* @param data jsonData
*/
+(id)JsonData:(NSData*)data;
/**
* 用途:读取文件字符串。
* @param path 文件路径
*/
+(NSString*)stringPath:(NSString*)path;
/**
* 用途:文件夹内文件元素。
* @param path 文件夹路径
*/
+(NSArray*)subPaths:(NSString*)path;
/**
* 用途:文件大小。
* @param path 文件夹路径
* @return 该文件的大小。
*/
+(long long)sizeOfFile:(NSString*)path;
@end

25
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFGzip.h

@ -0,0 +1,25 @@
//
// DFGzip.h
// DFUnits
//
// Created by DFung on 2016/12/13.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DFGzip : NSObject
/**
* Gzip 解压(Need Include => libz.1.2.8.tbd)
*/
+(NSData *)uncompressZippedData:(NSData *)compressedData;
/**
* Gzip 压缩(Need Include => libz.1.2.8.tbd)
*/
+(NSData *)gzipData:(NSData *)pUncompressedData;
@end

24
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFHmacMD5.h

@ -0,0 +1,24 @@
//
// DFHmacMD5.h
// DFUnits
//
// Created by DFung on 2016/12/13.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DFHmacMD5 : NSObject
/*
* MD5加密32位
*/
+ (NSString *)HmacMD5String:(NSString *)string;
/*
* HmacMD5加密
*/
+ (NSString *)HmacMD5String:(NSString *)string
Key:(NSString *)keyStr;
@end

70
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFHttp.h

@ -0,0 +1,70 @@
//
// DFHttp.h
// DFUnits
//
// Created by DFung on 16/1/22.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
@class DFHttp;
@protocol DFHttpDelegate <NSObject>
@optional
-(void)http:(DFHttp*)http didFail:(NSError*)error;
-(void)http:(DFHttp*)http didSuccess:(NSString*)path;
-(void)http:(DFHttp*)http progress:(float)rate;
@end
@interface DFHttp : NSObject
@property(assign,nonatomic)int tag;
@property(assign,nonatomic)id <DFHttpDelegate>delegate;
/*
* Set info[@"URL"];
* info[@"PATH"];
*/
-(void)down:(NSDictionary*)info;
-(void)cancelTask;
/*
Returns a new string made from the receiver by replacing
all characters not in the allowedCharacters set with percent
encoded characters. UTF-8 encoding is used to determine the
correct percent encoded characters. Entire URL strings cannot
be percent-encoded. This method is intended to percent-encode
an URL component or subcomponent string, NOT the entire URL
string. Any characters in allowedCharacters outside of the
7-bit ASCII range are ignored.
*/
+(NSString*)encodeURL:(NSString*)url;
/*
Returns a new string made from the receiver by replacing
all percent encoded sequences with the matching UTF-8 characters.
*/
+(NSString*)decodeURL:(NSString*)url;
/**
* 异步请求(GET)
*/
+(void)getWithUrl:(NSString*)url
Result:(void(^)(id ret, NSURLResponse *rps))block;
/**
* 异步请求(POST)
*/
+(void)postWithUrl:(NSString*)url
Body:(NSString*)body
Result:(void(^)(id ret, NSURLResponse *rps))block;
@end

29
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFHttp1.h

@ -0,0 +1,29 @@
//
// DFHttp1.h
// DFUnits
//
// Created by 杰理科技 on 2021/4/1.
// Copyright © 2021 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(UInt8, DF_HTTP1_Result) {
DF_HTTP1_ResultFail = 0x00, //下载失败
DF_HTTP1_ResultSuccess = 0x01, //下载成功
DF_HTTP1_ResultStart = 0x02, //开始下载
DF_HTTP1_ResultDownload = 0x03, //正在下载
DF_HTTP1_ResultCancel = 0x04, //正在取消
};
typedef void(^DF_HTTP1_BK)(float progress,NSData *__nullable data, DF_HTTP1_Result result);
@interface DFHttp1 : NSObject
-(void)httpDownload:(NSString*)url Result:(DF_HTTP1_BK __nullable)result;
-(void)httpCancelTask;
@end
NS_ASSUME_NONNULL_END

57
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFImage.h

@ -0,0 +1,57 @@
//
// DFImage.h
// DFUnits
//
// Created by DFung on 16/1/22.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface DFImage : NSObject
/**
* 用途:压缩图片。
* @param srcImage 待压缩的图片
* @param scale 压缩比
*/
+(NSData*)compressImage:(UIImage *)srcImage Scale:(double)scale;
/**
* 用途:从Project资源里寻找图片文件。
* @param image 图片名 -->> @"test@2x.png" <<--
*/
+(UIImage*)loadImage:(NSString*)image;
/**
* @use 图片模糊处理
* @param image 图片数据
* @param blur 模糊值,取值[0,1]
* @return 模糊后的图片
*/
+(UIImage*)blurImage:(UIImage*)image Blur:(CGFloat)blur;
/**
* @use 图片模糊处理
* @param image 图片数据
* @param blur 模糊值,取值[0,1]
* @param color 背景色调
* @return 模糊后的图片
*/
+(UIImage*)blurImage:(UIImage*)image Blur:(CGFloat)blur TintColor:(UIColor*)color;
/**
* @use 屏幕截图
* @param size 大小
* @param view 截取视图
* @return 截取后的图片
*/
+(UIImage*)screenshotSize:(CGSize)size OnView:(UIView*)view;
@end

534
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFLabel.h

@ -0,0 +1,534 @@
//
// DFLabel.h
// DFUnits
//
// Created by DFung on 2017/3/15.
// Copyright © 2017年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/** An enum that defines the types of `DFLabel` scrolling */
typedef NS_ENUM(NSUInteger, DFLabelType) {
/** Scrolls left first, then back right to the original position. */
DFLeftRight = 0,
/** Scrolls right first, then back left to the original position. */
DFRightLeft = 1,
/** Continuously scrolls left (with a pause at the original position if animationDelay is set). See the `trailingBuffer` property to define a spacing between the repeating strings.*/
DFContinuous = 2,
/** Continuously scrolls right (with a pause at the original position if animationDelay is set). See the `trailingBuffer` property to define a spacing between the repeating strings.*/
DFContinuousReverse = 3
};
#ifndef IBInspectable
#define IBInspectable
#endif
/**
DFLabel is a UILabel subclass adds a scrolling DFLabel effect when the text of a label instance outgrows the available width. Instances of `DFLabel` can be configured
for label scrolling direction/looping, speed/rate, and other options.
*/
IB_DESIGNABLE
@interface DFLabel : UILabel
////////////////////////////////////////////////////////////////////////////////
/// @name Creating DFLabels
////////////////////////////////////////////////////////////////////////////////
/** Returns a newly initialized `DFLabel` instance.
The default scroll duration of 7.0 seconds and fade length of 0.0 are used.
@param frame A rectangle specifying the initial location and size of the view in its superview's coordinates. Text (for the given font, font size, etc.) that does not fit in this frame will automatically scroll.
@return An initialized `DFLabel` object or nil if the object couldn't be created.
*/
- (instancetype)initWithFrame:(CGRect)frame;
/** Returns a newly initialized `DFLabel` instance with the specified scroll rate and edge transparency fade length.
You must specify a non-zero rate, and you cannot thereafter modify the rate.
@param frame A rectangle specifying the initial location and size of the view in its superview's coordinates. Text (for the given font, font size, etc.) that does not fit in this frame will automatically scroll.
@param pixelsPerSec A rate of scroll for the label scroll animation. Must be non-zero. Note that this will be the maximum rate for ease-type animation.
@param fadeLength A length of transparency fade at the left and right edges of the `DFLabel` instance's frame.
@see fadeLength
@return An initialized `DFLabel` object or nil if the object couldn't be created.
*/
- (instancetype)initWithFrame:(CGRect)frame rate:(CGFloat)pixelsPerSec andFadeLength:(CGFloat)fadeLength;
/** Returns a newly initialized `DFLabel` instance with the specified scroll duration and edge transparency fade length.
You must specify a non-zero duration, and you cannot thereafter modify the duration.
@param frame A rectangle specifying the initial location and size of the view in its superview's coordinates. Text (for the given font, font size, etc.) that does not fit in this frame will automatically scroll.
@param scrollDuration A scroll duration the label scroll animation. Must be non-zero. This will be the duration that the animation takes for one-half of the scroll cycle in the case of left-right and right-left DFLabel types, and for one loop of a continuous DFLabel type.
@param fadeLength A length of transparency fade at the left and right edges of the `DFLabel` instance's frame.
@see fadeLength
@return An initialized `DFLabel` object or nil if the object couldn't be created.
*/
- (instancetype)initWithFrame:(CGRect)frame duration:(NSTimeInterval)scrollDuration andFadeLength:(CGFloat)fadeLength;
/** Resizes the view to the minimum size necessary to fully enclose the current text (i.e. without scrolling), up to the maximum size specified.
The current origin of the frame is retained.
@param maxSize The maximum size up to which the view should be resized. Passing `CGSizeZero` will result in no maximum size limit.
@param adjustHeight A boolean that can be used to indicate if the view's height should also be adjusted. Note that this has no impact on scrolling.
*/
- (void)minimizeLabelFrameWithMaximumSize:(CGSize)maxSize adjustHeight:(BOOL)adjustHeight;
////////////////////////////////////////////////////////////////////////////////
/// @name Configuration Options
////////////////////////////////////////////////////////////////////////////////
/** Specifies the animation curve used in the scrolling motion of the labels.
Allowable options:
- `UIViewAnimationOptionCurveEaseInOut`
- `UIViewAnimationOptionCurveEaseIn`
- `UIViewAnimationOptionCurveEaseOut`
- `UIViewAnimationOptionCurveLinear`
Defaults to `UIViewAnimationOptionCurveEaseInOut`.
*/
@property (nonatomic, assign) UIViewAnimationOptions animationCurve;
/** A boolean property that sets whether the `DFLabel` should behave like a normal UILabel.
When set to `YES` the `DFLabel` will behave like a normal UILabel, and will not begin scrolling when the text is
larger than the specified frame. The change takes effect immediately, removing any in-flight animation as well as any
current edge fade. Note that the `DFLabel` will respect the current values of the `lineBreakMode` and `textAlignment`
properties while labelized.
To simply prevent automatic scrolling, use the `holdScrolling` property.
Defaults to `NO`.
@see holdScrolling
@see lineBreakMode
@warning The label will not automatically scroll when this property is set to `YES`.
@warning The UILabel default setting for the `lineBreakMode` property is `NSLineBreakByTruncatingTail`, which truncates
the text adds an ellipsis glyph (...). Set the `lineBreakMode` property to `NSLineBreakByClipping` in order to avoid the
ellipsis, especially if using an edge transparency fade.
*/
@property (nonatomic, assign) IBInspectable BOOL labelize;
/** A boolean property that sets whether the `DFLabel` should hold (prevent) label scrolling.
When set to `YES`, the `DFLabel` will not automatically scroll even its text is larger than the specified frame,
although the specified edge fades will remain.
To set the `DFLabel` to act like a normal UILabel, use the `labelize` property.
Defaults to `NO`.
@see labelize
@warning The label will not automatically scroll when this property is set to `YES`.
*/
@property (nonatomic, assign) IBInspectable BOOL holdScrolling;
/** A boolean property that sets whether the `DFLabel` should only begin a scroll when tapped.
If this property is set to `YES`, the `DFLabel` will begin a scroll animation cycle only when tapped. The label will
not automatically being a scroll. This setting overrides the setting of the `holdScrolling` property.
Defaults to `NO` .
@warning The label will not automatically scroll when this property is set to `YES`.
@see holdScrolling
*/
@property (nonatomic, assign) IBInspectable BOOL tapToScroll;
/** Defines the direction and method in which the `DFLabel` instance scrolls.
`DFLabel` supports four types of scrolling: `DFLeftRight`, `DFRightLeft`, `DFContinuous`, and `DFContinuousReverse`.
Given the nature of how text direction works, the options for the `DFLabelType` property require specific text alignments
and will set the textAlignment property accordingly.
- `DFLeftRight` type is ONLY compatible with a label text alignment of `NSTextAlignmentLeft`.
- `DFRightLeft` type is ONLY compatible with a label text alignment of `NSTextAlignmentRight`.
- `DFContinuous` does not require a text alignment (it is effectively centered).
- `DFContinuousReverse` does not require a text alignment (it is effectively centered).
Defaults to `DFLeftRight`.
@see DFLabelType
@see textAlignment
*/
#if TARGET_INTERFACE_BUILDER
@property (nonatomic, assign) IBInspectable NSInteger labelType;
#else
@property (nonatomic, assign) DFLabelType labelType;
#endif
/** Defines the duration of the scrolling animation.
This property sets the amount of time it will take for the scrolling animation to complete a
scrolling cycle. Note that for `DFLeftRight` and `DFRightLeft`, a cycle consists of the animation away,
a pause (if a delay is specified), and the animation back to the original position.
Setting this property will automatically override any value previously set to the `rate` property, and the `rate`
property will be set to `0.0`.
@see rate
*/
@property (nonatomic, assign) IBInspectable CGFloat scrollDuration;
/** Defines the rate at which the label will scroll, in pixels per second.
Setting this property will automatically override any value previousy set to the `scrollDuration` property, and the
`scrollDuration` property will be set to `0.0`. Note that this is the rate at which the label would scroll if it
moved at a constant speed - with other animation curves the rate will be slightly different.
@see scrollDuration
*/
@property (nonatomic, assign) IBInspectable CGFloat rate;
/** A buffer (offset) between the leading edge of the label text and the label frame.
This property adds additional space between the leading edge of the label text and the label frame. The
leading edge is the edge of the label text facing the direction of scroll (i.e. the edge that animates
offscreen first during scrolling).
Defaults to `0`.
@note The value set to this property affects label positioning at all times (including when `labelize` is set to `YES`),
including when the text string length is short enough that the label does not need to scroll.
@note For `DFContinuous`-type labels, the smallest value of `leadingBuffer`, 'trailingBuffer`, and `fadeLength`
is used as spacing between the two label instances. Zero is an allowable value for all three properties.
@see trailingBuffer
@since Available in 2.1.0 and later.
*/
@property (nonatomic, assign) IBInspectable CGFloat leadingBuffer;
/** A buffer (offset) between the trailing edge of the label text and the label frame.
This property adds additional space (buffer) between the trailing edge of the label text and the label frame. The
trailing edge is the edge of the label text facing away from the direction of scroll (i.e. the edge that animates
offscreen last during scrolling).
Defaults to `0`.
@note For `DFContinuous`-type labels, the smallest value of `leadingBuffer`, 'trailingBuffer`, and `fadeLength`
is used as spacing between the two label instances. Zero is an allowable value for all three properties.
@note The value set to this property has no effect when the `labelize` property is set to `YES`.
@see leadingBuffer
@since Available in 2.1.0 and later.
*/
@property (nonatomic, assign) IBInspectable CGFloat trailingBuffer;
/**
@deprecated Use `trailingBuffer` instead. Values set to this property are simply forwarded to `trailingBuffer`.
*/
@property (nonatomic, assign) CGFloat continuousDFLabelExtraBuffer DEPRECATED_ATTRIBUTE;
/** The length of transparency fade at the left and right edges of the `DFLabel` instance's frame.
This propery sets the size (in points) of the view edge transparency fades on the left and right edges of a `DFLabel`. The
transparency fades from an alpha of 1.0 (fully visible) to 0.0 (fully transparent) over this distance. Values set to this property
will be sanitized to prevent a fade length greater than 1/2 of the frame width.
Defaults to `0`.
*/
@property (nonatomic, assign) IBInspectable CGFloat fadeLength;
/** The length of delay in seconds that the label pauses at the completion of a scroll. */
@property (nonatomic, assign) IBInspectable CGFloat animationDelay;
/** The read-only duration of the scroll animation (not including delay).
The value of this property is calculated when using the `scrollRate` property to set label animation speed. The value of this property
is equal to the value of `scrollDuration` property when using the `scrollDuration` property to set label animation speed.
@see scrollDuration
@see scrollRate
*/
@property (nonatomic, readonly) NSTimeInterval animationDuration;
////////////////////////////////////////////////////////////////////////////////
/// @name Animation control
////////////////////////////////////////////////////////////////////////////////
/** Immediately resets the label to the home position, cancelling any in-flight scroll animation, and restarts the scroll animation if the appropriate conditions are met.
@see resetLabel
@see triggerScrollStart
*/
- (void)restartLabel;
/** Immediately resets the label to the home position, cancelling any in-flight scroll animation.
The text is immediately returned to the home position. Scrolling will not resume automatically after a call to this method.
To re-initiate scrolling use a call to `restartLabel` or `triggerScrollStart`, or make a change to a UILabel property such as text, bounds/frame,
font, font size, etc.
@see restartLabel
@see triggerScrollStart
@since Available in 2.4.0 and later.
*/
- (void)shutdownLabel;
/** Resets the label text, recalculating the scroll animation.
The text is immediately returned to the home position, and the scroll animation positions are cleared. Scrolling will not resume automatically after
a call to this method. To re-initiate scrolling, use either a call to `restartLabel` or make a change to a UILabel property such as text, bounds/frame,
font, font size, etc.
@see restartLabel
*/
- (void)resetLabel;
/** Pauses the text scrolling animation, at any point during an in-progress animation.
@note This method has no effect if a scroll animation is NOT already in progress. To prevent automatic scrolling on a newly-initialized label prior to its presentation onscreen, see the `holdScrolling` property.
@see holdScrolling
@see unpauseLabel
*/
- (void)pauseLabel;
/** Un-pauses a previously paused text scrolling animation. This method has no effect if the label was not previously paused using `pauseLabel`.
@see pauseLabel
*/
- (void)unpauseLabel;
/** Overrides any non-size condition which is preventing the receiver from automatically scrolling, and begins a scroll animation.
Currently the only non-size conditions which can prevent a label from scrolling are the `tapToScroll` and `holdScrolling` properties. This
method will not force a label with a string that fits inside the label bounds (i.e. that would not automatically scroll) to begin a scroll
animation.
Upon the completion of the first forced scroll animation, the receiver will not automatically continue to scroll unless the conditions
preventing scrolling have been removed.
@note This method has no effect if called during an already in-flight scroll animation.
@see restartLabel
@since Available in 2.2.0 and later.
*/
- (void)triggerScrollStart;
////////////////////////////////////////////////////////////////////////////////
/// @name Animation Status
////////////////////////////////////////////////////////////////////////////////
/** Called when the label animation is about to begin.
The default implementation of this method does nothing. Subclasses may override this method in order to perform any custom actions just as
the label animation begins. This is only called in the event that the conditions for scrolling to begin are met.
@since Available in 1.5.0 and later.
*/
- (void)labelWillBeginScroll;
/** Called when the label animation has finished, and the label is at the home position.
The default implementation of this method does nothing. Subclasses may override this method in order to perform any custom actions jas as
the label animation completes, and before the next animation would begin (assuming the scroll conditions are met).
@param finished A Boolean that indicates whether or not the scroll animation actually finished before the completion handler was called.
@since Available in 1.5.0 and later.
@warning This method will be called, and the `finished` parameter will be `NO`, when any property changes are made that would cause the label
scrolling to be automatically reset. This includes changes to label text and font/font size changes.
*/
- (void)labelReturnedToHome:(BOOL)finished;
/** A boolean property that indicates if the label's scroll animation has been paused.
@see pauseLabel
@see unpauseLabel
*/
@property (nonatomic, assign, readonly) BOOL isPaused;
/** A boolean property that indicates if the label is currently away from the home location.
The "home" location is the traditional location of `UILabel` text. This property essentially reflects if a scroll animation is underway.
*/
@property (nonatomic, assign, readonly) BOOL awayFromHome;
////////////////////////////////////////////////////////////////////////////////
/// @name Bulk-manipulation Methods
////////////////////////////////////////////////////////////////////////////////
/** Convenience method to restart all `DFLabel` instances that have the specified view controller in their next responder chain.
This method sends a `NSNotification` to all `DFLabel` instances with the specified view controller in their next responder chain.
The scrolling animation of these instances will be automatically restarted. This is equivalent to calling `restartLabel` on all affected
instances.
There is currently no functional difference between this method and `controllerViewDidAppear:` or `controllerViewWillAppear:`. The methods may
be used interchangeably.
@warning View controllers that appear with animation (such as from underneath a modal-style controller) can cause some `DFLabel` text
position "jumping" when this method is used in `viewDidAppear` if scroll animations are already underway. Use this method inside `viewWillAppear:`
instead to avoid this problem.
@warning This method may not function properly if passed the parent view controller when using view controller containment.
@param controller The view controller that has appeared.
@see restartLabel
@see controllerViewDidAppear:
@see controllerViewWillAppear:
@since Available in 1.3.1 and later.
*/
+ (void)restartLabelsOfController:(UIViewController *)controller;
/** Convenience method to restart all `DFLabel` instances that have the specified view controller in their next responder chain.
Alternative to `restartLabelsOfController:`. This method is retained for backwards compatibility and future enhancements.
@param controller The view controller that has appeared.
@see restartLabel
@see controllerViewWillAppear:
@since Available in 1.2.7 and later.
*/
+ (void)controllerViewDidAppear:(UIViewController *)controller;
/** Convenience method to restart all `DFLabel` instances that have the specified view controller in their next responder chain.
Alternative to `restartLabelsOfController:`. This method is retained for backwards compatibility and future enhancements.
@param controller The view controller that has appeared.
@see restartLabel
@see controllerViewDidAppear:
@since Available in 1.2.8 and later.
*/
+ (void)controllerViewWillAppear:(UIViewController *)controller;
/**
@deprecated Use `controllerViewDidAppear:` instead.
*/
+ (void)controllerViewAppearing:(UIViewController *)controller DEPRECATED_ATTRIBUTE;
/** Labelizes all `DFLabel` instances that have the specified view controller in their next responder chain.
This method sends an `NSNotification` to all `DFLabel` instances with the specified view controller in their next
responder chain. The `labelize` property of these `DFLabel` instances will be set to `YES`.
@param controller The view controller for which all `DFLabel` instances should be labelized.
@see labelize
*/
+ (void)controllerLabelsShouldLabelize:(UIViewController *)controller;
/** De-Labelizes all `DFLabel` instances that have the specified view controller in their next responder chain.
This method sends an `NSNotification` to all `DFLabel` instances with the specified view controller in their next
responder chain. The `labelize` property of these `DFLabel` instances will be set to `NO` .
@param controller The view controller for which all `DFLabel` instances should be de-labelized.
@see labelize
*/
+ (void)controllerLabelsShouldAnimate:(UIViewController *)controller;
@end

51
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFNetPlayer.h

@ -0,0 +1,51 @@
//
// DFNetPlayer.h
// Test
//
// Created by DFung on 2018/2/2.
// Copyright © 2018年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
typedef enum : NSUInteger {
DFNetPlayer_STATUS_PENDING,
DFNetPlayer_STATUS_PLAY,
DFNetPlayer_STATUS_PAUSE,
DFNetPlayer_STATUS_STOP,
} DFNetPlayer_STATUS;
@class DFNetPlayer;
@protocol DFNetPlayerDelegate <NSObject>
-(void)onDFNetPlayer:(DFNetPlayer*)player ChangeStatus:(DFNetPlayer_STATUS)status;
-(void)onDFNetPlayer:(DFNetPlayer*)player CachedProgress:(float)progress;
-(void)onDFNetPlayer:(DFNetPlayer*)player Speed:(float)speed TimeGap:(NSTimeInterval)timeGap;
-(void)onDFNetPlayer:(DFNetPlayer*)player PlayTime:(float)time;
-(void)onDFNetPlayer:(DFNetPlayer*)player PlayFinished:(float)ret;
@end
@interface DFNetPlayer : NSObject
@property (assign,nonatomic)id delegate;
@property (strong,nonatomic)AVPlayer *mPlayer;
@property (strong,nonatomic)AVPlayerItem *mSongItem;
@property (assign,nonatomic)DFNetPlayer_STATUS status;
@property (assign,nonatomic)float time_cached;
@property (assign,nonatomic)float time_total;
@property (assign,nonatomic)float time_play;
-(void)setVolume:(float)volume;
-(float)getVolume;
-(void)didPlayUrl:(NSString*)url;
-(void)didContinue;
-(void)didPause;
-(void)didStop;
-(void)clearObservers;
@end

56
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFNotice.h

@ -0,0 +1,56 @@
//
// DFNotice.h
// IPCamera
//
// Created by DFung on 16/5/27.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
@interface DFNotice : NSObject
/**
* 发送通知
*
* @param name :通知名字
* @param object:传递的对象
*/
+(void)post:(NSString*)name Object:(id)object;
/**
* 监听通知
*
* @param name :通知名字
* @param action:实现方法
* @param own :监听者
*/
+(void)add:(NSString*)name Action:(SEL)action Own:(id)own;
/**
* 监听取消
*
* @param name:通知名字
* @param own :监听者
*/
+(void)remove:(NSString*)name Own:(id)own;
/** (iOS 10.0 以上有效。)
* 定时通知
*
* @param date:yyyyMMddHHmmss
* @param repeat:0 -->不重复
*/
+(void)pushLocalNoticeDate:(NSString*)date
ID:(NSString*)noteId
Txt_0:(NSString*)txt_0
Txt_1:(NSString*)txt_1
Txt_2:(NSString*)txt_2
Badge:(NSNumber*)badge
Repeat:(BOOL)repeat;
@end

312
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFPing.h

@ -0,0 +1,312 @@
//
// DFPing.h
// MusicTest
//
// Created by DFung on 2018/3/30.
// Copyright © 2018年 DFung. All rights reserved.
//
#import <UIKit/UIKit.h>
#include <AssertMacros.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#pragma once
#include <sys/types.h>
#include <arpa/inet.h>
#include <sys/select.h>
#include <sys/time.h>
#include <fcntl.h>
#include <string.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/errno.h>
#include <pthread.h>
#define kNET_TIME_GAP 100
#define kDFPING_TIMEOUT @"DFPING_TIMEOUT"
struct net_ping_addr_t{
const char *name;
const char *host;
const int port;
};
typedef struct net_ping_addr_t n_ping_addr_t;
/**
* return 1:OK 0:Not good
*/
int do_net_ping(void);
int do_net_ping_1(n_ping_addr_t *paddrs);
NS_ASSUME_NONNULL_BEGIN
@protocol DFPingDelegate;
/*! Controls the IP address version used by DFPing instances.
*/
typedef NS_ENUM(NSInteger, DFPingAddressStyle) {
DFPingAddressStyleAny, ///< Use the first IPv4 or IPv6 address found; the default.
DFPingAddressStyleICMPv4, ///< Use the first IPv4 address found.
DFPingAddressStyleICMPv6 ///< Use the first IPv6 address found.
};
/*! An object wrapper around the low-level BSD Sockets ping function.
* \details To use the class create an instance, set the delegate and call `-start`
* to start the instance on the current run loop. If things go well you'll soon get the
* `-DFPing:didStartWithAddress:` delegate callback. From there you can can call
* `-sendPingWithData:` to send a ping and you'll receive the
* `-DFPing:didReceivePingResponsePacket:sequenceNumber:` and
* `-DFPing:didReceiveUnexpectedPacket:` delegate callbacks as ICMP packets arrive.
*
* The class can be used from any thread but the use of any single instance must be
* confined to a specific thread and that thread must run its run loop.
*/
@interface DFPing : NSObject
- (instancetype)init NS_UNAVAILABLE;
/*! Initialise the object to ping the specified host.
* \param hostName The DNS name of the host to ping; an IPv4 or IPv6 address in string form will
* work here.
* \returns The initialised object.
*/
- (instancetype)initWithHostName:(NSString *)hostName NS_DESIGNATED_INITIALIZER;
/*! A copy of the value passed to `-initWithHostName:`.
*/
@property (nonatomic, copy, readonly) NSString * hostName;
/*! The delegate for this object.
* \details Delegate callbacks are schedule in the default run loop mode of the run loop of the
* thread that calls `-start`.
*/
@property (nonatomic, weak, readwrite, nullable) id<DFPingDelegate> delegate;
/*! Controls the IP address version used by the object.
* \details You should set this value before starting the object.
*/
@property (nonatomic, assign, readwrite) DFPingAddressStyle addressStyle;
/*! The address being pinged.
* \details The contents of the NSData is a (struct sockaddr) of some form. The
* value is nil while the object is stopped and remains nil on start until
* `-DFPing:didStartWithAddress:` is called.
*/
@property (nonatomic, copy, readonly, nullable) NSData * hostAddress;
/*! The address family for `hostAddress`, or `AF_UNSPEC` if that's nil.
*/
@property (nonatomic, assign, readonly) sa_family_t hostAddressFamily;
/*! The identifier used by pings by this object.
* \details When you create an instance of this object it generates a random identifier
* that it uses to identify its own pings.
*/
@property (nonatomic, assign, readonly) uint16_t identifier;
/*! The next sequence number to be used by this object.
* \details This value starts at zero and increments each time you send a ping (safely
* wrapping back to zero if necessary). The sequence number is included in the ping,
* allowing you to match up requests and responses, and thus calculate ping times and
* so on.
*/
@property (nonatomic, assign, readonly) uint16_t nextSequenceNumber;
/*! Starts the object.
* \details You should set up the delegate and any ping parameters before calling this.
*
* If things go well you'll soon get the `-DFPing:didStartWithAddress:` delegate
* callback, at which point you can start sending pings (via `-sendPingWithData:`) and
* will start receiving ICMP packets (either ping responses, via the
* `-DFPing:didReceivePingResponsePacket:sequenceNumber:` delegate callback, or
* unsolicited ICMP packets, via the `-DFPing:didReceiveUnexpectedPacket:` delegate
* callback).
*
* If the object fails to start, typically because `hostName` doesn't resolve, you'll get
* the `-DFPing:didFailWithError:` delegate callback.
*
* It is not correct to start an already started object.
*/
- (void)start;
/*! Sends a ping packet containing the specified data.
* \details Sends an actual ping.
*
* The object must be started when you call this method and, on starting the object, you must
* wait for the `-DFPing:didStartWithAddress:` delegate callback before calling it.
* \param data Some data to include in the ping packet, after the ICMP header, or nil if you
* want the packet to include a standard 56 byte payload (resulting in a standard 64 byte
* ping).
*/
- (void)sendPingWithData:(nullable NSData *)data;
/*! Stops the object.
* \details You should call this when you're done pinging.
*
* It's safe to call this on an object that's stopped.
*/
- (void)stop;
@end
/*! A delegate protocol for the DFPing class.
*/
@protocol DFPingDelegate <NSObject>
@optional
/*! A DFPing delegate callback, called once the object has started up.
* \details This is called shortly after you start the object to tell you that the
* object has successfully started. On receiving this callback, you can call
* `-sendPingWithData:` to send pings.
*
* If the object didn't start, `-DFPing:didFailWithError:` is called instead.
* \param pinger The object issuing the callback.
* \param address The address that's being pinged; at the time this delegate callback
* is made, this will have the same value as the `hostAddress` property.
*/
- (void)DFPing:(DFPing *)pinger didStartWithAddress:(NSData *)address;
/*! A DFPing delegate callback, called if the object fails to start up.
* \details This is called shortly after you start the object to tell you that the
* object has failed to start. The most likely cause of failure is a problem
* resolving `hostName`.
*
* By the time this callback is called, the object has stopped (that is, you don't
* need to call `-stop` yourself).
* \param pinger The object issuing the callback.
* \param error Describes the failure.
*/
- (void)DFPing:(DFPing *)pinger didFailWithError:(NSError *)error;
/*! A DFPing delegate callback, called when the object has successfully sent a ping packet.
* \details Each call to `-sendPingWithData:` will result in either a
* `-DFPing:didSendPacket:sequenceNumber:` delegate callback or a
* `-DFPing:didFailToSendPacket:sequenceNumber:error:` delegate callback (unless you
* stop the object before you get the callback). These callbacks are currently delivered
* synchronously from within `-sendPingWithData:`, but this synchronous behaviour is not
* considered API.
* \param pinger The object issuing the callback.
* \param packet The packet that was sent; this includes the ICMP header (`ICMPHeader`) and the
* data you passed to `-sendPingWithData:` but does not include any IP-level headers.
* \param sequenceNumber The ICMP sequence number of that packet.
*/
- (void)DFPing:(DFPing *)pinger didSendPacket:(NSData *)packet sequenceNumber:(uint16_t)sequenceNumber;
/*! A DFPing delegate callback, called when the object fails to send a ping packet.
* \details Each call to `-sendPingWithData:` will result in either a
* `-DFPing:didSendPacket:sequenceNumber:` delegate callback or a
* `-DFPing:didFailToSendPacket:sequenceNumber:error:` delegate callback (unless you
* stop the object before you get the callback). These callbacks are currently delivered
* synchronously from within `-sendPingWithData:`, but this synchronous behaviour is not
* considered API.
* \param pinger The object issuing the callback.
* \param packet The packet that was not sent; see `-DFPing:didSendPacket:sequenceNumber:`
* for details.
* \param sequenceNumber The ICMP sequence number of that packet.
* \param error Describes the failure.
*/
- (void)DFPing:(DFPing *)pinger didFailToSendPacket:(NSData *)packet sequenceNumber:(uint16_t)sequenceNumber error:(NSError *)error;
/*! A DFPing delegate callback, called when the object receives a ping response.
* \details If the object receives an ping response that matches a ping request that it
* sent, it informs the delegate via this callback. Matching is primarily done based on
* the ICMP identifier, although other criteria are used as well.
* \param pinger The object issuing the callback.
* \param packet The packet received; this includes the ICMP header (`ICMPHeader`) and any data that
* follows that in the ICMP message but does not include any IP-level headers.
* \param sequenceNumber The ICMP sequence number of that packet.
*/
- (void)DFPing:(DFPing *)pinger didReceivePingResponsePacket:(NSData *)packet sequenceNumber:(uint16_t)sequenceNumber;
/*! A DFPing delegate callback, called when the object receives an unmatched ICMP message.
* \details If the object receives an ICMP message that does not match a ping request that it
* sent, it informs the delegate via this callback. The nature of ICMP handling in a
* BSD kernel makes this a common event because, when an ICMP message arrives, it is
* delivered to all ICMP sockets.
*
* IMPORTANT: This callback is especially common when using IPv6 because IPv6 uses ICMP
* for important network management functions. For example, IPv6 routers periodically
* send out Router Advertisement (RA) packets via Neighbor Discovery Protocol (NDP), which
* is implemented on top of ICMP.
*
* For more on matching, see the discussion associated with
* `-DFPing:didReceivePingResponsePacket:sequenceNumber:`.
* \param pinger The object issuing the callback.
* \param packet The packet received; this includes the ICMP header (`ICMPHeader`) and any data that
* follows that in the ICMP message but does not include any IP-level headers.
*/
- (void)DFPing:(DFPing *)pinger didReceiveUnexpectedPacket:(NSData *)packet;
@end
#pragma mark * ICMP On-The-Wire Format
/*! Describes the on-the-wire header format for an ICMP ping.
* \details This defines the header structure of ping packets on the wire. Both IPv4 and
* IPv6 use the same basic structure.
*
* This is declared in the header because clients of DFPing might want to use
* it parse received ping packets.
*/
struct DF_ICMPHeader {
uint8_t type;
uint8_t code;
uint16_t checksum;
uint16_t identifier;
uint16_t sequenceNumber;
};
typedef struct DF_ICMPHeader DF_ICMPHeader;
__Check_Compile_Time(sizeof(DF_ICMPHeader) == 8);
__Check_Compile_Time(offsetof(DF_ICMPHeader, type) == 0);
__Check_Compile_Time(offsetof(DF_ICMPHeader, code) == 1);
__Check_Compile_Time(offsetof(DF_ICMPHeader, checksum) == 2);
__Check_Compile_Time(offsetof(DF_ICMPHeader, identifier) == 4);
__Check_Compile_Time(offsetof(DF_ICMPHeader, sequenceNumber) == 6);
enum {
DF_ICMPv4TypeEchoRequest = 8, ///< The ICMP `type` for a ping request; in this case `code` is always 0.
DF_ICMPv4TypeEchoReply = 0 ///< The ICMP `type` for a ping response; in this case `code` is always 0.
};
enum {
DF_ICMPv6TypeEchoRequest = 128, ///< The ICMP `type` for a ping request; in this case `code` is always 0.
DF_ICMPv6TypeEchoReply = 129 ///< The ICMP `type` for a ping response; in this case `code` is always 0.
};
NS_ASSUME_NONNULL_END
typedef void(^DFPING_RET)(int ret);
@interface DFSimplePing : NSObject
+(id _Nullable )sharedMe;
-(void)pingNetWork:(DFPING_RET _Nullable )result;
@end

52
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFRing.h

@ -0,0 +1,52 @@
//
// DFRing.h
// libDVRunning
//
// Created by DFung on 2017/7/13.
// Copyright © 2017年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DFRing : NSObject
@property(assign,nonatomic)int32_t len_total;
/**
* 用途:【Ring Buffer】剩余容量
* @return uint32_t 容量大小
*/
-(uint32_t)ringUsable;
/**
* 用途:创建【Ring Buffer】
* @param size 循环buffer的大小
* @return BOOL 创建是否成功
*/
-(BOOL)ringMakeSize:(int32_t)size;
/**
* 用途:存入数据。
* @param buf 数据地址
* @param size 数据大小
*/
-(uint32_t)ringPut:(void*)buf Size:(uint32_t)size;
/**
* 用途:获取数据。
* @param buf 数据地址
* @param size 数据大小
*/
-(uint32_t)ringGet:(void*)buf Size:(uint32_t)size;
/**
* 用途:擦除【Ring Buffer】的数据。
*/
-(void)ringClean;
/**
* 用途:完全释放【Ring Buffer】
*/
-(void)ringRelease;
@end

32
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFSort.h

@ -0,0 +1,32 @@
//
// DFSort.h
// DFUnits
//
// Created by DFung on 16/1/29.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
#include <stdio.h>
@interface DFSort : NSObject
void DescendingSort(int* arr,int left, int right);
void AscendingSort(int* arr,int left, int right);
/**
* 打乱数组顺序。
* @param array
*/
+(NSArray*)arrayRandom:(NSArray*)array;
@end

115
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFTime.h

@ -0,0 +1,115 @@
//
// DFTime.h
//
//
// Created by Mac on 15/12/10.
//
//
#import <Foundation/Foundation.h>
@interface DFTime : NSObject
/**
返回时间戳(单位:秒)
*/
+(long)dateCurrent;
/**
* 获取iPhone时间(数组形式)。
* @return @"2016" @"2" @"18" @"11" @"26" @"00"
*/
+(NSArray*)dateMembers;
/**
* 获取iPhone时间(字符串形式)。
* @return @"20160218112600"
*/
+ (NSString*)dateString;
/**
* 编辑日期时间
*/
+(NSDate*)makeDateYear:(int)y
Month:(int)mo
Day:(int)d
Hour:(int)h
Min:(int)m
Sec:(int)s;
/**
* 将字符串日期分解时间成员,@"20160218112600" => @"2016" @"2" @"18" @"11" @"26" @"00"
* @param time @"20160218112600"
* @return @"2016" @"2" @"18" @"11" @"26" @"00"
*/
+ (NSArray*)divideDateMembers:(NSString*)time;
/**
* 时间值加“秒”值。
* @param sec 秒数
* @param date @"20160218112600"
*/
+ (NSString*)addSec:(NSTimeInterval)sec OnDate:(NSString *)date;
/**
* 求两个时间点差值。(timeA-timeB)
* @param timeA @"20160218112601"
* @param timeB @"20160218112600"
*/
+(NSTimeInterval)differenceOfDateA:(NSString*)timeA AndDateB:(NSString*)timeB;
/**
* 求两个时间点差值。(dateA-dateB)
* @param dateA
* @param dateB
*/
+(NSTimeInterval)gapOfDateA:(NSDate*)dateA DateB:(NSDate*)dateB;
/**
* 当前【天】
*/
+ (NSInteger)day:(NSDate *)date;
/**
* 当前【月】
*/
+ (NSInteger)month:(NSDate *)date;
/**
* 当前【年】
*/
+ (NSInteger)year:(NSDate *)date;
/**
* 当前【星期】
*/
+ (NSInteger)weekday:(NSDate *)date;
/**
* 这周是这个月的第几周?
*/
+ (NSInteger)firstWeekdayInThisMonth:(NSDate *)date;
/**
* 获取当前月天数
*/
+ (NSInteger)totaldaysInMonth:(NSDate *)date;
/**
* 上/下m个月后的时间。
*/
+ (NSDate *)changeMonth:(int)m onDate:(NSDate *)date;
/**
* 上/下d个天后的时间。
*/
+ (NSDate *)changeDay:(int)d onDate:(NSDate *)date;
/**
* 秒数换算
* 输入 :60秒 (uint32_t)
* 返回 :00:01:00 (NSString*)
*/
+(NSString*)stringFromSec:(uint32_t)sec;
@end

496
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFTips.h

@ -0,0 +1,496 @@
//
// DFTips.h
// JMAirKissDemo
//
// Created by DFung on 2016/12/9.
// Copyright © 2016年 com.DFung. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
@protocol DFTipsDelegate;
typedef NS_ENUM(NSInteger, DFTipsMode) {
/** Progress is shown using an UIActivityIndicatorView. This is the default. */
DFTipsModeIndeterminate,
/** Progress is shown using a round, pie-chart like, progress view. */
DFTipsModeDeterminate,
/** Progress is shown using a horizontal progress bar */
DFTipsModeDeterminateHorizontalBar,
/** Progress is shown using a ring-shaped progress view. */
DFTipsModeAnnularDeterminate,
/** Shows a custom view */
DFTipsModeCustomView,
/** Shows only labels */
DFTipsModeText
};
typedef NS_ENUM(NSInteger, DFTipsAnimation) {
/** Opacity animation */
DFTipsAnimationFade,
/** Opacity + scale animation */
DFTipsAnimationZoom,
DFTipsAnimationZoomOut = DFTipsAnimationZoom,
DFTipsAnimationZoomIn
};
#ifndef DF_MB_INSTANCETYPE
#if __has_feature(objc_instancetype)
#define DF_MB_INSTANCETYPE instancetype
#else
#define DF_MB_INSTANCETYPE id
#endif
#endif
#ifndef DF_MB_STRONG
#if __has_feature(objc_arc)
#define DF_MB_STRONG strong
#else
#define DF_MB_STRONG retain
#endif
#endif
#ifndef DF_MB_WEAK
#if __has_feature(objc_arc_weak)
#define DF_MB_WEAK weak
#elif __has_feature(objc_arc)
#define DF_MB_WEAK unsafe_unretained
#else
#define DF_MB_WEAK assign
#endif
#endif
#if NS_BLOCKS_AVAILABLE
typedef void (^DFTipsCompletionBlock)();
#endif
/**
* Displays a simple HUD window containing a progress indicator and two optional labels for short messages.
*
* This is a simple drop-in class for displaying a progress HUD view similar to Apple's private UIProgressHUD class.
* The DFTips window spans over the entire space given to it by the initWithFrame constructor and catches all
* user input on this region, thereby preventing the user operations on components below the view. The HUD itself is
* drawn centered as a rounded semi-transparent view which resizes depending on the user specified content.
*
* This view supports four modes of operation:
* - DFTipsModeIndeterminate - shows a UIActivityIndicatorView
* - DFTipsModeDeterminate - shows a custom round progress indicator
* - DFTipsModeAnnularDeterminate - shows a custom annular progress indicator
* - DFTipsModeCustomView - shows an arbitrary, user specified view (@see customView)
*
* All three modes can have optional labels assigned:
* - If the labelText property is set and non-empty then a label containing the provided content is placed below the
* indicator view.
* - If also the detailsLabelText property is set then another label is placed below the first label.
*/
@interface DFTips : UIView
/**
* Creates a new HUD, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:.
*
* @param view The view that the HUD will be added to
* @param animated If set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use
* animations while appearing.
* @return A reference to the created HUD.
*
* @see hideHUDForView:animated:
* @see animationType
*/
+ (DF_MB_INSTANCETYPE)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;
/**
* Finds the top-most HUD subview and hides it. The counterpart to this method is showHUDAddedTo:animated:.
*
* @param view The view that is going to be searched for a HUD subview.
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
* animations while disappearing.
* @return YES if a HUD was found and removed, NO otherwise.
*
* @see showHUDAddedTo:animated:
* @see animationType
*/
+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;
/**
* Finds all the HUD subviews and hides them.
*
* @param view The view that is going to be searched for HUD subviews.
* @param animated If set to YES the HUDs will disappear using the current animationType. If set to NO the HUDs will not use
* animations while disappearing.
* @return the number of HUDs found and removed.
*
* @see hideHUDForView:animated:
* @see animationType
*/
+ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated;
/**
* Finds the top-most HUD subview and returns it.
*
* @param view The view that is going to be searched.
* @return A reference to the last HUD subview discovered.
*/
+ (DF_MB_INSTANCETYPE)HUDForView:(UIView *)view;
/**
* Finds all HUD subviews and returns them.
*
* @param view The view that is going to be searched.
* @return All found HUD views (array of DFTips objects).
*/
+ (NSArray *)allHUDsForView:(UIView *)view;
/**
* A convenience constructor that initializes the HUD with the window's bounds. Calls the designated constructor with
* window.bounds as the parameter.
*
* @param window The window instance that will provide the bounds for the HUD. Should be the same instance as
* the HUD's superview (i.e., the window that the HUD will be added to).
*/
- (id)initWithWindow:(UIWindow *)window;
/**
* A convenience constructor that initializes the HUD with the view's bounds. Calls the designated constructor with
* view.bounds as the parameter
*
* @param view The view instance that will provide the bounds for the HUD. Should be the same instance as
* the HUD's superview (i.e., the view that the HUD will be added to).
*/
- (id)initWithView:(UIView *)view;
/**
* Display the HUD. You need to make sure that the main thread completes its run loop soon after this method call so
* the user interface can be updated. Call this method when your task is already set-up to be executed in a new thread
* (e.g., when using something like NSOperation or calling an asynchronous call like NSURLRequest).
*
* @param animated If set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use
* animations while appearing.
*
* @see animationType
*/
- (void)show:(BOOL)animated;
/**
* Hide the HUD. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to
* hide the HUD when your task completes.
*
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
* animations while disappearing.
*
* @see animationType
*/
- (void)hide:(BOOL)animated;
/**
* Hide the HUD after a delay. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to
* hide the HUD when your task completes.
*
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
* animations while disappearing.
* @param delay Delay in seconds until the HUD is hidden.
*
* @see animationType
*/
- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay;
/**
* Shows the HUD while a background task is executing in a new thread, then hides the HUD.
*
* This method also takes care of autorelease pools so your method does not have to be concerned with setting up a
* pool.
*
* @param method The method to be executed while the HUD is shown. This method will be executed in a new thread.
* @param target The object that the target method belongs to.
* @param object An optional object to be passed to the method.
* @param animated If set to YES the HUD will (dis)appear using the current animationType. If set to NO the HUD will not use
* animations while (dis)appearing.
*/
- (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated;
#if NS_BLOCKS_AVAILABLE
/**
* Shows the HUD while a block is executing on a background queue, then hides the HUD.
*
* @see showAnimated:whileExecutingBlock:onQueue:completionBlock:
*/
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block;
/**
* Shows the HUD while a block is executing on a background queue, then hides the HUD.
*
* @see showAnimated:whileExecutingBlock:onQueue:completionBlock:
*/
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(DFTipsCompletionBlock)completion;
/**
* Shows the HUD while a block is executing on the specified dispatch queue, then hides the HUD.
*
* @see showAnimated:whileExecutingBlock:onQueue:completionBlock:
*/
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue;
/**
* Shows the HUD while a block is executing on the specified dispatch queue, executes completion block on the main queue, and then hides the HUD.
*
* @param animated If set to YES the HUD will (dis)appear using the current animationType. If set to NO the HUD will
* not use animations while (dis)appearing.
* @param block The block to be executed while the HUD is shown.
* @param queue The dispatch queue on which the block should be executed.
* @param completion The block to be executed on completion.
*
* @see completionBlock
*/
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue
completionBlock:(DFTipsCompletionBlock)completion;
/**
* A block that gets called after the HUD was completely hidden.
*/
@property (copy) DFTipsCompletionBlock completionBlock;
#endif
/**
* DFTips operation mode. The default is DFTipsModeIndeterminate.
*
* @see DFTipsMode
*/
@property (assign) DFTipsMode mode;
/**
* The animation type that should be used when the HUD is shown and hidden.
*
* @see DFTipsAnimation
*/
@property (assign) DFTipsAnimation animationType;
/**
* The UIView (e.g., a UIImageView) to be shown when the HUD is in DFTipsModeCustomView.
* For best results use a 37 by 37 pixel view (so the bounds match the built in indicator bounds).
*/
@property (DF_MB_STRONG) UIView *customView;
/**
* The HUD delegate object.
*
* @see DFTipsDelegate
*/
@property (DF_MB_WEAK) id<DFTipsDelegate> delegate;
/**
* An optional short message to be displayed below the activity indicator. The HUD is automatically resized to fit
* the entire text. If the text is too long it will get clipped by displaying "..." at the end. If left unchanged or
* set to @"", then no message is displayed.
*/
@property (copy) NSString *labelText;
/**
* An optional details message displayed below the labelText message. This message is displayed only if the labelText
* property is also set and is different from an empty string (@""). The details text can span multiple lines.
*/
@property (copy) NSString *detailsLabelText;
/**
* The opacity of the HUD window. Defaults to 0.8 (80% opacity).
*/
@property (assign) float opacity;
/**
* The color of the HUD window. Defaults to black. If this property is set, color is set using
* this UIColor and the opacity property is not used. using retain because performing copy on
* UIColor base colors (like [UIColor greenColor]) cause problems with the copyZone.
*/
@property (DF_MB_STRONG) UIColor *color;
/**
* The x-axis offset of the HUD relative to the centre of the superview.
*/
@property (assign) float xOffset;
/**
* The y-axis offset of the HUD relative to the centre of the superview.
*/
@property (assign) float yOffset;
/**
* The amount of space between the HUD edge and the HUD elements (labels, indicators or custom views).
* Defaults to 20.0
*/
@property (assign) float margin;
/**
* The corner radius for the HUD
* Defaults to 10.0
*/
@property (assign) float cornerRadius;
/**
* Cover the HUD background view with a radial gradient.
*/
@property (assign) BOOL dimBackground;
/*
* Grace period is the time (in seconds) that the invoked method may be run without
* showing the HUD. If the task finishes before the grace time runs out, the HUD will
* not be shown at all.
* This may be used to prevent HUD display for very short tasks.
* Defaults to 0 (no grace time).
* Grace time functionality is only supported when the task status is known!
* @see taskInProgress
*/
@property (assign) float graceTime;
/**
* The minimum time (in seconds) that the HUD is shown.
* This avoids the problem of the HUD being shown and than instantly hidden.
* Defaults to 0 (no minimum show time).
*/
@property (assign) float minShowTime;
/**
* Indicates that the executed operation is in progress. Needed for correct graceTime operation.
* If you don't set a graceTime (different than 0.0) this does nothing.
* This property is automatically set when using showWhileExecuting:onTarget:withObject:animated:.
* When threading is done outside of the HUD (i.e., when the show: and hide: methods are used directly),
* you need to set this property when your task starts and completes in order to have normal graceTime
* functionality.
*/
@property (assign) BOOL taskInProgress;
/**
* Removes the HUD from its parent view when hidden.
* Defaults to NO.
*/
@property (assign) BOOL removeFromSuperViewOnHide;
/**
* Font to be used for the main label. Set this property if the default is not adequate.
*/
@property (DF_MB_STRONG) UIFont* labelFont;
/**
* Color to be used for the main label. Set this property if the default is not adequate.
*/
@property (DF_MB_STRONG) UIColor* labelColor;
/**
* Font to be used for the details label. Set this property if the default is not adequate.
*/
@property (DF_MB_STRONG) UIFont* detailsLabelFont;
/**
* Color to be used for the details label. Set this property if the default is not adequate.
*/
@property (DF_MB_STRONG) UIColor* detailsLabelColor;
/**
* The color of the activity indicator. Defaults to [UIColor whiteColor]
* Does nothing on pre iOS 5.
*/
@property (DF_MB_STRONG) UIColor *activityIndicatorColor;
/**
* The progress of the progress indicator, from 0.0 to 1.0. Defaults to 0.0.
*/
@property (assign) float progress;
/**
* The minimum size of the HUD bezel. Defaults to CGSizeZero (no minimum size).
*/
@property (assign) CGSize minSize;
/**
* The actual size of the HUD bezel.
* You can use this to limit touch handling on the bezel aria only.
* @see https://github.com/jdg/DFTips/pull/200
*/
@property (atomic, assign, readonly) CGSize size;
/**
* Force the HUD dimensions to be equal if possible.
*/
@property (assign, getter = isSquare) BOOL square;
@end
@protocol DFTipsDelegate <NSObject>
@optional
/**
* Called after the HUD was fully hidden from the screen.
*/
- (void)hudWasHidden:(DFTips *)hud;
@end
/**
* A progress view for showing definite progress by filling up a circle (pie chart).
*/
@interface DF_MBRoundProgressView : UIView
/**
* Progress (0.0 to 1.0)
*/
@property (nonatomic, assign) float progress;
/**
* Indicator progress color.
* Defaults to white [UIColor whiteColor]
*/
@property (nonatomic, DF_MB_STRONG) UIColor *progressTintColor;
/**
* Indicator background (non-progress) color.
* Defaults to translucent white (alpha 0.1)
*/
@property (nonatomic, DF_MB_STRONG) UIColor *backgroundTintColor;
/*
* Display mode - NO = round or YES = annular. Defaults to round.
*/
@property (nonatomic, assign, getter = isAnnular) BOOL annular;
@end
/**
* A flat bar progress view.
*/
@interface DF_MBBarProgressView : UIView
/**
* Progress (0.0 to 1.0)
*/
@property (nonatomic, assign) float progress;
/**
* Bar border line color.
* Defaults to white [UIColor whiteColor].
*/
@property (nonatomic, DF_MB_STRONG) UIColor *lineColor;
/**
* Bar background color.
* Defaults to clear [UIColor clearColor];
*/
@property (nonatomic, DF_MB_STRONG) UIColor *progressRemainingColor;
/**
* Bar progress color.
* Defaults to white [UIColor whiteColor].
*/
@property (nonatomic, DF_MB_STRONG) UIColor *progressColor;
@end

161
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFTools.h

@ -0,0 +1,161 @@
//
// DFTools.h
// DFUnits
//
// Created by DFung on 16/1/22.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DFTools : NSObject
/**
* NSString to NSMutableData
*
* @"ffff0000" => <ffff 0000>
*
* @param str:NSString
* @return NSMutableData
*/
+(NSMutableData*)HexToData:(NSString*)hex;
/**
* NSData to NSString
*
* <ffff 0000> => @"ffff0000"
*
* @param data:NSData
* @return NSString
*/
+(NSString*)dataToHex:(NSData*)data;
/**
* Alignment data in length you like.
* 将data按照指定的长度补齐
*/
+(NSData*)alignment:(NSData*)data length:(NSInteger)len;
/**
* NSData ==> NSDictory.
* 将 Json 字节码转换成 NSDictory。
*/
+(id)jsonWithData:(NSData*)data;
/**
* NSDictory ==> NSString.
*/
+(NSString*)dictionaryToJson:(NSDictionary *)dic;
/**
* NSDictory ==> NSData.
*/
+(NSData*)makeDataByDictionary:(NSDictionary *)dic;
/**
* NSData ==> NSDictory.
*/
+(NSDictionary*)makeDictionaryByData:(NSData *)data;
/**
* NSArray ==> NSString.
*/
+(NSString*)arrayToJson:(NSArray *)array;
/**
* 将 uint32_t 的4个字节转换成 NSData。
*/
+(NSData*)uInt32_data:(uint32_t)value;
/**
* 将 uint32_t 的4个字节转换成 NSData。
* @param endian:是否改变大小端
*/
+(NSData*)uInt32_data:(uint32_t)value Endian:(BOOL)endian;
/**
* 将 uint16_t 的2个字节转换成 NSData。
*/
+(NSData*)uInt16_data:(uint16_t)value;
/**
* 将 uint16_t 的2个字节转换成 NSData。
* @param endian:是否改变大小端
*/
+(NSData*)uInt16_data:(uint16_t)value Endian:(BOOL)endian;
+(NSData*)uInt8_data:(uint8_t)value;
/**
* Change Big Or Small Endian(改变NSData的大小端。)
* <000f> => <0f00>
*
* @param data:NSData
* @return NSData
*/
+(NSData*)changeBigOrSmall:(NSData*)data;
/**
* NSData to 10进制
*
* <000f> => 16
*
* @param data:NSData
* @return NSInteger
*/
+(NSInteger)dataToInt:(NSData*)data;
/**
* 求自然数:aByte ==> -1 0 1 2 3...
*/
+(int)getNaturalNumber:(NSData*)aByte;
/**
* 简写: [data subdataWithRange:NSMakeRange(index, length)];
*/
+(NSData*)data:(NSData*)data R:(NSInteger)index L:(NSInteger)length;
/**
* 简写: [[NSString alloc] initWithData:data encoding:encoding];
*/
+(NSString*)string:(NSData*)data Encode:(NSStringEncoding)encoding;
/**
* 简写: [NSString stringWithFormat:(NSString *)format, ...];
*/
+(NSString*)string:(NSArray*)array;
/**
* UNICODE 编码字符串
*/
+(NSString*)stringUnicode:(NSData*)data;
/**
* ANSI 编码字符串
*/
+(NSString*)stringANSI:(NSData*)data;
/**
* GBK 编码字符串
*/
+(NSString*)stringGBK:(NSData*)data;
/**
* 存入 NSUserDefaults
*/
+(void)setUser:(id)objc forKey:(NSString*)key;
/**
* 取出 NSUserDefaults
*/
+(id)getUserByKey:(NSString*)key;
/**
* 移除 NSUserDefaults
*/
+(void)removeUserByKey:(NSString*)key;
@end

21
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFUIAnimation.h

@ -0,0 +1,21 @@
//
// DFUIAnimation.h
// DFUIBox
//
// Created by DFung on 16/5/18.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef enum : NSUInteger {
DFUIAnimation_TYPE_SPRING,
} DFUIAnimation_TYPE;
@interface DFUIAnimation : NSObject
+ (void)showView:(UIView*)view Type:(DFUIAnimation_TYPE)type Completed:(void(^)(BOOL finished))block;
+ (void)hideView:(UIView*)view Type:(DFUIAnimation_TYPE)type Completed:(void(^)(BOOL finished))block;
@end

46
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFUIPullView.h

@ -0,0 +1,46 @@
//
// DFUIPullView.h
// RetainTest
//
// Created by DFung on 2016/12/7.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <UIKit/UIKit.h>
#define kPULLVIEW_IMAGE_SIZE 40.0
#define kPULLVIEW_TIME 1.5
typedef enum : NSUInteger {
PullView_TYPE_TABLEVIEW,
PullView_TYPE_COLLECTIONVIEW
} PullView_TYPE;
@protocol DFUIPullViewDelegate <NSObject>
@optional
-(void)onDFUIPullViewIsLoading;
-(void)onDFUIPullViewLoadFinished;
@end
@interface DFUIPullView : UIView
@property(nonatomic,weak) id<DFUIPullViewDelegate>delegate;
@property(nonatomic,strong) NSString *subText;
@property(nonatomic,weak) UIScrollView *outScrollView;
@property(nonatomic,weak) id outView;
- (instancetype)initWithScrollView:(UIScrollView*)scrollView
Type:(PullView_TYPE)type
OnView:(id)view;
- (void)setSubImage:(UIImage*)sImage;
@end

215
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFUITools.h

@ -0,0 +1,215 @@
//
// DFUITools.h
// DFUnits
//
// Created by DFung on 2016/12/9.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef void (^TipsCompletion) (void);
@class DFTips;
@interface DFUITools : NSObject
#define kDF_SCR_W_0 (int)[DFUITools screen_W]
#define kDF_SCR_H_0 (int)[DFUITools screen_H]
#define kDF_SCR_W_1 (int)[DFUITools screen_1_W]
#define kDF_SCR_H_1 (int)[DFUITools screen_1_H]
#define kDF_RGBA(r,g,b,a) [UIColor colorWithRed:((r)/255.0) green:((g)/255.0) blue:((b)/255.0) alpha:(a)]
#pragma mark 屏幕尺寸
/**
* 设备屏幕的【宽】
*/
+(CGFloat)screen_W;
/**
* 设备屏幕的【长】
*/
+(CGFloat)screen_H;
/**
* 设备竖屏的【宽】
*/
+(float)screen_1_W;
/**
* 设备竖屏的【长】
*/
+(float)screen_1_H;
/**
* iPhone竖屏的【宽】
*/
+(float)screen_2_W;
/**
* iPhone竖屏的【长】
*/
+(float)screen_2_H;
/**
* 获取手机版本
*/
+(float)getVersion;
/**
* 获取当前设备UUID
*/
+(NSString*)getUUID;
/**
* 获取当前UIWindow
*/
+(UIWindow*)getWindow;
/**
* 多语言化:当前系统语言
*/
+(NSString*)systemLanguage;
/**
* 多语言化:选择
*/
+(void)languageSet:(NSString*)lan;
/**
* 多语言化:翻译
*/
+(NSString*)languageText:(NSString*)key Table:(NSString*)table;
/**
* 设置UIButton的图片
*/
+(void)setButton:(UIButton*)btn Image:(NSString*)image;
+(void)setButton:(UIButton*)btn Image_1:(UIImage*)image;
/**
* 设置UIButton的文字
*/
+(void)setButton:(UIButton*)btn Text:(NSString*)text;
/**
* 设置UIButton的字体颜色
*/
+(void)setButton:(UIButton*)btn Color:(UIColor*)color;
/**
* 获取【定宽Label】的【高】。
*/
+ (CGFloat)labelHeightByWidth:(CGFloat)width Text:(NSString *)text Font:(UIFont *)font;
/**
* 获取【定宽Label】的【宽】。
*/
+ (CGFloat)labelWidthByWidth:(CGFloat)width Text:(NSString *)text Font:(UIFont *)font;
/**
* 加载Nib文件的UI。
*/
+(id)loadNib:(NSString*)name;
/**
* 增加触摸事件。
*/
+(UITapGestureRecognizer*)addSingleTaps:(int)taps
View:(UIView*)view
Target:(id)target
Action:(SEL)action;
/**
* 弄个UIColor,【RGB值】和【透明度Alpha】
*/
+(UIColor*)colorR:(float)r G:(float)g B:(float)b AP:(float)ap;
#pragma mark >>> DFTips___APIs___
+ (DFTips *)showHUDWithLabel:(NSString *)labelText
onView:(UIView *)view;
+ (DFTips *)showHUDWithLabel_1:(NSString *)labelText
onView:(UIView *)view;
+ (DFTips *)showHUDWithDetailLabel:(NSString *)detailLabelText
onView:(UIView *)view;
+ (DFTips *)showHUDOnWindowWithLabel:(NSString *)labelText;
+ (DFTips *)showHUDWithLabel:(NSString *)labelText
onView:(UIView *)view
color:(UIColor *)color;
+ (DFTips *)showHUDWithLabel:(NSString *)labelText
onView:(UIView *)view
color:(UIColor *)color
labelTextColor:(UIColor *)textColor
activityIndicatorColor:(UIColor *)actIndicatorColor;
+ (DFTips *)showHUDWithLabel:(NSString *)labelText
onView:(UIView *)view
alpha:(float)alpha
color:(UIColor *)color
labelTextColor:(UIColor *)textColor
activityIndicatorColor:(UIColor *)actIndicatorColor;
+ (DFTips *)showHUDOnWindowWithLabel:(NSString *)labelText
color:(UIColor *)color;
+ (DFTips *)showTransparentHUDWithLabel:(NSString *)labelText
onView:(UIView *)view;
+ (DFTips *)showTransparentHUDOnWindowWithLabel:(NSString *)labelText
labelTextColor:(UIColor *)textColor;
+ (DFTips *)showTransparentHUDOnWindowWithLabel:(NSString *)labelText;
+ (DFTips *)changeLabelText:(NSString *)labelText;
+ (DFTips *)changeDetailLabelText:(NSString *)labelText;
+ (void)removeHUD;
+ (void)removeHUDWithDelay:(float)time;
+ (void)removeHUDWithDelay:(float)time
completion:(TipsCompletion)completion;
+ (void)showText:(NSString *)text
onView:(UIView *)view
delay:(float)time;
+ (void)showText:(NSString *)text
onView:(UIView *)view
delay:(float)time
completion:(TipsCompletion)completion;
+ (void)showText_1:(NSString *)text
onView:(UIView *)view
delay:(float)time;
+ (void)showDetailText:(NSString *)text
onView:(UIView *)view
delay:(float)time;
+ (void)showDetailText:(NSString *)text
onView:(UIView *)view
delay:(float)time
completion:(TipsCompletion)completion;
+(void)showClearLayer;
+(void)showClearLayerDelay:(NSTimeInterval)time;
+(void)openWaittting:(NSString*)text delay:(NSTimeInterval)time;
+(void)closeWaitting:(NSTimeInterval)time;
@end

51
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFUnits.h

@ -0,0 +1,51 @@
//
// DFUnits.h
// DFUnits
//
// Created by EzioChan on 2022/6/29.
//
#import <Foundation/Foundation.h>
//! Project version number for DFUnits.
FOUNDATION_EXPORT double DFUnitsVersionNumber;
//! Project version string for DFUnits.
FOUNDATION_EXPORT const unsigned char DFUnitsVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <DFUnits/PublicHeader.h>
//Using statements like #import <DFUnits/PublicHeader.h>
#import <DFUnits/DFTools.h>
#import <DFUnits/DFFile.h>
#import <DFUnits/DFTime.h>
#import <DFUnits/DFHttp.h>
#import <DFUnits/DFHttp1.h>
#import <DFUnits/DFImage.h>
#import <DFUnits/DFVideo.h>
#import <DFUnits/DFAudio.h>
#import <DFUnits/DFAction.h>
#import <DFUnits/DFSort.h>
#import <DFUnits/DFNotice.h>
#import <DFUnits/AESx.h>
#import <DFUnits/OpenALM.h>
#import <DFUnits/queue.h>
#import <DFUnits/tcp_client.h>
#import <DFUnits/tcp_server.h>
#import <DFUnits/DFGzip.h>
#import <DFUnits/DFHmacMD5.h>
#import <DFUnits/DFNetPlayer.h>
#import <DFUnits/DFCrc16.h>
#import <DFUnits/DFRing.h>
#import <DFUnits/DFPing.h>
#import <DFUnits/DFContacts.h>
#import <DFUnits/DFUIAnimation.h>
#import <DFUnits/DFUITools.h>
#import <DFUnits/DFTips.h>
#import <DFUnits/DFUIPullView.h>
#import <DFUnits/DFLabel.h>
#import <DFUnits/DFFadeLabel.h>
#import <DFUnits/DFCircleTextView.h>
#define DFLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

38
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/DFVideo.h

@ -0,0 +1,38 @@
//
// DFVideo.h
// DFUnits
//
// Created by DFung on 16/1/22.
// Copyright © 2016年 DFung. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DFVideo : NSObject
/**
* 用途:获得AVI视频的PreViewImage。
* @param path 文件路径
* @return @{@"IMG" : 图片Data,
* @"SIZE": 宽高,
* @"TIME": 时长}
*/
+(NSDictionary*)previewAVI:(NSString*)path;
/**
* 用途:获得AVI视频的PreViewImage。
* @param data 文件数据
* @return @{@"IMG" : 图片Data,
* @"SIZE": 宽高,
* @"TIME": 时长}
*/
+(NSDictionary *)previewData:(NSData*)data;
/**
* 用途:秒数换算成时间字符串。
* @param total 秒数(60s ==> 00:01:00)
* @return @"00:01:00"
*/
+(NSString *)timeTyping:(long)total;
@end

59
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/OPenALM.h

@ -0,0 +1,59 @@
//
// OPenALM.h
// OpenALForPCM
//
// Created by 陈冠杰 on 16/2/15.
// Copyright © 2016年 zh-JieLi. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <AudioToolbox/ExtendedAudioFile.h>
#import <OpenAL/al.h>
#import <OpenAL/alc.h>
#include "queue.h"
struct AL_Data{
int size;
unsigned char *data;
};
/**
* 【OPenALM】播放停止
*/
#define kOPenALM_STOP @"OPenALM_STOP"
@interface OPenALM : NSObject
{
ALCcontext *mContext;
ALCdevice *mDevicde;
ALuint outSourceId;
ALuint buff;
}
@property(nonatomic)ALCcontext *mContext;
@property(nonatomic)ALCdevice *mDevice;
/**
* Need Import <OpenAL.frameworks>
* <AudioToolBox.frameworks>
*/
-(void)inputAudioBuffer:(struct AL_Data*)pkg;
-(BOOL)updataQueueBuffer;
-(void)playSound;
-(void)stopSound;
-(void)cleanUpOpenAL;
-(void)cleanMe;
@end

224
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/TPCircularBuffer.h

@ -0,0 +1,224 @@
//
// TPCircularBuffer.h
// Circular/Ring buffer implementation
//
// https://github.com/michaeltyson/TPCircularBuffer
//
// Created by Michael Tyson on 10/12/2011.
//
//
// This implementation makes use of a virtual memory mapping technique that inserts a virtual copy
// of the buffer memory directly after the buffer's end, negating the need for any buffer wrap-around
// logic. Clients can simply use the returned memory address as if it were contiguous space.
//
// The implementation is thread-safe in the case of a single producer and single consumer.
//
// Virtual memory technique originally proposed by Philip Howard (http://vrb.slashusr.org/), and
// adapted to Darwin by Kurt Revis (http://www.snoize.com,
// http://www.snoize.com/Code/PlayBufferedSoundFile.tar.gz)
//
//
// Copyright (C) 2012-2013 A Tasty Pixel
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef TPCircularBuffer_h
#define TPCircularBuffer_h
#include <libkern/OSAtomic.h>
#include <string.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
void *buffer;
int32_t length;
int32_t tail;
int32_t head;
volatile int32_t fillCount;
bool atomic;
} TPCircularBuffer;
/*!
* Initialise buffer
*
* Note that the length is advisory only: Because of the way the
* memory mirroring technique works, the true buffer length will
* be multiples of the device page size (e.g. 4096 bytes)
*
* @param buffer Circular buffer
* @param length Length of buffer
*/
#define TPCircularBufferInit(buffer, length) \
_TPCircularBufferInit(buffer, length, sizeof(*buffer))
bool _TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length, size_t structSize);
/*!
* Cleanup buffer
*
* Releases buffer resources.
*/
void TPCircularBufferCleanup(TPCircularBuffer *buffer);
/*!
* Clear buffer
*
* Resets buffer to original, empty state.
*
* This is safe for use by consumer while producer is accessing
* buffer.
*/
void TPCircularBufferClear(TPCircularBuffer *buffer);
/*!
* Set the atomicity
*
* If you set the atomiticy to false using this method, the buffer will
* not use atomic operations. This can be used to give the compiler a little
* more optimisation opportunities when the buffer is only used on one thread.
*
* Important note: Only set this to false if you know what you're doing!
*
* The default value is true (the buffer will use atomic operations)
*
* @param buffer Circular buffer
* @param atomic Whether the buffer is atomic (default true)
*/
void TPCircularBufferSetAtomic(TPCircularBuffer *buffer, bool atomic);
// Reading (consuming)
/*!
* Access end of buffer
*
* This gives you a pointer to the end of the buffer, ready
* for reading, and the number of available bytes to read.
*
* @param buffer Circular buffer
* @param availableBytes On output, the number of bytes ready for reading
* @return Pointer to the first bytes ready for reading, or NULL if buffer is empty
*/
static __inline__ __attribute__((always_inline)) void* TPCircularBufferTail(TPCircularBuffer *buffer, int32_t* availableBytes) {
*availableBytes = buffer->fillCount;
if ( *availableBytes == 0 ) return NULL;
return (void*)((char*)buffer->buffer + buffer->tail);
}
/*!
* Consume bytes in buffer
*
* This frees up the just-read bytes, ready for writing again.
*
* @param buffer Circular buffer
* @param amount Number of bytes to consume
*/
static __inline__ __attribute__((always_inline)) void TPCircularBufferConsume(TPCircularBuffer *buffer, int32_t amount) {
buffer->tail = (buffer->tail + amount) % buffer->length;
if ( buffer->atomic ) {
OSAtomicAdd32Barrier(-amount, &buffer->fillCount);
} else {
buffer->fillCount -= amount;
}
assert(buffer->fillCount >= 0);
}
/*!
* Access front of buffer
*
* This gives you a pointer to the front of the buffer, ready
* for writing, and the number of available bytes to write.
*
* @param buffer Circular buffer
* @param availableBytes On output, the number of bytes ready for writing
* @return Pointer to the first bytes ready for writing, or NULL if buffer is full
*/
static __inline__ __attribute__((always_inline)) void* TPCircularBufferHead(TPCircularBuffer *buffer, int32_t* availableBytes) {
*availableBytes = (buffer->length - buffer->fillCount);
if ( *availableBytes == 0 ) return NULL;
return (void*)((char*)buffer->buffer + buffer->head);
}
// Writing (producing)
/*!
* Produce bytes in buffer
*
* This marks the given section of the buffer ready for reading.
*
* @param buffer Circular buffer
* @param amount Number of bytes to produce
*/
static __inline__ __attribute__((always_inline)) void TPCircularBufferProduce(TPCircularBuffer *buffer, int32_t amount) {
buffer->head = (buffer->head + amount) % buffer->length;
if ( buffer->atomic ) {
OSAtomicAdd32Barrier(amount, &buffer->fillCount);
} else {
buffer->fillCount += amount;
}
assert(buffer->fillCount <= buffer->length);
}
/*!
* Helper routine to copy bytes to buffer
*
* This copies the given bytes to the buffer, and marks them ready for reading.
*
* @param buffer Circular buffer
* @param src Source buffer
* @param len Number of bytes in source buffer
* @return true if bytes copied, false if there was insufficient space
*/
static __inline__ __attribute__((always_inline)) bool TPCircularBufferProduceBytes(TPCircularBuffer *buffer, const void* src, int32_t len) {
int32_t space;
void *ptr = TPCircularBufferHead(buffer, &space);
if ( space < len ) return false;
memcpy(ptr, src, len);
TPCircularBufferProduce(buffer, len);
return true;
}
/*!
* Deprecated method
*/
static __inline__ __attribute__((always_inline)) __deprecated_msg("use TPCircularBufferSetAtomic(false) and TPCircularBufferConsume instead")
void TPCircularBufferConsumeNoBarrier(TPCircularBuffer *buffer, int32_t amount) {
buffer->tail = (buffer->tail + amount) % buffer->length;
buffer->fillCount -= amount;
assert(buffer->fillCount >= 0);
}
/*!
* Deprecated method
*/
static __inline__ __attribute__((always_inline)) __deprecated_msg("use TPCircularBufferSetAtomic(false) and TPCircularBufferProduce instead")
void TPCircularBufferProduceNoBarrier(TPCircularBuffer *buffer, int32_t amount) {
buffer->head = (buffer->head + amount) % buffer->length;
buffer->fillCount += amount;
assert(buffer->fillCount <= buffer->length);
}
#ifdef __cplusplus
}
#endif
#endif

317
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/queue.h

@ -0,0 +1,317 @@
#ifndef __QUEUE_H__
#define __QUEUE_H__
//
// Created by DFung on 16/1/25.
// Copyright © 2016年 DFung. All rights reserved.
//
/**
* Sample Used
*
* 1.Create Queue:
*
* queue_t *qt_video = queue_create_limited(100);
*
* 2.Put Data:
*
* Type_Data * p_data = (Type_Data *)p;
* int ret = queue_put(qt_video, p_data);
* if(ret != Q_OK){
* free(p_data);
* }
*
* 3.Get Data:
*
* Type_Data * get_frm_pkg = NULL;
* queue_get(qt_video, (void**)&get_frm_pkg);
*
* 4.Number of Data:
*
* int cache_counts = queue_elements(qt_video);
*
* 5.Destroy Queue:
*
* if (qt_video != NULL) {
* queue_destroy_complete(qt_video, queue_clean_video);
* qt_video = NULL;
* }
* static void queue_clean_video(void* tmp){
* Type_Data * qt_tmp = (Type_Data *)tmp;
* if (qt_tmp != NULL) {
* free(qt_tmp);
* }
* }
**/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h> /* (u)intX_t */
#ifndef _WIN32
#include <unistd.h> /* usleep */
#else
#include <windows.h> /* Sleep */
#endif
#include <errno.h> /* EBUSY */
#include <pthread.h> /* pthread_mutex_t, pthread_cond_t */
#ifdef _WIN32
#define sleepmilli(x) Sleep(x)
#else
#define sleepmilli(x) usleep(x * 1000)
#endif
/**
* type which is used for counting the number of elements.
* needed for limited queues
*/
#ifndef UINTX_MAX
typedef uint16_t uintX_t;
#define UINTX_MAX UINT16_MAX
#endif
/**
* simple macros to reduce necessary casting to void *
* or function pointers
*/
#define DEFINE_Q_DESTROY(fname, type) int8_t fname(queue_t *q, void (*ff)(type *)) { return queue_destroy_complete(q, (void (*)(void *))ff); }
#define DEFINE_Q_FLUSH(fname, type) int8_t fname(queue_t *q, void (*ff)(type *)) { return queue_flush_complete(q, (void (*)(void *))ff); }
#define DEFINE_Q_GET(fname, type) int8_t fname(queue_t *q, type **e) { return queue_get(q, (void **)e); }
#define DEFINE_Q_GET_WAIT(fname, type) int8_t fname(queue_t *q, type **e) { return queue_get_wait(q, (void **)e); }
#define DEFINE_Q_PUT(fname, type) int8_t fname(queue_t *q, type *e) { return queue_put(q, (void *)e); }
#define DEFINE_Q_PUT_WAIT(fname, type) int8_t fname(queue_t *q, type *e) { return queue_put_wait(q, (void *)e); }
#define DEFINE_Q_FLUSH_PUT(fname, type) int8_t fname(queue_t *q, void (*ff)(type *), type *e) { return queue_flush_complete_put(q, (void (*)(void *))ff, (void *)e); }
/**
* returned error codes, everything except Q_OK should be < 0
*/
typedef enum queue_erros_e {
Q_OK = 0,
Q_ERR_INVALID = -1,
Q_ERR_LOCK = -2,
Q_ERR_MEM = -3,
Q_ERR_NONEWDATA = -4,
Q_ERR_INVALID_ELEMENT = -5,
Q_ERR_INVALID_CB = -6,
Q_ERR_NUM_ELEMENTS = -7
} queue_errors_t;
typedef struct queue_element_s {
void *data;
struct queue_element_s *next;
} queue_element_t;
typedef struct queue_s {
queue_element_t *first_el, *last_el;
// (max.) number of elements
uintX_t num_els;
uintX_t max_els;
// no new data allowed
uint8_t new_data;
// sorted queue
int8_t sort;
int8_t asc_order;
int (*cmp_el)(void *, void *);
// multithreaded
pthread_mutex_t *mutex;
pthread_cond_t *cond_get;
pthread_cond_t *cond_put;
} queue_t;
/**
* initializes and allocates a queue with unlimited elements
*
* returns NULL on error, or a pointer to the queue
*/
queue_t *queue_create(void);
/**
* initializes and allocates a queue
*
* max_elements - maximum number of elements which are allowed in the queue, == 0 for "unlimited"
*
* returns NULL on error, or a pointer to the queue
*/
queue_t *queue_create_limited(uintX_t max_elements);
/**
* just like queue_create()
* additionally you can specify a comparator function so that your elements are ordered in the queue
* elements will only be ordered if you create the queue with this method
* the compare function should return 0 if both elements are the same, < 0 if the first is smaller
* and > 0 if the second is smaller
*
* asc - sort in ascending order if not 0
* cmp - comparator function, NULL will create an error
*
* returns NULL on error, or a pointer to the queue
*/
queue_t *queue_create_sorted(int8_t asc, int (*cmp)(void *, void *));
/**
* see queue_create_limited() and queue_create_sorted()
*/
queue_t *queue_create_limited_sorted(uintX_t max_elements, int8_t asc, int (*cmp)(void *, void *));
/**
* releases the memory internally allocated and destroys the queue
* you have to release the memory the elements in the queue use
*
* q - the queue to be destroyed
*/
int8_t queue_destroy(queue_t *q);
/**
* in addition to queue_destroy(), this function will also free the memory of your elements
*
* q - the queue to be destroyed
* ff - the free function to be used for the elements (free() if NULL)
*/
int8_t queue_destroy_complete(queue_t *q, void (*ff)(void *));
/**
* deletes all the elements from the queue, but does not release their memory
*
* q - the queue
*/
int8_t queue_flush(queue_t *q);
/**
* just like queue_flush, but releases the memory of the elements
*
* q - the queue
* ff - the free function to be used for the elements (free() if NULL)
*/
int8_t queue_flush_complete(queue_t *q, void (*ff)(void *));
/**
* just like queue_flush, followed by an queue_put atomically
*
* q - the queue
* ff - the free function to be used for the elements (free() if NULL)
* e - the element
*/
int8_t queue_flush_put(queue_t *q, void (*ff)(void *), void *e);
/**
* just like queue_flush_complete, followed by an queue_put atomically
*
* q - the queue
* ff - the free function to be used for the elements (free() if NULL)
* e - the element
*/
int8_t queue_flush_complete_put(queue_t *q, void (*ff)(void *), void *e);
/**
* returns the number of elements in the queue
*
* q - the queue
*
* returns number of elements or UINTX_MAX if an error occured
*/
uintX_t queue_elements(queue_t *q);
/**
* returns wether the queue is empty
* returns empty if there was an error
*
* q - the queue
*
* returns zero if queue is NOT empty, < 0 => error
*/
int8_t queue_empty(queue_t *q);
/**
* put a new element at the end of the queue
* will produce an error if you called queue_no_new_data()
*
* q - the queue
* e - the element
*
* returns 0 if everything worked, > 0 if max_elements is reached, < 0 if error occured
*/
int8_t queue_put(queue_t *q, void *e);
/**
* the same as queue_put(), but will wait if max_elements is reached,
* until queue_set_new_data(, 0) is called or elements are removed
*
* q - the queue
* e - the element
*
* returns 0 if everything worked, < 0 if error occured
*/
int8_t queue_put_wait(queue_t *q, void *e);
/**
* preview the first element of the queue(预览一个元素,但没有抽取。)
*
* q - the queue
* e - pointer which will be set to the element
*
* returns 0 if everything worked, > 0 if no elements in queue, < 0 if error occured
*/
int8_t queue_get_pre(queue_t *q, void **e);
/**
* get the first element of the queue
*
* q - the queue
* e - pointer which will be set to the element
*
* returns 0 if everything worked, > 0 if no elements in queue, < 0 if error occured
*/
int8_t queue_get(queue_t *q, void **e);
/**
* the same as queue_get(), but will wait if no elements are in the queue,
* until queue_set_new_data(, 0) is called or new elements are added
*
* q - the queue
* e - pointer which will be set to the element
*
* returns 0 if everything worked, < 0 if error occured
*/
int8_t queue_get_wait(queue_t *q, void **e);
/**
* gets the first element for which the given compare function returns 0 (equal)
* does NOT wait if no elements in the queue
* the compare function should return 0 if both elements are the same, < 0 if the first is smaller
* and > 0 if the second is smaller
*
* q - the queue
* e - pointer which will be set to the element
* cmp - comparator function, NULL will create an error
* cmpel - element with which should be compared
*
* returns 0 if everything worked, < 0 => error, Q_ERR_NUM_ELEMENTS(<0) if no element fulfills the requirement
*/
int8_t queue_get_filtered(queue_t *q, void **e, int (*cmp)(void *, void *), void *cmpel);
/**
* sets wether the queue will accept new data
* defaults to 1 on creation
* you should use this function when you're done and queue_put_wait() and queue_get_wait() should return
* queue_put()/queue_put_wait() won't have any effect when new data isn't accepted.
*
* q - the queue
* v - 0 new data NOT accepted
*/
int8_t queue_set_new_data(queue_t *q, uint8_t v);
/**
* returns wether the queue will accept new data
* also returns 0, if there was an error
*
* q - the queue
*
* return 0 if new data is NOT accepted
*/
uint8_t queue_get_new_data(queue_t *q);
#endif /* __QUEUE_H__ */

97
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/queue_internal.h

@ -0,0 +1,97 @@
#ifndef __QUEUE_INTERNAL_H__
#define __QUEUE_INTERNAL_H__
/**
* Copyright (C) 2011 by Tobias Thiel
* 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <queue.h>
/**
* ATTENTION:
* these functions are internal and should not be used directly.
* they may _not_ lock properly, expecting the caller to do so
*/
/**
* locks the queue
* returns 0 on success, else not usable
*/
int8_t queue_lock_internal(queue_t *q);
/**
* unlocks the queue
* returns 0 on success, else not usable
*/
int8_t queue_unlock_internal(queue_t *q);
/**
* adds an element to the queue.
* when action is NULL the function returns with an error code.
* queue _has_ to be locked.
*
* q - the queue
* el - the element
* action - specifies what should be executed if max_elements is reached.
*
* returns < 0 => error, 0 okay
*/
int8_t queue_put_internal(queue_t *q, void *el, int (*action)(pthread_cond_t *, pthread_mutex_t *));
/**
* gets the first element in the queue.
* when action is NULL the function returns with an error code.
* queue _has_ to be locked.
*
* q - the queue
* e - element pointer
* action - specifies what should be executed if there are no elements in the queue
* cmp - comparator function, NULL will create an error
* cmpel - element with which should be compared
*
* returns < 0 => error, 0 okay
*/
int8_t queue_get_internal(queue_t *q, void **e, int (*action)(pthread_cond_t *, pthread_mutex_t *), int (*cmp)(void *, void *), void *cmpel);
/**
* destroys a queue.
* queue will be locked.
*
* q - the queue
* fd - should element data be freed? 0 => No, Otherwise => Yes
* ff - function to release the memory, NULL => free()
*/
int8_t queue_destroy_internal(queue_t *q, uint8_t fd, void (*ff)(void *));
/**
* flushes a queue.
* deletes all elements in the queue.
* queue _has_ to be locked.
*
* q - the queue
* fd - should element data be freed? 0 => No, Otherwise => Yes
* ff - function to release the memory, NULL => free()
*/
int8_t queue_flush_internal(queue_t *q, uint8_t fd, void (*ff)(void *));
#endif /* __QUEUE_INTERNAL_H__ */

26
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/tcp_client.h

@ -0,0 +1,26 @@
#ifndef __TCP_CLIENT_H__
#define __TCP_CLIENT_H__
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <unistd.h>
struct tcp_client{
int fd;
};
int tcp_connect(const char *ip, const int port, struct tcp_client **tc);
int tcp_read(struct tcp_client *tc, unsigned char *buf, int size);
int tcp_write(struct tcp_client *tc, unsigned char *buf, int size);
int tcp_close(struct tcp_client *tc);
#endif

29
local_plugins/ota/ios/Frameworks/DFUnits.framework/Headers/tcp_server.h

@ -0,0 +1,29 @@
#ifndef __TCP_SERVER_H__
#define __TCP_SERVER_H__
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <unistd.h>
struct tcp_server{
int fd;
};
#include "tcp_client.h"
int tcp_new_server(const int port ,struct tcp_server **ts);
int tcp_new_client(int fd, struct tcp_client **tc);
int tcp_listen(struct tcp_server *ts, const int max);
int tcp_accept(struct tcp_server *ts, struct sockaddr *addr, socklen_t *len);
int tcp_server_close(struct tcp_server *ts);
#endif

BIN
local_plugins/ota/ios/Frameworks/DFUnits.framework/Info.plist

Binary file not shown.

6
local_plugins/ota/ios/Frameworks/DFUnits.framework/Modules/module.modulemap

@ -0,0 +1,6 @@
framework module DFUnits {
umbrella header "DFUnits.h"
export *
module * { export * }
}

19
local_plugins/ota/ios/Frameworks/JLLogHelper.framework/Headers/JLLogHelper.h

@ -0,0 +1,19 @@
//
// JLLogHelper.h
// JLLogHelper
//
// Created by EzioChan on 2024/5/8.
// Copyright © 2024 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for JLLogHelper.
FOUNDATION_EXPORT double JLLogHelperVersionNumber;
//! Project version string for JLLogHelper.
FOUNDATION_EXPORT const unsigned char JLLogHelperVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <JLLogHelper/PublicHeader.h>
#import <JLLogHelper/JLLogManager.h>

75
local_plugins/ota/ios/Frameworks/JLLogHelper.framework/Headers/JLLogManager.h

@ -0,0 +1,75 @@
//
// JLLogManager.h
// JLLogHelper
//
// Created by EzioChan on 2024/5/8.
// Copyright © 2024 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 打印宏
#define kJLLog(level,fmt...) [JLLogManager logLevel:level funcName:__FUNCTION__ line:__LINE__ format:fmt]
typedef NS_ENUM(NSInteger, JLLOG_LEVEL) {
JLLOG_COMPLETE = 0,
JLLOG_DEBUG = 1,
JLLOG_INFO = 2,
JLLOG_WARN = 3,
JLLOG_ERROR = 4,
};
/// 日志打印
@interface JLLogManager : NSObject
/// 打印SDK版本
+(void)sdkVersion;
///清理已存储的打印
+(void)clearLog;
/**
* 打印文本
*/
+(void)openLogTextFile;
/// 打印时间
/// @param isTimeStamp 是否打印 default is false
+(void)logWithTimestamp:(BOOL)isTimeStamp;
/// 把日志保存存储起来
/// @param isSave 是否保存 default is yes
+(void)saveLogAsFile:(BOOL)isSave;
///LOG使能与等级,默认开启且debug等级。
/// @param enable LOG使能
/// @param isMore 是否打印【函数名&行号】
/// @param level LOG等级
+(void)setLog:(BOOL)enable IsMore:(BOOL)isMore Level:(JLLOG_LEVEL)level;
/// 打印函数
/// @param level LOG等级
/// @param func 函数名
/// @param line 行号
/// @param format 内容
+(void)logLevel:(JLLOG_LEVEL)level funcName:(const char* _Nullable)func line:(const int)line format:(NSString * _Nonnull)format,...;
/// 打印
/// @param something 任意字符串内容
+(void)logSomething:(NSString *)something;
/// 打印
/// @param level LOG等级
/// @param content 内容
+(void)logLevel:(JLLOG_LEVEL)level content:(NSString *)content;
/// 保存日志信息到文件中
/// @param logContent 日志内容
+(void)saveLog:(NSString *)logContent;
@end
NS_ASSUME_NONNULL_END

BIN
local_plugins/ota/ios/Frameworks/JLLogHelper.framework/Info.plist

Binary file not shown.

BIN
local_plugins/ota/ios/Frameworks/JLLogHelper.framework/JLLogHelper

Binary file not shown.

6
local_plugins/ota/ios/Frameworks/JLLogHelper.framework/Modules/module.modulemap

@ -0,0 +1,6 @@
framework module JLLogHelper {
umbrella header "JLLogHelper.h"
export *
module * { export * }
}

BIN
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Frameworks/JLLogHelper.framework/Info.plist

Binary file not shown.

BIN
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Frameworks/JLLogHelper.framework/JLLogHelper

Binary file not shown.

67
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLAdvParse.h

@ -0,0 +1,67 @@
//
// JLAdvParse.h
// JL_AdvParse
//
// Created by EzioChan on 2023/1/31.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <JLLogHelper/JLLogHelper.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(UInt8,JL_AdvType) {
JL_AdvTypeSoundBox = 0, //音箱类型
JL_AdvTypeChargingBin = 1, //充电仓类型
JL_AdvTypeTWS = 2, //TWS耳机类型
JL_AdvTypeHeadset = 3, //普通耳机类型
JL_AdvTypeSoundCard = 4, //声卡类型
JL_AdvTypeWatch = 5, //手表类型
JL_AdvTypeTradition = 6, //传统设备类型
};
typedef NS_ENUM(NSInteger,JL_DeviceType) {
JL_DeviceTypeSoundBox = 0, //AI音箱类型
JL_DeviceTypeChargingBin = 1, //充电仓类型
JL_DeviceTypeTWS = 2, //TWS耳机类型
JL_DeviceTypeHeadset = 3, //普通耳机类型
JL_DeviceTypeSoundCard = 4, //声卡类型
JL_DeviceTypeWatch = 5, //手表类型
JL_DeviceTypeTradition = -1, //传统设备类型
};
/// 广播包解析器
@interface JLAdvParse : NSObject
/// 打印当前SDK的版本
+(void)sdkVersion;
/// 解析设备广播包内容
/// @param key 过滤码(只针对传统设备生效,默认填空即可)
/// @param advertData 蓝牙广播字典
+(NSDictionary*)bluetoothAdvParse:(NSData *_Nullable)key AdvData:(NSDictionary*_Nonnull)advertData;
#pragma mark - 回连广播包信息
/**
* 获取广播包kCBAdvDataManufacturerData里面 'JLOTA' 标识的蓝牙地址
* @param kCBAdvDataManufacturerData 广播包
*/
+ (NSString * _Nullable)otaBleMacAddressFromCBAdvDataManufacturerData:(NSData *)kCBAdvDataManufacturerData;
/**
* 判断当前蓝牙地址是否等于广播包kCBAdvDataManufacturerData里面的蓝牙地址
* @param otaBleMacAddress ota升级中设备的蓝牙地址
* @param kCBAdvDataManufacturerData 广播包
*/
+ (Boolean)otaBleMacAddress:(NSString *)otaBleMacAddress isEqualToCBAdvDataManufacturerData:(NSData *)kCBAdvDataManufacturerData;
@end
NS_ASSUME_NONNULL_END

64
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLChargingBoxAdv.h

@ -0,0 +1,64 @@
//
// JLChargingBoxAdv.h
// JL_AdvParse
//
// Created by EzioChan on 2023/12/12.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import "JLDevicesAdv.h"
NS_ASSUME_NONNULL_BEGIN
@interface JLChargingBoxAdv : JLDevicesAdv
/// 经典蓝牙地址
@property(nonatomic, strong) NSString *edrAddr;
/// 是否已配对
@property(nonatomic, assign) BOOL isParied;
/// 是否已开盖
@property(nonatomic, assign) BOOL isOpen;
/// 耳机状态
///0x00:不显示弹窗
///0x01:经典蓝牙未连接
///0x02:经典蓝牙已连接
///0x03:设备正在回连
///0x04:设备不可连接 (需要手动进入配对模式)
@property(nonatomic, assign) uint8_t status;
/// 左耳电量
@property(nonatomic, assign) uint8_t batteryLeft;
/// 右耳电量
@property(nonatomic, assign) uint8_t batteryRight;
/// 充电仓电量
@property(nonatomic, assign) uint8_t batteryBox;
///左耳是否在充电中
@property(nonatomic, assign) BOOL isChargingLeft;
///右耳是否在充电中
@property(nonatomic, assign) BOOL isChargingRight;
///充电仓是否在充电中
@property(nonatomic, assign) BOOL isChargingBox;
/// seq
/// 用于区分是否同一次开机。每次开机或者断开连接后 增加1
@property(nonatomic, assign) uint8_t seq;
///模式
/// 0x00:充电模式
/// 0x01:发射模式
@property(nonatomic, assign) uint8_t mode;
/// 加密 Hash 校验值
@property(nonatomic, copy) NSData *hashData;
@end
NS_ASSUME_NONNULL_END

54
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLDevicesAdv.h

@ -0,0 +1,54 @@
//
// JLDevicesAdv.h
// JL_AdvParse
//
// Created by EzioChan on 2023/12/12.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JLAdvParse.h"
NS_ASSUME_NONNULL_BEGIN
@interface JLDevicesAdv : NSObject
/// 客户唯一标识
@property(nonatomic,assign)uint16_t uid;
/// 产品唯一标识
@property(nonatomic,assign)uint16_t pid;
/// 设备类型
///JL_DeviceTypeSoundBox = 0, //AI音箱类型
///JL_DeviceTypeChargingBin = 1, //充电仓类型
///JL_DeviceTypeTWS = 2, //TWS耳机类型
///JL_DeviceTypeHeadset = 3, //普通耳机类型
///JL_DeviceTypeSoundCard = 4, //声卡类型
///JL_DeviceTypeWatch = 5, //手表类型
///JL_DeviceTypeTradition = -1, //传统设备类型
@property(nonatomic,assign)JL_DeviceType type;
/// 协议版本
@property(nonatomic,assign)uint8_t version;
/// 可变数据段
@property(nonatomic,copy)NSData *variableData;
- (instancetype)initWithData:(NSData *)data;
/// 转成model类型
/// @param basicData 蓝牙广播数据
+(JLDevicesAdv *__nullable)advertDataToModel:(NSData *)basicData;
/// 转成model类型
/// @param basicHexStr 蓝牙广播数据
+(JLDevicesAdv *__nullable)advertDataHexStrToModel:(NSString *)basicHexStr;
@end
NS_ASSUME_NONNULL_END

47
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLEarphoneAdv.h

@ -0,0 +1,47 @@
//
// JLEarphoneAdv.h
// JL_AdvParse
//
// Created by EzioChan on 2023/12/12.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import "JLDevicesAdv.h"
NS_ASSUME_NONNULL_BEGIN
@interface JLEarphoneAdv : JLDevicesAdv
/// 左耳电量
@property(nonatomic, assign) uint8_t batteryLeft;
/// 右耳电量
@property(nonatomic, assign) uint8_t batteryRight;
///左耳是否在充电中
@property(nonatomic, assign) BOOL isChargingLeft;
///右耳是否在充电中
@property(nonatomic, assign) BOOL isChargingRight;
/// 是否已配对
@property(nonatomic, assign) BOOL isParied;
/// 是否主机
@property(nonatomic, assign) BOOL isMaster;
/// 是否允许连接
@property(nonatomic, assign) BOOL enableConnect;
/// 耳机状态
///0x00:不显示弹窗
///0x01:经典蓝牙未连接
///0x02:经典蓝牙已连接
///0x03:设备正在回连
///0x04:设备不可连接 (需要手动进入配对模式)
@property(nonatomic, assign) uint8_t status;
@end
NS_ASSUME_NONNULL_END

25
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLOtaAdv.h

@ -0,0 +1,25 @@
//
// JLOtaAdv.h
// JL_AdvParse
//
// Created by EzioChan on 2023/12/12.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import <JL_AdvParse/JL_AdvParse.h>
NS_ASSUME_NONNULL_BEGIN
@interface JLOtaAdv : JLDevicesAdv
/// ble address before
@property(nonatomic,strong)NSString *BleAddrBefore;
//MARK: - Version 1
/// battery
@property(nonatomic,assign)uint8_t battery;
@end
NS_ASSUME_NONNULL_END

19
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLSoundBoxAdv.h

@ -0,0 +1,19 @@
//
// JLSoundBoxAdv.h
// JL_AdvParse
//
// Created by EzioChan on 2023/12/12.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import "JLTwsAdv.h"
NS_ASSUME_NONNULL_BEGIN
@interface JLSoundBoxAdv : JLTwsAdv
@property(nonatomic,assign)uint8_t battery;
@end
NS_ASSUME_NONNULL_END

19
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLSoundCardAdv.h

@ -0,0 +1,19 @@
//
// JLSoundCardAdv.h
// JL_AdvParse
//
// Created by EzioChan on 2023/12/12.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import "JLTwsAdv.h"
NS_ASSUME_NONNULL_BEGIN
@interface JLSoundCardAdv : JLTwsAdv
@property(nonatomic,assign)uint8_t battery;
@end
NS_ASSUME_NONNULL_END

70
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLTwsAdv.h

@ -0,0 +1,70 @@
//
// JLTwsAdv.h
// JL_AdvParse
//
// Created by EzioChan on 2023/12/12.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import "JLDevicesAdv.h"
NS_ASSUME_NONNULL_BEGIN
@interface JLTwsAdv : JLDevicesAdv
//MARK: - Version 0
/// 经典蓝牙地址
@property(nonatomic, strong) NSString *edrAddr;
/// 耳机状态
///0x00:不显示弹窗
///0x01:经典蓝牙未连接
///0x02:经典蓝牙已连接
///0x03:设备正在回连
///0x04:设备不可连接 (需要手动进入配对模式)
@property(nonatomic, assign) uint8_t status;
/// 左耳电量
@property(nonatomic, assign) uint8_t batteryLeft;
/// 右耳电量
@property(nonatomic, assign) uint8_t batteryRight;
/// 充电仓电量
@property(nonatomic, assign) uint8_t batteryBox;
///左耳是否在充电中
@property(nonatomic, assign) BOOL isChargingLeft;
///右耳是否在充电中
@property(nonatomic, assign) BOOL isChargingRight;
///充电仓是否在充电中
@property(nonatomic, assign) BOOL isChargingBox;
/// seq
/// 用于区分是否同一次开机。每次开机或者断开连接后 增加1
@property(nonatomic, assign) uint8_t seq;
/// 加密 Hash 校验值
@property(nonatomic, copy) NSData *hashData;
//MARK: - Version 1
/// BLE连接属性(enableConnect)
@property(nonatomic, assign) BOOL bleEnable;
//MARK: - Version 2
/// 连接方式
/// 0x00 BLE 通迅
/// 0x01 SPP 通迅
@property(nonatomic, assign) uint8_t connectWay;
/// 是否支持智能充电仓
@property(nonatomic, assign) BOOL isSupportChargBox;
//MARK: - Version 3
/// 左耳电量为挂脖耳机电量!!!,其他耳机电量使用
@end
NS_ASSUME_NONNULL_END

35
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JLWatchAdv.h

@ -0,0 +1,35 @@
//
// JLWatchAdv.h
// JL_AdvParse
//
// Created by EzioChan on 2023/12/12.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import <JL_AdvParse/JLDevicesAdv.h>
NS_ASSUME_NONNULL_BEGIN
@interface JLWatchAdv : JLDevicesAdv
/// 经典蓝牙地址
@property(nonatomic, strong) NSString *edrAddr;
/// 连接方式
/// 0x00 ble
/// 0x01 spp
@property(nonatomic, assign) int8_t connectWay;
/// 手表状态
/// 0x00:经典蓝牙未连接
/// 0x01:经典蓝牙已连接 0x02:设备正在回连
/// 0x03:设备不可连接 (需要手动进入配对模式)
@property(nonatomic, assign) int8_t connectState;
/// 是否需要先连上 ble
@property(nonatomic, assign) BOOL priorityConnection;
@end
NS_ASSUME_NONNULL_END

27
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Headers/JL_AdvParse.h

@ -0,0 +1,27 @@
//
// JL_AdvParse.h
// JL_AdvParse
//
// Created by EzioChan on 2023/1/31.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for JL_AdvParse.
FOUNDATION_EXPORT double JL_AdvParseVersionNumber;
//! Project version string for JL_AdvParse.
FOUNDATION_EXPORT const unsigned char JL_AdvParseVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <JL_AdvParse/PublicHeader.h>
#import <JL_AdvParse/JLAdvParse.h>
#import <JL_AdvParse/JLDevicesAdv.h>
#import <JL_AdvParse/JLTwsAdv.h>
#import <JL_AdvParse/JLSoundBoxAdv.h>
#import <JL_AdvParse/JLSoundCardAdv.h>
#import <JL_AdvParse/JLChargingBoxAdv.h>
#import <JL_AdvParse/JLEarphoneAdv.h>
#import <JL_AdvParse/JLWatchAdv.h>
#import <JL_AdvParse/JLOtaAdv.h>

BIN
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Info.plist

Binary file not shown.

BIN
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/JL_AdvParse

Binary file not shown.

6
local_plugins/ota/ios/Frameworks/JL_AdvParse.framework/Modules/module.modulemap

@ -0,0 +1,6 @@
framework module JL_AdvParse {
umbrella header "JL_AdvParse.h"
export *
module * { export * }
}

BIN
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Frameworks/JLLogHelper.framework/Info.plist

Binary file not shown.

BIN
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Frameworks/JLLogHelper.framework/JLLogHelper

Binary file not shown.

25
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Headers/BtHash.h

@ -0,0 +1,25 @@
//
// BtHash.h
// BtHash
//
// Created by huanghaibo on 2019/7/28.
// Copyright © 2019 jieli. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BtHash : NSObject
/*
@param [in] pt[*1] The plaintext
@param ptlen The length of the plaintext(octets) range: 1~32
@param [in] key[*1] The key for encrypt
@param keylen[*1] The length of the key(octets) range: 1~32
@param [out] mac[*1] output : The Message Authentication Code 16 bytes.
@return error if < 0, 0 is normal.
*/
+(int)decryptWithPlaintext:(unsigned char *)pt
andPlaintextLen:(int)ptlen
andKey: (unsigned char *)key
andKeyLen: (int)keylen
andMac:(unsigned char *)mac;
@end

54
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Headers/JLHashHandler.h

@ -0,0 +1,54 @@
//
// JLHashHandler.h
// JL_BLEKit
//
// Created by EzioChan on 2023/1/30.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <JLLogHelper/JLLogHelper.h>
NS_ASSUME_NONNULL_BEGIN
typedef void(^JLHashBlock)(BOOL ret);
@protocol JLHashHandlerDelegate <NSObject>
/// 需要发送到设备校验认证的数据
/// - Parameter data: 数据
-(void)hashOnPairOutputData:(NSData*)data;
@end
/// 设备认证
@interface JLHashHandler : NSObject
@property(nonatomic,weak)id<JLHashHandlerDelegate> delegate;
/// APP端发起设备认证
/// - Parameters:
/// - pKey: 加密Key(默认为空)
/// - bk: 配对认证回调结果
-(void)bluetoothPairingKey:(NSData *__nullable)pKey Result:(JLHashBlock)bk;
/// 重置设备认证过程
-(void)hashResetPair;
/// 填入设备回复数据
/// - Parameter rData: 数据
-(void)inputPairData:(NSData*)rData;
/// 打印当前SDK的版本
+(void)sdkVersion;
@end
NS_ASSUME_NONNULL_END

21
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Headers/JL_HashPair.h

@ -0,0 +1,21 @@
//
// JL_HashPair.h
// JL_HashPair
//
// Created by EzioChan on 2023/1/30.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for JL_HashPair.
FOUNDATION_EXPORT double JL_HashPairVersionNumber;
//! Project version string for JL_HashPair.
FOUNDATION_EXPORT const unsigned char JL_HashPairVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <JL_HashPair/PublicHeader.h>
#import <JL_HashPair/BtHash.h>
#import <JL_HashPair/JLHashHandler.h>
#import <JL_HashPair/JL_ble_pair.h>

20
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Headers/JL_ble_pair.h

@ -0,0 +1,20 @@
//
// JL_ble_pair.h
// JL_BLEKit
//
// Created by zhihui liang on 2018/11/10.
// Copyright © 2018 www.zh-jieli.com. All rights reserved.
//
#ifndef JL_ble_pair_h
#define JL_ble_pair_h
#include <stdio.h>
#include <stdint.h>
void function_jieli(uint8_t *address,uint8_t *RAND,uint8_t *K,uint8_t *result);
#pragma mark CRC校验
unsigned short JL_CRC16(unsigned char *ptr, int len, uint16_t lastCrc);
#endif /* JL_ble_pair_h */

BIN
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Info.plist

Binary file not shown.

BIN
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/JL_HashPair

Binary file not shown.

6
local_plugins/ota/ios/Frameworks/JL_HashPair.framework/Modules/module.modulemap

@ -0,0 +1,6 @@
framework module JL_HashPair {
umbrella header "JL_HashPair.h"
export *
module * { export * }
}

BIN
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Frameworks/JLLogHelper.framework/Info.plist

Binary file not shown.

BIN
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Frameworks/JLLogHelper.framework/JLLogHelper

Binary file not shown.

52
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Headers/JLOTAFile.h

@ -0,0 +1,52 @@
//
// JLOTAFile.h
// JL_OTALib
//
// Created by EzioChan on 2024/7/26.
// Copyright © 2024 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(UInt8, JL_OTAUrlResult) {
JL_OTAUrlResultSuccess = 0x00, //OTA文件获取成功
JL_OTAUrlResultFail = 0x01, //OTA文件获取失败
JL_OTAUrlResultDownloadFail = 0x02, //OTA文件下载失败
};
typedef void(^JL_OTA_URL)(JL_OTAUrlResult result,
NSString* __nullable version,
NSString* __nullable url,
NSString* __nullable explain);
@interface JLOTAFile : NSObject
#pragma mark -文件下载
/**
文件下载
@param key 授权key
@param code 授权code
@param result 回复
*/
-(void)cmdGetOtaFileKey:(NSString*)key
Code:(NSString*)code
Result:(JL_OTA_URL __nullable)result;
/**
OTA升级文件下载【MD5】
@param key 授权key
@param code 授权code
@param hash MD5值
@param result 回复
*/
-(void)cmdGetOtaFileKey:(NSString*)key
Code:(NSString*)code
hash:(NSString*)hash
Result:(JL_OTA_URL __nullable)result;
@end
NS_ASSUME_NONNULL_END

20
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Headers/JL_OTALib.h

@ -0,0 +1,20 @@
//
// JL_OTALib.h
// JL_OTALib
//
// Created by EzioChan on 2023/1/29.
// Copyright © 2023 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for JL_OTALib.
FOUNDATION_EXPORT double JL_OTALibVersionNumber;
//! Project version string for JL_OTALib.
FOUNDATION_EXPORT const unsigned char JL_OTALibVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <JL_OTALib/PublicHeader.h>
#import <JL_OTALib/JL_OTAManager.h>
#import <JL_OTALib/jl_ufw.h>
#import <JL_OTALib/JLOTAFile.h>

227
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Headers/JL_OTAManager.h

@ -0,0 +1,227 @@
//
// JL_OTAManager.h
// JL_BLEKit
//
// Created by 杰理科技 on 2021/11/16.
// Copyright © 2021 www.zh-jieli.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <JLLogHelper/JLLogHelper.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(UInt8, JL_OTAResult) {
JL_OTAResultSuccess = 0x00, // OTA升级成功
JL_OTAResultFail = 0x01, // OTA升级失败
JL_OTAResultDataIsNull = 0x02, // OTA升级数据为空
JL_OTAResultCommandFail = 0x03, // OTA指令失败
JL_OTAResultSeekFail = 0x04, // OTA标示偏移查找失败
JL_OTAResultInfoFail = 0x05, // OTA升级固件信息错误
JL_OTAResultLowPower = 0x06, // OTA升级设备电压低
JL_OTAResultEnterFail = 0x07, // 未能进入OTA升级模式
JL_OTAResultUpgrading = 0x08, // OTA升级中
JL_OTAResultReconnect = 0x09, // OTA需重连设备(uuid方式)
JL_OTAResultReboot = 0x0a, // OTA需设备重启
JL_OTAResultPreparing = 0x0b, // OTA准备中
JL_OTAResultPrepared = 0x0f, // OTA准备完成
JL_OTAResultStatusIsUpdating = 0x10, // 设备已在升级中
JL_OTAResultFailedConnectMore = 0x11, // 当前固件多台设备连接,请手动断开另 一个设备连接
JL_OTAResultFailSameSN = 0xe0, // 升级数据校验失败,SN 多次重复
JL_OTAResultCancel = 0xe1, // 升级取消
JL_OTAResultFailVerification = 0xf1, // 升级数据校验失败
JL_OTAResultFailCompletely = 0xf2, // 升级失败
JL_OTAResultFailKey = 0xf3, // 升级数据校验失败,加密Key不对
JL_OTAResultFailErrorFile = 0xf4, // 升级文件出错
JL_OTAResultFailUboot = 0xf5, // uboot不匹配
JL_OTAResultFailLenght = 0xf6, // 升级过程长度出错
JL_OTAResultFailFlash = 0xf7, // 升级过程flash读写失败
JL_OTAResultFailCmdTimeout = 0xf8, // 升级过程指令超时
JL_OTAResultFailSameVersion = 0xf9, // 相同版本
JL_OTAResultFailTWSDisconnect = 0xfa, // TWS耳机未连接
JL_OTAResultFailNotInBin = 0xfb, // 耳机未在充电仓
JL_OTAResultReconnectWithMacAddr = 0xfc, // OTA需重连设备(mac方式)
JL_OTAResultDisconnect = 0xfd, // OTA设备断开
JL_OTAResultUnknown, // OTA未知错误
};
typedef NS_ENUM(UInt8, JL_OTAReconnectType) {
JL_OTAReconnectTypeUUID = 0x00, // OTA升级回连使用uuid
JL_OTAReconnectTypeMACAddr = 0x01, // OTA升级回连使用mac地址
};
typedef NS_ENUM(UInt8, JL_OtaStatus) {
JL_OtaStatusNormal = 0, // 正常升级
JL_OtaStatusForce = 1, // 强制升级
};
typedef NS_ENUM(UInt8, JL_OtaHeadset) {
JL_OtaHeadsetNO = 0, // 耳机单备份 正常升级
JL_OtaHeadsetYES = 1, // 耳机单备份 强制升级
};
typedef NS_ENUM(UInt8, JL_OtaWatch) {
JL_OtaWatchNO = 0, // 手表资源 正常升级
JL_OtaWatchYES = 1, // 手表资源 强制升级
};
typedef NS_ENUM(UInt8, JL_BootLoader) {
JL_BootLoaderNO = 0, // 不需要下载Bootloader
JL_BootLoaderYES = 1, // 需要下载BootLoader
};
typedef NS_ENUM(UInt8, JL_Partition) {
JL_PartitionSingle = 0, // 固件单备份
JL_PartitionDouble = 1, // 固件双备份
};
typedef void (^JL_OTA_RT)(JL_OTAResult result, float progress);
typedef void (^JL_OTA_RESULT)(uint8_t status, uint8_t sn, NSData *__nullable data);
@class JL_OTAManager;
/// OTA 升级管理对象回调
@protocol JL_OTAManagerDelegate <NSObject>
/// 即将被发送的数据
/// @param data 数据内容
- (void)otaDataSend:(NSData *_Nonnull)data;
@optional
/// 回调设备状态信息
/// @param manager 对象状态
- (void)otaFeatureResult:(JL_OTAManager *_Nonnull)manager;
/// 回调升级状态以及进度等
/// @param result 状态以及进度信息
/// @param progress 进度信息
- (void)otaUpgradeResult:(JL_OTAResult)result Progress:(float)progress;
/// 取消OTA升级
- (void)otaCancel;
@end
/// OTA升级管理对象
@interface JL_OTAManager : NSObject
/// 设备UUID(需要开发者填入)
@property(strong, nonatomic) NSString *mBLE_UUID;
/// 设备名称(需要开发者填入)
@property(strong, nonatomic) NSString *mBLE_NAME;
/// 是否仅仅支持BLE
@property(assign, nonatomic) BOOL bleOnly;
/// ble蓝牙地址
@property(strong, nonatomic) NSString *bleAddr;
/// SN值
@property(assign, nonatomic) uint8_t mCmdSN;
/// 设备版本号
@property(assign, nonatomic) uint16_t version;
/// 设备版本信息
@property(strong, nonatomic) NSString *versionFirmware;
/// 设备OTA状态
@property(assign, nonatomic) JL_OtaStatus otaStatus;
/// 耳机单备份 是否需要强制升级
@property(assign, nonatomic) JL_OtaHeadset otaHeadset;
/// 手表资源 是否需要强制升级
@property(assign, nonatomic) JL_OtaWatch otaWatch;
/// 设备OTA时支持单/双备份
@property(assign, nonatomic) JL_Partition otaPartition;
/// 设备是否需要下载Loader
@property(assign, nonatomic) JL_BootLoader bootloaderType;
/// OTA升级回连方式
@property(assign, nonatomic) JL_OTAReconnectType otaReconnectType;
/// OTA升级内容大小(设备通知的)
@property(assign, nonatomic, readonly) int64_t otaLength;
/// 已传输的数据大小
@property(assign, nonatomic, readonly) uint32_t otaSent;
/// 设备交互回调代理
@property(weak, nonatomic) id<JL_OTAManagerDelegate> delegate;
/// 获取 OTA 升级对象
+ (JL_OTAManager *)getOTAManager;
/// 不建议使用自行初始化
/// 推荐获取 getOTAManager
- (instancetype)init __attribute__((deprecated("Please use getOTAManager instead.")));
;
/// 打印OTA发送的数据内容
/// - Parameter status: 开关
- (void)logSendData:(BOOL)status;
/// 当BLE连接上时告知SDK
- (void)noteEntityConnected;
/// 当BLE断开时告知SDK
- (void)noteEntityDisconnected;
/// 设置最大丢包次数
/// - Parameter count: 次数
/// default: 2
- (void)maxLostCount:(int)count;
/// Receive data from rcsp
/// 设备端过来的数据
/// - Parameter data: data
- (void)cmdOtaDataReceive:(NSData *)data;
/// 查询设备OTA信息
/// 所有情况下都需要执行,而且是在连上后(认证完成)第一步执行
- (void)cmdTargetFeature;
/// 查询设备系统状态
/// 当设备需要挂载外置flash才能正常升级时需要执行,其他情况则无需执行
- (void)cmdSystemFunction;
/// OTA单备份,是否正在回连
- (BOOL)cmdOtaIsRelinking;
#pragma mark---> OTA升级
/**
开始OTA升级
@param data 升级数据
@param result 升级结果
*/
- (void)cmdOTAData:(NSData *)data
Result:(JL_OTA_RT __nullable)result;
/// OTA升级II
/// 单备份升级特有!!!!
/// 此接口可用于 OTA 回连成功后,再次发起升级使用
/// @param result 升级结果回调
- (void)cmdOtaDataIIResult:(JL_OTA_RT __nullable)result;
/**
OTA升级取消
@param result 回复
*/
- (void)cmdOTACancelResult:(JL_OTA_RESULT __nullable)result;
/// 重启设备
- (void)cmdRebootDevice;
/// 强制重启设备
- (void)cmdRebootForceDevice;
/// 重置OTA manager
- (void)resetOTAManager;
/// 打印OTA SDK版本
+ (NSString *)logSDKVersion;
@end
NS_ASSUME_NONNULL_END

207
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Headers/jl_ufw.h

@ -0,0 +1,207 @@
/**
* Des:
* author: Bob
* date: 2022/11/29
* Copyright: Jieli Technology
*/
#ifndef NATIVEAPPLICATION_JL_UFW_H
#define NATIVEAPPLICATION_JL_UFW_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <android/log.h>
//#include <jni.h>
//
//#define tag "myJNI"
//#define logi(TAG, ...) ((void)__android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__))
//#define logw(TAG, ...) ((void)__android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__))
//#define loge(TAG, ...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__))
int parse_fw_info(const char *data, int size, uint8_t *resultBuff, uint32_t buffSize);
#define BIT(n) (1 << n)
// for FW file
enum eFW_FILE_TYPE {
FILE_TYPE_FW_FLASH_BIN = 0, // FLASH文件,第一块FLASH数据
FILE_TYPE_FW_OTP_BIN = 1, // OTP文件
FILE_TYPE_FW_INFO_LOG = 2, // FW文件中保存的描述信息
FILE_TYPE_FW_BURN_CFG = 3, // 烧写器配置文件
FILE_TYPE_FW_SCRIPT_DATA = 4, // 烧写器打包烧写器下载文件时,需要执行的脚本数据
FILE_TYPE_FW_SRC = 5, // 需要保存在FW文件中的代码文件, FW文件查看/编辑器都不能显示这些数据
FILE_TYPE_FW_NAME_BIN = 6, // 升级名字用的FW文件,已经废除
FILE_TYPE_FW_OTP_VER_BIN = 7, // OTP maskrom版本
FILE_TYPE_FW_OTPCFG_BIN = 8, // OTP配置信息
FILE_TYPE_FW_OTP_CHIP_CONTROL_BIN = 9, // OTP芯片控制信息
FILE_TYPE_FW_OTP_MINI_UBOOT = 0xA, // 烧写到OTP的MINI UBOOT文件
FILE_TYPE_FW_OTP_FIX_UBOOT = 0xB, // 烧写到OTP的FIX UBOOT文件
FILE_TYPE_FW_FLASH_2_BIN = 0xC, // 第二块FLASH数据
FILE_TYPE_FW_BR18_EFUSE_CONFIG_BIN = 0xD, // BR18 24BIT EFUSE配置数据
FILE_TYPE_FW_RESOURCE_FILE = 0xE, // 资源文件
FILE_TYPE_FW_2018KEY_INFO = 0xF, // 2018年的新KEY信息
FILE_TYPE_FW_BURNER_CUSTOMER_DATA = 0x10, // 一拖八烧写器用户信息
FILE_TYPE_FW_BURNER_DV15_FLASH_BIN = 0x11, // 一拖八烧写器第一块FLASH数据
FILE_TYPE_FW_BURNER_APP_FLASH_BIN = 0x12, // 一拖八烧写器第二块FLASH数据
FILE_TYPE_FW_BURNER_DATA_FLASH_BIN = 0x13, // 一拖八烧写器第三块FLASH数据
FILE_TYPE_FW_BURNER_BR21_FLASH_BIN = 0x14, // 一拖八烧写器第四块FLASH数据
FILE_TYPE_FW_FLASH_BIN_2 = 0x20, // 下载到第一块FLASH的文件,下载工具根据条件要么下载FILE_TYPE_FW_FLASH_BIN,要么下载FILE_TYPE_FW_FLASH_BIN_2
FILE_TYPE_FW_FLASH_BIN_3,
FILE_TYPE_FW_FLASH_BIN_4,
FILE_TYPE_FW_LOADER_BIN = 0x31, // 打包的LOADER程序代码
FILE_TYPE_FW_TEST_BOX_OTA_BIN = 0x64, // 测试盒使用的ota.bin
FILE_TYPE_FW_3RD_DATA_FILE = 0x71, // 第三方烧写数据
FILE_TYPE_FW_OTA_TARGET_DEVICE_INFO = 0xA0,
FILE_TYPE_FW_BURN_COUNT_LIMIT = 0xA1, // 烧写授权信息
FILE_TYPE_FW_ADDITIONAL_FILE = 0xEE, // 附加文件,由烧写器根据名字决定用途
FILE_TYPE_FW_PASSTHROUGH_DATA = 0xEF, // AC691X BTIF数据
// 仅存在于FW文件中的数据
FILE_TYPE_FW_HIDDEN_CFG_BIN = 0xFA,
FILE_TYPE_FW_INVISIBLE_DATA = 0xFB, // 保存在FW文件中的隐藏数据,FW文件查看/编辑器都不能显示这些数据
FILE_TYPE_FW_VISIBLE_DATA = 0xFE, // 仅保存在FW文件中的HEX数据
FILE_TYPE_FW_TAIL = 0xFF, // FW文件尾部标识
};
typedef struct U16BIT
{
unsigned char b0 : 1;
unsigned char b1 : 1;
unsigned char b2 : 1;
unsigned char b3 : 1;
unsigned char b4 : 1;
unsigned char b5 : 1;
unsigned char b6 : 1;
unsigned char b7 : 1;
unsigned char b8 : 1;
unsigned char b9 : 1;
unsigned char b10 : 1;
unsigned char b11 : 1;
unsigned char b12 : 1;
unsigned char b13 : 1;
unsigned char b14 : 1;
unsigned char b15 : 1;
} U16BIT;
typedef union UBIT16
{
U16BIT bits;
uint16_t val;
} UBIT16;
typedef struct stRES_FILE_HEAD {
uint32_t u32Tag;
uint16_t u16Crc;
uint16_t u16CrcOfItems;
uint32_t u32Len;
uint16_t u16Count;
uint16_t u16Res;
uint8_t u8Res16[16];
}RES_FILE_HEAD;
typedef struct stRES_CONFIG_ITEM {
uint16_t u16Index;
uint16_t u16Type;
uint32_t u32Addr;
uint32_t u32Len;
uint16_t u16CrcOfData;
uint16_t u16Res;
char szName[16];
}RES_CONFIG_ITEM;
static uint16_t m_u16ChipKey = 0xFFFF;
static uint16_t m_u16DefaultKey = 0xFFFF;
#pragma pack(1)
#define JL_FILE_ITEM_NAME_MAX_LEN 16
#define JL_CHIP_KEY_ENC_LENGTH 32
typedef struct stUFW_SYD_HEAD_V1 {
uint16_t u16Crc; // crc16 for this struct
uint16_t u16CrcOfSydFileHead;
uint32_t u32FileLength; // file length
uint16_t u16FileCount; // 此FW文件中包含的子文件个数
uint16_t u16Version;
uint32_t u32Res;
char szChipName[16]; // 此FW文件对应的芯片类型,如AC690X,AC691X
uint32_t u32Res2[4];
uint32_t u32Res3[4];
}UFW_SYD_HEAD_V1;
typedef struct stUFW_FILE_HEAD_V1 {
uint8_t u8FileType; // 文件类型
uint8_t u8Res; // 保留
uint16_t u16Index; // 文件索引号
uint16_t u16Crc; // 明文数据的校验码
uint16_t u16Version; // 本结构体版本
uint32_t u32Addr; // 地址
uint32_t u32Length; // 数据长度
uint32_t u32AllLength; // 数据长度+尾部对齐的数据长度
uint32_t u32EncryptedAddr; // 加密数据的地址偏移(相对u32Addr的地址)
uint32_t u32EncryptedLength; // 加密的数据长度
uint32_t u32Res; // 保留
uint32_t u64Res1[4]; // 保留
uint32_t u64Res2[4]; // 保留
char name[JL_FILE_ITEM_NAME_MAX_LEN];
}UFW_FILE_HEAD_V1;
typedef struct stJL_FILE_TAIL {
char szChipKey[JL_CHIP_KEY_ENC_LENGTH]; // 32 // 固定位置
uint16_t u16ChipKeyCRC16; // 34 // 固定位置
uint8_t u8Magic[6]; // 40 // 固定位置
uint8_t u8Res8[8]; // 48
char szTailChipName[6]; // 54 // 固定位置
uint8_t u8Reserv10[10]; // 64
}JL_FILE_TAIL;
typedef struct {
char szName[3];
char szVersion[3];
uint8_t u8Flag;
uint8_t u8Res;
uint32_t u32Crc;
uint16_t u16Crc;
uint16_t u16Res;
}JL_FLASH_BIN_TAIL;
typedef UFW_SYD_HEAD_V1 jl_ufw_syd_head;
typedef UFW_FILE_HEAD_V1 jl_ufw_file_head;
typedef JL_FILE_TAIL jl_ufw_tail;
typedef struct stJL_BR22_FLASH_HEAD {
uint16_t u16Crc; // 结构体自身校验码
uint8_t u8SizeForBurner; // 为烧写器保留的空间大小
uint8_t u8Version; // FLASH FS版本号
char vid[4]; // 4byte的vid
uint32_t u32FlashSize; // FLASH大小,由isd_download计算得出
uint8_t u8FsVersion; // 类型:br18/br22
uint8_t u8BlockAlingnModulus; // 对齐系数
uint8_t u8Res; // 保留,以后有可能会用于存放顶层目录的偏移和文件目录内偏移信息
uint8_t u8SpecialOptFlag; // 用于标记是否需要生成2种flash格式的标记位,目前只用1位,以后如果需要特殊操作需要标记,再用其他位
char pid[16]; // 16byte的pid
}JL_BR22_FLASH_HEAD;
#pragma pack()
#endif //NATIVEAPPLICATION_JL_UFW_H

BIN
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Info.plist

Binary file not shown.

BIN
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/JL_OTALib

Binary file not shown.

6
local_plugins/ota/ios/Frameworks/JL_OTALib.framework/Modules/module.modulemap

@ -0,0 +1,6 @@
framework module JL_OTALib {
umbrella header "JL_OTALib.h"
export *
module * { export * }
}

7
local_plugins/ota/ios/ota.podspec

@ -16,6 +16,13 @@ A new Flutter project.
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '12.0'
s.vendored_frameworks = [
'Frameworks/DFUnits.framework',
'Frameworks/JL_AdvParse.framework',
'Frameworks/JL_HashPair.framework',
'Frameworks/JL_OTALib.framework',
'Frameworks/JLLogHelper.framework'
]
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }

4
local_plugins/ota/lib/ota.dart

@ -132,11 +132,11 @@ class Ota {
// _isEventListenerSet = true;
// }
Future<String?> startUpgrading(String? filePath) {
Future<void> startUpgrading(String? filePath) {
return OtaPlatform.instance.startUpgrading(filePath);
}
Future<String?> onOtaClose() {
Future<void> onOtaClose() {
return OtaPlatform.instance.onOtaClose();
}
}

10
local_plugins/ota/lib/ota_method_channel.dart

@ -10,17 +10,15 @@ class MethodChannelOta extends OtaPlatform {
final methodChannel = const MethodChannel('ota');
@override
Future<String?> startUpgrading(String? filePath) async {
final version = await methodChannel.invokeMethod<String>(
Future<void> startUpgrading(String? filePath) async {
await methodChannel.invokeMethod<String>(
'startUpgrading',
{'filePath': filePath}, // 传递参数
);
return version;
}
@override
Future<String?> onOtaClose() async {
final version = await methodChannel.invokeMethod<String>('onOtaClose');
return version;
Future<void> onOtaClose() async {
await methodChannel.invokeMethod<String>('onOtaClose');
}
}

4
local_plugins/ota/lib/ota_platform_interface.dart

@ -23,11 +23,11 @@ abstract class OtaPlatform extends PlatformInterface {
_instance = instance;
}
Future<String?> startUpgrading(String? filePath) {
Future<void> startUpgrading(String? filePath) {
throw UnimplementedError('platformVersion() has not been implemented.');
}
Future<String?> onOtaClose() {
Future<void> onOtaClose() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
}

Loading…
Cancel
Save