Browse Source
device_jieli.podspec 原本 vendor 了 7 个 xcframework,但其中 5 个跟其他 本地 plugin 重复(CocoaPods 不会自动去重): - JL_OTALib / JL_AdvParse / JL_HashPair / JLLogHelper —— ota plugin 已有 - JLAudioUnitKit —— ble_service plugin 的 SPM binary target 已有 只保留 device_jieli 独家依赖:JL_BLEKit + JLAV2Lib。删除 Frameworks/ 内 重复的 xcframework 副本以避免误用。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>weicu
107 changed files with 6 additions and 5338 deletions
@ -1,43 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>AvailableLibraries</key> |
|||
<array> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JLAudioUnitKit.framework/JLAudioUnitKit</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-x86_64-simulator</string> |
|||
<key>LibraryPath</key> |
|||
<string>JLAudioUnitKit.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>x86_64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
<key>SupportedPlatformVariant</key> |
|||
<string>simulator</string> |
|||
</dict> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JLAudioUnitKit.framework/JLAudioUnitKit</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64</string> |
|||
<key>LibraryPath</key> |
|||
<string>JLAudioUnitKit.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
</dict> |
|||
</array> |
|||
<key>CFBundlePackageType</key> |
|||
<string>XFWK</string> |
|||
<key>XCFrameworkFormatVersion</key> |
|||
<string>1.0</string> |
|||
</dict> |
|||
</plist> |
|||
@ -1,26 +0,0 @@ |
|||
//
|
|||
// JLAudioUnitKit.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
//! Project version number for JLAudioUnitKit.
|
|||
FOUNDATION_EXPORT double JLAudioUnitKitVersionNumber; |
|||
|
|||
//! Project version string for JLAudioUnitKit.
|
|||
FOUNDATION_EXPORT const unsigned char JLAudioUnitKitVersionString[]; |
|||
|
|||
// In this header, you should import all the public headers of your framework using statements like #import <JLAudioUnitKit/PublicHeader.h>
|
|||
|
|||
#import <JLAudioUnitKit/JLSpeexDecoder.h> |
|||
#import <JLAudioUnitKit/JLOpusDecoder.h> |
|||
#import <JLAudioUnitKit/JLOpusEncoder.h> |
|||
#import <JLAudioUnitKit/JLOpusFormat.h> |
|||
#import <JLAudioUnitKit/JLOpusEncodeConfig.h> |
|||
#import <JLAudioUnitKit/JLPcmToWtg.h> |
|||
#import <JLAudioUnitKit/JLPcmToWav.h> |
|||
#import <JLAudioUnitKit/JLAudioUnitPlayer.h> |
|||
#import <JLAudioUnitKit/JLOpusToOgg.h> |
|||
@ -1,58 +0,0 @@ |
|||
//
|
|||
// JLAudioUnitPlayer.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/4/16.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <AudioToolbox/AudioToolbox.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
typedef NS_ENUM(NSInteger, JLAudioUnitPlayerType) { |
|||
JLAudioUnitPlayerTypeFile, // 支持 MP3/WAV/AAC 等文件格式(AVAudioPlayer)
|
|||
JLAudioUnitPlayerTypePCM // 支持 PCM 流式播放(Audio Queue)
|
|||
}; |
|||
|
|||
@class JLAudioUnitPlayer; |
|||
|
|||
@protocol JLAudioPlayerDelegate <NSObject> |
|||
@optional |
|||
// 播放进度更新(秒)
|
|||
- (void)audioPlayer:(JLAudioUnitPlayer *)player didUpdateProgress:(NSTimeInterval)currentTime duration:(NSTimeInterval)duration; |
|||
// 播放完成
|
|||
- (void)audioPlayerDidFinishPlaying:(JLAudioUnitPlayer *)player; |
|||
// 播放错误
|
|||
- (void)audioPlayer:(JLAudioUnitPlayer *)player didFailWithError:(NSError *)error; |
|||
@end |
|||
|
|||
@interface JLAudioUnitPlayer : NSObject |
|||
|
|||
@property (nonatomic, weak) id<JLAudioPlayerDelegate> delegate; |
|||
@property (nonatomic, readonly) NSTimeInterval duration; // 总时长(文件模式下有效)
|
|||
@property (nonatomic, readonly) NSTimeInterval currentTime; |
|||
@property (nonatomic, readonly) BOOL isPlaying; |
|||
|
|||
#pragma mark - 初始化方法 |
|||
|
|||
/// 文件播放初始化(MP3/WAV/AAC)
|
|||
- (instancetype)initWithAudioFile:(NSString *)filePath; |
|||
|
|||
/// PCM 流播放初始化(需指定格式)
|
|||
- (instancetype)initWithPCMFormat:(AudioStreamBasicDescription)format; |
|||
|
|||
#pragma mark - 播放控制 |
|||
- (void)play; |
|||
- (void)pause; |
|||
- (void)stop; |
|||
- (void)seekToTime:(NSTimeInterval)time; // 仅文件模式有效
|
|||
|
|||
#pragma mark - PCM 流式输入(仅 PCM 模式有效) |
|||
- (void)appendPCMData:(NSData *)pcmData; |
|||
- (void)endPCMStream; // 结束 PCM 流输入
|
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,66 +0,0 @@ |
|||
//
|
|||
// JLOpusDecoder.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
// Copyright © 2024 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <JLAudioUnitKit/JLOpusFormat.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
@class JLOpusDecoder; |
|||
|
|||
/// Opus 解码代理
|
|||
@protocol JLOpusDecoderDelegate <NSObject> |
|||
|
|||
/// Opus 数据解码
|
|||
/// - Parameters:
|
|||
/// - decoder: 解码器
|
|||
/// - data: pcm 数据
|
|||
/// - error: 错误信息
|
|||
-(void)opusDecoder:(JLOpusDecoder *)decoder Data:(NSData* _Nullable)data error:(NSError* _Nullable)error; |
|||
|
|||
@end |
|||
|
|||
typedef void(^JLOpusDecoderConvertBlock)(NSString *_Nullable pcmPath,NSError *_Nullable error); |
|||
|
|||
/// Opus 解码
|
|||
@interface JLOpusDecoder : NSObject |
|||
|
|||
/// 数据格式参数
|
|||
@property (nonatomic, strong) JLOpusFormat *opusFormat; |
|||
|
|||
/// 代理委托
|
|||
@property(nonatomic, weak) id<JLOpusDecoderDelegate> delegate; |
|||
|
|||
- (instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 初始化
|
|||
/// - Parameters:
|
|||
/// - format: 解码格式
|
|||
/// - delegate: 代理
|
|||
- (instancetype)initDecoder:(JLOpusFormat *)format delegate:(id<JLOpusDecoderDelegate>)delegate; |
|||
|
|||
/// 重置解码格式
|
|||
/// - Parameter format: 解码格式
|
|||
-(void)resetOpusFramet:(JLOpusFormat *)format; |
|||
|
|||
/// 输入 Opus 数据
|
|||
/// - Parameter data: Opus 数据
|
|||
-(void)opusDecoderInputData:(NSData *)data; |
|||
|
|||
/// 解码文件
|
|||
/// - Parameters:
|
|||
/// - input: opus 文件
|
|||
/// - outPut: 输出路径
|
|||
/// - result: 结果回调
|
|||
-(void)opusDecodeFile:(NSString *)input outPut:(NSString *_Nullable)outPut Resoult:(JLOpusDecoderConvertBlock _Nullable)result; |
|||
|
|||
/// 释放
|
|||
-(void)opusOnRelease; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,83 +0,0 @@ |
|||
//
|
|||
// JLOpusEncodeConfig.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/8/27.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
typedef NS_ENUM(NSInteger, JLOpusEncoderBandwidth) { |
|||
///(4kHz bandpass)
|
|||
JLOpusEncoderBandwidthNarrowband = 1101, // 对应 OPUS_BANDWIDTH_NARROWBAND
|
|||
/// (6kHz bandpass)
|
|||
JLOpusEncoderBandwidthMediumband = 1102, // 对应 OPUS_BANDWIDTH_MEDIUMBAND
|
|||
/// (8kHz bandpass)
|
|||
JLOpusEncoderBandwidthWideband = 1103, // 对应 OPUS_BANDWIDTH_WIDEBAND
|
|||
/// (12kHz bandpass)
|
|||
JLOpusEncoderBandwidthSuperwideband = 1104,// 对应 OPUS_BANDWIDTH_SUPERWIDEBAND
|
|||
/// (20kHz bandpass)
|
|||
JLOpusEncoderBandwidthFullband = 1105 // 对应 OPUS_BANDWIDTH_FULLBAND
|
|||
}; |
|||
|
|||
@interface JLOpusEncodeConfig : NSObject |
|||
|
|||
/// 采样率
|
|||
@property (nonatomic, assign) int sampleRate; |
|||
|
|||
/// 单/双声道
|
|||
@property (nonatomic, assign) int channels; |
|||
|
|||
/// 帧长度 20ms 默认值
|
|||
@property (nonatomic, assign) int frameDuration; |
|||
|
|||
/// 帧长度
|
|||
@property (nonatomic, assign) int frameSize; |
|||
|
|||
/// BitRate
|
|||
@property (nonatomic, assign) int bitRate; |
|||
|
|||
/// 可变比特率开关,默认 NO(使用 CBR)
|
|||
@property (nonatomic, assign) BOOL useVBR; |
|||
|
|||
/// VBR 限制模式,默认 NO
|
|||
@property (nonatomic, assign) BOOL constrainedVBR; |
|||
|
|||
/// 编码复杂度 0~10,默认 5
|
|||
@property (nonatomic, assign) int complexity; |
|||
|
|||
/// 强制输出声道数 -1: 自适应, 1: 单声道, 2: 双声道, 默认 -1
|
|||
@property (nonatomic, assign) int forceChannels; |
|||
|
|||
/// 是否启用 DTX(静音段不发送数据),默认 NO
|
|||
@property (nonatomic, assign) BOOL useDTX; |
|||
|
|||
/// 网络丢包百分比,默认 0
|
|||
@property (nonatomic, assign) int packetLossPercent; |
|||
|
|||
/// 最大带宽限制(OPUS_BANDWIDTH_*),默认 FULLBAND
|
|||
@property (nonatomic, assign) int bandwidth; |
|||
|
|||
/// PCM 输入有效位深,默认 16
|
|||
@property (nonatomic, assign) int lsbDepth; |
|||
|
|||
/// 专家模式下帧时长(ms),默认与 frameDuration 一致
|
|||
@property (nonatomic, assign) int expertFrameDuration; |
|||
|
|||
/// 是否启用数据头
|
|||
/// 默认是启用的
|
|||
@property (nonatomic, assign) BOOL hasDataHeader; |
|||
|
|||
/// 创建默认编码配置
|
|||
+ (instancetype)defaultConfig; |
|||
|
|||
/// 获取默认配置
|
|||
/// 杰理的无头配置
|
|||
+ (instancetype)defaultJL; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,69 +0,0 @@ |
|||
//
|
|||
// JLOpusEncoder.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
// Copyright © 2024 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <JLAudioUnitKit/JLOpusEncodeConfig.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
@class JLOpusEncoder; |
|||
|
|||
/// Opus 编码代理
|
|||
@protocol JLOpusEncoderDelegate <NSObject> |
|||
|
|||
/// PCM 数据编码
|
|||
/// - Parameters:
|
|||
/// - encoder: 解码器
|
|||
/// - data: opus 数据
|
|||
/// - error: 错误信息
|
|||
-(void)opusEncoder:(JLOpusEncoder *)encoder Data:(NSData* _Nullable)data error:(NSError* _Nullable)error; |
|||
|
|||
@end |
|||
|
|||
typedef void(^JLOpusEncoderConvertBlock)(NSString *_Nullable pcmPath,NSError *_Nullable error); |
|||
|
|||
/// Opus 编码
|
|||
@interface JLOpusEncoder : NSObject |
|||
|
|||
/// 音频格式
|
|||
@property (nonatomic, strong) JLOpusEncodeConfig *opusFormat; |
|||
|
|||
/// 代理
|
|||
@property (nonatomic, weak) id<JLOpusEncoderDelegate> delegate; |
|||
|
|||
-(instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 初始化
|
|||
/// - Parameters:
|
|||
/// - config: 音频格式
|
|||
/// - delegate: 代理
|
|||
-(instancetype)initFormat:(JLOpusEncodeConfig *)format delegate:(id<JLOpusEncoderDelegate>)delegate; |
|||
|
|||
/// PCM 数据
|
|||
/// - Parameter data: PCM 数据
|
|||
-(void)opusEncodeData:(NSData *)data; |
|||
|
|||
/// PCM 文件转换成 Opus 文件(推荐新接口,流式读取,避免一次性加载内存)
|
|||
/// - Parameters:
|
|||
/// - pcmPath: PCM 文件存放路径
|
|||
/// - output: 文件输出路径(可空,默认 ~/Documents/pcmToOpus.opus)
|
|||
/// - result: 结果回调,回传输出路径或错误
|
|||
-(void)opusEncodeFile:(NSString *)pcmPath output:(NSString *_Nullable)output result:(JLOpusEncoderConvertBlock _Nullable)result; |
|||
|
|||
/// 兼容旧接口(已废弃:命名拼写问题,且旧实现一次性读入文件)
|
|||
/// - Parameters:
|
|||
/// - pcmPath: PCM 文件存放路径
|
|||
/// - outPut: 文件输出路径
|
|||
/// - result: 结果回调
|
|||
-(void)opusEncodeFile:(NSString *)pcmPath outPut:(NSString *_Nullable)outPut Resoult:(JLOpusEncoderConvertBlock _Nullable)result __attribute__((deprecated("Use opusEncodeFile:output:result: instead."))); |
|||
|
|||
/// 释放
|
|||
-(void)opusOnRelease; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,59 +0,0 @@ |
|||
//
|
|||
// JLOpusOptions.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
// Copyright © 2024 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
#define OPUS_JL_MAX_FRAME_SIZE 48000 * 2 |
|||
#define OPUS_JL_MAX_PACKET_SIZE 1500 |
|||
|
|||
|
|||
@interface JLOpusFormat : NSObject |
|||
|
|||
/// 采样率
|
|||
@property (nonatomic, assign) int sampleRate; |
|||
|
|||
/// 单/双声道
|
|||
@property (nonatomic, assign) int channels; |
|||
|
|||
/// 帧长度 20ms 默认值
|
|||
@property (nonatomic, assign) int frameDuration; |
|||
|
|||
/// BitRate
|
|||
@property (nonatomic, assign) int bitRate; |
|||
|
|||
/// 数据帧大小
|
|||
@property (nonatomic, assign, readonly) int frameSize; |
|||
|
|||
/// 数据大小
|
|||
@property (nonatomic, assign) int dataSize; |
|||
|
|||
/// 是否包含数据头部
|
|||
@property (nonatomic, assign) BOOL hasDataHeader; |
|||
|
|||
/// 是否开启slik语音优化
|
|||
@property (nonatomic, assign) BOOL usVoipSlik; |
|||
|
|||
|
|||
-(instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 默认配置
|
|||
/// sampleRate: 16000
|
|||
/// channels: 1
|
|||
/// frameDuration: 20
|
|||
/// dataSize: 40
|
|||
/// frameSize: 320
|
|||
/// hasDataHeader: YES
|
|||
/// bitRate: 16000
|
|||
/// usVoipSlik: false
|
|||
+(JLOpusFormat*)defaultFormats; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,67 +0,0 @@ |
|||
//
|
|||
// JLOpusToOgg.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/5/16.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
typedef void(^JLOpusToOggConvertBlock)(NSData *_Nullable oggData, BOOL isLast, NSError *_Nullable error); |
|||
|
|||
/// 将Opus数据转换为Ogg数据
|
|||
@interface JLOpusToOgg : NSObject |
|||
|
|||
/// 转码内容的回调
|
|||
@property(nonatomic,strong)JLOpusToOggConvertBlock _Nullable convertBlock; |
|||
|
|||
/// 帧长
|
|||
/// - Parameter frameLen: 帧长
|
|||
/// 默认值 40
|
|||
- (instancetype)initWithFrameLength:(uint32_t)frameLen; |
|||
|
|||
/// 开始流
|
|||
-(void)startStream; |
|||
|
|||
/// 添加Opus数据
|
|||
/// - Parameter opusData: 符合杰理的无头裸 opus 数据
|
|||
- (void)appendOpusData:(NSData *)opusData; |
|||
|
|||
/// 关闭流
|
|||
- (void)closeStream; |
|||
|
|||
|
|||
/// 将Opus数据转换为Ogg数据
|
|||
/// opus 必须为 16000
|
|||
/// opus 必须是 单声道
|
|||
/// - Parameters:
|
|||
/// - opusData: 符合杰理的无头裸 opus 数据
|
|||
/// - frameLen: 帧长 公版默认帧长是 40
|
|||
/// - duration: 转换后的时长
|
|||
/// - error: 错误
|
|||
+ (NSData *_Nullable)convertOpusDataToOgg:(NSData *)opusData |
|||
frameLen:(uint32_t)frameLen |
|||
duration:(double *)duration |
|||
error:(NSError *__autoreleasing _Nullable *)error ; |
|||
|
|||
/// 将Opus文件转换为Ogg文件
|
|||
/// 符合杰理的无头裸 opus 文件
|
|||
/// opus 必须为 16000
|
|||
/// opus 必须是 单声道
|
|||
/// - Parameters:
|
|||
/// - opusFilePath: opus文件路径
|
|||
/// - oggFilePath: ogg文件路径
|
|||
/// - frameLen: 帧长 公版默认帧长是 40
|
|||
/// - duration: 转换后的时长
|
|||
+(void)convertOpusFileToOgg:(NSString *)opusFilePath |
|||
oggFilePath:(NSString *)oggFilePath |
|||
frameLen:(uint32_t)frameLen |
|||
duration:(double *)duration; |
|||
|
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,55 +0,0 @@ |
|||
//
|
|||
// JLPcmToWav.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/4/15.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/// PCM 转 WAV
|
|||
@interface JLPcmToWav : NSObject |
|||
|
|||
#pragma mark - 流式编码接口 |
|||
|
|||
/// 初始化流式编码器
|
|||
/// @param outputPath 输出文件路径
|
|||
/// @param sampleRate 采样率(如 16000)
|
|||
/// @param numChannels 声道数(1 或 2)
|
|||
/// @param bitsPerSample 位深(16)
|
|||
- (instancetype)initWithOutputPath:(NSString *)outputPath |
|||
sampleRate:(uint32_t)sampleRate |
|||
numChannels:(uint16_t)numChannels |
|||
bitsPerSample:(uint16_t)bitsPerSample; |
|||
|
|||
/// 追加 PCM 数据(需确保数据格式与初始化参数一致)
|
|||
/// @param pcmData PCM 数据块
|
|||
/// @param error 错误信息
|
|||
- (BOOL)appendPCMData:(NSData *)pcmData error:(NSError **)error; |
|||
|
|||
/// 完成编码并关闭文件(必须调用以更新 WAV 头)
|
|||
/// @param error 错误信息
|
|||
- (BOOL)finishWithError:(NSError **)error; |
|||
|
|||
#pragma mark - 一次性编码接口(便捷方法) |
|||
|
|||
/// 将 PCM 数据一次性转为 WAV 文件
|
|||
/// @param pcmData PCM 数据块
|
|||
/// @param outputPath 输出文件路径
|
|||
/// @param sampleRate 采样率(如 16000)
|
|||
/// @param numChannels 声道数(1 或 2)
|
|||
/// @param bitsPerSample 位深(16)
|
|||
/// @param error 错误信息
|
|||
+ (BOOL)convertPCMData:(NSData *)pcmData |
|||
toWAVFile:(NSString *)outputPath |
|||
sampleRate:(uint32_t)sampleRate |
|||
numChannels:(uint16_t)numChannels |
|||
bitsPerSample:(uint16_t)bitsPerSample |
|||
error:(NSError **)error; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,51 +0,0 @@ |
|||
//
|
|||
// JLPcmToWtg.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/1/21.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
@interface JLPcm2WtgModel : NSObject <NSCopying> |
|||
|
|||
/// 音频文件
|
|||
@property (nonatomic, copy) NSString *pcmPath; |
|||
|
|||
/// 输出文件
|
|||
@property (nonatomic, copy) NSString *wtgPath; |
|||
|
|||
@end |
|||
|
|||
|
|||
/// JLPcmToWtgProtocol
|
|||
@protocol JLPcmToWtgDelegate <NSObject> |
|||
|
|||
/// 音频转码完成
|
|||
/// - Parameter model: 音频转码模型
|
|||
- (void)convertPcmToWtgDone:(JLPcm2WtgModel *)model; |
|||
|
|||
@end |
|||
|
|||
/// 音频转码
|
|||
/// PCM 转 WTG
|
|||
@interface JLPcmToWtg : NSObject |
|||
|
|||
- (instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 音频转码初始化
|
|||
/// - Parameter delegate: 音频转码代理
|
|||
- (instancetype)initWithDelegate:(id<JLPcmToWtgDelegate>)delegate; |
|||
|
|||
/// 音频转码
|
|||
/// 当前接口模型只限制 PCM 文件格式为:8k 16bit
|
|||
/// 输入的pcm文件(16bit,小端,8k采样率),wtg_filename:输出的wtg文件
|
|||
/// - Parameter model: 音频转码模型
|
|||
-(void)convertPcmToWtg:(JLPcm2WtgModel *)model; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,54 +0,0 @@ |
|||
//
|
|||
// JLSpeexUnit.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
@class JLSpeexDecoder; |
|||
|
|||
@protocol JLSpeexDelegate <NSObject> |
|||
|
|||
/// Speex 数据解码
|
|||
/// - Parameters:
|
|||
/// - decoder: 解码器
|
|||
/// - data: PCM 数据
|
|||
/// - error: 错误信息
|
|||
- (void)speexDecoder:(JLSpeexDecoder *)decoder Data:(NSData* _Nullable)data error:(NSError* _Nullable)error; |
|||
|
|||
@end |
|||
|
|||
typedef void(^JLSpeexConvertBlock)(NSString *_Nullable pcmPath,NSError *_Nullable error); |
|||
|
|||
/// Speex 数据解码
|
|||
@interface JLSpeexDecoder : NSObject |
|||
|
|||
-(instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 初始化
|
|||
/// - Parameter delegate: 委托
|
|||
-(instancetype)initWithDelegate:(id<JLSpeexDelegate>)delegate; |
|||
|
|||
/// 委托
|
|||
@property (nonatomic, weak) id<JLSpeexDelegate> delegate; |
|||
|
|||
/// 输入 Speex 数据
|
|||
/// - Parameter data: Speex 数据
|
|||
-(void)speexInputData:(NSData*)data; |
|||
|
|||
/// 将 Speex 转换为 PCM
|
|||
/// - Parameters:
|
|||
/// - filePath: Speex 路径
|
|||
/// - opPath: 输出路径
|
|||
/// - result: 结果回调
|
|||
-(void)speexConvertToPcm:(NSString *)filePath outPutFilePath:(NSString * _Nullable)opPath Result:(JLSpeexConvertBlock)result; |
|||
|
|||
/// 释放对象
|
|||
-(void)speexOnRelease; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JLAudioUnitKit { |
|||
umbrella header "JLAudioUnitKit.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,52 +0,0 @@ |
|||
DESCRIPTION |
|||
----------- |
|||
This package includes the files needed to build the fixed point implementation |
|||
of the ITU-T G.729 Appendix IV. |
|||
|
|||
DIFFERENCES WITH G.729B |
|||
----------------------- |
|||
The ANSI-C source code simulating the bit-exact, fixed point simulation |
|||
software of enhanced VAD is integrated into the G.729B source code. |
|||
The modification to the G.729B source code updated files of coder.c, |
|||
cod_ld8k.c, bits.c, dec_sid.c, dtx.c, qsidgain.c, qsidlsf.c, tab_dtx.c, |
|||
tab_dtx.h, ld8k.h, deleted vad.c/h and integrated the enhanced VAD functions |
|||
into the G.729B project. The modification also replaced the original basic |
|||
operators used in the original G.729B source code by the basic operators of |
|||
ITU-T Software Tool Library STL2005. |
|||
|
|||
COMPILATION |
|||
----------- |
|||
For UNIX systems the following makefiles are provided |
|||
|
|||
coder.mak |
|||
decoder.mak |
|||
|
|||
Edit the makefiles coder.mak and decoder.mak to set the proper options |
|||
for your system. |
|||
The command to compile and link all code on a UNIX system is |
|||
|
|||
make -f coder.mak |
|||
make -f decoder.mak |
|||
|
|||
For other platforms, the *.mak files can be used to work out the |
|||
compilation procedures. |
|||
|
|||
USAGE |
|||
----- |
|||
The command line instruction for the encoder is as follows: |
|||
coder inputfile bitstreamfile dtx_option mode x |
|||
where: |
|||
inputfile : 8 kHz sampled data file containing 16 bit linear PCM signal |
|||
bitstreamfile: binary file containing bitstream |
|||
dtx_option : = 1 : DTX enabled 0 : DTX disabled |
|||
mode X : Run encoder with enhanced VAD in operating point X, |
|||
X=0 or 1 or 2 representing balanced or quality-preferred |
|||
or bandwidth saving operating point, respectively |
|||
|
|||
The command line for the decoder is as follows: |
|||
decoder bitstreamfile outputfile |
|||
where: |
|||
bitstreamfile: binary file containing bitstream |
|||
outputfile : 8 kHz sampled data file containing 16 bit linear PCM signal |
|||
|
|||
|
|||
@ -1,26 +0,0 @@ |
|||
//
|
|||
// JLAudioUnitKit.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
//! Project version number for JLAudioUnitKit.
|
|||
FOUNDATION_EXPORT double JLAudioUnitKitVersionNumber; |
|||
|
|||
//! Project version string for JLAudioUnitKit.
|
|||
FOUNDATION_EXPORT const unsigned char JLAudioUnitKitVersionString[]; |
|||
|
|||
// In this header, you should import all the public headers of your framework using statements like #import <JLAudioUnitKit/PublicHeader.h>
|
|||
|
|||
#import <JLAudioUnitKit/JLSpeexDecoder.h> |
|||
#import <JLAudioUnitKit/JLOpusDecoder.h> |
|||
#import <JLAudioUnitKit/JLOpusEncoder.h> |
|||
#import <JLAudioUnitKit/JLOpusFormat.h> |
|||
#import <JLAudioUnitKit/JLOpusEncodeConfig.h> |
|||
#import <JLAudioUnitKit/JLPcmToWtg.h> |
|||
#import <JLAudioUnitKit/JLPcmToWav.h> |
|||
#import <JLAudioUnitKit/JLAudioUnitPlayer.h> |
|||
#import <JLAudioUnitKit/JLOpusToOgg.h> |
|||
@ -1,58 +0,0 @@ |
|||
//
|
|||
// JLAudioUnitPlayer.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/4/16.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <AudioToolbox/AudioToolbox.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
typedef NS_ENUM(NSInteger, JLAudioUnitPlayerType) { |
|||
JLAudioUnitPlayerTypeFile, // 支持 MP3/WAV/AAC 等文件格式(AVAudioPlayer)
|
|||
JLAudioUnitPlayerTypePCM // 支持 PCM 流式播放(Audio Queue)
|
|||
}; |
|||
|
|||
@class JLAudioUnitPlayer; |
|||
|
|||
@protocol JLAudioPlayerDelegate <NSObject> |
|||
@optional |
|||
// 播放进度更新(秒)
|
|||
- (void)audioPlayer:(JLAudioUnitPlayer *)player didUpdateProgress:(NSTimeInterval)currentTime duration:(NSTimeInterval)duration; |
|||
// 播放完成
|
|||
- (void)audioPlayerDidFinishPlaying:(JLAudioUnitPlayer *)player; |
|||
// 播放错误
|
|||
- (void)audioPlayer:(JLAudioUnitPlayer *)player didFailWithError:(NSError *)error; |
|||
@end |
|||
|
|||
@interface JLAudioUnitPlayer : NSObject |
|||
|
|||
@property (nonatomic, weak) id<JLAudioPlayerDelegate> delegate; |
|||
@property (nonatomic, readonly) NSTimeInterval duration; // 总时长(文件模式下有效)
|
|||
@property (nonatomic, readonly) NSTimeInterval currentTime; |
|||
@property (nonatomic, readonly) BOOL isPlaying; |
|||
|
|||
#pragma mark - 初始化方法 |
|||
|
|||
/// 文件播放初始化(MP3/WAV/AAC)
|
|||
- (instancetype)initWithAudioFile:(NSString *)filePath; |
|||
|
|||
/// PCM 流播放初始化(需指定格式)
|
|||
- (instancetype)initWithPCMFormat:(AudioStreamBasicDescription)format; |
|||
|
|||
#pragma mark - 播放控制 |
|||
- (void)play; |
|||
- (void)pause; |
|||
- (void)stop; |
|||
- (void)seekToTime:(NSTimeInterval)time; // 仅文件模式有效
|
|||
|
|||
#pragma mark - PCM 流式输入(仅 PCM 模式有效) |
|||
- (void)appendPCMData:(NSData *)pcmData; |
|||
- (void)endPCMStream; // 结束 PCM 流输入
|
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,66 +0,0 @@ |
|||
//
|
|||
// JLOpusDecoder.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
// Copyright © 2024 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <JLAudioUnitKit/JLOpusFormat.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
@class JLOpusDecoder; |
|||
|
|||
/// Opus 解码代理
|
|||
@protocol JLOpusDecoderDelegate <NSObject> |
|||
|
|||
/// Opus 数据解码
|
|||
/// - Parameters:
|
|||
/// - decoder: 解码器
|
|||
/// - data: pcm 数据
|
|||
/// - error: 错误信息
|
|||
-(void)opusDecoder:(JLOpusDecoder *)decoder Data:(NSData* _Nullable)data error:(NSError* _Nullable)error; |
|||
|
|||
@end |
|||
|
|||
typedef void(^JLOpusDecoderConvertBlock)(NSString *_Nullable pcmPath,NSError *_Nullable error); |
|||
|
|||
/// Opus 解码
|
|||
@interface JLOpusDecoder : NSObject |
|||
|
|||
/// 数据格式参数
|
|||
@property (nonatomic, strong) JLOpusFormat *opusFormat; |
|||
|
|||
/// 代理委托
|
|||
@property(nonatomic, weak) id<JLOpusDecoderDelegate> delegate; |
|||
|
|||
- (instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 初始化
|
|||
/// - Parameters:
|
|||
/// - format: 解码格式
|
|||
/// - delegate: 代理
|
|||
- (instancetype)initDecoder:(JLOpusFormat *)format delegate:(id<JLOpusDecoderDelegate>)delegate; |
|||
|
|||
/// 重置解码格式
|
|||
/// - Parameter format: 解码格式
|
|||
-(void)resetOpusFramet:(JLOpusFormat *)format; |
|||
|
|||
/// 输入 Opus 数据
|
|||
/// - Parameter data: Opus 数据
|
|||
-(void)opusDecoderInputData:(NSData *)data; |
|||
|
|||
/// 解码文件
|
|||
/// - Parameters:
|
|||
/// - input: opus 文件
|
|||
/// - outPut: 输出路径
|
|||
/// - result: 结果回调
|
|||
-(void)opusDecodeFile:(NSString *)input outPut:(NSString *_Nullable)outPut Resoult:(JLOpusDecoderConvertBlock _Nullable)result; |
|||
|
|||
/// 释放
|
|||
-(void)opusOnRelease; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,83 +0,0 @@ |
|||
//
|
|||
// JLOpusEncodeConfig.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/8/27.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
typedef NS_ENUM(NSInteger, JLOpusEncoderBandwidth) { |
|||
///(4kHz bandpass)
|
|||
JLOpusEncoderBandwidthNarrowband = 1101, // 对应 OPUS_BANDWIDTH_NARROWBAND
|
|||
/// (6kHz bandpass)
|
|||
JLOpusEncoderBandwidthMediumband = 1102, // 对应 OPUS_BANDWIDTH_MEDIUMBAND
|
|||
/// (8kHz bandpass)
|
|||
JLOpusEncoderBandwidthWideband = 1103, // 对应 OPUS_BANDWIDTH_WIDEBAND
|
|||
/// (12kHz bandpass)
|
|||
JLOpusEncoderBandwidthSuperwideband = 1104,// 对应 OPUS_BANDWIDTH_SUPERWIDEBAND
|
|||
/// (20kHz bandpass)
|
|||
JLOpusEncoderBandwidthFullband = 1105 // 对应 OPUS_BANDWIDTH_FULLBAND
|
|||
}; |
|||
|
|||
@interface JLOpusEncodeConfig : NSObject |
|||
|
|||
/// 采样率
|
|||
@property (nonatomic, assign) int sampleRate; |
|||
|
|||
/// 单/双声道
|
|||
@property (nonatomic, assign) int channels; |
|||
|
|||
/// 帧长度 20ms 默认值
|
|||
@property (nonatomic, assign) int frameDuration; |
|||
|
|||
/// 帧长度
|
|||
@property (nonatomic, assign) int frameSize; |
|||
|
|||
/// BitRate
|
|||
@property (nonatomic, assign) int bitRate; |
|||
|
|||
/// 可变比特率开关,默认 NO(使用 CBR)
|
|||
@property (nonatomic, assign) BOOL useVBR; |
|||
|
|||
/// VBR 限制模式,默认 NO
|
|||
@property (nonatomic, assign) BOOL constrainedVBR; |
|||
|
|||
/// 编码复杂度 0~10,默认 5
|
|||
@property (nonatomic, assign) int complexity; |
|||
|
|||
/// 强制输出声道数 -1: 自适应, 1: 单声道, 2: 双声道, 默认 -1
|
|||
@property (nonatomic, assign) int forceChannels; |
|||
|
|||
/// 是否启用 DTX(静音段不发送数据),默认 NO
|
|||
@property (nonatomic, assign) BOOL useDTX; |
|||
|
|||
/// 网络丢包百分比,默认 0
|
|||
@property (nonatomic, assign) int packetLossPercent; |
|||
|
|||
/// 最大带宽限制(OPUS_BANDWIDTH_*),默认 FULLBAND
|
|||
@property (nonatomic, assign) int bandwidth; |
|||
|
|||
/// PCM 输入有效位深,默认 16
|
|||
@property (nonatomic, assign) int lsbDepth; |
|||
|
|||
/// 专家模式下帧时长(ms),默认与 frameDuration 一致
|
|||
@property (nonatomic, assign) int expertFrameDuration; |
|||
|
|||
/// 是否启用数据头
|
|||
/// 默认是启用的
|
|||
@property (nonatomic, assign) BOOL hasDataHeader; |
|||
|
|||
/// 创建默认编码配置
|
|||
+ (instancetype)defaultConfig; |
|||
|
|||
/// 获取默认配置
|
|||
/// 杰理的无头配置
|
|||
+ (instancetype)defaultJL; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,69 +0,0 @@ |
|||
//
|
|||
// JLOpusEncoder.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
// Copyright © 2024 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <JLAudioUnitKit/JLOpusEncodeConfig.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
@class JLOpusEncoder; |
|||
|
|||
/// Opus 编码代理
|
|||
@protocol JLOpusEncoderDelegate <NSObject> |
|||
|
|||
/// PCM 数据编码
|
|||
/// - Parameters:
|
|||
/// - encoder: 解码器
|
|||
/// - data: opus 数据
|
|||
/// - error: 错误信息
|
|||
-(void)opusEncoder:(JLOpusEncoder *)encoder Data:(NSData* _Nullable)data error:(NSError* _Nullable)error; |
|||
|
|||
@end |
|||
|
|||
typedef void(^JLOpusEncoderConvertBlock)(NSString *_Nullable pcmPath,NSError *_Nullable error); |
|||
|
|||
/// Opus 编码
|
|||
@interface JLOpusEncoder : NSObject |
|||
|
|||
/// 音频格式
|
|||
@property (nonatomic, strong) JLOpusEncodeConfig *opusFormat; |
|||
|
|||
/// 代理
|
|||
@property (nonatomic, weak) id<JLOpusEncoderDelegate> delegate; |
|||
|
|||
-(instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 初始化
|
|||
/// - Parameters:
|
|||
/// - config: 音频格式
|
|||
/// - delegate: 代理
|
|||
-(instancetype)initFormat:(JLOpusEncodeConfig *)format delegate:(id<JLOpusEncoderDelegate>)delegate; |
|||
|
|||
/// PCM 数据
|
|||
/// - Parameter data: PCM 数据
|
|||
-(void)opusEncodeData:(NSData *)data; |
|||
|
|||
/// PCM 文件转换成 Opus 文件(推荐新接口,流式读取,避免一次性加载内存)
|
|||
/// - Parameters:
|
|||
/// - pcmPath: PCM 文件存放路径
|
|||
/// - output: 文件输出路径(可空,默认 ~/Documents/pcmToOpus.opus)
|
|||
/// - result: 结果回调,回传输出路径或错误
|
|||
-(void)opusEncodeFile:(NSString *)pcmPath output:(NSString *_Nullable)output result:(JLOpusEncoderConvertBlock _Nullable)result; |
|||
|
|||
/// 兼容旧接口(已废弃:命名拼写问题,且旧实现一次性读入文件)
|
|||
/// - Parameters:
|
|||
/// - pcmPath: PCM 文件存放路径
|
|||
/// - outPut: 文件输出路径
|
|||
/// - result: 结果回调
|
|||
-(void)opusEncodeFile:(NSString *)pcmPath outPut:(NSString *_Nullable)outPut Resoult:(JLOpusEncoderConvertBlock _Nullable)result __attribute__((deprecated("Use opusEncodeFile:output:result: instead."))); |
|||
|
|||
/// 释放
|
|||
-(void)opusOnRelease; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,59 +0,0 @@ |
|||
//
|
|||
// JLOpusOptions.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
// Copyright © 2024 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
#define OPUS_JL_MAX_FRAME_SIZE 48000 * 2 |
|||
#define OPUS_JL_MAX_PACKET_SIZE 1500 |
|||
|
|||
|
|||
@interface JLOpusFormat : NSObject |
|||
|
|||
/// 采样率
|
|||
@property (nonatomic, assign) int sampleRate; |
|||
|
|||
/// 单/双声道
|
|||
@property (nonatomic, assign) int channels; |
|||
|
|||
/// 帧长度 20ms 默认值
|
|||
@property (nonatomic, assign) int frameDuration; |
|||
|
|||
/// BitRate
|
|||
@property (nonatomic, assign) int bitRate; |
|||
|
|||
/// 数据帧大小
|
|||
@property (nonatomic, assign, readonly) int frameSize; |
|||
|
|||
/// 数据大小
|
|||
@property (nonatomic, assign) int dataSize; |
|||
|
|||
/// 是否包含数据头部
|
|||
@property (nonatomic, assign) BOOL hasDataHeader; |
|||
|
|||
/// 是否开启slik语音优化
|
|||
@property (nonatomic, assign) BOOL usVoipSlik; |
|||
|
|||
|
|||
-(instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 默认配置
|
|||
/// sampleRate: 16000
|
|||
/// channels: 1
|
|||
/// frameDuration: 20
|
|||
/// dataSize: 40
|
|||
/// frameSize: 320
|
|||
/// hasDataHeader: YES
|
|||
/// bitRate: 16000
|
|||
/// usVoipSlik: false
|
|||
+(JLOpusFormat*)defaultFormats; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,67 +0,0 @@ |
|||
//
|
|||
// JLOpusToOgg.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/5/16.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
typedef void(^JLOpusToOggConvertBlock)(NSData *_Nullable oggData, BOOL isLast, NSError *_Nullable error); |
|||
|
|||
/// 将Opus数据转换为Ogg数据
|
|||
@interface JLOpusToOgg : NSObject |
|||
|
|||
/// 转码内容的回调
|
|||
@property(nonatomic,strong)JLOpusToOggConvertBlock _Nullable convertBlock; |
|||
|
|||
/// 帧长
|
|||
/// - Parameter frameLen: 帧长
|
|||
/// 默认值 40
|
|||
- (instancetype)initWithFrameLength:(uint32_t)frameLen; |
|||
|
|||
/// 开始流
|
|||
-(void)startStream; |
|||
|
|||
/// 添加Opus数据
|
|||
/// - Parameter opusData: 符合杰理的无头裸 opus 数据
|
|||
- (void)appendOpusData:(NSData *)opusData; |
|||
|
|||
/// 关闭流
|
|||
- (void)closeStream; |
|||
|
|||
|
|||
/// 将Opus数据转换为Ogg数据
|
|||
/// opus 必须为 16000
|
|||
/// opus 必须是 单声道
|
|||
/// - Parameters:
|
|||
/// - opusData: 符合杰理的无头裸 opus 数据
|
|||
/// - frameLen: 帧长 公版默认帧长是 40
|
|||
/// - duration: 转换后的时长
|
|||
/// - error: 错误
|
|||
+ (NSData *_Nullable)convertOpusDataToOgg:(NSData *)opusData |
|||
frameLen:(uint32_t)frameLen |
|||
duration:(double *)duration |
|||
error:(NSError *__autoreleasing _Nullable *)error ; |
|||
|
|||
/// 将Opus文件转换为Ogg文件
|
|||
/// 符合杰理的无头裸 opus 文件
|
|||
/// opus 必须为 16000
|
|||
/// opus 必须是 单声道
|
|||
/// - Parameters:
|
|||
/// - opusFilePath: opus文件路径
|
|||
/// - oggFilePath: ogg文件路径
|
|||
/// - frameLen: 帧长 公版默认帧长是 40
|
|||
/// - duration: 转换后的时长
|
|||
+(void)convertOpusFileToOgg:(NSString *)opusFilePath |
|||
oggFilePath:(NSString *)oggFilePath |
|||
frameLen:(uint32_t)frameLen |
|||
duration:(double *)duration; |
|||
|
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,55 +0,0 @@ |
|||
//
|
|||
// JLPcmToWav.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/4/15.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/// PCM 转 WAV
|
|||
@interface JLPcmToWav : NSObject |
|||
|
|||
#pragma mark - 流式编码接口 |
|||
|
|||
/// 初始化流式编码器
|
|||
/// @param outputPath 输出文件路径
|
|||
/// @param sampleRate 采样率(如 16000)
|
|||
/// @param numChannels 声道数(1 或 2)
|
|||
/// @param bitsPerSample 位深(16)
|
|||
- (instancetype)initWithOutputPath:(NSString *)outputPath |
|||
sampleRate:(uint32_t)sampleRate |
|||
numChannels:(uint16_t)numChannels |
|||
bitsPerSample:(uint16_t)bitsPerSample; |
|||
|
|||
/// 追加 PCM 数据(需确保数据格式与初始化参数一致)
|
|||
/// @param pcmData PCM 数据块
|
|||
/// @param error 错误信息
|
|||
- (BOOL)appendPCMData:(NSData *)pcmData error:(NSError **)error; |
|||
|
|||
/// 完成编码并关闭文件(必须调用以更新 WAV 头)
|
|||
/// @param error 错误信息
|
|||
- (BOOL)finishWithError:(NSError **)error; |
|||
|
|||
#pragma mark - 一次性编码接口(便捷方法) |
|||
|
|||
/// 将 PCM 数据一次性转为 WAV 文件
|
|||
/// @param pcmData PCM 数据块
|
|||
/// @param outputPath 输出文件路径
|
|||
/// @param sampleRate 采样率(如 16000)
|
|||
/// @param numChannels 声道数(1 或 2)
|
|||
/// @param bitsPerSample 位深(16)
|
|||
/// @param error 错误信息
|
|||
+ (BOOL)convertPCMData:(NSData *)pcmData |
|||
toWAVFile:(NSString *)outputPath |
|||
sampleRate:(uint32_t)sampleRate |
|||
numChannels:(uint16_t)numChannels |
|||
bitsPerSample:(uint16_t)bitsPerSample |
|||
error:(NSError **)error; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,51 +0,0 @@ |
|||
//
|
|||
// JLPcmToWtg.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2025/1/21.
|
|||
// Copyright © 2025 ZhuHai JieLi Technology Co.,Ltd. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
@interface JLPcm2WtgModel : NSObject <NSCopying> |
|||
|
|||
/// 音频文件
|
|||
@property (nonatomic, copy) NSString *pcmPath; |
|||
|
|||
/// 输出文件
|
|||
@property (nonatomic, copy) NSString *wtgPath; |
|||
|
|||
@end |
|||
|
|||
|
|||
/// JLPcmToWtgProtocol
|
|||
@protocol JLPcmToWtgDelegate <NSObject> |
|||
|
|||
/// 音频转码完成
|
|||
/// - Parameter model: 音频转码模型
|
|||
- (void)convertPcmToWtgDone:(JLPcm2WtgModel *)model; |
|||
|
|||
@end |
|||
|
|||
/// 音频转码
|
|||
/// PCM 转 WTG
|
|||
@interface JLPcmToWtg : NSObject |
|||
|
|||
- (instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 音频转码初始化
|
|||
/// - Parameter delegate: 音频转码代理
|
|||
- (instancetype)initWithDelegate:(id<JLPcmToWtgDelegate>)delegate; |
|||
|
|||
/// 音频转码
|
|||
/// 当前接口模型只限制 PCM 文件格式为:8k 16bit
|
|||
/// 输入的pcm文件(16bit,小端,8k采样率),wtg_filename:输出的wtg文件
|
|||
/// - Parameter model: 音频转码模型
|
|||
-(void)convertPcmToWtg:(JLPcm2WtgModel *)model; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,54 +0,0 @@ |
|||
//
|
|||
// JLSpeexUnit.h
|
|||
// JLAudioUnitKit
|
|||
//
|
|||
// Created by EzioChan on 2024/11/14.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
@class JLSpeexDecoder; |
|||
|
|||
@protocol JLSpeexDelegate <NSObject> |
|||
|
|||
/// Speex 数据解码
|
|||
/// - Parameters:
|
|||
/// - decoder: 解码器
|
|||
/// - data: PCM 数据
|
|||
/// - error: 错误信息
|
|||
- (void)speexDecoder:(JLSpeexDecoder *)decoder Data:(NSData* _Nullable)data error:(NSError* _Nullable)error; |
|||
|
|||
@end |
|||
|
|||
typedef void(^JLSpeexConvertBlock)(NSString *_Nullable pcmPath,NSError *_Nullable error); |
|||
|
|||
/// Speex 数据解码
|
|||
@interface JLSpeexDecoder : NSObject |
|||
|
|||
-(instancetype)init NS_UNAVAILABLE; |
|||
|
|||
/// 初始化
|
|||
/// - Parameter delegate: 委托
|
|||
-(instancetype)initWithDelegate:(id<JLSpeexDelegate>)delegate; |
|||
|
|||
/// 委托
|
|||
@property (nonatomic, weak) id<JLSpeexDelegate> delegate; |
|||
|
|||
/// 输入 Speex 数据
|
|||
/// - Parameter data: Speex 数据
|
|||
-(void)speexInputData:(NSData*)data; |
|||
|
|||
/// 将 Speex 转换为 PCM
|
|||
/// - Parameters:
|
|||
/// - filePath: Speex 路径
|
|||
/// - opPath: 输出路径
|
|||
/// - result: 结果回调
|
|||
-(void)speexConvertToPcm:(NSString *)filePath outPutFilePath:(NSString * _Nullable)opPath Result:(JLSpeexConvertBlock)result; |
|||
|
|||
/// 释放对象
|
|||
-(void)speexOnRelease; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JLAudioUnitKit { |
|||
umbrella header "JLAudioUnitKit.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,234 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>files</key> |
|||
<dict> |
|||
<key>Headers/JLAudioUnitKit.h</key> |
|||
<data> |
|||
hE2nr+4q2/NdSgBaayJc7ZoOXb0= |
|||
</data> |
|||
<key>Headers/JLAudioUnitPlayer.h</key> |
|||
<data> |
|||
QPMLV/XA8hjk39d+vT+S57t0fDU= |
|||
</data> |
|||
<key>Headers/JLOpusDecoder.h</key> |
|||
<data> |
|||
K1bYcaJ67prImNlGuldy8csTRHc= |
|||
</data> |
|||
<key>Headers/JLOpusEncodeConfig.h</key> |
|||
<data> |
|||
NArAew5QxnSJGsD0tRzQ2V7bHrY= |
|||
</data> |
|||
<key>Headers/JLOpusEncoder.h</key> |
|||
<data> |
|||
7DYUlvXrp1QC9l2XZ5tNHtsmsBQ= |
|||
</data> |
|||
<key>Headers/JLOpusFormat.h</key> |
|||
<data> |
|||
Du1x3VNk87NstmspRk7ElijuZrk= |
|||
</data> |
|||
<key>Headers/JLOpusToOgg.h</key> |
|||
<data> |
|||
fSJT6LcyylJHTHX1wsN3JHG2FxU= |
|||
</data> |
|||
<key>Headers/JLPcmToWav.h</key> |
|||
<data> |
|||
/BbZmqmWpWVBusXqjnzbjaBNCNg= |
|||
</data> |
|||
<key>Headers/JLPcmToWtg.h</key> |
|||
<data> |
|||
zoOdOFpIulND0F1OrfIXR1H0kh0= |
|||
</data> |
|||
<key>Headers/JLSpeexDecoder.h</key> |
|||
<data> |
|||
5ecBKtD3BDGccLiKpTs0fS0CSgs= |
|||
</data> |
|||
<key>Info.plist</key> |
|||
<data> |
|||
pXqOzYCqPnMLY0nonWZTcbfnlhU= |
|||
</data> |
|||
<key>Modules/module.modulemap</key> |
|||
<data> |
|||
2vYf0m+hGTOTapX6sliv/F1E1VI= |
|||
</data> |
|||
<key>readme.txt</key> |
|||
<data> |
|||
wijZX0Dr2OlODWS6XYbpeKabb7g= |
|||
</data> |
|||
</dict> |
|||
<key>files2</key> |
|||
<dict> |
|||
<key>Headers/JLAudioUnitKit.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
J5pq6Ed3fR+cQ7CGPXDoPl7BZzix7Cjf5yJZFRRvxqs= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLAudioUnitPlayer.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
qBz0OA82HUH4kBtO8xiUw7Q4ohtiIvCSYfCqax5xjJY= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLOpusDecoder.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
cnAj6Nt6vgRLoEH6QY3Q+gYpjcxGPN1OLLZbCgdLymI= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLOpusEncodeConfig.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
qrPpsrXaNCvyxf0/gUZtvveL+ywsfgBUrMPFibjneOo= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLOpusEncoder.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
YoHsvoGH2VEjvEIzEa7t+cAnzf8kHEU3dJTd03ABr1w= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLOpusFormat.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
Nm6vM9/EbFzyIWbsysu6EOO2S+vZVeplcop4NvoJaMA= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLOpusToOgg.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
dNSvJJnED/6E1p7TYZ4zBzUnLDVsZ8NovuNYjge6T/w= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLPcmToWav.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
l/SEQhSFh7ctq/pBV+Z7X+Z0/gz30eCw3s31otjMPho= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLPcmToWtg.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
MwtbX3Sa0nytA+m11x+1rDvP4WvJnZLljshuT5B3WD0= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLSpeexDecoder.h</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
pV0X3xn07Ps7wE+0EfL9Yu/08tp8Ug8s14iDigRU46o= |
|||
</data> |
|||
</dict> |
|||
<key>Modules/module.modulemap</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
akFCUM59aSAaRM/ADWQ138YT9GD3oAjcaTvTUo24Ml8= |
|||
</data> |
|||
</dict> |
|||
<key>readme.txt</key> |
|||
<dict> |
|||
<key>hash2</key> |
|||
<data> |
|||
+2GG9ORrf2yJnBe2joKWtyBZL9p2sCH8EXqK1GIgW0E= |
|||
</data> |
|||
</dict> |
|||
</dict> |
|||
<key>rules</key> |
|||
<dict> |
|||
<key>^.*</key> |
|||
<true/> |
|||
<key>^.*\.lproj/</key> |
|||
<dict> |
|||
<key>optional</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1000</real> |
|||
</dict> |
|||
<key>^.*\.lproj/locversion.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1100</real> |
|||
</dict> |
|||
<key>^Base\.lproj/</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>1010</real> |
|||
</dict> |
|||
<key>^version.plist$</key> |
|||
<true/> |
|||
</dict> |
|||
<key>rules2</key> |
|||
<dict> |
|||
<key>.*\.dSYM($|/)</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>11</real> |
|||
</dict> |
|||
<key>^(.*/)?\.DS_Store$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>2000</real> |
|||
</dict> |
|||
<key>^.*</key> |
|||
<true/> |
|||
<key>^.*\.lproj/</key> |
|||
<dict> |
|||
<key>optional</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1000</real> |
|||
</dict> |
|||
<key>^.*\.lproj/locversion.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1100</real> |
|||
</dict> |
|||
<key>^Base\.lproj/</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>1010</real> |
|||
</dict> |
|||
<key>^Info\.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^PkgInfo$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^embedded\.provisionprofile$</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^version\.plist$</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
</dict> |
|||
</dict> |
|||
</plist> |
|||
@ -1,52 +0,0 @@ |
|||
DESCRIPTION |
|||
----------- |
|||
This package includes the files needed to build the fixed point implementation |
|||
of the ITU-T G.729 Appendix IV. |
|||
|
|||
DIFFERENCES WITH G.729B |
|||
----------------------- |
|||
The ANSI-C source code simulating the bit-exact, fixed point simulation |
|||
software of enhanced VAD is integrated into the G.729B source code. |
|||
The modification to the G.729B source code updated files of coder.c, |
|||
cod_ld8k.c, bits.c, dec_sid.c, dtx.c, qsidgain.c, qsidlsf.c, tab_dtx.c, |
|||
tab_dtx.h, ld8k.h, deleted vad.c/h and integrated the enhanced VAD functions |
|||
into the G.729B project. The modification also replaced the original basic |
|||
operators used in the original G.729B source code by the basic operators of |
|||
ITU-T Software Tool Library STL2005. |
|||
|
|||
COMPILATION |
|||
----------- |
|||
For UNIX systems the following makefiles are provided |
|||
|
|||
coder.mak |
|||
decoder.mak |
|||
|
|||
Edit the makefiles coder.mak and decoder.mak to set the proper options |
|||
for your system. |
|||
The command to compile and link all code on a UNIX system is |
|||
|
|||
make -f coder.mak |
|||
make -f decoder.mak |
|||
|
|||
For other platforms, the *.mak files can be used to work out the |
|||
compilation procedures. |
|||
|
|||
USAGE |
|||
----- |
|||
The command line instruction for the encoder is as follows: |
|||
coder inputfile bitstreamfile dtx_option mode x |
|||
where: |
|||
inputfile : 8 kHz sampled data file containing 16 bit linear PCM signal |
|||
bitstreamfile: binary file containing bitstream |
|||
dtx_option : = 1 : DTX enabled 0 : DTX disabled |
|||
mode X : Run encoder with enhanced VAD in operating point X, |
|||
X=0 or 1 or 2 representing balanced or quality-preferred |
|||
or bandwidth saving operating point, respectively |
|||
|
|||
The command line for the decoder is as follows: |
|||
decoder bitstreamfile outputfile |
|||
where: |
|||
bitstreamfile: binary file containing bitstream |
|||
outputfile : 8 kHz sampled data file containing 16 bit linear PCM signal |
|||
|
|||
|
|||
@ -1,44 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>AvailableLibraries</key> |
|||
<array> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JLLogHelper.framework/JLLogHelper</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64_x86_64-simulator</string> |
|||
<key>LibraryPath</key> |
|||
<string>JLLogHelper.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
<string>x86_64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
<key>SupportedPlatformVariant</key> |
|||
<string>simulator</string> |
|||
</dict> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JLLogHelper.framework/JLLogHelper</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64</string> |
|||
<key>LibraryPath</key> |
|||
<string>JLLogHelper.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
</dict> |
|||
</array> |
|||
<key>CFBundlePackageType</key> |
|||
<string>XFWK</string> |
|||
<key>XCFrameworkFormatVersion</key> |
|||
<string>1.0</string> |
|||
</dict> |
|||
</plist> |
|||
@ -1,19 +0,0 @@ |
|||
//
|
|||
// 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> |
|||
@ -1,88 +0,0 @@ |
|||
//
|
|||
// 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 path 路径
|
|||
+(void)redirectLogPath:(NSString *)path; |
|||
|
|||
/// 收集日志回调接口
|
|||
/// @param block 回调
|
|||
+(void)collectLog:(void(^)(NSString *log))block; |
|||
|
|||
/// 打印时间
|
|||
/// @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 object 任意对象
|
|||
+(void)logObject:(id)object; |
|||
|
|||
|
|||
|
|||
/// 打印
|
|||
/// @param level LOG等级
|
|||
/// @param content 内容
|
|||
+(void)logLevel:(JLLOG_LEVEL)level content:(NSString *)content; |
|||
|
|||
/// 保存日志信息到文件中
|
|||
/// @param logContent 日志内容
|
|||
+(void)saveLog:(NSString *)logContent; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JLLogHelper { |
|||
umbrella header "JLLogHelper.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
//
|
|||
// 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> |
|||
@ -1,88 +0,0 @@ |
|||
//
|
|||
// 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 path 路径
|
|||
+(void)redirectLogPath:(NSString *)path; |
|||
|
|||
/// 收集日志回调接口
|
|||
/// @param block 回调
|
|||
+(void)collectLog:(void(^)(NSString *log))block; |
|||
|
|||
/// 打印时间
|
|||
/// @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 object 任意对象
|
|||
+(void)logObject:(id)object; |
|||
|
|||
|
|||
|
|||
/// 打印
|
|||
/// @param level LOG等级
|
|||
/// @param content 内容
|
|||
+(void)logLevel:(JLLOG_LEVEL)level content:(NSString *)content; |
|||
|
|||
/// 保存日志信息到文件中
|
|||
/// @param logContent 日志内容
|
|||
+(void)saveLog:(NSString *)logContent; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JLLogHelper { |
|||
umbrella header "JLLogHelper.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,147 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>files</key> |
|||
<dict> |
|||
<key>Headers/JLLogHelper.h</key> |
|||
<data> |
|||
TahP/o16a5TgPGLNFs/QhND95FU= |
|||
</data> |
|||
<key>Headers/JLLogManager.h</key> |
|||
<data> |
|||
Be4QtnAF0IDSmlMZquwyK7LLd8w= |
|||
</data> |
|||
<key>Info.plist</key> |
|||
<data> |
|||
PJl+BYy7qbdneBUnydYicJKb/SM= |
|||
</data> |
|||
<key>Modules/module.modulemap</key> |
|||
<data> |
|||
YwPsApnJXdp+uskVahraY2UK/Jk= |
|||
</data> |
|||
</dict> |
|||
<key>files2</key> |
|||
<dict> |
|||
<key>Headers/JLLogHelper.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
TahP/o16a5TgPGLNFs/QhND95FU= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
nD5WuwBhpaoCwOGeWB5OusXVP21nYy+/Hcn6nPideIk= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLLogManager.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
Be4QtnAF0IDSmlMZquwyK7LLd8w= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
vOgQgQVptNwQdUKpCW2EBNruc0PL6BnkSjxVpptJsf0= |
|||
</data> |
|||
</dict> |
|||
<key>Modules/module.modulemap</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
YwPsApnJXdp+uskVahraY2UK/Jk= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
ViwpXSuoKoiEUwMpetyre+mlEz0+JE8UURyNSgBuylM= |
|||
</data> |
|||
</dict> |
|||
</dict> |
|||
<key>rules</key> |
|||
<dict> |
|||
<key>^.*</key> |
|||
<true/> |
|||
<key>^.*\.lproj/</key> |
|||
<dict> |
|||
<key>optional</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1000</real> |
|||
</dict> |
|||
<key>^.*\.lproj/locversion.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1100</real> |
|||
</dict> |
|||
<key>^Base\.lproj/</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>1010</real> |
|||
</dict> |
|||
<key>^version.plist$</key> |
|||
<true/> |
|||
</dict> |
|||
<key>rules2</key> |
|||
<dict> |
|||
<key>.*\.dSYM($|/)</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>11</real> |
|||
</dict> |
|||
<key>^(.*/)?\.DS_Store$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>2000</real> |
|||
</dict> |
|||
<key>^.*</key> |
|||
<true/> |
|||
<key>^.*\.lproj/</key> |
|||
<dict> |
|||
<key>optional</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1000</real> |
|||
</dict> |
|||
<key>^.*\.lproj/locversion.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1100</real> |
|||
</dict> |
|||
<key>^Base\.lproj/</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>1010</real> |
|||
</dict> |
|||
<key>^Info\.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^PkgInfo$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^embedded\.provisionprofile$</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^version\.plist$</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
</dict> |
|||
</dict> |
|||
</plist> |
|||
@ -1,44 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>AvailableLibraries</key> |
|||
<array> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JL_AdvParse.framework/JL_AdvParse</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64</string> |
|||
<key>LibraryPath</key> |
|||
<string>JL_AdvParse.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
</dict> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JL_AdvParse.framework/JL_AdvParse</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64_x86_64-simulator</string> |
|||
<key>LibraryPath</key> |
|||
<string>JL_AdvParse.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
<string>x86_64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
<key>SupportedPlatformVariant</key> |
|||
<string>simulator</string> |
|||
</dict> |
|||
</array> |
|||
<key>CFBundlePackageType</key> |
|||
<string>XFWK</string> |
|||
<key>XCFrameworkFormatVersion</key> |
|||
<string>1.0</string> |
|||
</dict> |
|||
</plist> |
|||
@ -1,72 +0,0 @@ |
|||
//
|
|||
// 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_DeviceTypeDongle = 6, //Dongle
|
|||
JL_DeviceTypeTradition = -1, //传统设备类型
|
|||
}; |
|||
|
|||
|
|||
/// 广播包解析器
|
|||
@interface JLAdvParse : NSObject |
|||
|
|||
/// 打印当前SDK的版本
|
|||
+(void)sdkVersion; |
|||
|
|||
/// 解析设备广播包内容
|
|||
/// @param key 过滤码(只针对传统设备生效,默认填空即可)
|
|||
/// @param advertData 蓝牙广播字典
|
|||
+(NSDictionary*)bluetoothAdvParse:(NSData *_Nullable)key AdvData:(NSDictionary*_Nonnull)advertData; |
|||
|
|||
/// 解析蓝牙广播包
|
|||
/// @param advertData 蓝牙广播报字典
|
|||
/// @param rssi 蓝牙信号强度
|
|||
+(NSDictionary *)bluetoothAdvData:(NSDictionary *)advertData RSSI:(NSNumber *)rssi; |
|||
|
|||
#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 |
|||
@ -1,64 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,54 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,47 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,25 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,19 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,19 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,89 +0,0 @@ |
|||
//
|
|||
// 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 通迅
|
|||
/// 0x02 GATT Over BR/EDR (V5/V6)
|
|||
@property(nonatomic, assign) uint8_t connectWay; |
|||
|
|||
/// 是否支持智能充电仓
|
|||
@property(nonatomic, assign) BOOL isSupportChargBox; |
|||
|
|||
//MARK: - Version 3
|
|||
/// 左耳电量为挂脖耳机电量!!!,其他耳机电量使用
|
|||
|
|||
//MARK: - Version 4/5/6 扩展
|
|||
/// LeAudio连接状态值
|
|||
@property(nonatomic, assign) uint8_t leAudioStatus; |
|||
/// 是否支持LeAudio
|
|||
@property(nonatomic, assign) BOOL supportLeAudio; |
|||
/// LeAudio是否已连接
|
|||
@property(nonatomic, assign) BOOL leAudioConnectedStatus; |
|||
/// RCSP是否使用LeAudio地址
|
|||
@property(nonatomic, assign) BOOL rcspUseLeAudioAddress; |
|||
/// 是否需要认证
|
|||
@property(nonatomic, assign) BOOL needAuth; |
|||
/// 协议版本号
|
|||
@property(nonatomic, assign) uint8_t protocolVersion; |
|||
|
|||
/// 设备数量 (V6)
|
|||
@property(nonatomic, assign) uint8_t deviceQuantity; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,35 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,27 +0,0 @@ |
|||
//
|
|||
// 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> |
|||
|
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JL_AdvParse { |
|||
umbrella header "JL_AdvParse.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,72 +0,0 @@ |
|||
//
|
|||
// 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_DeviceTypeDongle = 6, //Dongle
|
|||
JL_DeviceTypeTradition = -1, //传统设备类型
|
|||
}; |
|||
|
|||
|
|||
/// 广播包解析器
|
|||
@interface JLAdvParse : NSObject |
|||
|
|||
/// 打印当前SDK的版本
|
|||
+(void)sdkVersion; |
|||
|
|||
/// 解析设备广播包内容
|
|||
/// @param key 过滤码(只针对传统设备生效,默认填空即可)
|
|||
/// @param advertData 蓝牙广播字典
|
|||
+(NSDictionary*)bluetoothAdvParse:(NSData *_Nullable)key AdvData:(NSDictionary*_Nonnull)advertData; |
|||
|
|||
/// 解析蓝牙广播包
|
|||
/// @param advertData 蓝牙广播报字典
|
|||
/// @param rssi 蓝牙信号强度
|
|||
+(NSDictionary *)bluetoothAdvData:(NSDictionary *)advertData RSSI:(NSNumber *)rssi; |
|||
|
|||
#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 |
|||
@ -1,64 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,54 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,47 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,25 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,19 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,19 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,89 +0,0 @@ |
|||
//
|
|||
// 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 通迅
|
|||
/// 0x02 GATT Over BR/EDR (V5/V6)
|
|||
@property(nonatomic, assign) uint8_t connectWay; |
|||
|
|||
/// 是否支持智能充电仓
|
|||
@property(nonatomic, assign) BOOL isSupportChargBox; |
|||
|
|||
//MARK: - Version 3
|
|||
/// 左耳电量为挂脖耳机电量!!!,其他耳机电量使用
|
|||
|
|||
//MARK: - Version 4/5/6 扩展
|
|||
/// LeAudio连接状态值
|
|||
@property(nonatomic, assign) uint8_t leAudioStatus; |
|||
/// 是否支持LeAudio
|
|||
@property(nonatomic, assign) BOOL supportLeAudio; |
|||
/// LeAudio是否已连接
|
|||
@property(nonatomic, assign) BOOL leAudioConnectedStatus; |
|||
/// RCSP是否使用LeAudio地址
|
|||
@property(nonatomic, assign) BOOL rcspUseLeAudioAddress; |
|||
/// 是否需要认证
|
|||
@property(nonatomic, assign) BOOL needAuth; |
|||
/// 协议版本号
|
|||
@property(nonatomic, assign) uint8_t protocolVersion; |
|||
|
|||
/// 设备数量 (V6)
|
|||
@property(nonatomic, assign) uint8_t deviceQuantity; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,35 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,27 +0,0 @@ |
|||
//
|
|||
// 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> |
|||
|
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JL_AdvParse { |
|||
umbrella header "JL_AdvParse.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,267 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>files</key> |
|||
<dict> |
|||
<key>Headers/JLAdvParse.h</key> |
|||
<data> |
|||
64SI1XBWnV1VmXIYu8XpmwMpE04= |
|||
</data> |
|||
<key>Headers/JLChargingBoxAdv.h</key> |
|||
<data> |
|||
dxEumtBFtKzehtXyVAacIJk/UU4= |
|||
</data> |
|||
<key>Headers/JLDevicesAdv.h</key> |
|||
<data> |
|||
WG6Ivw9lqj20J5OXda4lXMvAsig= |
|||
</data> |
|||
<key>Headers/JLEarphoneAdv.h</key> |
|||
<data> |
|||
fJODfMyuNuG59rHtw1StpNjde1A= |
|||
</data> |
|||
<key>Headers/JLOtaAdv.h</key> |
|||
<data> |
|||
4Mj6y77mEbeHdo+4OgFL9yf+E0c= |
|||
</data> |
|||
<key>Headers/JLSoundBoxAdv.h</key> |
|||
<data> |
|||
9psoYa5IuZ6p/X9FRRnLe5THJMQ= |
|||
</data> |
|||
<key>Headers/JLSoundCardAdv.h</key> |
|||
<data> |
|||
Q5T5xqjNDkTS+Niqp/KpoD9vipY= |
|||
</data> |
|||
<key>Headers/JLTwsAdv.h</key> |
|||
<data> |
|||
whLObetTxteRXS580FiZ1/A3Yzo= |
|||
</data> |
|||
<key>Headers/JLWatchAdv.h</key> |
|||
<data> |
|||
gK+FyDcSe6OVJK11wqqm1ppRE9k= |
|||
</data> |
|||
<key>Headers/JL_AdvParse.h</key> |
|||
<data> |
|||
gtcFkie1/FuAHO4WI/GUyN9chKY= |
|||
</data> |
|||
<key>Info.plist</key> |
|||
<data> |
|||
y32GLYYZ4FDhJGOjUkYUZfxaRn8= |
|||
</data> |
|||
<key>Modules/module.modulemap</key> |
|||
<data> |
|||
hBvb1e7FRkpwYoECUsVQBBscN38= |
|||
</data> |
|||
</dict> |
|||
<key>files2</key> |
|||
<dict> |
|||
<key>Headers/JLAdvParse.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
64SI1XBWnV1VmXIYu8XpmwMpE04= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
ZG6RQ7l2Ko9IXNo517Aimfq7d03KANKIIPV09hZSFrg= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLChargingBoxAdv.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
dxEumtBFtKzehtXyVAacIJk/UU4= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
Bci4NCRbpGrT/YgMlRkA2DjX/lY/o8VmxkWPNtV+DjA= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLDevicesAdv.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
WG6Ivw9lqj20J5OXda4lXMvAsig= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
Mxf6qWhX6ctmSC0RVl7gdK4koCGeaUr8omEI9+9PMvc= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLEarphoneAdv.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
fJODfMyuNuG59rHtw1StpNjde1A= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
WThhDcnj1tcLW3Lrp2VUET7rXC/8iv9Y1dtAdPg0yWs= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLOtaAdv.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
4Mj6y77mEbeHdo+4OgFL9yf+E0c= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
HuR8+O4ONYywZcporXuxlzO1xXOtZZqm/P9+s8yj+OI= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLSoundBoxAdv.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
9psoYa5IuZ6p/X9FRRnLe5THJMQ= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
Iqjsp9NyRvmdlXu0gN7zltuwg75M+Kc9qFaTSHStolA= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLSoundCardAdv.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
Q5T5xqjNDkTS+Niqp/KpoD9vipY= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
WTBLq2+eyH5+TrY08Gh3/yReEWRnKg9UOCJmz56bnkE= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLTwsAdv.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
whLObetTxteRXS580FiZ1/A3Yzo= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
w6Ia/stHXZvCfmmPgTEpBj7A6haG6O+E0MeXH/fNKmA= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLWatchAdv.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
gK+FyDcSe6OVJK11wqqm1ppRE9k= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
7iXBmticKJ52uKE+6RrHJt5ES0gq2Xan5WIG/w0sCyk= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JL_AdvParse.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
gtcFkie1/FuAHO4WI/GUyN9chKY= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
t61emyM8slC+fTJM6XnBxjTDrpY7xvhUK5gCXfQf/3E= |
|||
</data> |
|||
</dict> |
|||
<key>Modules/module.modulemap</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
hBvb1e7FRkpwYoECUsVQBBscN38= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
F65y3OGliGsHZpxzdTdQxUwgmJdHiihk1gvX6sJzhxA= |
|||
</data> |
|||
</dict> |
|||
</dict> |
|||
<key>rules</key> |
|||
<dict> |
|||
<key>^.*</key> |
|||
<true/> |
|||
<key>^.*\.lproj/</key> |
|||
<dict> |
|||
<key>optional</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1000</real> |
|||
</dict> |
|||
<key>^.*\.lproj/locversion.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1100</real> |
|||
</dict> |
|||
<key>^Base\.lproj/</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>1010</real> |
|||
</dict> |
|||
<key>^version.plist$</key> |
|||
<true/> |
|||
</dict> |
|||
<key>rules2</key> |
|||
<dict> |
|||
<key>.*\.dSYM($|/)</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>11</real> |
|||
</dict> |
|||
<key>^(.*/)?\.DS_Store$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>2000</real> |
|||
</dict> |
|||
<key>^.*</key> |
|||
<true/> |
|||
<key>^.*\.lproj/</key> |
|||
<dict> |
|||
<key>optional</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1000</real> |
|||
</dict> |
|||
<key>^.*\.lproj/locversion.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1100</real> |
|||
</dict> |
|||
<key>^Base\.lproj/</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>1010</real> |
|||
</dict> |
|||
<key>^Info\.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^PkgInfo$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^embedded\.provisionprofile$</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^version\.plist$</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
</dict> |
|||
</dict> |
|||
</plist> |
|||
@ -1,44 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>AvailableLibraries</key> |
|||
<array> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JL_HashPair.framework/JL_HashPair</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64</string> |
|||
<key>LibraryPath</key> |
|||
<string>JL_HashPair.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
</dict> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JL_HashPair.framework/JL_HashPair</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64_x86_64-simulator</string> |
|||
<key>LibraryPath</key> |
|||
<string>JL_HashPair.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
<string>x86_64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
<key>SupportedPlatformVariant</key> |
|||
<string>simulator</string> |
|||
</dict> |
|||
</array> |
|||
<key>CFBundlePackageType</key> |
|||
<string>XFWK</string> |
|||
<key>XCFrameworkFormatVersion</key> |
|||
<string>1.0</string> |
|||
</dict> |
|||
</plist> |
|||
@ -1,25 +0,0 @@ |
|||
//
|
|||
// BtHash.h
|
|||
// BtHash
|
|||
//
|
|||
// Created by EzioChan on 2022/6/29.
|
|||
//
|
|||
|
|||
#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 |
|||
@ -1,59 +0,0 @@ |
|||
//
|
|||
// 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; |
|||
|
|||
|
|||
/// 停止设备认证过程
|
|||
/// stop device pairing
|
|||
-(void)stopAuthPair; |
|||
|
|||
|
|||
/// 打印当前SDK的版本
|
|||
+(void)sdkVersion; |
|||
|
|||
|
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,21 +0,0 @@ |
|||
//
|
|||
// 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> |
|||
@ -1,20 +0,0 @@ |
|||
//
|
|||
// 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 */ |
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JL_HashPair { |
|||
umbrella header "JL_HashPair.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,25 +0,0 @@ |
|||
//
|
|||
// BtHash.h
|
|||
// BtHash
|
|||
//
|
|||
// Created by EzioChan on 2022/6/29.
|
|||
//
|
|||
|
|||
#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 |
|||
@ -1,59 +0,0 @@ |
|||
//
|
|||
// 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; |
|||
|
|||
|
|||
/// 停止设备认证过程
|
|||
/// stop device pairing
|
|||
-(void)stopAuthPair; |
|||
|
|||
|
|||
/// 打印当前SDK的版本
|
|||
+(void)sdkVersion; |
|||
|
|||
|
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,21 +0,0 @@ |
|||
//
|
|||
// 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> |
|||
@ -1,20 +0,0 @@ |
|||
//
|
|||
// 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 */ |
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JL_HashPair { |
|||
umbrella header "JL_HashPair.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,177 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>files</key> |
|||
<dict> |
|||
<key>Headers/BtHash.h</key> |
|||
<data> |
|||
EdZDmmVVm0KY3D72UHE3hQF42e4= |
|||
</data> |
|||
<key>Headers/JLHashHandler.h</key> |
|||
<data> |
|||
ArAEdyp9k5H5o4gFjW9zdx+0ISY= |
|||
</data> |
|||
<key>Headers/JL_HashPair.h</key> |
|||
<data> |
|||
Y9dInJ7eyVXJ8WOASyZGNDDIj9s= |
|||
</data> |
|||
<key>Headers/JL_ble_pair.h</key> |
|||
<data> |
|||
YP6GQrFs1nWR8BkMoj1fQdKHKKM= |
|||
</data> |
|||
<key>Info.plist</key> |
|||
<data> |
|||
pLA2PfPyxsguwM09KFXPq/Cy2ko= |
|||
</data> |
|||
<key>Modules/module.modulemap</key> |
|||
<data> |
|||
6wQFoRjNQqLop5Z3m/K5slHiG2k= |
|||
</data> |
|||
</dict> |
|||
<key>files2</key> |
|||
<dict> |
|||
<key>Headers/BtHash.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
EdZDmmVVm0KY3D72UHE3hQF42e4= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
EfOAmi/ycUONPu8OgPUuPkc9caXqUhvVXE27JNmmnPk= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JLHashHandler.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
ArAEdyp9k5H5o4gFjW9zdx+0ISY= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
7iuW7k7IBL4tf/bE1O3SudVyeFxG8YHoo7DqZGFdSBI= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JL_HashPair.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
Y9dInJ7eyVXJ8WOASyZGNDDIj9s= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
5Ow8T39Md9cD7Jb7iMaoihnIJhv8GHHIjGAsgZG//Og= |
|||
</data> |
|||
</dict> |
|||
<key>Headers/JL_ble_pair.h</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
YP6GQrFs1nWR8BkMoj1fQdKHKKM= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
ggTJvYOE/W4Tmghs665eiywakMiTsvgl7PeEayUkKqQ= |
|||
</data> |
|||
</dict> |
|||
<key>Modules/module.modulemap</key> |
|||
<dict> |
|||
<key>hash</key> |
|||
<data> |
|||
6wQFoRjNQqLop5Z3m/K5slHiG2k= |
|||
</data> |
|||
<key>hash2</key> |
|||
<data> |
|||
N+WiNcfG40LwaFvJZeLG5iNA48ZbrW0Oph/B9U+7i9U= |
|||
</data> |
|||
</dict> |
|||
</dict> |
|||
<key>rules</key> |
|||
<dict> |
|||
<key>^.*</key> |
|||
<true/> |
|||
<key>^.*\.lproj/</key> |
|||
<dict> |
|||
<key>optional</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1000</real> |
|||
</dict> |
|||
<key>^.*\.lproj/locversion.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1100</real> |
|||
</dict> |
|||
<key>^Base\.lproj/</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>1010</real> |
|||
</dict> |
|||
<key>^version.plist$</key> |
|||
<true/> |
|||
</dict> |
|||
<key>rules2</key> |
|||
<dict> |
|||
<key>.*\.dSYM($|/)</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>11</real> |
|||
</dict> |
|||
<key>^(.*/)?\.DS_Store$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>2000</real> |
|||
</dict> |
|||
<key>^.*</key> |
|||
<true/> |
|||
<key>^.*\.lproj/</key> |
|||
<dict> |
|||
<key>optional</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1000</real> |
|||
</dict> |
|||
<key>^.*\.lproj/locversion.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>1100</real> |
|||
</dict> |
|||
<key>^Base\.lproj/</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>1010</real> |
|||
</dict> |
|||
<key>^Info\.plist$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^PkgInfo$</key> |
|||
<dict> |
|||
<key>omit</key> |
|||
<true/> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^embedded\.provisionprofile$</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
<key>^version\.plist$</key> |
|||
<dict> |
|||
<key>weight</key> |
|||
<real>20</real> |
|||
</dict> |
|||
</dict> |
|||
</dict> |
|||
</plist> |
|||
@ -1,44 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>AvailableLibraries</key> |
|||
<array> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JL_OTALib.framework/JL_OTALib</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64</string> |
|||
<key>LibraryPath</key> |
|||
<string>JL_OTALib.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
</dict> |
|||
<dict> |
|||
<key>BinaryPath</key> |
|||
<string>JL_OTALib.framework/JL_OTALib</string> |
|||
<key>LibraryIdentifier</key> |
|||
<string>ios-arm64_x86_64-simulator</string> |
|||
<key>LibraryPath</key> |
|||
<string>JL_OTALib.framework</string> |
|||
<key>SupportedArchitectures</key> |
|||
<array> |
|||
<string>arm64</string> |
|||
<string>x86_64</string> |
|||
</array> |
|||
<key>SupportedPlatform</key> |
|||
<string>ios</string> |
|||
<key>SupportedPlatformVariant</key> |
|||
<string>simulator</string> |
|||
</dict> |
|||
</array> |
|||
<key>CFBundlePackageType</key> |
|||
<string>XFWK</string> |
|||
<key>XCFrameworkFormatVersion</key> |
|||
<string>1.0</string> |
|||
</dict> |
|||
</plist> |
|||
@ -1,52 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,62 +0,0 @@ |
|||
//
|
|||
// JLOtaCustom.h
|
|||
// JL_OTALib
|
|||
//
|
|||
// Created by EzioChan on 2025/4/17.
|
|||
// Copyright © 2025 www.zh-jieli.com. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
@class JL_OTAManager; |
|||
|
|||
/// 自定义命令对象
|
|||
@interface JLOtaCustomData : NSObject |
|||
|
|||
/// 是否需要回复
|
|||
@property (nonatomic, assign) BOOL needResponse; |
|||
|
|||
/// 数据
|
|||
@property (nonatomic, strong) NSData *data; |
|||
|
|||
/// 回复数据 SN
|
|||
@property (nonatomic, assign) uint8_t sn; |
|||
|
|||
@end |
|||
|
|||
|
|||
/// 自定义命令回调
|
|||
@protocol JLOtaCustomDelegate <NSObject> |
|||
|
|||
/// 自定义命令回调
|
|||
/// - Parameter data: 自定义命令对象
|
|||
-(void)otaCustomReceiveData:(JLOtaCustomData *)data; |
|||
|
|||
@end |
|||
|
|||
/// 自定义命令
|
|||
@interface JLOtaCustom : NSObject |
|||
|
|||
/// 自定义命令
|
|||
/// - Parameters:
|
|||
/// - delegate: 代理回调
|
|||
/// - manager: 升级对象
|
|||
-(instancetype)initWithDelegate:(id<JLOtaCustomDelegate>)delegate OtaManager:(JL_OTAManager *)manager; |
|||
|
|||
/// 发送自定义命令
|
|||
/// - Parameters:
|
|||
/// - data: 下发的数据
|
|||
/// - need: 是否需要回复内容
|
|||
/// - result: 命令回复结果
|
|||
- (void)cmdSendCommandData:(NSData *)data needResponse:(BOOL)need Result:(void(^)(NSData * __nullable response, NSError * __nullable error)) result; |
|||
|
|||
/// 回复自定义命令
|
|||
/// - Parameters:
|
|||
/// - data: 回复的数据
|
|||
/// - sn: 回复的SN
|
|||
- (void)cmdResponseData:(NSData *)data sn:(uint8_t)sn; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,43 +0,0 @@ |
|||
//
|
|||
// JLOtaReConnectOption.h
|
|||
// JL_OTALib
|
|||
//
|
|||
// Created by EzioChan on 2025/3/27.
|
|||
// Copyright © 2025 www.zh-jieli.com. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
@interface JLOtaReConnectOption : NSObject |
|||
|
|||
/// 是否需要使用设备认证
|
|||
@property (assign, nonatomic) BOOL deviceAuthorize; |
|||
|
|||
/// 握手(配对)秘钥
|
|||
@property(strong,nonatomic)NSData *__nullable authKey; |
|||
|
|||
/// 设备服务UUID
|
|||
/// 默认是 AE00
|
|||
@property (strong, nonatomic) NSString *serviceUUID; |
|||
|
|||
///写特征 UUID
|
|||
/// 默认是 AE01
|
|||
@property (strong, nonatomic) NSString *writeUUID; |
|||
|
|||
/// 读特征 UUID
|
|||
/// 默认是 AE02
|
|||
@property (strong, nonatomic) NSString *readUUID; |
|||
|
|||
/// 是否需要响应的回应方式
|
|||
/// 默认是NO
|
|||
@property (assign, nonatomic) BOOL isWriteWithResponse; |
|||
|
|||
|
|||
|
|||
+ (JLOtaReConnectOption *)defaultOption; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,22 +0,0 @@ |
|||
//
|
|||
// 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> |
|||
#import <JL_OTALib/JLOtaReConnectOption.h> |
|||
#import <JL_OTALib/JLOtaCustom.h> |
|||
@ -1,302 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@class JLOtaReConnectOption; |
|||
|
|||
typedef NS_ENUM(UInt16, JL_OTAResult) { |
|||
/// OTA升级成功
|
|||
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需重连设备(uuid方式)
|
|||
JL_OTAResultReconnect = 0x09, |
|||
/// OTA需设备重启
|
|||
JL_OTAResultReboot = 0x0a, |
|||
/// OTA准备中
|
|||
JL_OTAResultPreparing = 0x0b, |
|||
/// OTA准备完成
|
|||
JL_OTAResultPrepared = 0x0f, |
|||
/// 设备已在升级中
|
|||
JL_OTAResultStatusIsUpdating = 0x10, |
|||
/// 当前固件多台设备连接,请手动断开另一个设备连接
|
|||
JL_OTAResultFailedConnectMore = 0x11, |
|||
/// 升级数据校验失败,SN 多次重复
|
|||
JL_OTAResultFailSameSN = 0xe0, |
|||
/// 升级取消
|
|||
JL_OTAResultCancel = 0xe1, |
|||
/// 升级数据校验失败
|
|||
JL_OTAResultFailVerification = 0xf1, |
|||
/// 升级失败
|
|||
JL_OTAResultFailCompletely = 0xf2, |
|||
/// 升级数据校验失败,加密Key不对
|
|||
JL_OTAResultFailKey = 0xf3, |
|||
/// 升级文件出错
|
|||
JL_OTAResultFailErrorFile = 0xf4, |
|||
/// uboot不匹配
|
|||
JL_OTAResultFailUboot = 0xf5, |
|||
/// 升级过程长度出错
|
|||
JL_OTAResultFailLenght = 0xf6, |
|||
/// 升级过程flash读写失败
|
|||
JL_OTAResultFailFlash = 0xf7, |
|||
/// 升级过程指令超时
|
|||
JL_OTAResultFailCmdTimeout = 0xf8, |
|||
/// 相同版本
|
|||
JL_OTAResultFailSameVersion = 0xf9, |
|||
/// TWS耳机未连接
|
|||
JL_OTAResultFailTWSDisconnect = 0xfa, |
|||
/// 耳机未在充电仓
|
|||
JL_OTAResultFailNotInBin = 0xfb, |
|||
/// OTA需重连设备(mac方式)
|
|||
JL_OTAResultReconnectWithMacAddr = 0xfc, |
|||
/// OTA设备断开
|
|||
JL_OTAResultDisconnect = 0xfd, |
|||
/// OTA需重连设备(更新资源)
|
|||
JL_OTAResultReconnectUpdateSource = 0xfe, |
|||
/// OTA未知错误
|
|||
JL_OTAResultUnknown |
|||
}; |
|||
|
|||
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, // 手表资源 强制升级
|
|||
}__attribute__((deprecated("This enum is deprecated. Use JLOtaSourcesExtendMode instead."))); |
|||
|
|||
/// OTA资源升级模式
|
|||
typedef NS_ENUM(UInt8, JLOtaSourcesExtendMode) { |
|||
/// 不启用
|
|||
JLSourcesExtendModeDisable = 0, |
|||
/// 启用普通资源升级模式
|
|||
JLSourcesExtendModeNormal = 1, |
|||
/// 启用只升级资源的模式
|
|||
JLSourcesExtendModeSourceOnly = 2, |
|||
/// 启用只升级固件程序的模式
|
|||
JLSourcesExtendModeFirmwareOnly = 3, |
|||
}; |
|||
|
|||
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 __attribute__((deprecated("This property is deprecated. Use otaSourceMode instead."))); |
|||
|
|||
/// 是否支持复用空间进行 OTA
|
|||
@property(assign, nonatomic) BOOL isSupportReuseSpaceOTA; |
|||
|
|||
/// 是否支持 OTA 拓展功能
|
|||
@property (assign, nonatomic) BOOL isSupportExpand; |
|||
|
|||
/// 资源升级模式类型
|
|||
@property(assign, nonatomic) JLOtaSourcesExtendMode otaSourceMode; |
|||
|
|||
/// 设备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: 10
|
|||
- (void)maxLostCount:(int)count; |
|||
|
|||
/// 设置超时时间
|
|||
/// - Parameter timeOut: 时间
|
|||
/// default: 5
|
|||
- (void)cmdTimeOut:(int)timeOut; |
|||
|
|||
/// 设置是否需要回连
|
|||
/// 一般不允许外部干扰状态机,外部不适用此方法
|
|||
/// - Parameter isReLink: 回连
|
|||
- (void)setOTARelink:(BOOL)isReLink __attribute__((deprecated("Can't be used externally."))); |
|||
|
|||
/// 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升级III
|
|||
/// 单备份升级特有!!!
|
|||
/// 此接口免去了公版 OTA 的外边回连策略,内部实现回连
|
|||
/// ⚠️使用此方法时不可使用 delegate 的回调信息,要使用 Result 的回调信息
|
|||
/// @param data OTA数据
|
|||
/// @param option 回连选项
|
|||
/// @param result 回复
|
|||
-(void)cmdUpgrade:(NSData *)data Option:(JLOtaReConnectOption *_Nullable)option Result:(JL_OTA_RT _Nonnull)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 |
|||
@ -1,207 +0,0 @@ |
|||
/**
|
|||
* 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
|
|||
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@ |
|||
framework module JL_OTALib { |
|||
umbrella header "JL_OTALib.h" |
|||
export * |
|||
|
|||
module * { export * } |
|||
} |
|||
@ -1,52 +0,0 @@ |
|||
//
|
|||
// 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 |
|||
@ -1,62 +0,0 @@ |
|||
//
|
|||
// JLOtaCustom.h
|
|||
// JL_OTALib
|
|||
//
|
|||
// Created by EzioChan on 2025/4/17.
|
|||
// Copyright © 2025 www.zh-jieli.com. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
@class JL_OTAManager; |
|||
|
|||
/// 自定义命令对象
|
|||
@interface JLOtaCustomData : NSObject |
|||
|
|||
/// 是否需要回复
|
|||
@property (nonatomic, assign) BOOL needResponse; |
|||
|
|||
/// 数据
|
|||
@property (nonatomic, strong) NSData *data; |
|||
|
|||
/// 回复数据 SN
|
|||
@property (nonatomic, assign) uint8_t sn; |
|||
|
|||
@end |
|||
|
|||
|
|||
/// 自定义命令回调
|
|||
@protocol JLOtaCustomDelegate <NSObject> |
|||
|
|||
/// 自定义命令回调
|
|||
/// - Parameter data: 自定义命令对象
|
|||
-(void)otaCustomReceiveData:(JLOtaCustomData *)data; |
|||
|
|||
@end |
|||
|
|||
/// 自定义命令
|
|||
@interface JLOtaCustom : NSObject |
|||
|
|||
/// 自定义命令
|
|||
/// - Parameters:
|
|||
/// - delegate: 代理回调
|
|||
/// - manager: 升级对象
|
|||
-(instancetype)initWithDelegate:(id<JLOtaCustomDelegate>)delegate OtaManager:(JL_OTAManager *)manager; |
|||
|
|||
/// 发送自定义命令
|
|||
/// - Parameters:
|
|||
/// - data: 下发的数据
|
|||
/// - need: 是否需要回复内容
|
|||
/// - result: 命令回复结果
|
|||
- (void)cmdSendCommandData:(NSData *)data needResponse:(BOOL)need Result:(void(^)(NSData * __nullable response, NSError * __nullable error)) result; |
|||
|
|||
/// 回复自定义命令
|
|||
/// - Parameters:
|
|||
/// - data: 回复的数据
|
|||
/// - sn: 回复的SN
|
|||
- (void)cmdResponseData:(NSData *)data sn:(uint8_t)sn; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,43 +0,0 @@ |
|||
//
|
|||
// JLOtaReConnectOption.h
|
|||
// JL_OTALib
|
|||
//
|
|||
// Created by EzioChan on 2025/3/27.
|
|||
// Copyright © 2025 www.zh-jieli.com. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
@interface JLOtaReConnectOption : NSObject |
|||
|
|||
/// 是否需要使用设备认证
|
|||
@property (assign, nonatomic) BOOL deviceAuthorize; |
|||
|
|||
/// 握手(配对)秘钥
|
|||
@property(strong,nonatomic)NSData *__nullable authKey; |
|||
|
|||
/// 设备服务UUID
|
|||
/// 默认是 AE00
|
|||
@property (strong, nonatomic) NSString *serviceUUID; |
|||
|
|||
///写特征 UUID
|
|||
/// 默认是 AE01
|
|||
@property (strong, nonatomic) NSString *writeUUID; |
|||
|
|||
/// 读特征 UUID
|
|||
/// 默认是 AE02
|
|||
@property (strong, nonatomic) NSString *readUUID; |
|||
|
|||
/// 是否需要响应的回应方式
|
|||
/// 默认是NO
|
|||
@property (assign, nonatomic) BOOL isWriteWithResponse; |
|||
|
|||
|
|||
|
|||
+ (JLOtaReConnectOption *)defaultOption; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
|||
@ -1,22 +0,0 @@ |
|||
//
|
|||
// 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> |
|||
#import <JL_OTALib/JLOtaReConnectOption.h> |
|||
#import <JL_OTALib/JLOtaCustom.h> |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue