This repository has been archived by the owner on Feb 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
mainloop.h
76 lines (69 loc) · 2.67 KB
/
mainloop.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright 2014-2018 René Ladan
// SPDX-License-Identifier: BSD-2-Clause
#ifndef DCF77PI_MAINLOOP_H
#define DCF77PI_MAINLOOP_H
#include "setclock.h"
#include <stdbool.h>
struct DT_result;
struct GB_result;
struct alm;
struct tm;
/** User input which controls the client */
struct ML_result {
/** Request to change the name of the log file */
bool change_logfile;
/** Request to quit the program */
bool quit;
/** Request to set the system time upon each valid minute */
bool settime;
/** Result of setting the system time */
enum eSC_status settime_result;
/** The name of the log file */
char *logfilename;
};
/**
* Provide a ready-to-use mainloop function for the main program. Both dcf77pi
* and dcf77pi-analyze use it.
*
* @param logfilename The name of the log file to write the live data to or
* NULL if not in live mode.
* @param get_bit The callback to obtain a bit (either live or from a log
* file).
* @param display_bit The callback to display the currently received bit
* (either live or from a log file).
* @param display_long_minute The callback to indicate that this minute is too
* long (eGB_too_long is set).
* @param display_minute The callback to display information about the current
* minute.
* @param display_new_second The optional callback for additional actions
* after the bit is displayed and the minute information is updated.
* @param display_alarm The callback to display third party alarm messsages.
* @param display_unknown The callback to display unknown third party
* messages.
* @param display_weather The callback to display third party weather
* messages.
* @param display_time The callback to display the decoded time.
* @param display_thirdparty_buffer The callback to display the third party
* buffer.
* @param process_setclock_result The optional callback to display the result
* of setting the system clock.
* @param process_input The optional callback to handle interactive user
* input.
* @param post_process_input The optional callback to finish handling
* interactive user input.
*/
void mainloop(char *logfilename,
struct GB_result (*get_bit)(void),
void (*display_bit)(struct GB_result, int),
void (*display_long_minute)(void),
void (*display_minute)(int),
void (*display_new_second)(void),
void (*display_alarm)(struct alm),
void (*display_unknown)(void),
void (*display_weather)(void),
void (*display_time)(struct DT_result, struct tm),
void (*display_thirdparty_buffer)(const unsigned[]),
struct ML_result (*process_setclock_result)(struct ML_result, int),
struct ML_result (*process_input)(struct ML_result, int),
struct ML_result (*post_process_input)(struct ML_result, int));
#endif