diff options
| author | hc <haocheng.xie@respiree.com> | 2026-04-13 15:17:52 +0800 |
|---|---|---|
| committer | hc <haocheng.xie@respiree.com> | 2026-04-13 15:17:52 +0800 |
| commit | d6d9a09d505d11148599a95a5be3e1351edbe0ac (patch) | |
| tree | a5f5891983d1ff207e99f683a5e151519cef4980 /libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h | |
| parent | e4fb9966e762852bf17f21c8406501d42fae0b61 (diff) | |
Local iHealth SDK, device detail screen, iOS event fixes
Diffstat (limited to 'libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h')
| -rw-r--r-- | libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h new file mode 100644 index 0000000..57dace4 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | // | ||
| 2 | // DFUController.h | ||
| 3 | // iHealthSDKStatic | ||
| 4 | // | ||
| 5 | // Created by Lei Bao on 2017/7/17. | ||
| 6 | // Copyright © 2017年 daiqingquan. All rights reserved. | ||
| 7 | // | ||
| 8 | |||
| 9 | #import <Foundation/Foundation.h> | ||
| 10 | #import "DFUMacro.h" | ||
| 11 | /** | ||
| 12 | DFU Controller | ||
| 13 | */ | ||
| 14 | @interface DFUController : NSObject | ||
| 15 | |||
| 16 | /** | ||
| 17 | Get instance | ||
| 18 | |||
| 19 | @return DFUController object | ||
| 20 | */ | ||
| 21 | + (instancetype)shareInstance; | ||
| 22 | |||
| 23 | /** | ||
| 24 | Query device firmware information in Flash | ||
| 25 | |||
| 26 | @param deviceType DFUDeviceType enum | ||
| 27 | @param uuid device UUID | ||
| 28 | @param successBlock success block | ||
| 29 | @param errorBlock DFUError enum(DFUError_InUpgradeCannotExecuteCommand,DFUError_UnsupportedDeviceType,DFUError_InvalidUUID,DFUError_NoConnectedDevice,DFUError_CommandTimeOut,DFUError_DeviceDisconnect) | ||
| 30 | @note The method should be called when device is connected. | ||
| 31 | */ | ||
| 32 | - (void)queryDeviceFirmwareInfoWithDeviceType:(DFUDeviceType)deviceType | ||
| 33 | uuid:(NSString *)uuid | ||
| 34 | successBlock:(QueryDeviceFirmwareInfoSuccessBlock)successBlock | ||
| 35 | errorBlock:(DFUErrorBlock)errorBlock; | ||
| 36 | |||
| 37 | /** | ||
| 38 | Query the latest firmware information from server | ||
| 39 | |||
| 40 | @param deviceType DFUDeviceType enum | ||
| 41 | @param productModel Model Number(you can get from IDPS or device object's property) | ||
| 42 | @param currentFirmwareVersion current firmware version (you can get from IDPS or device object's property) | ||
| 43 | @param hardwareVersion hardware version (you can get from IDPS or device object's property) | ||
| 44 | @param successBlock success block | ||
| 45 | @param errorBlock DFUError enum(DFUError_UnsupportedDeviceType,DFUError_InvalidFirmwareVersion,DFUError_InvalidHardwareVersion,DFUError_NetworkError,DFUError_ServerError) | ||
| 46 | @note No need to connect but IDPS should be known. | ||
| 47 | */ | ||
| 48 | - (void)queryServerFirmwareInfoWithDeviceType:(DFUDeviceType)deviceType | ||
| 49 | productModel:(NSString *)productModel | ||
| 50 | currentFirmwareVersion:(NSString *)currentFirmwareVersion | ||
| 51 | hardwareVersion:(NSString *)hardwareVersion | ||
| 52 | successBlock:(QueryServerFirmwareInfoSuccessBlock)successBlock | ||
| 53 | errorBlock:(DFUErrorBlock)errorBlock; | ||
| 54 | |||
| 55 | |||
| 56 | /** | ||
| 57 | Download firmware file | ||
| 58 | |||
| 59 | @param deviceType DFUDeviceType enum | ||
| 60 | @param productModel Model Number(you can get from IDPS or device object's property) | ||
| 61 | @param firmwareVersion firmware version you want to download (the latest version you can get from "queryServerFirmwareInfoWithDeviceType:") | ||
| 62 | @param hardwareVersion hardware version (you can get from IDPS or device object's property) | ||
| 63 | @param startBlock download start block | ||
| 64 | @param downloadFirmwareProgressBlock download progress block [0-100] | ||
| 65 | @param successBlock success block (firmwareIdentifier is used to in "startUpgradeWithDeviceType:") | ||
| 66 | @param errorBlock DFUError enum(DFUError_UnsupportedDeviceType,DFUError_InvalidFirmwareVersion,DFUError_InvalidHardwareVersion,DFUError_FileSaveError,DFUError_NetworkError,DFUError_ServerError,DFUError_RequestedFileNotExist,DFUError_InfoFileCheckNotPass,DFUError_firmwareFileCheckNotPass) | ||
| 67 | */ | ||
| 68 | - (void)downloadFirmwareWithDeviceType:(DFUDeviceType)deviceType | ||
| 69 | productModel:(NSString *)productModel | ||
| 70 | firmwareVersion:(NSString *)firmwareVersion | ||
| 71 | hardwareVersion:(NSString *)hardwareVersion | ||
| 72 | downloadStartBlock:(DownloadFirmwareStartBlock)startBlock | ||
| 73 | downloadFirmwareProgressBlock:(DownloadFirmwareProgressBlock)downloadFirmwareProgressBlock | ||
| 74 | successblock:(DownloadFirmwareSuccessBlock)successBlock | ||
| 75 | errorBlock:(DFUErrorBlock)errorBlock; | ||
| 76 | |||
| 77 | |||
| 78 | /** | ||
| 79 | Cancel downloading firmware file | ||
| 80 | |||
| 81 | @param deviceType DFUDeviceType enum | ||
| 82 | @param successBlock success block | ||
| 83 | |||
| 84 | */ | ||
| 85 | - (void)cancelDownloadFirmwareWithDeviceType:(DFUDeviceType)deviceType | ||
| 86 | successBlock:(CancelDownloadFirmwareSuccessBlock)successBlock; | ||
| 87 | |||
| 88 | /** | ||
| 89 | Start update | ||
| 90 | |||
| 91 | @param deviceType DFUDeviceType enum | ||
| 92 | @param productModel Model Number(you can get from IDPS or device object's property) | ||
| 93 | @param uuid device UUID | ||
| 94 | @param firmwareIdentifier firmware identifier | ||
| 95 | @param firmwareVersion destination firmware version | ||
| 96 | @param hardwareVersion hardware version (you can get from IDPS or device object's property) | ||
| 97 | @param deviceReplyCannotUpgradeBlock cannot upgrade and return reason | ||
| 98 | @param transferBeginBlock transfer begin | ||
| 99 | @param transferProgressBlock transfer progress block [0-100] | ||
| 100 | @param transferSuccessBlock transfer success block (return write MCU speed, unit:Byte/s, only support AM3S,AM4,PO3,HS2,HS4,ECG) | ||
| 101 | @param transferResultBlock transfer result block (return result type, pasue reason, pause length,only support BG5S,BP5S,ABPM) | ||
| 102 | @param upgradeSuccessBlock upgrade success block(only support AM3) | ||
| 103 | @param upgradeFailBlock upgrade fail block | ||
| 104 | @param upgradeErrorBlock upgrade error blcok (DFUError enum(DFUError_InUpgradeCannotExecuteCommand,DFUError_UnsupportedDeviceType,DFUError_InvalidUUID,DFUError_NoConnectedDevice,DFUError_NoFirmwareFile,DFUError_InvalidFirmwareInfoFile,DFUError_CommandTimeOut,DFUError_DeviceDisconnect)) | ||
| 105 | */ | ||
| 106 | - (void)startUpgradeWithDeviceType:(DFUDeviceType)deviceType | ||
| 107 | productModel:(NSString *)productModel | ||
| 108 | uuid:(NSString *)uuid | ||
| 109 | firmwareVersion:(NSString *)firmwareVersion | ||
| 110 | hardwareVersion:(NSString *)hardwareVersion | ||
| 111 | firmwareIdentifier:(NSString *)firmwareIdentifier | ||
| 112 | deviceReplyCannotUpgradeBlock:(DeviceReplyCannotUpgradeBlock)deviceReplyCannotUpgradeBlock | ||
| 113 | transferBeginBlock:(TransferBeginBlock)transferBeginBlock | ||
| 114 | transferProgressBlock:(TransferProgressBlock)transferProgressBlock | ||
| 115 | transferSuccessBlock:(TransferSuccessBlock)transferSuccessBlock | ||
| 116 | transferResultBlock:(TransferResultBlock)transferResultBlock | ||
| 117 | upgradeSuccessBlock:(UpgradeSuccessBlock)upgradeSuccessBlock | ||
| 118 | upgradeFailBlock:(UpgradeFailBlock)upgradeFailBlock | ||
| 119 | upgradeErrorBlock:(DFUErrorBlock)upgradeErrorBlock; | ||
| 120 | |||
| 121 | /** | ||
| 122 | Stop update | ||
| 123 | |||
| 124 | @param deviceType DFUDeviceType enum | ||
| 125 | @param uuid device UUID | ||
| 126 | @param successBlock success block | ||
| 127 | @param failBlock fail block, DFUError enum:(DFUError_UnsupportedDeviceType,DFUError_InvalidUUID,DFUError_CommandTimeOut) | ||
| 128 | */ | ||
| 129 | - (void)stopUpgradeWithDeviceType:(DFUDeviceType)deviceType | ||
| 130 | uuid:(NSString *)uuid | ||
| 131 | successBlock:(StopUpgradeSuccessBlock)successBlock | ||
| 132 | failBlock:(DFUErrorBlock)failBlock; | ||
| 133 | |||
| 134 | /** | ||
| 135 | Delete firmware file | ||
| 136 | |||
| 137 | @param firmwareIdentifier firmware identifier | ||
| 138 | @param successBlock success block | ||
| 139 | @param errorBlock error block DFUError enum:DFUError_DeleteError | ||
| 140 | */ | ||
| 141 | - (void)deleteFirmwareWithIdentifier:(NSString *)firmwareIdentifier | ||
| 142 | successBlock:(DeleteFirmwareSuccessBlock)successBlock | ||
| 143 | errorBlock:(DFUErrorBlock)errorBlock; | ||
| 144 | |||
| 145 | /** | ||
| 146 | Query DFU state | ||
| 147 | |||
| 148 | @return Busy or Free | ||
| 149 | */ | ||
| 150 | - (DFUState)queryDFUState; | ||
| 151 | |||
| 152 | /** | ||
| 153 | Query Device UUID in updating | ||
| 154 | |||
| 155 | @return Device UUID | ||
| 156 | */ | ||
| 157 | - (NSString *)UUIDInDFU; | ||
| 158 | |||
| 159 | - (void)openSesame:(NSInteger)number; | ||
| 160 | @end | ||
