
#include <libsaria/libsaria.h>
#include <libsaria/callback.h>
#include <libsaria/print.h>
#include <ocarina/ocarina.h>
#include <ocarina/button.h>
#include <ocarina/library.h>
#include <ocarina/settings.h>
#include <ocarina/footer.h>

void cb_play()
{
	println("Ocarina PLAY callback!");
	hide_button_list(PLAY_BUTTON_LIST);
	show_button_list(PAUSE_BUTTON_LIST);
}

void cb_pause()
{
	println("Ocarina PAUSE callback!");
	hide_button_list(PAUSE_BUTTON_LIST);
	show_button_list(PLAY_BUTTON_LIST);
}

void cb_idle_task_queued()
{
	println("Ocarina IDLE_TASK_QUEUED callback!");
	ocarina::idle_add();
}

void cb_library_refresh()
{
	println("Ocarina LIBRARY_REFRESH callback!");
	ocarina::library::refresh();
	library_settings_refresh();
}

void cb_track_loaded()
{
	println("Ocarina TRACK_LOADED callback!");
	libsaria::current_track(set_footer_track);
}

void setup_callbacks()
{
	println("Ocarina setting up callbacks");
	register_callback(PLAY, cb_play);
	register_callback(PAUSE, cb_pause);
	register_callback(IDLE_TASK_QUEUED, cb_idle_task_queued);
	register_callback(LIBRARY_REFRESH, cb_library_refresh);
	register_callback(TRACK_LOADED, cb_track_loaded);
}
