diff options
Diffstat (limited to 'libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h')
| -rw-r--r-- | libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h | 264 |
1 files changed, 264 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h new file mode 100644 index 0000000..4848ad9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h | |||
| @@ -0,0 +1,264 @@ | |||
| 1 | // | ||
| 2 | // DFUMacro.h | ||
| 3 | // iHealthSDKStatic | ||
| 4 | // | ||
| 5 | // Created by Lei Bao on 2017/7/18. | ||
| 6 | // Copyright © 2017年 daiqingquan. All rights reserved. | ||
| 7 | // | ||
| 8 | |||
| 9 | #ifndef DFUMacro_h | ||
| 10 | #define DFUMacro_h | ||
| 11 | |||
| 12 | @class DFUDeviceFirmwareInfo; | ||
| 13 | @class DFUServerFirmwareInfo; | ||
| 14 | |||
| 15 | /** | ||
| 16 | DFU error code | ||
| 17 | */ | ||
| 18 | typedef NS_ENUM(NSInteger, DFUError) { | ||
| 19 | /// Device type does not support. | ||
| 20 | DFUError_UnsupportedDeviceType = 100, | ||
| 21 | /// UUID is invalid. | ||
| 22 | DFUError_InvalidUUID = 101, | ||
| 23 | /// Command timeout. | ||
| 24 | DFUError_CommandTimeOut = 102, | ||
| 25 | /// Device is not connected. | ||
| 26 | DFUError_NoConnectedDevice = 104, | ||
| 27 | /// During DFU, other commands cannot be executed. | ||
| 28 | DFUError_InUpgradeCannotExecuteCommand = 105, | ||
| 29 | /// Firmware version is invalid. | ||
| 30 | DFUError_InvalidFirmwareVersion = 106, | ||
| 31 | /// Hardware version is invalid. | ||
| 32 | DFUError_InvalidHardwareVersion = 107, | ||
| 33 | /// The firmware info file is wrong. | ||
| 34 | DFUError_InvalidFirmwareInfoFile = 108, | ||
| 35 | /// The firmware file is wrong. | ||
| 36 | DFUError_InvalidFirmwareFile = 109, | ||
| 37 | /// It indicates network error. | ||
| 38 | DFUError_NetworkError = 200, | ||
| 39 | /// Server error | ||
| 40 | DFUError_ServerError = 202, | ||
| 41 | /// Requested file does not exist. | ||
| 42 | DFUError_RequestedFileNotExist = 203, | ||
| 43 | /// File save error | ||
| 44 | DFUError_FileSaveError = 204, | ||
| 45 | /// Info file does not pass check. | ||
| 46 | DFUError_InfoFileCheckNotPass = 205, | ||
| 47 | /// Firmware file does not pass check. | ||
| 48 | DFUError_firmwareFileCheckNotPass = 206, | ||
| 49 | /// Device disconnects before command finish. | ||
| 50 | DFUError_DeviceDisconnect = 300, | ||
| 51 | /// Device stops update. | ||
| 52 | DFUError_DeviceStopUpdate = 301, | ||
| 53 | /// The firmware file does not exist. | ||
| 54 | DFUError_NoFirmwareFile = 402, | ||
| 55 | /// Delete error | ||
| 56 | DFUError_DeleteError = 407, | ||
| 57 | /// Delete file , but file does not exist | ||
| 58 | DFUError_DeleteWhileFileNotExist = 408, | ||
| 59 | /// Device flash error (only support in ECG3 DFU) | ||
| 60 | DFUError_DeviceFlashError = 408, | ||
| 61 | |||
| 62 | }; | ||
| 63 | |||
| 64 | /** | ||
| 65 | DFU device type | ||
| 66 | */ | ||
| 67 | typedef NS_ENUM(NSInteger, DFUDeviceType) { | ||
| 68 | /// Unknown | ||
| 69 | DFUDeviceType_Unknown = -1, | ||
| 70 | /// AM3 | ||
| 71 | DFUDeviceType_AM3, | ||
| 72 | /// AM3S | ||
| 73 | DFUDeviceType_AM3S, | ||
| 74 | /// AM4 | ||
| 75 | DFUDeviceType_AM4, | ||
| 76 | /// PO3 | ||
| 77 | DFUDeviceType_PO3, | ||
| 78 | /// HS2 | ||
| 79 | DFUDeviceType_HS2, | ||
| 80 | /// HS4 | ||
| 81 | DFUDeviceType_HS4, | ||
| 82 | /// ECG | ||
| 83 | DFUDeviceType_ECG, | ||
| 84 | /// BP5S | ||
| 85 | DFUDeviceType_BP5S, | ||
| 86 | /// ABPM | ||
| 87 | DFUDeviceType_ABPM, | ||
| 88 | /// BG5S | ||
| 89 | DFUDeviceType_BG5S, | ||
| 90 | /// HS2S | ||
| 91 | DFUDeviceType_HS2S, | ||
| 92 | /// placeholder | ||
| 93 | DFUDeviceType_MAX, | ||
| 94 | }; | ||
| 95 | |||
| 96 | /** | ||
| 97 | Cannot upgrade reason | ||
| 98 | */ | ||
| 99 | typedef NS_ENUM(NSInteger, DFUDeviceReplyCannotUpgradeReason){ | ||
| 100 | /// Unknown | ||
| 101 | DFUDeviceReplyCannotUpgradeReason_Unknown = 1, | ||
| 102 | /// battery is low | ||
| 103 | DFUDeviceReplyCannotUpgradeReason_Battery, | ||
| 104 | /// cannot upgrade when measuring | ||
| 105 | DFUDeviceReplyCannotUpgradeReason_InMeasuring, | ||
| 106 | }; | ||
| 107 | |||
| 108 | /** | ||
| 109 | Upgrade fail reason | ||
| 110 | */ | ||
| 111 | typedef NS_ENUM(NSInteger, DFUUpgradeFailReason) { | ||
| 112 | /// Unknown | ||
| 113 | DFUUpgradeFailReason_Unknown = -1, | ||
| 114 | /// Device recieve wrong data or no data | ||
| 115 | DFUUpgradeFailReason_DeviceRecieveWrongDataOrNotRecieve, | ||
| 116 | /// Write MCU error | ||
| 117 | DFUUpgradeFailReason_WriteMCUError, | ||
| 118 | /// Device stop upgrade | ||
| 119 | DFUUpgradeFailReason_DeviceStopUpgrade, | ||
| 120 | /// Delete firmware error (only support in ECG3 DFU) | ||
| 121 | DFUUpgradeFailReason_DeleteFirmwareError, | ||
| 122 | /// Device flash error (only support in ECG3 DFU) | ||
| 123 | DFUUpgradeFailReason_DeviceFlashError, | ||
| 124 | }; | ||
| 125 | |||
| 126 | /** | ||
| 127 | Transmission result type | ||
| 128 | */ | ||
| 129 | typedef NS_ENUM(NSInteger, DFUTransmissionResultType) { | ||
| 130 | /// Unknown | ||
| 131 | DFUTransmissionResultType_Unknown = -1, | ||
| 132 | /// All firmware transfer finish | ||
| 133 | DFUTransmissionResultType_Finish, | ||
| 134 | /// Pasuse because device needs write MCU | ||
| 135 | DFUTransmissionResultType_Pause, | ||
| 136 | }; | ||
| 137 | |||
| 138 | /** | ||
| 139 | Pause reason | ||
| 140 | */ | ||
| 141 | typedef NS_ENUM(NSInteger, DFUPauseReason) { | ||
| 142 | /// Unkonw reason | ||
| 143 | DFUPauseReason_Unknown = 0, | ||
| 144 | /// Need write MCU, if finished, device can be connected. | ||
| 145 | DFUPauseReason_RebootAndNeedReconnect, | ||
| 146 | }; | ||
| 147 | |||
| 148 | |||
| 149 | /** | ||
| 150 | DFU state | ||
| 151 | */ | ||
| 152 | typedef NS_ENUM(NSInteger, DFUState) { | ||
| 153 | /// Unknown | ||
| 154 | DFUState_Unknown = -1, | ||
| 155 | /// Busy | ||
| 156 | DFUState_Busy, | ||
| 157 | /// Free | ||
| 158 | DFUState_Free, | ||
| 159 | }; | ||
| 160 | |||
| 161 | |||
| 162 | /** | ||
| 163 | DFU error block | ||
| 164 | |||
| 165 | @param error DFUError enum | ||
| 166 | */ | ||
| 167 | typedef void (^DFUErrorBlock)(DFUError error); | ||
| 168 | |||
| 169 | /** | ||
| 170 | Device firmware information block | ||
| 171 | |||
| 172 | @param deviceFirmwareInfo DFUDeviceFirmwareInfo object | ||
| 173 | */ | ||
| 174 | typedef void (^QueryDeviceFirmwareInfoSuccessBlock)(DFUDeviceFirmwareInfo *deviceFirmwareInfo); | ||
| 175 | |||
| 176 | /** | ||
| 177 | Server firmware information block | ||
| 178 | |||
| 179 | @param serverFirmwareInfo DFUServerFirmwareInfo object | ||
| 180 | */ | ||
| 181 | typedef void (^QueryServerFirmwareInfoSuccessBlock)(DFUServerFirmwareInfo *serverFirmwareInfo); | ||
| 182 | |||
| 183 | /** | ||
| 184 | Download firmware file success block | ||
| 185 | |||
| 186 | @param firmwareIdentifier firmware ID | ||
| 187 | */ | ||
| 188 | typedef void (^DownloadFirmwareSuccessBlock)(NSString *firmwareIdentifier); | ||
| 189 | |||
| 190 | /** | ||
| 191 | Download firmware file start block | ||
| 192 | */ | ||
| 193 | typedef void (^DownloadFirmwareStartBlock)(void); | ||
| 194 | |||
| 195 | /** | ||
| 196 | Download firmware file progress block | ||
| 197 | |||
| 198 | @param progress 0-100 | ||
| 199 | */ | ||
| 200 | typedef void (^DownloadFirmwareProgressBlock)(NSInteger progress); | ||
| 201 | |||
| 202 | /** | ||
| 203 | CancelDownloadFirmwareSuccessBlock | ||
| 204 | */ | ||
| 205 | typedef void (^CancelDownloadFirmwareSuccessBlock)(void); | ||
| 206 | |||
| 207 | /** | ||
| 208 | DeviceReplyCannotUpgradeBlock | ||
| 209 | |||
| 210 | @param reason DFUDeviceReplyCannotUpgradeReason enum | ||
| 211 | */ | ||
| 212 | typedef void(^DeviceReplyCannotUpgradeBlock)(DFUDeviceReplyCannotUpgradeReason reason); | ||
| 213 | |||
| 214 | /** | ||
| 215 | TransferBeginBlock | ||
| 216 | */ | ||
| 217 | typedef void(^TransferBeginBlock)(void); | ||
| 218 | |||
| 219 | /** | ||
| 220 | TransferProgressBlock | ||
| 221 | |||
| 222 | @param progress 0-100 | ||
| 223 | */ | ||
| 224 | typedef void(^TransferProgressBlock)(NSInteger progress); | ||
| 225 | |||
| 226 | /** | ||
| 227 | TransferSuccessBlock | ||
| 228 | |||
| 229 | @param writeMCUSpeed unit:bytes/second | ||
| 230 | */ | ||
| 231 | typedef void(^TransferSuccessBlock)(NSUInteger writeMCUSpeed); | ||
| 232 | |||
| 233 | /** | ||
| 234 | TransferResultBlock | ||
| 235 | |||
| 236 | @param type DFUTransmissionResultType enum | ||
| 237 | @param reason DFUPauseReason enum, -1 if type is DFUTransmissionResultType_Finish; | ||
| 238 | @param pauseLength 0-255s,-1 if type is DFUTransmissionResultType_Finish; | ||
| 239 | */ | ||
| 240 | typedef void(^TransferResultBlock)(DFUTransmissionResultType type,DFUPauseReason reason,NSInteger pauseLength); | ||
| 241 | |||
| 242 | /** | ||
| 243 | UpgradeSuccessBlock | ||
| 244 | */ | ||
| 245 | typedef void(^UpgradeSuccessBlock)(void); | ||
| 246 | |||
| 247 | /** | ||
| 248 | UpgradeFailBlock | ||
| 249 | |||
| 250 | @param reason DFUUpgradeFailReason enum | ||
| 251 | */ | ||
| 252 | typedef void(^UpgradeFailBlock)(DFUUpgradeFailReason reason); | ||
| 253 | |||
| 254 | /** | ||
| 255 | StopUpgradeSuccessBlock | ||
| 256 | */ | ||
| 257 | typedef void(^StopUpgradeSuccessBlock)(void); | ||
| 258 | |||
| 259 | /** | ||
| 260 | DeleteFirmwareSuccessBlock | ||
| 261 | */ | ||
| 262 | typedef void(^DeleteFirmwareSuccessBlock)(void); | ||
| 263 | |||
| 264 | #endif /* DFUMacro_h */ | ||
