Files
CYD-HomeBoard/include/kdeconnect.h
T

28 lines
1.0 KiB
C

// Minimal KDE Connect client: pairing + MPRIS (what is playing where).
// Runs in its own FreeRTOS task; the functions below are safe to call from the UI loop.
#pragma once
#include <stdint.h>
#include <stddef.h>
struct NowPlaying {
bool valid = false; // something is known (playing or paused)
bool playing = false;
char device[33] = "";
char player[33] = "";
char title[97] = "";
char artist[65] = "";
int32_t posMs = 0, lenMs = 0; // position at atMs (millis())
uint32_t atMs = 0;
uint32_t seq = 0; // changes whenever title/artist/state/device change
};
void kdeStart(const char* deviceName);
void kdeGetNowPlaying(NowPlaying& out);
// Returns a non-zero id while a pairing request waits for an answer and copies the device name.
uint32_t kdePairRequest(char* name, size_t n);
void kdeAnswerPair(bool accept);
// "PlayPause", "Next", "Previous" for the player shown in kdeGetNowPlaying.
void kdeMediaAction(const char* action);
// Number of paired devices currently connected.
int kdeConnectedCount();