ota_client.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Tencent is pleased to support the open source community by making IoT Hub
  3. available.
  4. * Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
  5. * Licensed under the MIT License (the "License"); you may not use this file
  6. except in
  7. * compliance with the License. You may obtain a copy of the License at
  8. * http://opensource.org/licenses/MIT
  9. * Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is
  11. * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  12. KIND,
  13. * either express or implied. See the License for the specific language
  14. governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. #ifndef IOT_OTA_CLIENT_H_
  19. #define IOT_OTA_CLIENT_H_
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #include <stdint.h>
  24. /* Specify the maximum characters of version */
  25. #define OTA_MAX_TOPIC_LEN (64)
  26. #define TYPE_FIELD "type"
  27. #define MD5_FIELD "md5sum"
  28. #define VERSION_FIELD "version"
  29. #define URL_FIELD "url"
  30. #define FILESIZE_FIELD "file_size"
  31. #define RESULT_FIELD "result_code"
  32. #define REPORT_VERSION_RSP "report_version_rsp"
  33. #define UPDATE_FIRMWARE "update_firmware"
  34. enum { MQTT_CHANNEL, COAP_CHANNEL };
  35. typedef void (*OnOTAMessageCallback)(void *pcontext, const char *msg, uint32_t msgLen);
  36. void *qcloud_osc_init(const char *productId, const char *deviceName, void *channel, OnOTAMessageCallback callback,
  37. void *context);
  38. int qcloud_osc_deinit(void *handle);
  39. int qcloud_osc_report_progress(void *handle, const char *msg);
  40. int qcloud_osc_report_version(void *handle, const char *msg);
  41. int qcloud_osc_report_upgrade_result(void *handle, const char *msg);
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif /* IOT_OTA_CLIENT_H_ */