joylink_extern_ota.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* --------------------------------------------------
  2. * @file: joylink_extern_ota.h
  3. *
  4. * @brief:
  5. *
  6. * @version: 2.0
  7. *
  8. * @date: 2018/07/26 PM
  9. *
  10. * --------------------------------------------------
  11. */
  12. #ifndef _JOYLINK_EXTERN_OTA_H_
  13. #define _JOYLINK_EXTERN_OTA_H_
  14. #ifdef __cplusplus
  15. extern "C"{
  16. #endif
  17. //#define HTTP_URL "http://storage.360buyimg.com/devh5/micapp_ota_9_1532350290755.bin"
  18. #define OTA_STATUS_DOWNLOAD 0
  19. #define OTA_STATUS_INSTALL 1
  20. #define OTA_STATUS_SUCCESS 2
  21. #define OTA_STATUS_FAILURE 3
  22. //#define OTA_PACKET_NUMB 1
  23. #define HTTP_DEFAULT_PORT 80
  24. #define EVERY_PACKET_LEN 1024
  25. #define OTA_TIME_OUT (5 * 60 * 1000)
  26. #define HTTP_HEAD "HEAD /%s HTTP/1.1\r\nHOST: %s:%d\r\nConnection: Keep-Alive\r\n\r\n"
  27. #define HTTP_GET "GET /%s HTTP/1.1\r\nHOST: %s:%d\r\nRange: bytes=%ld-%ld\r\nKeep-Alive: 200\r\nConnection: Keep-Alive\r\n\r\n"
  28. typedef struct _http_ota_st
  29. {
  30. char url[256];
  31. char host_name[64];
  32. int host_port;
  33. char file_path[64];
  34. char file_name[64];
  35. long int file_size;
  36. long int file_offset;
  37. int finish_percent;
  38. } http_ota_st;
  39. void *joylink_ota_task(void *data);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif