cspot_sink.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. This example code is in the Public Domain (or CC0 licensed, at your option.)
  3. Unless required by applicable law or agreed to in writing, this
  4. software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied.
  6. */
  7. #pragma once
  8. #include <stdint.h>
  9. #ifdef __cplusplus
  10. extern "C"
  11. {
  12. #endif
  13. // STOP means remove playlist, FLUSH means flush audio buffer, DISC means bye-bye
  14. typedef enum { CSPOT_START, CSPOT_DISC, CSPOT_FLUSH, CSPOT_STOP, CSPOT_PLAY, CSPOT_PAUSE, CSPOT_SEEK,
  15. CSPOT_NEXT, CSPOT_PREV, CSPOT_TOGGLE,
  16. CSPOT_TRACK_INFO, CSPOT_TRACK_MARK,
  17. CSPOT_VOLUME, CSPOT_VOLUME_UP, CSPOT_VOLUME_DOWN,
  18. CSPOT_BUSY, CSPOT_QUERY_STARTED, CSPOT_QUERY_REMAINING,
  19. } cspot_event_t;
  20. typedef bool (*cspot_cmd_cb_t)(cspot_event_t event, ...);
  21. typedef bool (*cspot_cmd_vcb_t)(cspot_event_t event, va_list args);
  22. typedef uint32_t (*cspot_data_cb_t)(const uint8_t *data, size_t len);
  23. /**
  24. * @brief init sink mode (need to be provided)
  25. */
  26. void cspot_sink_init(cspot_cmd_vcb_t cmd_cb, cspot_data_cb_t data_cb);
  27. /**
  28. * @brief deinit sink mode (need to be provided)
  29. */
  30. #define cspot_sink_deinit()
  31. /**
  32. * @brief force disconnection
  33. */
  34. void cspot_disconnect(void);
  35. #ifdef __cplusplus
  36. }
  37. #endif