Fix c&p error from r25853 that should've fixed some snprintf warnings.
[kugel-rb.git] / apps / status.c
blob485ca0aa34cd575c3f674343ba64baf35930026d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include <string.h>
22 #include <stdbool.h>
23 #include "config.h"
24 #include "status.h"
25 #include "audio.h"
26 #if CONFIG_TUNER
27 #include "radio.h"
28 #endif
30 static enum playmode ff_mode = 0;
32 void status_set_ffmode(enum playmode mode)
34 ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
37 enum playmode status_get_ffmode(void)
39 /* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
40 /* use audio_status() for other modes */
41 return ff_mode;
44 int current_playmode(void)
46 int audio_stat = audio_status();
48 /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
49 and that supercedes the other modes */
50 if(ff_mode)
51 return ff_mode;
53 if(audio_stat & AUDIO_STATUS_PLAY)
55 if(audio_stat & AUDIO_STATUS_PAUSE)
56 return STATUS_PAUSE;
57 else
58 return STATUS_PLAY;
61 #ifdef HAVE_RECORDING
62 if(audio_stat & AUDIO_STATUS_RECORD)
64 if(audio_stat & AUDIO_STATUS_PAUSE)
65 return STATUS_RECORD_PAUSE;
66 else
67 return STATUS_RECORD;
69 #endif
71 #if CONFIG_TUNER
72 audio_stat = get_radio_status();
73 if(audio_stat & FMRADIO_PLAYING)
74 return STATUS_RADIO;
76 if(audio_stat & FMRADIO_PAUSED)
77 return STATUS_RADIO_PAUSE;
78 #endif
80 return STATUS_STOP;
83 #if defined(HAVE_LCD_CHARCELLS)
84 bool record = false;
85 bool audio = false;
86 bool param = false;
87 bool usb = false;
89 void status_set_record(bool b)
91 record = b;
94 void status_set_audio(bool b)
96 audio = b;
99 void status_set_param(bool b)
101 param = b;
104 void status_set_usb(bool b)
106 usb = b;
109 #endif /* HAVE_LCD_CHARCELLS */