bot_errno.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. /**
  2. * @file bot_errno.h
  3. * @brief bot error number header file
  4. *
  5. * @copyright Copyright (C) 2015-2022 Ant Group Holding Limited
  6. */
  7. #ifndef __BOT_ERRNO_H__
  8. #define __BOT_ERRNO_H__
  9. #include "bot_typedef.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /* -------------- General Error Code --------------------------- */
  14. #define BOT_EMAAS_OK 0 /**< There is no error */
  15. #define BOT_EMAAS_ERROR -1 /**< A generic error happens */
  16. #define BOT_EMAAS_NOMEM -2 /**< No memory */
  17. #define BOT_EMAAS_INVAL -3 /**< Invalid argument */
  18. /* ------------------------------------------------------------ */
  19. /* -------------- Components&Service Error Code -----------------*/
  20. #define BOT_ETYPE_NORMAL (0x00U << 24)
  21. #define BOT_ETYPE_WARN (0x01U << 24)
  22. #define BOT_ETYPE_ERROR (0x02U << 24)
  23. #define BOT_ETYPE_FATAL (0x03U << 24)
  24. /* The MID represent each module */
  25. typedef enum {
  26. BOT_MID_COMP_AT = 0x00, /* AT component. */
  27. BOT_MID_COMP_CRYPTO = 0x01, /* Crypto component. */
  28. BOT_MID_COMP_GNSS = 0x02, /* GNSS component. */
  29. BOT_MID_COMP_KV = 0x03, /* KV component. */
  30. BOT_MID_COMP_LOG = 0x04, /* LOG component. */
  31. BOT_MID_COMP_MEM = 0x05, /* MEM component. */
  32. BOT_MID_COMP_NET = 0x06, /* NET component. */
  33. BOT_MID_COMP_TLV = 0x07, /* TLV component. */
  34. BOT_MID_COMP_UTILS = 0x08, /* UTILS component. */
  35. BOT_MID_COMP_CHAIN = 0x09, /* UTILS component. */
  36. BOT_MID_SRV_DTC = 0x30, /* Service : Data to Cloud/Chain*/
  37. BOT_MID_SRV_NTP = 0x31, /* Service : NTP*/
  38. BOT_MID_MAX
  39. } bot_module_id;
  40. /* ------ Coin Macros for three Comp&Service Error Code segments. -------*/
  41. /* Define bot fatal error, 32-bit unsigned integer error code */
  42. #define BOT_ERRNO_FATAL(MID, ERRNO) \
  43. (-(BOT_ETYPE_FATAL | ((uint32_t)(MID) << 16) | ((uint32_t)(ERRNO))))
  44. /* Define bot critical error, 32-bit unsigned integer error code */
  45. #define BOT_ERRNO_ERROR(MID, ERRNO) \
  46. (-(BOT_ETYPE_ERROR | ((uint32_t)(MID) << 16) | ((uint32_t)(ERRNO))))
  47. /* Define bot warn, 32-bit unsigned integer error code */
  48. #define BOT_ERRNO_WARN(MID, ERRNO) \
  49. (-(BOT_ETYPE_WARN | ((uint32_t)(MID) << 16) | ((uint32_t)(ERRNO))))
  50. /* Define bot info, 32-bit unsigned integer error code */
  51. #define BOT_ERRNO_NORMAL(MID, ERRNO) \
  52. (-(BOT_ETYPE_NORMAL | ((uint32_t)(MID) << 16) | ((uint32_t)(ERRNO))))
  53. /* -------------------------------------------------------------------- */
  54. /* It's a helper macro for record log, post to clond, etc. */
  55. #define __BOT_ERROR_HANDLER(para1, para2, func, line) \
  56. BOT_LOGE(" [Func: %s] [Line: %d] 0X%08X 0X%08X\r\n",func, line, para1, para2)
  57. #define __BOT_ERROR_RET_INT(errno, para1, para2, func, line) \
  58. do{ \
  59. __BOT_ERROR_HANDLER(para1, para2, func, line); \
  60. return errno; \
  61. }while(0)
  62. #define __BOT_ERROR_RET_VOID(para1, para2, func, line) \
  63. do{ \
  64. __BOT_ERROR_HANDLER(para1, para2, func, line); \
  65. return;\
  66. }while(0)
  67. #define __BOT_ERROR_RECORD(para1, para2, func, line) \
  68. do{ \
  69. __BOT_ERROR_HANDLER(para1, para2, func, line); \
  70. }while(0)
  71. /*
  72. * Error Handle Macros . Record and return errcode.
  73. * @errno: errcode. signed interger.
  74. * @para1: user's parameter, signed integer.
  75. * @para2: user's parameter, signed integer.
  76. */
  77. #define BOT_ERROR_RET_INT(errno, para1, para2) __BOT_ERROR_RET_INT(errno, para1, para2, __func__, __LINE__)
  78. /*
  79. * Error Handle Macros . Record and return void.
  80. * @para1: user's parameter, signed integer.
  81. * @para2: user's parameter, signed integer.
  82. */
  83. #define BOT_ERROR_RET_VOID(para1, para2) __BOT_ERROR_RET_VOID(para1, para2, __func__, __LINE__)
  84. /*
  85. * Error Handle Macros . Record only.
  86. * @para1: user's parameter, signed integer.
  87. * @para2: user's parameter, signed integer.
  88. */
  89. #define BOT_ERROR_RECORD(para1, para2) __BOT_ERROR_RECORD(para1, para2, __func__, __LINE__)
  90. /*
  91. * Assert-like macro to check, record and return errcode (for example, interface's return-code).
  92. * @pred: predicate (for example, ret!=0, ret!=NULL, a>b, etc.)
  93. * @ret: the return-code of checked interface or other variables.
  94. * @para1: user's parameter, signed integer.
  95. * @para2: user's parameter, signed integer.
  96. */
  97. #define BOT_ERROR_PARA_RETINT_ASSERT(pred, ret, para1, para2) \
  98. if (pred){ \
  99. __BOT_ERROR_HANDLER(para1, para2, __func__, __LINE__); \
  100. return ret; \
  101. }
  102. /*
  103. * Assert-like macro to check, record and return void.
  104. * @pred: predicate (for example, ret!=0, ret!=NULL, a>b, etc.)
  105. * @para1: user's parameter, signed integer.
  106. * @para2: user's parameter, signed integer.
  107. */
  108. #define BOT_ERROR_PARA_RETVOID_ASSERT(pred, para1, para2) \
  109. if (pred) { \
  110. __BOT_ERROR_HANDLER(para1, para2, __func__, __LINE__); \
  111. return; \
  112. }
  113. /*
  114. * Assert-like macro to check, record but not return .
  115. * @pred: predicate (for example, ret!=0, ret!=NULL, a>b, etc.)
  116. * @para1: user's parameter, signed integer.
  117. * @para2: user's parameter, signed integer.
  118. */
  119. #define BOT_ERROR_PARA_RECORD_ASSERT(pred, para1, para2) \
  120. if (pred) { \
  121. __BOT_ERROR_HANDLER(para1, para2, __func__, __LINE__); \
  122. }
  123. /*
  124. * Example:
  125. * =======>
  126. * ret = bot_device_register_adv_check(...);
  127. * if (ret != BOT_EMAAS_OK){
  128. * BOT_LOGE("bot_device_register_adv_check fail %d \r\n", ret);
  129. return ret;
  130. * }
  131. * =======>
  132. * ret = bot_device_register_adv_check(...);
  133. * BOT_ERROR_STR_RETINT_ASSERT(ret, "bot_device_register_adv_check fail");
  134. */
  135. /*
  136. * Assert-like macro to check, record and return errcode if "if statement" is true.
  137. * @ret: the return-code of checked interface or other variables.
  138. * @desc: the description of ret that is a errcode.
  139. */
  140. #define BOT_ERROR_STR_RETINT_ASSERT(ret, desc) \
  141. if (ret != BOT_EMAAS_OK){ \
  142. BOT_LOGE(" [Func: %s] [Line: %d] %s\r\n",__func__, __LINE__, desc); \
  143. return ret; \
  144. }
  145. /*
  146. * Assert-like macro to check, record and return void if "if statement" is true.
  147. * @ret: the return-code of checked interface or other variables.
  148. * @desc: the description of ret that is a errcode.
  149. */
  150. #define BOT_ERROR_STR_RETVOID_ASSERT(ret, desc) \
  151. if (ret != BOT_EMAAS_OK){ \
  152. BOT_LOGE("[Func: %s] [Line: %d] %s\r\n",__func__, __LINE__, desc); \
  153. return; \
  154. }
  155. /*
  156. * Assert-like macro to check, record but not return if "if statement" is true.
  157. * @ret: the return-code of checked interface or other variables.
  158. * @desc: the description of ret that is a errcode.
  159. */
  160. #define BOT_ERROR_STR_RECORD_ASSERT(ret, desc) \
  161. if (ret != BOT_EMAAS_OK){ \
  162. BOT_LOGE("[Func: %s] [Line: %d] %s\r\n",__func__, __LINE__, desc); \
  163. }
  164. /* -------------------------------------------------------------------------------*/
  165. /*
  166. * Name Format: BOT_E<MODULE_NAME>_<ERRCODE_NAME> .
  167. */
  168. /* -------------------------- AT Components Errcode ------------------------------*/
  169. #define BOT_EAT_OK BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0000) /* -0x02000000 */
  170. #define BOT_EAT_PARA_NULL BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0001) /* -0x02000001 */
  171. #define BOT_EAT_NUM_INV BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0002) /* -0x02000002 */
  172. #define BOT_EAT_CMD_INV BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0003) /* -0x02000003 */
  173. #define BOT_EAT_UART_INIT BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0004) /* -0x02000004 */
  174. #define BOT_EAT_UART_CB_REG BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0005) /* -0x02000005 */
  175. #define BOT_EAT_CMD_CB_REG BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0006) /* -0x02000006 */
  176. #define BOT_EAT_TASK_CRT_FAIL BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0007) /* -0x02000007 */
  177. #define BOT_EAT_RE_INITIALIZE BOT_ERRNO_ERROR(BOT_MID_COMP_AT, 0X0008) /* -0x02000008 */
  178. /* -------------------------------------------------------------------------------*/
  179. /* ------------------------- CRYPTO Components Errcode -------------------------- */
  180. /* The ECDSA key input parameters are not complete */
  181. #define BOT_ECRYPTO_KEYGEN_NULL BOT_ERRNO_ERROR(BOT_MID_COMP_CRYPTO, 0X0000) /* -0x02010000 */
  182. /* Failed to generate the ECDSA key */
  183. #define BOT_ECRYPTO_KEYGEN BOT_ERRNO_ERROR(BOT_MID_COMP_CRYPTO, 0X0001) /* -0x02010001 */
  184. /* Failed to generate the ECDSA signature */
  185. #define BOT_ECRYPTO_SIGNGEN BOT_ERRNO_ERROR(BOT_MID_COMP_CRYPTO, 0X0002) /* -0x02010002 */
  186. /* The input type error which is not in keypair and signature */
  187. #define BOT_ECRYPTO_DATA_TYPE BOT_ERRNO_ERROR(BOT_MID_COMP_CRYPTO, 0X0003) /* -0x02010003 */
  188. /* Failed to save keypair or signature file */
  189. #define BOT_ECRYPTO_SAVE_FILE BOT_ERRNO_ERROR(BOT_MID_COMP_CRYPTO, 0X0004) /* -0x02010004 */
  190. /* Failed to read keypair or signature file */
  191. #define BOT_ECRYPTO_READ_FILE BOT_ERRNO_ERROR(BOT_MID_COMP_CRYPTO, 0X0005) /* -0x02010005 */
  192. /* Output is NULL */
  193. #define BOT_ECRYPTO_OUTPUT_NULL BOT_ERRNO_ERROR(BOT_MID_COMP_CRYPTO, 0X0006) /* -0x02010006 */
  194. /* -------------------------------------------------------------------------------*/
  195. /* ------------------------- GNSS Components Errcode ---------------------------- */
  196. //#define BOT_EGNSS_XX BOT_ERRNO_ERROR(BOT_MID_COMP_GNSS, 0X0001) /* -0x02020001 */
  197. //#define BOT_EGNSS_YY BOT_ERRNO_ERROR(BOT_MID_COMP_GNSS, 0X0002) /* -0x02020002 */
  198. /* -------------------------------------------------------------------------------*/
  199. /* ------------------------- KV Components Errcode ------------------------------ */
  200. /* The space is out of range */
  201. #define BOT_EKV_NO_SPACE BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0001) /* -0x02030001 */
  202. /* The parameter is invalid */
  203. #define BOT_EKV_INVALID_PARAM BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0002) /* -0x02030002 */
  204. /* The os memory malloc error */
  205. #define BOT_EKV_MALLOC_FAILED BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0003) /* -0x02030003 */
  206. /* Could not found the item */
  207. #define BOT_EKV_NOT_FOUND BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0004) /* -0x02030004 */
  208. /* The flash read operation error */
  209. #define BOT_EKV_FLASH_READ BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0005) /* -0x02030005 */
  210. /* The flash write operation error */
  211. #define BOT_EKV_FLASH_WRITE BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0006) /* -0x02030006 */
  212. /* The flash erase operation error */
  213. #define BOT_EKV_FLASH_ERASE BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0007) /* -0x02030007 */
  214. /* The error related to os lock */
  215. #define BOT_EKV_OS_LOCK BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0008) /* -0x02030008 */
  216. /* The error related to os semaphose */
  217. #define BOT_EKV_OS_SEM BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0009) /* -0x02030009 */
  218. /* Data encryption error */
  219. #define BOT_EKV_ENCRYPT BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X000A) /* -0x0203000A */
  220. /* Data decryption error */
  221. #define BOT_EKV_DECRYPT BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X000B) /* -0x0203000B */
  222. /* The function is not support yet */
  223. #define BOT_EKV_NOT_SUPPORT BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X000C) /* -0x0203000C */
  224. /* File open fail */
  225. #define BOT_EKV_FILE_OPEN BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X000D) /* -0x0203000D */
  226. /* File read fail */
  227. #define BOT_EKV_FILE_READ BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X000E) /* -0x0203000E */
  228. /* File write fail */
  229. #define BOT_EKV_FILE_WRITE BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X000F) /* -0x0203000F */
  230. /* File seek fail */
  231. #define BOT_EKV_FILE_SEEK BOT_ERRNO_ERROR(BOT_MID_COMP_KV, 0X0010) /* -0x02030010 */
  232. /* ------------------------------------------------------------------------------ */
  233. /* ------------------------- LOG Components Errcode ----------------------------- */
  234. //#define BOT_ELOG_XX BOT_ERRNO_ERROR(BOT_MID_COMP_LOG, 0X0001) /* -0x02040001 */
  235. //#define BOT_ELOG_YY BOT_ERRNO_ERROR(BOT_MID_COMP_LOG, 0X0002) /* -0x02040002 */
  236. /* ------------------------------------------------------------------------------ */
  237. /* ------------------------- MEM Components Errcode ----------------------------- */
  238. /* mem module mem infomation get failed */
  239. #define BOT_EMEM_INFO_GET BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0001) /* -0x02050001 */
  240. /* mem module infomation with invalid para */
  241. #define BOT_EMEM_INFO_PARA BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0002) /* -0x02050002 */
  242. /* mem module init len invalid */
  243. #define BOT_EMEM_INIT_LEN_INV BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0003) /* -0x02050003 */
  244. /* mem module region add len invalid */
  245. #define BOT_EMEM_REGION_ADD_LEN_INV BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0004) /* -0x02050004 */
  246. /* mem module alloc size zero */
  247. #define BOT_EMEM_ALLOC_SIZE_ZERO BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0005) /* -0x02050005 */
  248. /* mem module alloc size invalid */
  249. #define BOT_EMEM_ALLOC_SIZE_INV BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0006) /* -0x02050006 */
  250. /* mem module partition head invalid */
  251. #define BOT_EMEM_PT_HEAD_INV BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0007) /* -0x02050007 */
  252. /* mem module no valid mem block */
  253. #define BOT_EMEM_NO_VALID_BLK BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0008) /* -0x02050008 */
  254. /* mem module free ptr is NULL */
  255. #define BOT_EMEM_FREE_PTR_NULL BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X0009) /* -0x02050009 */
  256. /* mem module realloc size invalid */
  257. #define BOT_EMEM_REALLOC_SIZE_INV BOT_ERRNO_ERROR(BOT_MID_COMP_MEM, 0X000A) /* -0x0205000A */
  258. /* ------------------------------------------------------------------------------ */
  259. /* ------------------------- NET Componnets Errcode ----------------------------- */
  260. /* network module imei id get failed */
  261. #define BOT_ENET_MQTT_PARAMETER_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0001) /* -0x02060001 */
  262. /* network module mqtt data model init failed */
  263. #define BOT_ENET_MQTT_DM_INIT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0002) /* -0x02060002 */
  264. /* network module mqtt init failed */
  265. #define BOT_ENET_MQTT_INIT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0003) /* -0x02060003 */
  266. /* network module mqtt connect failed */
  267. #define BOT_ENET_MQTT_CONNECT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0004) /* -0x02060004 */
  268. /* network module mqtt disconnect failed */
  269. #define BOT_ENET_MQTT_DISCONNECT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0005) /* -0x02060005 */
  270. /* network module mqtt send data failed */
  271. #define BOT_ENET_MQTT_SEND_DATA_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0006) /* -0x02060006 */
  272. /* network module json create failed */
  273. #define BOT_ENET_JSON_CREATE_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0007) /* -0x02060007 */
  274. /* network module json get failed */
  275. #define BOT_ENET_JSON_GET_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0008) /* -0x02060008 */
  276. /* network module json parse failed */
  277. #define BOT_ENET_JSON_PARSE_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0009) /* -0x02060009 */
  278. /* network module dynamic registration init failed */
  279. #define BOT_ENET_DYNREG_INIT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X000A) /* -0x0206000A */
  280. /* network module dynamic registration deinit failed */
  281. #define BOT_ENET_DYNREG_DEINIT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X000B) /* -0x0206000B */
  282. /* network module dynamic registration send failed */
  283. #define BOT_ENET_DYNREG_SEND_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X000C) /* -0x0206000C */
  284. /* network module dynamic registration receive failed */
  285. #define BOT_ENET_DYNREG_RECV_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X000D) /* -0x0206000D */
  286. /* network module dynamic registration already */
  287. #define BOT_ENET_DYNREG_ALREADY_REG BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X000E) /* -0x0206000E */
  288. /* network module coap init failed */
  289. #define BOT_ENET_COAP_INIT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X000F) /* -0x0205000F */
  290. /* network module coap connect failed */
  291. #define BOT_ENET_COAP_CONNECT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0010) /* -0x02050010 */
  292. /* network module coap disconnect failed */
  293. #define BOT_ENET_COAP_DISCONNECT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0011) /* -0x02050011 */
  294. /* network module coap send data failed */
  295. #define BOT_ENET_COAP_SEND_DATA_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0012) /* -0x02050012 */
  296. /* network module coap request auth token filed */
  297. #define BOT_ENET_COAP_AUTH_TOKEN_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_NET, 0X0013) /* -0x02050013 */
  298. /* ------------------------------------------------------------------------------ */
  299. /* ------------------------- TLV Components Errcode ----------------------------- */
  300. /* TLV module put object failed */
  301. #define BOT_ETLV_PUT_OBJ BOT_ERRNO_ERROR(BOT_MID_COMP_TLV, 0X0001) /* -0x02070001 */
  302. /* TLV module key list add failed, key is already existed */
  303. #define BOT_ETLV_KEY_LIST_ADD BOT_ERRNO_ERROR(BOT_MID_COMP_TLV, 0X0002) /* -0x02070002 */
  304. /* TLV module serialize failed */
  305. #define BOT_ETLV_SERIALIZE BOT_ERRNO_ERROR(BOT_MID_COMP_TLV, 0X0003) /* -0x02070003 */
  306. /* TLV module key node get failed, node is not found */
  307. #define BOT_ETLV_KEY_LIST_NODE_GET BOT_ERRNO_ERROR(BOT_MID_COMP_TLV, 0X0004) /* -0x02070004 */
  308. /* TLV module get bytes failed */
  309. #define BOT_ETLV_BOX_GET_BYTES BOT_ERRNO_ERROR(BOT_MID_COMP_TLV, 0X0005) /* -0x02070005 */
  310. /* TLV module get types failed */
  311. #define BOT_ETLV_BOX_GET_TYPES BOT_ERRNO_ERROR(BOT_MID_COMP_TLV, 0X0006) /* -0x02070006 */
  312. /* TLV create failed */
  313. #define BOT_ETLV_CREATE_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_TLV, 0X0007) /* -0x02070007 */
  314. /* ------------------------------------------------------------------------------ */
  315. /* ------------------------- UTILS Components Errcode --------------------------- */
  316. /* utils get current time fail */
  317. #define BOT_EUTILS_CUR_TIME_GET BOT_ERRNO_ERROR(BOT_MID_COMP_UTILS, 0X0001) /* -0x02080001 */
  318. /* utils gmtime fail */
  319. #define BOT_EUTILS_GMTIME BOT_ERRNO_ERROR(BOT_MID_COMP_UTILS, 0X0002) /* -0x02080002 */
  320. /* ------------------------------------------------------------------------------ */
  321. /* ------------------------- CHAIN Components Errcode --------------------------- */
  322. /* chain module get ecc curve fail */
  323. #define BOT_ECHAIN_ALG_TYPE_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0003) /* -0x02080003 */
  324. /* chain module sign with ecc fail */
  325. #define BOT_ECHAIN_ECC_SIGN_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0004) /* -0x02080004 */
  326. /* chain module get random number fail */
  327. #define BOT_ECHAIN_RAND_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0005) /* -0x02080005 */
  328. /* chain module net connect fail */
  329. #define BOT_ECHAIN_NET_CONNECT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0010) /* -0x02080010 */
  330. /* chain module net send fail */
  331. #define BOT_ECHAIN_NET_SEND_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0011) /* -0x02080011 */
  332. /* chain module net receive fail */
  333. #define BOT_ECHAIN_NET_RECV_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0012) /* -0x02080012 */
  334. /* chain module packet head get fail */
  335. #define BOT_ECHAIN_HEAD_RECV_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0013) /* -0x02080013 */
  336. /* chain module packet head verify fail */
  337. #define BOT_ECHAIN_HEAD_VERIFY_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0014) /* -0x02080014 */
  338. /* chain module handshake fail */
  339. #define BOT_ECHAIN_HANDSHAKE_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0015) /* -0x02080015 */
  340. /* chain module response return error */
  341. #define BOT_ECHAIN_RESP_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0020) /* -0x02080020 */
  342. /* chain module recepit return error */
  343. #define BOT_ECHAIN_RECEPIT_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0021) /* -0x02080021 */
  344. /* chain module transaction response parse fail */
  345. #define BOT_ECHAIN_TRANS_RESP_PARSE_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0022) /* -0x02080022 */
  346. /* chain module deposit data fail */
  347. #define BOT_ECHAIN_DEPOSIT_DATA_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0023) /* -0x02080023 */
  348. /* chain module message not defined */
  349. #define BOT_ECHAIN_NO_DEFINED_MSG BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0024) /* -0x02080024 */
  350. /* chain module transaction parse fail */
  351. #define BOT_ECHAIN_TRANS_PARSE_ERR BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0025) /* -0x02080025 */
  352. /* chain module data to be deposited is too long*/
  353. #define BOT_ECHAIN_TRANS_DATA_OVERSIZE BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0026) /* -0x02080026 */
  354. /* chain module rlp decode fail, too few itms */
  355. #define BOT_ECHAIN_MISSING_ITEMS BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0027) /* -0x02080027 */
  356. /* chain module response type mimatch */
  357. #define BOT_ECHAIN_RESP_TYPE_MISMATCH BOT_ERRNO_ERROR(BOT_MID_COMP_CHAIN, 0X0028) /* -0x02080028 */
  358. /* ------------------------------------------------------------------------------ */
  359. /* ------------------------- DTC Service Errcode -------------------------------- */
  360. /* zero config encryption flag bit is abnormal */
  361. #define BOT_EDTC_CONFIG_FLAG BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0200) /* -0x02300200 */
  362. /* zero config disable */
  363. #define BOT_EDTC_CONFIG_DISABLE BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0201) /* -0x02300201 */
  364. /* zero config handler not found */
  365. #define BOT_EDTC_CONFIG_HANDLER BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0202) /* -0x02300202 */
  366. /* zero config invalid pk */
  367. #define BOT_EDTC_CONFIG_PK BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0203) /* -0x02300203 */
  368. /* zero config set pk fail */
  369. #define BOT_EDTC_CONFIG_SET_PK BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0204) /* -0x02300204 */
  370. /* zero config invalid ps */
  371. #define BOT_EDTC_CONFIG_PS BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0205) /* -0x02300205 */
  372. /* zero config set ps fail */
  373. #define BOT_EDTC_CONFIG_SET_PS BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0206) /* -0x02300206 */
  374. /* zero config get pk fail */
  375. #define BOT_EDTC_CONFIG_GET_PK BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0207) /* -0x02300207 */
  376. /* zero config get ps fail */
  377. #define BOT_EDTC_CONFIG_GET_PS BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0208) /* -0x02300208 */
  378. /* zero config get array size too small */
  379. #define BOT_EDTC_CONFIG_GET_BUF BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0209) /* -0x02300209 */
  380. /* zero config invalid pn(product name) */
  381. #define BOT_EDTC_CONFIG_PN BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X020A) /* -0x0230020A */
  382. /* zero config set pn fail */
  383. #define BOT_EDTC_CONFIG_SET_PN BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X020B) /* -0x0230020B */
  384. /* zero config get pn fail */
  385. #define BOT_EDTC_CONFIG_GET_PN BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X020C) /* -0x0230020C */
  386. /* zero config repeat */
  387. #define BOT_EDTC_CONFIG_REPEAT BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X020D) /* -0x0230020D */
  388. /* zero config decrypto fail */
  389. #define BOT_EDTC_CONFIG_DECRYPTO BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X020E) /* -0x0230020E */
  390. /* zero config encrypto fail */
  391. #define BOT_EDTC_CONFIG_ENCRYPTO BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X020F) /* -0x0230020F */
  392. /* zero config decode fail */
  393. #define BOT_EDTC_CONFIG_DECODE BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0210) /* -0x02300210 */
  394. /* zero config encode fail */
  395. #define BOT_EDTC_CONFIG_ENCODE BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0211) /* -0x02300211 */
  396. /* zero config encode fail */
  397. #define BOT_EDTC_CONFIG_CRC_CHECK BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0212) /* -0x02300212 */
  398. /* zero config encode fail */
  399. #define BOT_EDTC_CONFIG_SEM_CREAT BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0213) /* -0x02300213 */
  400. /* zero config device info init fail */
  401. #define BOT_EDTC_CONFIG_DEV_INFO BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0214) /* -0x02300214 */
  402. /* zero config init fail */
  403. #define BOT_EDTC_CONFIG_INIT BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0215) /* -0x02300215 */
  404. /* zero config invalid instance id */
  405. #define BOT_EDTC_CONFIG_IID BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0216) /* -0x02300216 */
  406. /* zero config set instance id fail */
  407. #define BOT_EDTC_CONFIG_SET_IID BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0217) /* -0x02300217 */
  408. /* zero config get instance id fail */
  409. #define BOT_EDTC_CONFIG_GET_IID BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0218) /* -0x02300218 */
  410. /* The asset ID format is incorrect */
  411. #define BOT_EDTC_ASSET_ID BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0300) /* -0x02300300 */
  412. /* The asset Type format is incorrect */
  413. #define BOT_EDTC_ASSET_TYPE BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0301) /* -0x02300301 */
  414. /* ADV format error */
  415. #define BOT_EDTC_ADV BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0302) /* -0x02300302 */
  416. /* Asset registration interval is too short */
  417. #define BOT_EDTC_REG_BUSY BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0303) /* -0x02300303 */
  418. /* Asset registration config invalid */
  419. #define BOT_EDTC_REG_CONFIG_ERR BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0304) /* -0x02300304 */
  420. /* Network anomalies */
  421. #define BOT_EDTC_NET BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0400) /* -0x02300400 */
  422. /* The server is not connected */
  423. #define BOT_EDTC_NOT_CONNECT BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0401) /* -0x02300401 */
  424. /* The key is invalid */
  425. #define BOT_EDTC_SIGNATURE BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0402) /* -0x02300402 */
  426. /* Abnormal dm_handle */
  427. #define BOT_EDTC_DM BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0403) /* -0x02300403 */
  428. /* Signature generation exception */
  429. #define BOT_EDTC_GENERATE_SIG BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0404) /* -0x02300404 */
  430. /* Failed to set kv parameters */
  431. #define BOT_EDTC_KV BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0405) /* -0x02300405 */
  432. /* Device not registered */
  433. #define BOT_EDTC_UNREGIST BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0406) /* -0x02300406 */
  434. /* Json format error */
  435. #define BOT_EDTC_JSON BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0407) /* -0x02300407 */
  436. /* The uploaded data does not contain an assert ID */
  437. #define BOT_EDTC_ASSERT_ID BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0408) /* -0x02300408 */
  438. /* Abnormal deviceinfo_handle */
  439. #define BOT_EDTC_DI BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0409) /* -0x02300409 */
  440. /* Debug info decode error */
  441. #define BOT_EDTC_DECODE_ERROR BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0500) /* -0x02300500 */
  442. /* Debug command error */
  443. #define BOT_EDTC_DEBUG_CMD_INV BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0501) /* -0x02300501 */
  444. /* Fail to clear the device info */
  445. #define BOT_EDTC_DEV_CLR_ERROR BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0502) /* -0x02300502 */
  446. /* Fail to clear the connect info */
  447. #define BOT_EDTC_CONN_CLR_ERROR BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0503) /* -0x02300503 */
  448. /* Send queue is full, please try again later */
  449. #define BOT_EDTC_BUSY BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0504) /* -0x02300504 */
  450. /* Acknowledgment received timed out */
  451. #define BOT_EDTC_ACK_TIMEOUT BOT_ERRNO_ERROR(BOT_MID_SRV_DTC, 0X0505) /* -0x02300505 */
  452. /* ------------------------------------------------------------------------------ */
  453. /* ------------------------- NTP Service Errcode --------------------------- */
  454. /* ntp service init fail */
  455. #define BOT_ENTP_INIT BOT_ERRNO_ERROR(BOT_MID_SRV_NTP, 0X0001) /* -0x02310001 */
  456. /* ntp service setopt fail */
  457. #define BOT_ENTP_SET BOT_ERRNO_ERROR(BOT_MID_SRV_NTP, 0X0002) /* -0x02310002 */
  458. /* ntp service send fail */
  459. #define BOT_ENTP_SEND BOT_ERRNO_ERROR(BOT_MID_SRV_NTP, 0X0003) /* -0x02310003 */
  460. /* ------------------------------------------------------------------------------ */
  461. #ifdef __cplusplus
  462. }
  463. #endif
  464. #endif /* __BOT_ERRNO_H__ */