ota_config.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 VERSION_FIELD "Payload.Version"
  23. #define URL_FIELD "Payload.URL"
  24. #define SIZE_FIELD "Payload.Size"
  25. #define UPDATE_FIRMWARE_METHOD "update_firmware"
  26. #define REPORT_PROGRESS_MSG_TEMPLATE "{\"Method\": \"report_progress\", \"Payload\": {\"State\":\"%s\", \"Percent\":%d}}"
  27. #define REPORT_SUCCESS_MSG_TEMPLATE "{\"Method\": \"report_success\", \"Payload\":{\"Version\":\"%s\"}}"
  28. #define REPORT_FAIL_MSG_TEMPLATE "{\"Method\": \"report_fail\", \"Payload\": {\"ErrCode\": %d}}"
  29. #define REPORT_VERSION_MSG_TEMPLATE "{\"Method\": \"report_version\", \"Payload\":{\"Version\":\"%s\"}}"
  30. #define REQUEST_FIRMWARE_MSG_TEMPLATE "{\"Method\": \"request_firmware\", \"Payload\":{\"Version\":\"%s\"}}"
  31. #define OTA_VERSION_STR_LEN_MIN (1)
  32. #define OTA_VERSION_STR_LEN_MAX (32)
  33. #define OTA_UPSTREAM_MSG_BUF_LEN (129)
  34. #define OTA_TOPIC_BUF_LEN (129)
  35. #define OTA_UPSTREAM_TOPIC_TYPE "upstream"
  36. #define OTA_DOWNSTREAM_TOPIC_TYPE "downstream"
  37. #define OTA_TOPIC_TEMPLATE "/$system/%s/%s/ota/%s"
  38. #define OTA_REPORT_PROGRESS_INTERVAL 5 //下载固件过程中,上报progress的时间间隔,单位: s
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif //C_SDK_OTA_CONFIG_H_