Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os-example-mbed5-blinky by
package_api.h
00001 00002 #ifndef _MBED_PACK_INCLUDE_ 00003 #define _MBED_PACK_INCLUDE_ 00004 00005 #ifdef __cplusplus 00006 #define MBEDPACK_EXTERN extern "C" 00007 #else 00008 #define MBEDPACK_EXTERN extern 00009 #endif 00010 00011 #include "pack_include.h" 00012 #include <stdint.h> 00013 00014 /// 00015 /// all modules type can included in package 00016 /*typedef enum _module_type { 00017 ModuleTypeALL, 00018 ModuleTypeJS, 00019 ModuleTypeSO, 00020 ModuleTypeBIN, 00021 ModuleTypeJSON, 00022 ModuleTypeIMG 00023 } module_type_t; 00024 */ 00025 /// 00026 /// package type : a package can contain app, os or profile 00027 /*typedef enum _package_type { 00028 PackageTypeApp, 00029 PackageTypeOS, 00030 PackageTypeProfile, 00031 PackageTypeUnknown 00032 } package_type_t; 00033 */ 00034 /* 00035 typedef enum { 00036 false = 0, 00037 true 00038 } bool;*/ 00039 00040 00041 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00042 00043 00044 /** 00045 * verification init 00046 * 00047 * \return verification context if success, or NULL 00048 */ 00049 MBEDPACK_EXTERN void* mbed_verification_init(); 00050 00051 /** 00052 * verification update context 00053 * 00054 * \param ctx verification context 00055 * \param buffer data to update context 00056 * \param buffer_size data size 00057 */ 00058 MBEDPACK_EXTERN void mbed_verification_update_ctx(void* ctx, unsigned char* buffer, uint32_t buffer_size); 00059 00060 /** 00061 * verify 00062 * 00063 * \param ctx verification context 00064 * 00065 * \return 0 if success, or fail 00066 */ 00067 MBEDPACK_EXTERN int mbed_verification(void* ctx); 00068 00069 00070 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00071 00072 00073 /** 00074 * 00075 * package decompress 00076 * 00077 * \return decompress context 00078 */ 00079 MBEDPACK_EXTERN void* mbed_decompress_init(); 00080 00081 00082 /** 00083 * 00084 * package decompress process 00085 * 00086 * \param ctx decompress context 00087 * \param buffer data to decompress 00088 * \param bufferSZ buffer size 00089 * \param lFileHandle fs file index 00090 * 00091 * \return process state 00092 */ 00093 MBEDPACK_EXTERN int mbed_decompress_process(void * verify_cxt, void* ctx, unsigned char* buffer, uint32_t bufferSZ, struct IOtaUpdater *updater, void *update_cxt); 00094 00095 00096 /** 00097 * 00098 * package decompress uninit 00099 * 00100 * \param ctx decompress context 00101 * 00102 */ 00103 MBEDPACK_EXTERN void mbed_decompress_uninit(void* ctx); 00104 00105 00106 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00107 00108 00109 00110 /** 00111 * 00112 * package info collector init 00113 * 00114 * \return ctx collector context 00115 * 00116 */ 00117 MBEDPACK_EXTERN void* mbed_data_collector_init(unsigned char* filename); 00118 00119 00120 /** 00121 * 00122 * package info collector uninit 00123 * 00124 * \param ctx collector context 00125 * 00126 */ 00127 MBEDPACK_EXTERN void mbed_data_collector_uninit(void* ctx); 00128 00129 00130 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00131 00132 /** 00133 * get a certain type module count 00134 00135 * 00136 * \param ctx package context 00137 * \param type module type of js , bin or all 00138 * \return module count of a certain type if success, or 0 00139 */ 00140 MBEDPACK_EXTERN uint8_t pkg_get_module_count(void* ctx, module_type_t type); 00141 00142 00143 /** 00144 00145 * get module handle 00146 * 00147 * \param ctx package context 00148 * \param type module type of js , bin or all 00149 00150 * \param index index of module 00151 * \return module handle of a certain type if success, or 0 00152 */ 00153 MBEDPACK_EXTERN void* /*handle*/pkg_acquire_module(void* ctx, module_type_t type, int index); 00154 00155 00156 /** 00157 * release module handle 00158 * 00159 * \param handle module handle to release 00160 */ 00161 MBEDPACK_EXTERN void pkg_release_module(void* handle); 00162 00163 00164 /** 00165 * get module name 00166 * 00167 * \param handle module handle to operate module 00168 * \return module name if success, or NULL 00169 */ 00170 MBEDPACK_EXTERN const char* pkg_get_module_name(void* handle); 00171 00172 00173 /** 00174 * get module version : software version or hardware version 00175 * 00176 * \param handle module handle to operate module 00177 * \param hardware_version version caller cared 00178 * \return module version if success, or NULL 00179 */ 00180 MBEDPACK_EXTERN const char* pkg_get_module_version(void* handle, bool hardware_version); 00181 00182 00183 /** 00184 * get module offset and size, user can read module data from fs 00185 * 00186 * \param handle module handle to operate module 00187 * \param offset offset to the beginning of package 00188 * \param size module size if success or 0 00189 * \return 0 if success, or fail 00190 */ 00191 MBEDPACK_EXTERN int pkg_locate_module_data(void* handle, uint32_t* offset, uint32_t* size); 00192 00193 /** 00194 * get package name 00195 * 00196 * \param ctx package context 00197 * \param name package name 00198 * \param name_length length of name 00199 * \return 0 if success, 1 means no enough length buffer and return length need, or failed 00200 */ 00201 MBEDPACK_EXTERN int pkg_get_pkg_name(void* ctx, unsigned char* name, uint8_t* name_length); 00202 00203 /** 00204 * get package type 00205 * 00206 * \param ctx package context 00207 * \param type package type 00208 * \return 0 if success, or fail 00209 */ 00210 MBEDPACK_EXTERN int pkg_get_pkg_type(void* ctx, package_type_t* type); 00211 00212 #endif 00213 00214
Generated on Tue Jul 12 2022 16:28:53 by
1.7.2
