// // RTKOTAImage.h // RTKOTASDK // // Created by jerome_gu on 2019/1/28. // Copyright © 2019 Realtek. All rights reserved. // #import #ifdef RTK_SDK_IS_STATIC_LIBRARY #import "RTKOTABin.h" #else #import #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 *)imagesExtractedFromMPPackFilePath:(NSString *)path error:(NSError *__nullable *__nullable)errPtr; + (nullable NSArray *)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 *)imagesExtractedFromMPPackFileData:(NSData *)data error:(NSError *__nullable *__nullable)errPtr; + (nullable NSArray *)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 *_Nullable*_Nullable)primaryBinsRef secondaryBudBins:(NSArray *_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 *_Nullable*_Nullable)primaryBinsRef secondaryBudBins:(NSArray *_Nullable*_Nullable)secondaryBinsRef; @end NS_ASSUME_NONNULL_END