comparison 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
comparison
equal deleted inserted replaced
244:bec9198fc306 245:3b8d291ed45a
2 * This ATI module and the AT commands implemented therein are a FreeCalypso 2 * This ATI module and the AT commands implemented therein are a FreeCalypso
3 * addition. The purpose of these AT commands is to exercise the audio 3 * addition. The purpose of these AT commands is to exercise the audio
4 * capabilities of the firmware - by using these commands, you should be 4 * capabilities of the firmware - by using these commands, you should be
5 * able to emit sounds from the speaker or record voice from the microphone 5 * able to emit sounds from the speaker or record voice from the microphone
6 * without needing to be in a call, and without bringing up GSM at all. 6 * without needing to be in a call, and without bringing up GSM at all.
7 *
8 * Our corrected implementation of the AT@AUL command (originally added
9 * by Openmoko) has been moved into this module as well.
7 */ 10 */
8 11
9 #ifndef ATI_AUDIO_C 12 #ifndef ATI_AUDIO_C
10 #define ATI_AUDIO_C 13 #define ATI_AUDIO_C
11 14
76 static void audio_callback(void *event_from_audio) 79 static void audio_callback(void *event_from_audio)
77 { 80 {
78 /* do nothing at this time */ 81 /* do nothing at this time */
79 } 82 }
80 83
84 /*
85 * PURPOSE : @AUL command (Audio table load)
86 */
87
88 static char aul_name[AUDIO_MODE_FILENAME_MAX_SIZE];
89
90 GLOBAL T_ATI_RSLT atAtAUL (char *cl, UBYTE srcId)
91 {
92 T_AUDIO_MODE_LOAD aul_param;
93 T_RV_RETURN return_path;
94
95 TRACE_FUNCTION("atAtAUL()");
96
97 cl = parse(cl, "S", (LONG)(sizeof(aul_param.audio_mode_filename)),
98 aul_param.audio_mode_filename);
99 if (!cl || !aul_param.audio_mode_filename[0])
100 return (ATI_FAIL);
101
102 /* Openmoko backward compatibility */
103 if (isdigit(aul_param.audio_mode_filename[0]) &&
104 !aul_param.audio_mode_filename[1])
105 sprintf(aul_param.audio_mode_filename, "para%c",
106 aul_param.audio_mode_filename[0]);
107
108 return_path.addr_id = NULL;
109 return_path.callback_func = audio_callback;
110 if (audio_mode_load(&aul_param, return_path) == AUDIO_OK) {
111 strcpy(aul_name, aul_param.audio_mode_filename);
112 return (ATI_CMPL);
113 } else
114 return (ATI_FAIL);
115 }
116
117 GLOBAL T_ATI_RSLT queatAtAUL (char *cl, UBYTE srcId)
118 {
119 char *me="@AUL: ";
120
121 TRACE_FUNCTION("queatAtAUL()");
122
123 if (aul_name[0])
124 sprintf(g_sa, "%s/aud/%s.cfg", me, aul_name);
125 else
126 sprintf(g_sa, "%s", me);
127
128 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
129
130 return (ATI_CMPL);
131 }
132
81 /* AT@E1 - play an E1 format melody */ 133 /* AT@E1 - play an E1 format melody */
82 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId ) 134 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId )
83 { 135 {
84 T_AUDIO_MELODY_E1_PARAMETER e1_param; 136 T_AUDIO_MELODY_E1_PARAMETER e1_param;
85 T_RV_RETURN return_path; 137 T_RV_RETURN return_path;