aboutsummaryrefslogtreecommitdiffstats
path: root/src/dtmf_scheduler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dtmf_scheduler.c')
-rw-r--r--src/dtmf_scheduler.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/dtmf_scheduler.c b/src/dtmf_scheduler.c
index 5a99a5b..dbb39e7 100644
--- a/src/dtmf_scheduler.c
+++ b/src/dtmf_scheduler.c
@@ -21,6 +21,7 @@
#include "dtmf_scheduler.h"
#include <string.h>
#include <stdio.h>
+#include <limits.h>
void dtmf_state_init(struct dtmf_state *state)
{
@@ -40,6 +41,19 @@ int dtmf_state_add(struct dtmf_state *state, char tone)
return 0;
}
+char dtmf_state_pop_tone(struct dtmf_state *state)
+{
+ char res;
+
+ if (state->size == 0)
+ return CHAR_MAX;
+
+ res = state->tones[0];
+ state->size -= 1;
+ memmove(&state->tones[0], &state->tones[1], state->size);
+ return res;
+}
+
unsigned int dtmf_state_get_pending(struct dtmf_state *state, char *tones)
{
int pos;
@@ -62,6 +76,11 @@ void dtmf_state_played(struct dtmf_state *state)
state->playing = 0;
}
+void dtmf_state_play(struct dtmf_state *state)
+{
+ state->playing = 1;
+}
+
unsigned int dtmf_tones_queued(struct dtmf_state *state)
{
return state->size;