changeset 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 a33da2d26a31
files src/aci2/aci/ati_audio.c src/aci2/aci/ati_omcompat.c
diffstat 2 files changed, 70 insertions(+), 71 deletions(-) [+]
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 )
 {
--- a/src/aci2/aci/ati_omcompat.c	Mon Jul 24 04:15:14 2017 +0000
+++ b/src/aci2/aci/ati_omcompat.c	Mon Jul 24 04:41:53 2017 +0000
@@ -48,7 +48,7 @@
 #include "ati_int.h"
 
 #ifndef _SIMULATION_
-#include "ffs\ffs.h"
+#include "ffs/ffs.h"
 #endif
 
 #ifdef FF_ATI_BAT
@@ -61,24 +61,23 @@
 
 #endif /*FF_ATI_BAT*/
 
-#include "audio\audio_api.h"
+#include "audio/audio_api.h"
 #include "abb.h"
-#include "..\drivers\drv_app\power\power.h"
+#include "../drivers/drv_app/power/power.h"
 
 #ifdef GPRS
 #include "p_mph.h"
 #include "p_mphc.h"
-#include "..\alr\alr_gprs.h"
+#include "../alr/alr_gprs.h"
 #endif
 #include "p_tb.h"
-#include "..\alr\alr.h"
+#include "../alr/alr.h"
 
 /*
  * PURPOSE : @ST command (Configure the sidetone level)
  */
 GLOBAL T_ATI_RSLT atAtST (char *cl, UBYTE srcId)
 {
-	T_ACI_RETURN ret = AT_FAIL;  
 	char tmp[8]={0};
 	INT8 gain = -26;
 	TRACE_FUNCTION("atAtST()");
@@ -98,18 +97,17 @@
 			return (ATI_CMPL);
 		}
 		else
-		{     
+		{
 			cmdCmsError(CMS_ERR_OpNotAllowed);
 			return (ATI_FAIL);
 		}
-	} 
+	}
 }
 
 GLOBAL T_ATI_RSLT queatAtST (char *cl, UBYTE srcId)
 {
 	char *me="+ST: ";
 	INT8 ST1;
-	T_ACI_RETURN ret = AT_FAIL;  
 
 	TRACE_FUNCTION("queatAtST()");
 
@@ -120,57 +118,6 @@
 	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
 
 	return (ATI_CMPL);
-
-}
-
-/*
- * PURPOSE : @AUL command (Audio table load)
- */
-
-static char tmp[8]={0};
-
-GLOBAL T_ATI_RSLT atAtAUL (char *cl, UBYTE srcId)
-{
-	T_ACI_RETURN ret = AT_FAIL;    
-	T_AUDIO_MODE_LOAD audio_mode_load_parameter;  
-	T_RV_RETURN return_path;
-
-	/* initalize the return path, for this test the return path is an message */
-	return_path.callback_func = NULL;
-	return_path.addr_id = rvf_get_taskid();
-
-	TRACE_FUNCTION("atAtAUL()"); 
-
-	/*
-	 * input functionality
-	 */
-	cl = parse(cl,"s", (LONG)8, tmp);   
-
-	sprintf(audio_mode_load_parameter.audio_mode_filename, "para%s", tmp);
-	
-	if ( audio_mode_load(&audio_mode_load_parameter, return_path) == AUDIO_ERROR )
-		return (ATI_FAIL);
-	else
-		return (ATI_CMPL);
-
-}
-
-GLOBAL T_ATI_RSLT queatAtAUL (char *cl, UBYTE srcId)
-{
-	char *me="@AUL: ";  
-	T_ACI_RETURN ret = AT_FAIL;  
-
-	TRACE_FUNCTION("queatAtAUL()");  
-
-	if (strlen(tmp))
-		sprintf(g_sa,"%s/aud/para%s.cfg",me, tmp);
-	else
-		sprintf(g_sa,"%s",me);  		
-
-	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
-
-	return (ATI_CMPL);
-
 }
 
 /*
@@ -178,15 +125,15 @@
  */
  
 GLOBAL T_ATI_RSLT atAtPOFF (char *cl, UBYTE srcId)
-{		
+{
 	TRACE_FUNCTION("atAtPOFF");
-	
-	sprintf(g_sa,"%s","OK");  		
+
+	sprintf(g_sa,"%s","OK");
 	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
 
 	ABB_Power_Off();
-	
-	return (ATI_CMPL);	
+
+	return (ATI_CMPL);
 }
 
 /*
@@ -194,12 +141,12 @@
  */
  
 GLOBAL T_ATI_RSLT atAtRST (char *cl, UBYTE srcId)
-{		
-	TRACE_FUNCTION("atAtRST");			
-	
-	Power_OFF_Button();  
-	
-	return (ATI_CMPL);	
+{
+	TRACE_FUNCTION("atAtRST");
+
+	Power_OFF_Button();
+
+	return (ATI_CMPL);
 }
 
 /*