ota_trans_bt.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief OTA bluetooth backend interface
  9. */
  10. #ifndef __OTA_TRANS_BT_H__
  11. #define __OTA_TRANS_BT_H__
  12. #include <stream.h>
  13. //#include <types.h>
  14. //#include <bt_eg_api.h>
  15. #include <ota_trans.h>
  16. #include <ota_api.h>
  17. #include <crc.h>
  18. #ifndef uint8
  19. typedef unsigned char uint8;
  20. #endif
  21. #ifndef int8
  22. typedef signed char int8;
  23. #endif
  24. #ifndef uint16
  25. typedef unsigned short uint16;
  26. #endif
  27. #ifndef int16
  28. typedef signed short int16;
  29. #endif
  30. #ifndef uint32
  31. typedef unsigned int uint32;
  32. #endif
  33. #ifndef int32
  34. typedef signed int int32;
  35. #endif
  36. struct ota_bt_dev{
  37. u8_t valid;
  38. u8_t rssi;
  39. u8_t bd_addr[6];
  40. } ;
  41. struct ota_trans_image_info{
  42. int image_offset;
  43. int read_len;
  44. int image_percent;
  45. };
  46. struct ota_trans_upgrade_image{
  47. u8_t *buffer;
  48. int size;
  49. u32_t crc;
  50. int ctn;
  51. };
  52. struct ota_trans_image_head_info{
  53. u32_t version;
  54. u32_t head_crc;
  55. };
  56. struct ota_trans_bt {
  57. struct ota_trans trans;
  58. struct cli_prot_context cli_ctx;
  59. struct ota_bt_dev ota_dev;
  60. };
  61. struct ota_trans_bt_init_param {
  62. const u8_t *spp_uuid;
  63. struct le_gatt_attr *le_gatt_attr;
  64. struct le_gatt_attr *tx_attr;
  65. struct le_gatt_attr *ccc_attr;
  66. struct le_gatt_attr *rx_attr;
  67. };
  68. struct ota_trans *ota_trans_bt_init(ota_trans_notify_cb_t cb,
  69. struct ota_trans_bt_init_param *param);
  70. void ota_trans_bt_exit(struct ota_trans *trans);
  71. #endif /* __OTA_BACKEND_BT_H__ */