btif_map.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (c) 2016 Actions Semi Co., Inc.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief bt pbap interface
  9. */
  10. #define SYS_LOG_DOMAIN "btif_map"
  11. #include "btsrv_os_common.h"
  12. #include "btsrv_inner.h"
  13. int btif_map_register_processer(void)
  14. {
  15. return btsrv_register_msg_processer(MSG_BTSRV_MAP, &btsrv_map_process);
  16. }
  17. int btif_map_client_connect(struct bt_map_connect_param *param)
  18. {
  19. if (!param || !param->app_id || !param->cb) {
  20. return -EINVAL;
  21. }
  22. return btsrv_function_call_malloc(MSG_BTSRV_MAP, MSG_BTSRV_MAP_CONNECT, (void *)param, sizeof(struct bt_map_connect_param), 0);
  23. }
  24. int btif_map_client_set_folder(struct bt_map_set_folder_param *param)
  25. {
  26. if (!param || !param->app_id) {
  27. return -EINVAL;
  28. }
  29. return btsrv_function_call_malloc(MSG_BTSRV_MAP, MSG_BTSRV_MAP_SET_FOLDER, (void *)param, sizeof(struct bt_map_set_folder_param), 0);
  30. }
  31. int btif_map_get_folder_listing(uint8_t app_id)
  32. {
  33. int id = app_id;
  34. if (!id) {
  35. return -EINVAL;
  36. }
  37. return btsrv_function_call(MSG_BTSRV_MAP, MSG_BTSRV_MAP_GET_FOLDERLISTING, (void *)id);
  38. }
  39. int btif_map_get_messages_listing(struct bt_map_get_messages_listing_param *param)
  40. {
  41. if (!param || !param->app_id) {
  42. return -EINVAL;
  43. }
  44. return btsrv_function_call_malloc(MSG_BTSRV_MAP, MSG_BTSRV_MAP_GET_MESSAGESLISTING, (void *)param, sizeof(struct bt_map_get_messages_listing_param), 0);
  45. }
  46. int btif_map_get_message(struct bt_map_get_param *param)
  47. {
  48. if (!param || !param->app_id ||
  49. !param->cb || !param->map_path) {
  50. return -EINVAL;
  51. }
  52. return btsrv_function_call_malloc(MSG_BTSRV_MAP, MSG_BTSRV_MAP_GET_MESSAGE, (void *)param, sizeof(struct bt_map_get_param), 0);
  53. }
  54. int btif_map_abort_get(uint8_t app_id)
  55. {
  56. int id = app_id;
  57. if (id == 0) {
  58. return -EINVAL;
  59. }
  60. return btsrv_function_call(MSG_BTSRV_MAP, MSG_BTSRV_MAP_ABORT_GET, (void *)id);
  61. }
  62. int btif_map_client_disconnect(uint8_t app_id)
  63. {
  64. int id = app_id;
  65. if (id == 0) {
  66. return -EINVAL;
  67. }
  68. return btsrv_function_call(MSG_BTSRV_MAP, MSG_BTSRV_MAP_DISCONNECT, (void *)id);
  69. }