You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
3.5 KiB
100 lines
3.5 KiB
![]()
2 years ago
|
//
|
||
|
// RTKOTAImage.h
|
||
|
// RTKOTASDK
|
||
|
//
|
||
|
// Created by jerome_gu on 2019/1/28.
|
||
|
// Copyright © 2019 Realtek. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import <Foundation/Foundation.h>
|
||
|
|
||
|
#ifdef RTK_SDK_IS_STATIC_LIBRARY
|
||
|
#import "RTKOTABin.h"
|
||
|
#else
|
||
|
#import <RTKOTASDK/RTKOTABin.h>
|
||
|
#endif
|
||
|
|
||
|
|
||
|
typedef NS_ENUM(NSUInteger, RTKOTAUpgradeBank) {
|
||
|
RTKOTAUpgradeBank_Unknown,
|
||
|
RTKOTAUpgradeBank_SingleOrBank0,
|
||
|
RTKOTAUpgradeBank_Bank1,
|
||
|
};
|
||
|
|
||
|
|
||
|
@class RTKOTAPeripheral;
|
||
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
|
/**
|
||
|
* A concrete RTKOTABin class represents a binary which is about to send to a device.
|
||
|
*/
|
||
|
@interface RTKOTAUpgradeBin : RTKOTABin
|
||
|
|
||
|
/// The OTA Version which this binary object is created in accordance with.
|
||
|
@property (readonly) NSUInteger otaVersion;
|
||
|
|
||
|
/// The security version of this binary object.
|
||
|
@property (readonly) NSUInteger secVersion;
|
||
|
|
||
|
/// The identifier of this binary object.
|
||
|
@property (readonly) NSUInteger imageId;
|
||
|
|
||
|
/// The raw bytes of the binary.
|
||
|
@property (readonly) NSData *data;
|
||
|
|
||
|
|
||
|
- (instancetype)initWithPureData:(NSData *)data;
|
||
|
|
||
|
/**
|
||
|
* Indicates which bank this image is about be installed at.
|
||
|
*
|
||
|
* @note This is available for dual bank SOC.
|
||
|
*/
|
||
|
@property (readonly) RTKOTAUpgradeBank upgradeBank;
|
||
|
|
||
|
/// Return the check bytes which has a 32-byte length.
|
||
|
@property (readonly, nullable) NSData *checkValue;
|
||
|
|
||
|
/**
|
||
|
* Parse and return a list of RTKOTAUpgradeBin objects form a MPPack file.
|
||
|
*
|
||
|
* @discussion The archive file which path locate should be a valid MPPack file format or MP binary format.
|
||
|
* @seealso +imagesExtractedFromMPPackFileData:error:
|
||
|
*/
|
||
|
+ (nullable NSArray <RTKOTAUpgradeBin*> *)imagesExtractedFromMPPackFilePath:(NSString *)path error:(NSError *__nullable *__nullable)errPtr;
|
||
|
|
||
|
+ (nullable NSArray <RTKOTAUpgradeBin*> *)imagesExtractFromMPPackFilePath:(NSString *)path error:(NSError *__nullable *__nullable)errPtr DEPRECATED_MSG_ATTRIBUTE("use +imagesExtractedFromMPPackFilePath:error: instead");
|
||
|
|
||
|
/**
|
||
|
* Parse and return a list of RTKOTAUpgradeBin objects form a MPPack file data.
|
||
|
*
|
||
|
* @discussion The archive file data should be a valid MPPack file format or MP binary format.
|
||
|
* @seealso +imagesExtractedFromMPPackFilePath:error:
|
||
|
*/
|
||
|
+ (nullable NSArray <RTKOTAUpgradeBin*> *)imagesExtractedFromMPPackFileData:(NSData *)data error:(NSError *__nullable *__nullable)errPtr;
|
||
|
|
||
|
+ (nullable NSArray <RTKOTAUpgradeBin*> *)imagesExtractFromMPPackFileData:(NSData *)data error:(NSError *__nullable *__nullable)errPtr DEPRECATED_MSG_ATTRIBUTE("use +imagesExtractedFromMPPackFileData:error: instead");
|
||
|
|
||
|
/**
|
||
|
* Parse and return 2 list of RTKOTAUpgradeBin objects for RWS buds form a CombineMPPack file.
|
||
|
*
|
||
|
* @discussion The archive file which path locate should be a valid CombineMPPack file format.
|
||
|
* @seealso +extractCombinePackFileWithData:toPrimaryBudBins:secondaryBudBins:
|
||
|
*/
|
||
|
+ (nullable NSError*)extractCombinePackFileWithFilePath:(NSString *)path toPrimaryBudBins:(NSArray <RTKOTAUpgradeBin*> *_Nullable*_Nullable)primaryBinsRef secondaryBudBins:(NSArray <RTKOTAUpgradeBin*> *_Nullable*_Nullable)secondaryBinsRef;
|
||
|
|
||
|
/**
|
||
|
* Parse and return 2 list of RTKOTAUpgradeBin objects for RWS buds form a CombineMPPack file data.
|
||
|
*
|
||
|
* @discussion The fileData should be a valid CombineMPPack file format.
|
||
|
* @seealso +extractCombinePackFileWithFilePath:toPrimaryBudBins:secondaryBudBins:
|
||
|
*/
|
||
|
+ (nullable NSError*)extractCombinePackFileWithData:(NSData *)fileData toPrimaryBudBins:(NSArray <RTKOTAUpgradeBin*> *_Nullable*_Nullable)primaryBinsRef secondaryBudBins:(NSArray <RTKOTAUpgradeBin*> *_Nullable*_Nullable)secondaryBinsRef;
|
||
|
|
||
|
|
||
|
@end
|
||
|
|
||
|
|
||
|
NS_ASSUME_NONNULL_END
|