ota_config.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2012-2019 UCloud. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License").
  5. * You may not use this file except in compliance with the License.
  6. * A copy of the License is located at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * or in the "license" file accompanying this file. This file is distributed
  11. * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  12. * express or implied. See the License for the specific language governing
  13. * permissions and limitations under the License.
  14. */
  15. #ifndef C_SDK_OTA_CONFIG_H_
  16. #define C_SDK_OTA_CONFIG_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #define TYPE_FIELD "Method"
  21. #define MD5_FIELD "Payload.MD5"
  22. #define MODULE_FIELD "Payload.Module"
  23. #define VERSION_FIELD "Payload.Version"
  24. #define URL_FIELD "Payload.URL"
  25. #define SIZE_FIELD "Payload.Size"
  26. #define UPDATE_FIRMWARE_METHOD "update_firmware"
  27. #define CANCEL_UPDATE_METHOD "cancel_update"
  28. #define REPORT_PROGRESS_MSG_TEMPLATE "{\"Method\": \"report_progress\", \"Payload\": {\"State\":\"%s\", \"Percent\":%d, \"Module\":\"%s\", \"Version\":\"%s\" }}"
  29. #define REPORT_SUCCESS_MSG_TEMPLATE "{\"Method\": \"report_success\", \"Payload\":{\"Module\":\"%s\", \"Version\":\"%s\"}}"
  30. #define REPORT_FAIL_MSG_TEMPLATE "{\"Method\": \"report_fail\", \"Payload\": {\"ErrCode\": %d, \"Module\":\"%s\", \"Version\":\"%s\"}}"
  31. #define REPORT_VERSION_MSG_TEMPLATE "{\"Method\": \"report_version\", \"Payload\":{\"Module\":\"%s\", \"Version\":\"%s\"}}"
  32. #define REQUEST_FIRMWARE_MSG_TEMPLATE "{\"Method\": \"request_firmware\", \"Payload\":{\"Module\":\"%s\", \"Version\":\"%s\"}}"
  33. #define OTA_VERSION_STR_LEN_MIN (1)
  34. #define OTA_VERSION_STR_LEN_MAX (32)
  35. #define OTA_UPSTREAM_MSG_BUF_LEN (129)
  36. #define OTA_TOPIC_BUF_LEN (129)
  37. #define OTA_UPSTREAM_TOPIC_TYPE "upstream"
  38. #define OTA_DOWNSTREAM_TOPIC_TYPE "downstream"
  39. #define OTA_TOPIC_TEMPLATE "/$system/%s/%s/ota/%s"
  40. #define OTA_REPORT_PROGRESS_INTERVAL 5 //下载固件过程中,上报progress的时间间隔,单位: s
  41. #ifdef __cplusplus
  42. }
  43. #endif
  44. #endif //C_SDK_OTA_CONFIG_H_