diff options
Diffstat (limited to 'apps/misc.h')
-rw-r--r-- | apps/misc.h | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/apps/misc.h b/apps/misc.h index 1bc9a23447..6c660e0a5e 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -19,21 +19,46 @@ | |||
19 | #ifndef MISC_H | 19 | #ifndef MISC_H |
20 | #define MISC_H | 20 | #define MISC_H |
21 | 21 | ||
22 | #include <stdbool.h> | ||
23 | |||
22 | /* Format a large-range value for output, using the appropriate unit so that | 24 | /* Format a large-range value for output, using the appropriate unit so that |
23 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" | 25 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" |
24 | * units) if possible, and 3 significant digits are shown. If a buffer is | 26 | * units) if possible, and 3 significant digits are shown. If a buffer is |
25 | * given, the result is snprintf()'d into that buffer, otherwise the result is | 27 | * given, the result is snprintf()'d into that buffer, otherwise the result is |
26 | * voiced.*/ | 28 | * voiced.*/ |
27 | void output_dyn_value(char *buf, int buf_size, int value, | 29 | char *output_dyn_value(char *buf, int buf_size, int value, |
28 | const unsigned char **units, bool bin_scale); | 30 | const unsigned char **units, bool bin_scale); |
29 | 31 | ||
32 | /* Create a filename with a number part in a way that the number is 1 | ||
33 | * higher than the highest numbered file matching the same pattern. | ||
34 | * It is allowed that buffer and path point to the same memory location, | ||
35 | * saving a strcpy(). Path must always be given without trailing slash. | ||
36 | * | ||
37 | * "num" can point to an int specifying the number to use or NULL or a value | ||
38 | * less than zero to number automatically. The final number used will also | ||
39 | * be returned in *num. If *num is >= 0 then *num will be incremented by | ||
40 | * one. */ | ||
41 | #if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) && !defined(CONFIG_RTC) | ||
42 | /* this feature is needed by SWCODEC recording without a RTC to prevent | ||
43 | disk access when changing files */ | ||
44 | #define IF_CNFN_NUM_(...) __VA_ARGS__ | ||
45 | #define IF_CNFN_NUM | ||
46 | #else | ||
47 | #define IF_CNFN_NUM_(...) | ||
48 | #endif | ||
30 | char *create_numbered_filename(char *buffer, const char *path, | 49 | char *create_numbered_filename(char *buffer, const char *path, |
31 | const char *prefix, const char *suffix, | 50 | const char *prefix, const char *suffix, |
32 | int numberlen); | 51 | int numberlen IF_CNFN_NUM_(, int *num)); |
33 | #ifdef CONFIG_RTC | 52 | #ifdef CONFIG_RTC |
53 | /* Create a filename with a date+time part. | ||
54 | It is allowed that buffer and path point to the same memory location, | ||
55 | saving a strcpy(). Path must always be given without trailing slash. | ||
56 | unique_time as true makes the function wait until the current time has | ||
57 | changed. */ | ||
34 | char *create_datetime_filename(char *buffer, const char *path, | 58 | char *create_datetime_filename(char *buffer, const char *path, |
35 | const char *prefix, const char *suffix); | 59 | const char *prefix, const char *suffix, |
36 | #endif | 60 | bool unique_time); |
61 | #endif /* CONFIG_RTC */ | ||
37 | 62 | ||
38 | /* Read (up to) a line of text from fd into buffer and return number of bytes | 63 | /* Read (up to) a line of text from fd into buffer and return number of bytes |
39 | * read (which may be larger than the number of bytes stored in buffer). If | 64 | * read (which may be larger than the number of bytes stored in buffer). If |
@@ -57,4 +82,4 @@ long default_event_handler(long event); | |||
57 | void car_adapter_mode_init(void); | 82 | void car_adapter_mode_init(void); |
58 | extern int show_logo(void); | 83 | extern int show_logo(void); |
59 | 84 | ||
60 | #endif | 85 | #endif /* MISC_H */ |