model.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: LGPL-2.1-or-later */
  2. /*
  3. *
  4. * BlueZ - Bluetooth protocol stack for Linux
  5. *
  6. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  7. *
  8. *
  9. */
  10. #define VENDOR_ID_INVALID 0xFFFF
  11. typedef bool (*model_send_msg_func_t) (void *user_data, uint16_t dst,
  12. uint16_t app_idx, uint8_t *data, uint16_t len);
  13. typedef bool (*model_send_pub_func_t) (void *user_data, uint16_t vendor_id,
  14. uint16_t mod_id, uint8_t *data, uint16_t len);
  15. typedef bool (*model_set_send_func_t)(model_send_msg_func_t func,
  16. void *user_data);
  17. typedef bool (*model_set_pub_func_t)(model_send_pub_func_t func,
  18. void *user_data);
  19. typedef bool (*model_recv_func_t)(uint16_t src, uint16_t app_idx,
  20. uint8_t *data, uint16_t len);
  21. typedef int (*model_bind_func_t)(uint16_t app_idx, int action);
  22. struct model_pub {
  23. uint16_t app_idx;
  24. uint16_t period;
  25. union {
  26. uint16_t addr;
  27. uint8_t label[16];
  28. } u;
  29. bool cred;
  30. uint32_t prd_res;
  31. uint16_t rtx_interval;
  32. uint8_t prd_steps;
  33. uint8_t rtx_cnt;
  34. uint8_t ttl;
  35. };
  36. typedef int (*model_pub_func_t)(struct model_pub *pub);
  37. struct model_ops {
  38. model_set_send_func_t set_send_func;
  39. model_set_pub_func_t set_pub_func;
  40. model_recv_func_t recv;
  41. model_bind_func_t bind;
  42. model_pub_func_t pub;
  43. };
  44. struct model_info {
  45. struct model_ops ops;
  46. uint16_t mod_id;
  47. uint16_t vendor_id;
  48. };