ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1
TMBOY 47:9e361da97763 2 #ifndef _MBED_PACK_DATAC_
TMBOY 47:9e361da97763 3 #define _MBED_PACK_DATAC_
TMBOY 47:9e361da97763 4
TMBOY 47:9e361da97763 5 #include "pack_include.h"
TMBOY 47:9e361da97763 6 #include "cJSON.h"
TMBOY 47:9e361da97763 7
TMBOY 47:9e361da97763 8
TMBOY 47:9e361da97763 9 /**
TMBOY 47:9e361da97763 10 *
TMBOY 47:9e361da97763 11 * build meta.json data object
TMBOY 47:9e361da97763 12 *
TMBOY 47:9e361da97763 13 * \return ctx to collect package data
TMBOY 47:9e361da97763 14 *
TMBOY 47:9e361da97763 15 */
TMBOY 47:9e361da97763 16 void* mbed_build_pck_config_block(unsigned char* filename);
TMBOY 47:9e361da97763 17
TMBOY 47:9e361da97763 18
TMBOY 47:9e361da97763 19 /**
TMBOY 47:9e361da97763 20 *
TMBOY 47:9e361da97763 21 * destory meta.json data object
TMBOY 47:9e361da97763 22 *
TMBOY 47:9e361da97763 23 * \param ctx to collect package data
TMBOY 47:9e361da97763 24 *
TMBOY 47:9e361da97763 25 */
TMBOY 47:9e361da97763 26 void mbed_destroy_pck_config_block(meta_info_t* ctx);
TMBOY 47:9e361da97763 27
TMBOY 47:9e361da97763 28
TMBOY 47:9e361da97763 29 /**
TMBOY 47:9e361da97763 30 * pre-build module, init for extract module from package
TMBOY 47:9e361da97763 31 *
TMBOY 47:9e361da97763 32 * \param meta_object meta.json object decompress from package
TMBOY 47:9e361da97763 33 * \param module_info module info extracted from package by parse meta.json
TMBOY 47:9e361da97763 34 * \param index index of module record in record
TMBOY 47:9e361da97763 35 * \return 0 if success, or failed
TMBOY 47:9e361da97763 36 */
TMBOY 47:9e361da97763 37 int mbed_prebuild_module(cJSON* meta_object, module_info_t* module_info, uint8_t index);
TMBOY 47:9e361da97763 38
TMBOY 47:9e361da97763 39 /**
TMBOY 47:9e361da97763 40 * post-build module, uninit for extract module from package
TMBOY 47:9e361da97763 41 *
TMBOY 47:9e361da97763 42 * \param module module info extracted from package by parse meta.json
TMBOY 47:9e361da97763 43 */
TMBOY 47:9e361da97763 44 void mbed_postbuild_module(module_info_t* module);
TMBOY 47:9e361da97763 45
TMBOY 47:9e361da97763 46 /**
TMBOY 47:9e361da97763 47 * main operation of decompressing package
TMBOY 47:9e361da97763 48 *
TMBOY 47:9e361da97763 49 * \param package_bin original data of package
TMBOY 47:9e361da97763 50 * \param package_bin_size original package size
TMBOY 47:9e361da97763 51 * \return 0 if success, or failed
TMBOY 47:9e361da97763 52 */
TMBOY 47:9e361da97763 53 //int mbed_decompress(decompress_info_t* decompress_info, unsigned char* package_bin, uint32_t package_bin_size);
TMBOY 47:9e361da97763 54
TMBOY 47:9e361da97763 55 /**
TMBOY 47:9e361da97763 56 * get module count by parse meta.json
TMBOY 47:9e361da97763 57 *
TMBOY 47:9e361da97763 58 * \param meta_object meta.json object
TMBOY 47:9e361da97763 59 * \param type the type caller want to get
TMBOY 47:9e361da97763 60 * \return if successful retrun module count, or return -1
TMBOY 47:9e361da97763 61 */
TMBOY 47:9e361da97763 62 uint8_t mbed_get_module_num(cJSON* meta_object, module_type_t type);
TMBOY 47:9e361da97763 63
TMBOY 47:9e361da97763 64 /**
TMBOY 47:9e361da97763 65 * get module info from meta.json and modules array data
TMBOY 47:9e361da97763 66 *
TMBOY 47:9e361da97763 67 * \param meta_data meta.json data
TMBOY 47:9e361da97763 68 * \param module_begin_offset, modules begin offset from package
TMBOY 47:9e361da97763 69 * \param module_info used for store signle module info
TMBOY 47:9e361da97763 70 * \param index index of module in modules array
TMBOY 47:9e361da97763 71 * \return 0 if success, or failed
TMBOY 47:9e361da97763 72 */
TMBOY 47:9e361da97763 73 int mbed_get_module_info(cJSON* meta_object, uint32_t module_begin_offset, module_info_t* module_info, uint8_t index);
TMBOY 47:9e361da97763 74
TMBOY 47:9e361da97763 75 /**
TMBOY 47:9e361da97763 76 * get module info from meta.json and modules array data
TMBOY 47:9e361da97763 77 *
TMBOY 47:9e361da97763 78 * \param meta_data meta.json data
TMBOY 47:9e361da97763 79 * \param name package name
TMBOY 47:9e361da97763 80 *\ param name_len length of name
TMBOY 47:9e361da97763 81 * \return 0 if success, or failed
TMBOY 47:9e361da97763 82 */
TMBOY 47:9e361da97763 83 int mbed_get_pkg_name(cJSON* meta_object, unsigned char* name, uint8_t* name_len);
TMBOY 47:9e361da97763 84
TMBOY 47:9e361da97763 85 /**
TMBOY 47:9e361da97763 86 * get package type info from meta.json
TMBOY 47:9e361da97763 87 *
TMBOY 47:9e361da97763 88 * \param meta_data meta.json data
TMBOY 47:9e361da97763 89 * \param type package type
TMBOY 47:9e361da97763 90 * \return 0 if success, or failed
TMBOY 47:9e361da97763 91 */
TMBOY 47:9e361da97763 92 int mbed_get_pkg_type(cJSON* meta_object, package_type_t* type);
TMBOY 47:9e361da97763 93
TMBOY 47:9e361da97763 94
TMBOY 47:9e361da97763 95 #endif
TMBOY 47:9e361da97763 96