cspot_sink.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_SETUP, CSPOT_DISC, CSPOT_FLUSH, CSPOT_STOP, CSPOT_PLAY, CSPOT_PAUSE, CSPOT_SEEK, CSPOT_TRACK, CSPOT_LOAD,
  15. CSPOT_VOLUME, CSPOT_VOLUME_UP, CSPOT_VOLUME_DOWN, CSPOT_NEXT, CSPOT_PREV, CSPOT_TOGGLE,
  16. } cspot_event_t;
  17. typedef bool (*cspot_cmd_cb_t)(cspot_event_t event, ...);
  18. typedef bool (*cspot_cmd_vcb_t)(cspot_event_t event, va_list args);
  19. typedef void (*cspot_data_cb_t)(const uint8_t *data, uint32_t len);
  20. /**
  21. * @brief init sink mode (need to be provided)
  22. */
  23. void cspot_sink_init(cspot_cmd_vcb_t cmd_cb, cspot_data_cb_t data_cb);
  24. /**
  25. * @brief deinit sink mode (need to be provided)
  26. */
  27. #define cspot_sink_deinit()
  28. /**
  29. * @brief force disconnection
  30. */
  31. void cspot_disconnect(void);
  32. #ifdef __cplusplus
  33. }
  34. #endif