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-2026 Juergen Mang <mail@jcgames.de>
4 https://github.com/jcorporation/mympd
5*/
6
10
11#ifndef MYMPD_API_TIMER_H
12#define MYMPD_API_TIMER_H
13
14#include "dist/sds/sds.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, struct t_mympd_state *mympd_state);
30
41
44bool mympd_api_timer_check(int fd, struct t_timer_list *timer_list, struct t_mympd_state *mympd_state);
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_add_uniq(struct t_timer_list *l, int timeout, int interval, timer_handler handler,
50 unsigned timer_id, struct t_timer_definition *definition);
51bool mympd_api_timer_replace(struct t_timer_list *l, int timeout, int interval,
52 timer_handler handler, unsigned timer_id, struct t_timer_definition *definition);
53bool mympd_api_timer_remove(struct t_timer_list *l, unsigned timer_id);
54bool mympd_api_timer_remove_by_fd(struct t_timer_list *l, int fd);
56bool mympd_api_timer_toggle(struct t_timer_list *l, unsigned timer_id, sds *error);
58struct t_timer_definition *mympd_api_timer_parse(sds str, const char *partition, struct t_json_parse_error *error);
60sds mympd_api_timer_list(struct t_timer_list *timer_list, sds buffer, unsigned request_id, const char *partition);
61sds mympd_api_timer_get(struct t_timer_list *timer_list, sds buffer, unsigned request_id, unsigned timer_id);
62bool mympd_api_timer_file_read(struct t_timer_list *timer_list, sds workdir);
63bool mympd_api_timer_file_save(struct t_timer_list *timer_list, sds workdir);
64
65#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:474
void mympd_api_timer_timerlist_clear(struct t_timer_list *l)
Definition timer.c:373
bool mympd_api_timer_remove(struct t_timer_list *l, unsigned timer_id)
Definition timer.c:262
timer_intervals
Definition timer.h:21
int mympd_api_timer_calc_starttime(int start_hour, int start_minute, int interval)
Definition timer.c:447
sds mympd_api_timer_get(struct t_timer_list *timer_list, sds buffer, unsigned request_id, unsigned timer_id)
Definition timer.c:510
bool mympd_api_timer_remove_by_fd(struct t_timer_list *l, int fd)
Definition timer.c:292
bool mympd_api_timer_toggle(struct t_timer_list *l, unsigned timer_id, sds *error)
Definition timer.c:351
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:171
void * mympd_api_timer_free_definition(struct t_timer_definition *timer_def)
Definition timer.c:383
bool mympd_api_timer_file_save(struct t_timer_list *timer_list, sds workdir)
Definition timer.c:613
bool mympd_api_timer_add_uniq(struct t_timer_list *l, int timeout, int interval, timer_handler handler, unsigned timer_id, struct t_timer_definition *definition)
Definition timer.c:190
int mympd_api_timer_remove_partition(struct t_timer_list *l, sds partition)
Definition timer.c:323
struct t_timer_definition * mympd_api_timer_parse(sds str, const char *partition, struct t_json_parse_error *error)
Definition timer.c:402
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:119
void(* timer_handler)(unsigned timer_id, struct t_timer_definition *definition, struct t_mympd_state *mympd_state)
Definition timer.h:29
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:215
void mympd_api_timer_timerlist_init(struct t_timer_list *l)
Definition timer.c:49
bool mympd_api_timer_file_read(struct t_timer_list *timer_list, sds workdir)
Definition timer.c:541
bool mympd_api_timer_check(int fd, struct t_timer_list *timer_list, struct t_mympd_state *mympd_state)
Definition timer.c:62
Central myMPD state for the mympd_api thread.
Definition json_query.h:38
Definition mympd_state.h:31
Definition partition_state.h:27
Definition timer_state.h:20
int start_minute
start minute
Definition timer_state.h:25
sds partition
mpd partition
Definition timer_state.h:22
int start_hour
start hour
Definition timer_state.h:24
Definition timer_state.h:38
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