a2dp-sink.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // SPDX-License-Identifier: LGPL-2.1-or-later
  2. /*
  3. *
  4. * BlueZ - Bluetooth protocol stack for Linux
  5. *
  6. * Copyright (C) 2014 Intel Corporation. All rights reserved.
  7. *
  8. *
  9. */
  10. #ifdef HAVE_CONFIG_H
  11. #include <config.h>
  12. #endif
  13. #include <stdbool.h>
  14. #include <glib.h>
  15. #include "lib/bluetooth.h"
  16. #include "src/log.h"
  17. #include "hal-msg.h"
  18. #include "ipc.h"
  19. #include "a2dp-sink.h"
  20. static struct ipc *hal_ipc = NULL;
  21. static void bt_a2dp_sink_connect(const void *buf, uint16_t len)
  22. {
  23. /* TODO */
  24. DBG("");
  25. ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_A2DP_SINK, HAL_OP_A2DP_CONNECT,
  26. HAL_STATUS_UNSUPPORTED);
  27. }
  28. static void bt_a2dp_sink_disconnect(const void *buf, uint16_t len)
  29. {
  30. /* TODO */
  31. DBG("");
  32. ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_A2DP_SINK, HAL_OP_A2DP_DISCONNECT,
  33. HAL_STATUS_UNSUPPORTED);
  34. }
  35. static const struct ipc_handler cmd_handlers[] = {
  36. /* HAL_OP_A2DP_CONNECT */
  37. { bt_a2dp_sink_connect, false, sizeof(struct hal_cmd_a2dp_connect) },
  38. /* HAL_OP_A2DP_DISCONNECT */
  39. { bt_a2dp_sink_disconnect, false,
  40. sizeof(struct hal_cmd_a2dp_disconnect) },
  41. };
  42. bool bt_a2dp_sink_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
  43. {
  44. DBG("");
  45. hal_ipc = ipc;
  46. ipc_register(hal_ipc, HAL_SERVICE_ID_A2DP_SINK, cmd_handlers,
  47. G_N_ELEMENTS(cmd_handlers));
  48. return true;
  49. }
  50. void bt_a2dp_sink_unregister(void)
  51. {
  52. DBG("");
  53. ipc_unregister(hal_ipc, HAL_SERVICE_ID_A2DP_SINK);
  54. hal_ipc = NULL;
  55. }