ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/IOtaUpdater.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | /* |
| TMBOY | 47:9e361da97763 | 2 | * IOtaUpdater.h |
| TMBOY | 47:9e361da97763 | 3 | * |
| TMBOY | 47:9e361da97763 | 4 | * Created on: 2016-7-15 |
| TMBOY | 47:9e361da97763 | 5 | * Author: duanlian01 |
| TMBOY | 47:9e361da97763 | 6 | */ |
| TMBOY | 47:9e361da97763 | 7 | |
| TMBOY | 47:9e361da97763 | 8 | #ifndef IOTAUPDATER_H_ |
| TMBOY | 47:9e361da97763 | 9 | #define IOTAUPDATER_H_ |
| TMBOY | 47:9e361da97763 | 10 | |
| TMBOY | 47:9e361da97763 | 11 | #define PACKAGE_NAME_LENGTH_MAX (15) |
| TMBOY | 47:9e361da97763 | 12 | #define PACKAGE_TYPE_OS 1 |
| TMBOY | 47:9e361da97763 | 13 | #define PACKAGE_TYPE_APP 2 |
| TMBOY | 47:9e361da97763 | 14 | #define PACKAGE_NO_UPDATE 0 |
| TMBOY | 47:9e361da97763 | 15 | #define PACKAGE_UPDATE 1 |
| TMBOY | 47:9e361da97763 | 16 | |
| TMBOY | 47:9e361da97763 | 17 | struct meta_data_basic_info{ |
| TMBOY | 47:9e361da97763 | 18 | char package_name[PACKAGE_NAME_LENGTH_MAX + 1]; |
| TMBOY | 47:9e361da97763 | 19 | unsigned char package_type; |
| TMBOY | 47:9e361da97763 | 20 | unsigned char package_update; |
| TMBOY | 47:9e361da97763 | 21 | }; |
| TMBOY | 47:9e361da97763 | 22 | |
| TMBOY | 47:9e361da97763 | 23 | |
| TMBOY | 47:9e361da97763 | 24 | #define MODULE_NAME_LENGTH_MAX (PACKAGE_NAME_LENGTH_MAX) |
| TMBOY | 47:9e361da97763 | 25 | #define MODULE_VERSION_LENGTH_MAX 15 |
| TMBOY | 47:9e361da97763 | 26 | #define HARDWARE_VERSION_LENGTH_MAX 15 |
| TMBOY | 47:9e361da97763 | 27 | #define MODULE_SIGNATURE_LENGTH 16 |
| TMBOY | 47:9e361da97763 | 28 | #define MODULE_TYPE_BIN 1 |
| TMBOY | 47:9e361da97763 | 29 | #define MODULE_NO_UPDATE 0 |
| TMBOY | 47:9e361da97763 | 30 | #define MODULE_UPDATE 1 |
| TMBOY | 47:9e361da97763 | 31 | |
| TMBOY | 47:9e361da97763 | 32 | struct module_info{ |
| TMBOY | 47:9e361da97763 | 33 | char module_name[MODULE_NAME_LENGTH_MAX + 1]; |
| TMBOY | 47:9e361da97763 | 34 | char module_version[MODULE_VERSION_LENGTH_MAX + 1]; |
| TMBOY | 47:9e361da97763 | 35 | char module_support_hw_version[HARDWARE_VERSION_LENGTH_MAX + 1]; |
| TMBOY | 47:9e361da97763 | 36 | unsigned char module_signature[MODULE_SIGNATURE_LENGTH]; |
| TMBOY | 47:9e361da97763 | 37 | unsigned int module_size; |
| TMBOY | 47:9e361da97763 | 38 | unsigned char module_type; |
| TMBOY | 47:9e361da97763 | 39 | unsigned char module_update; |
| TMBOY | 47:9e361da97763 | 40 | }; |
| TMBOY | 47:9e361da97763 | 41 | |
| TMBOY | 47:9e361da97763 | 42 | #define PACKAGE_INSTALL_PATH_MAX 255 |
| TMBOY | 47:9e361da97763 | 43 | struct meta_data_install_info{ |
| TMBOY | 47:9e361da97763 | 44 | char package_install_path[PACKAGE_INSTALL_PATH_MAX + 1]; |
| TMBOY | 47:9e361da97763 | 45 | unsigned int module_count; |
| TMBOY | 47:9e361da97763 | 46 | struct module_info *module_list; |
| TMBOY | 47:9e361da97763 | 47 | }; |
| TMBOY | 47:9e361da97763 | 48 | |
| TMBOY | 47:9e361da97763 | 49 | #define PACKAGE_VERSION_LENGTH MODULE_VERSION_LENGTH_MAX |
| TMBOY | 47:9e361da97763 | 50 | struct meta_data_update_info{ |
| TMBOY | 47:9e361da97763 | 51 | char package_version[PACKAGE_VERSION_LENGTH]; |
| TMBOY | 47:9e361da97763 | 52 | }; |
| TMBOY | 47:9e361da97763 | 53 | |
| TMBOY | 47:9e361da97763 | 54 | struct meta_data_extension{ |
| TMBOY | 47:9e361da97763 | 55 | unsigned int pair_count; |
| TMBOY | 47:9e361da97763 | 56 | char **keys; |
| TMBOY | 47:9e361da97763 | 57 | char **values; |
| TMBOY | 47:9e361da97763 | 58 | }; |
| TMBOY | 47:9e361da97763 | 59 | |
| TMBOY | 47:9e361da97763 | 60 | struct package_meta_data{ |
| TMBOY | 47:9e361da97763 | 61 | struct meta_data_basic_info basic_info; |
| TMBOY | 47:9e361da97763 | 62 | struct meta_data_install_info install_info; |
| TMBOY | 47:9e361da97763 | 63 | struct meta_data_update_info update_info; |
| TMBOY | 47:9e361da97763 | 64 | struct meta_data_extension extension_info; |
| TMBOY | 47:9e361da97763 | 65 | }; |
| TMBOY | 47:9e361da97763 | 66 | |
| TMBOY | 47:9e361da97763 | 67 | struct IOtaUpdater |
| TMBOY | 47:9e361da97763 | 68 | { |
| TMBOY | 47:9e361da97763 | 69 | int (*notify_data_begin)(); |
| TMBOY | 47:9e361da97763 | 70 | int (*notify_meta_data)(void *cxt, struct package_meta_data *meta); |
| TMBOY | 47:9e361da97763 | 71 | int (*notify_module_data)(void *cxt, unsigned int offset, unsigned char *data, unsigned int size); |
| TMBOY | 47:9e361da97763 | 72 | int (*notify_data_end)(); |
| TMBOY | 47:9e361da97763 | 73 | int (*update_img_begin)(); |
| TMBOY | 47:9e361da97763 | 74 | int (*update_img)(); |
| TMBOY | 47:9e361da97763 | 75 | int (*update_img_end)(); |
| TMBOY | 47:9e361da97763 | 76 | }; |
| TMBOY | 47:9e361da97763 | 77 | |
| TMBOY | 47:9e361da97763 | 78 | #endif /* IOTAUPDATER_H_ */ |
