diff src/aci2/aci/ati_audio.c @ 245:3b8d291ed45a

aci2: AT@AUL reimplemented in the new FreeCalypso way
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 24 Jul 2017 04:41:53 +0000
parents bec9198fc306
children 3edeadec6804
line wrap: on
line diff
--- a/src/aci2/aci/ati_audio.c	Mon Jul 24 04:15:14 2017 +0000
+++ b/src/aci2/aci/ati_audio.c	Mon Jul 24 04:41:53 2017 +0000
@@ -4,6 +4,9 @@
  * capabilities of the firmware - by using these commands, you should be
  * able to emit sounds from the speaker or record voice from the microphone
  * without needing to be in a call, and without bringing up GSM at all.
+ *
+ * Our corrected implementation of the AT@AUL command (originally added
+ * by Openmoko) has been moved into this module as well.
  */
 
 #ifndef ATI_AUDIO_C
@@ -78,6 +81,55 @@
 	/* do nothing at this time */
 }
 
+/*
+ * PURPOSE : @AUL command (Audio table load)
+ */
+
+static char aul_name[AUDIO_MODE_FILENAME_MAX_SIZE];
+
+GLOBAL T_ATI_RSLT atAtAUL (char *cl, UBYTE srcId)
+{
+	T_AUDIO_MODE_LOAD aul_param;
+	T_RV_RETURN return_path;
+
+	TRACE_FUNCTION("atAtAUL()");
+
+	cl = parse(cl, "S", (LONG)(sizeof(aul_param.audio_mode_filename)),
+		   aul_param.audio_mode_filename);
+	if (!cl || !aul_param.audio_mode_filename[0])
+		return (ATI_FAIL);
+
+	/* Openmoko backward compatibility */
+	if (isdigit(aul_param.audio_mode_filename[0]) &&
+	    !aul_param.audio_mode_filename[1])
+		sprintf(aul_param.audio_mode_filename, "para%c",
+			aul_param.audio_mode_filename[0]);
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_mode_load(&aul_param, return_path) == AUDIO_OK) {
+		strcpy(aul_name, aul_param.audio_mode_filename);
+		return (ATI_CMPL);
+	} else
+		return (ATI_FAIL);
+}
+
+GLOBAL T_ATI_RSLT queatAtAUL (char *cl, UBYTE srcId)
+{
+	char *me="@AUL: ";
+
+	TRACE_FUNCTION("queatAtAUL()");
+
+	if (aul_name[0])
+		sprintf(g_sa, "%s/aud/%s.cfg", me, aul_name);
+	else
+		sprintf(g_sa, "%s", me);
+
+	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
+
+	return (ATI_CMPL);
+}
+
 /* AT@E1 - play an E1 format melody */
 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId )
 {