Files
pi-dashboard/components/audio_client/audio_client.h

51 lines
1.2 KiB
C
Raw Normal View History

2026-02-15 21:11:33 +09:00
#pragma once
#include <stdbool.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
2026-02-15 21:46:18 +09:00
#include "lvgl.h"
2026-02-15 21:11:33 +09:00
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
AUDIO_IDLE = 0,
AUDIO_CONNECTED,
AUDIO_PLAYING,
AUDIO_ERROR,
} audio_state_t;
/**
* Initialize the audio streaming client.
* @param uri WebSocket URI (e.g. "ws://192.168.2.199:8766")
* @param codec Pointer to CodecPort instance (passed as void* for C linkage)
*/
void audio_client_init(const char *uri, void *codec);
/** Start the WebSocket connection and playback task. */
void audio_client_start(void);
/** Stop playback and disconnect. */
void audio_client_stop(void);
/** Get current audio client state. */
audio_state_t audio_client_get_state(void);
/**
* Register a task to be notified (via xTaskNotifyGive) when a new status
* image arrives. Call before audio_client_start().
*/
void audio_client_set_image_notify_task(TaskHandle_t task);
2026-02-15 21:46:18 +09:00
/**
* Get the latest status image descriptor.
* @param updated Set to true if a new image arrived since last call, then reset.
* @return Pointer to the static image descriptor (always valid).
*/
const lv_img_dsc_t *audio_client_get_status_image(bool *updated);
2026-02-15 21:11:33 +09:00
#ifdef __cplusplus
}
#endif