myMPD
Internal API documentation
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-3.0-or-later
3 myMPD (c) 2018-2025 Juergen Mang <mail@jcgames.de>
4 https://github.com/jcorporation/mympd
5*/
6
11#ifndef MYMPD_API_TIMER_H
12#define MYMPD_API_TIMER_H
13
14#include "dist/sds/sds.h"
16#include "src/lib/mympd_state.h"
17
22 TIMER_ONE_SHOT_REMOVE = -1,
23 TIMER_ONE_SHOT_DISABLE = 0
24};
25
29typedef void (*timer_handler)(unsigned timer_id, struct t_timer_definition *definition);
30
41
44bool mympd_api_timer_check(int fd, struct t_timer_list *timer_list);
45bool mympd_api_timer_save(struct t_partition_state *partition_state, struct t_timer_list *timer_list, int interval, unsigned timerid,
46 struct t_timer_definition *timer_def, sds *error);
47bool mympd_api_timer_add(struct t_timer_list *l, int timeout, int interval,
48 timer_handler handler, unsigned timer_id, struct t_timer_definition *definition);
49bool mympd_api_timer_replace(struct t_timer_list *l, int timeout, int interval,
50 timer_handler handler, unsigned timer_id, struct t_timer_definition *definition);
51bool mympd_api_timer_remove(struct t_timer_list *l, unsigned timer_id);
52bool mympd_api_timer_toggle(struct t_timer_list *l, unsigned timer_id, sds *error);
54struct t_timer_definition *mympd_api_timer_parse(sds str, const char *partition, struct t_json_parse_error *error);
56sds mympd_api_timer_list(struct t_timer_list *timer_list, sds buffer, unsigned request_id, const char *partition);
57sds mympd_api_timer_get(struct t_timer_list *timer_list, sds buffer, unsigned request_id, unsigned timer_id);
58bool mympd_api_timer_file_read(struct t_timer_list *timer_list, sds workdir);
59bool mympd_api_timer_file_save(struct t_timer_list *timer_list, sds workdir);
60#endif
Json query implementation.
sds mympd_api_timer_list(struct t_timer_list *timer_list, sds buffer, unsigned request_id, const char *partition)
Definition timer.c:386
void mympd_api_timer_timerlist_clear(struct t_timer_list *l)
Definition timer.c:285
void(* timer_handler)(unsigned timer_id, struct t_timer_definition *definition)
Definition timer.h:29
bool mympd_api_timer_remove(struct t_timer_list *l, unsigned timer_id)
Definition timer.c:233
timer_intervals
Definition timer.h:21
int mympd_api_timer_calc_starttime(int start_hour, int start_minute, int interval)
Definition timer.c:359
sds mympd_api_timer_get(struct t_timer_list *timer_list, sds buffer, unsigned request_id, unsigned timer_id)
Definition timer.c:422
bool mympd_api_timer_toggle(struct t_timer_list *l, unsigned timer_id, sds *error)
Definition timer.c:263
bool mympd_api_timer_replace(struct t_timer_list *l, int timeout, int interval, timer_handler handler, unsigned timer_id, struct t_timer_definition *definition)
Definition timer.c:168
void * mympd_api_timer_free_definition(struct t_timer_definition *timer_def)
Definition timer.c:295
bool mympd_api_timer_file_save(struct t_timer_list *timer_list, sds workdir)
Definition timer.c:525
struct t_timer_definition * mympd_api_timer_parse(sds str, const char *partition, struct t_json_parse_error *error)
Definition timer.c:314
bool mympd_api_timer_save(struct t_partition_state *partition_state, struct t_timer_list *timer_list, int interval, unsigned timerid, struct t_timer_definition *timer_def, sds *error)
Definition timer.c:116
bool mympd_api_timer_add(struct t_timer_list *l, int timeout, int interval, timer_handler handler, unsigned timer_id, struct t_timer_definition *definition)
Definition timer.c:187
void mympd_api_timer_timerlist_init(struct t_timer_list *l)
Definition timer.c:47
bool mympd_api_timer_file_read(struct t_timer_list *timer_list, sds workdir)
Definition timer.c:453
bool mympd_api_timer_check(int fd, struct t_timer_list *timer_list)
Definition timer.c:59
Central myMPD state for the mympd_api thread.
Definition json_query.h:38
Definition mympd_state.h:114
Definition mympd_state.h:178
int start_minute
start minute
Definition mympd_state.h:183
sds partition
mpd partition
Definition mympd_state.h:180
int start_hour
start hour
Definition mympd_state.h:182
Definition mympd_state.h:196
Definition timer.h:34
struct t_timer_definition * definition
optional pointer to timer definition (GUI)
Definition timer.h:37
int timeout
seconds when timer will run
Definition timer.h:38
timer_handler callback
timer callback function
Definition timer.h:36
int fd
holds the timerfd
Definition timer.h:35
int interval
reschedule timer interval
Definition timer.h:39