changeset 563:d648cafa30cf

aci3: implemented AT@E1STOP and AT@E2STOP commands
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 06 Jan 2019 23:37:13 +0000
parents adae731ae50d
children ade27cd84b97
files src/g23m-aci/aci/aci_cmh.h src/g23m-aci/aci/ati_audio.c src/g23m-aci/aci/ati_cmd.c
diffstat 3 files changed, 51 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/g23m-aci/aci/aci_cmh.h	Sun Jan 06 22:33:33 2019 +0000
+++ b/src/g23m-aci/aci/aci_cmh.h	Sun Jan 06 23:37:13 2019 +0000
@@ -529,8 +529,10 @@
   AT_CMD_AT_VPATH,
   AT_CMD_AT_SND,
   AT_CMD_AT_E1,
+  AT_CMD_AT_E1STOP,
   AT_CMD_AT_E2,
   AT_CMD_AT_E2LSI,
+  AT_CMD_AT_E2STOP,
   AT_CMD_AT_TONE,
   AT_CMD_AT_TSTOP,
   AT_CMD_AT_VMP,
--- a/src/g23m-aci/aci/ati_audio.c	Sun Jan 06 22:33:33 2019 +0000
+++ b/src/g23m-aci/aci/ati_audio.c	Sun Jan 06 23:37:13 2019 +0000
@@ -214,6 +214,8 @@
 }
 #endif
 
+static char melody_E1_name[AUDIO_PATH_NAME_MAX_SIZE];
+
 /* AT@E1 - play an E1 format melody */
 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId )
 {
@@ -229,12 +231,33 @@
 
 	return_path.addr_id        = NULL;
 	return_path.callback_func  = audio_callback;
-	if (audio_melody_E1_start(&e1_param, return_path) == AUDIO_OK)
+	if (audio_melody_E1_start(&e1_param, return_path) == AUDIO_OK) {
+		strcpy(melody_E1_name, e1_param.melody_name);
+		return (ATI_CMPL);
+	} else
+		return (ATI_FAIL);
+}
+
+/* AT@E1STOP - stop melody started with AT@E1 */
+GLOBAL T_ATI_RSLT atAtE1STOP ( char *cl, UBYTE srcId )
+{
+	T_AUDIO_MELODY_E1_STOP_PARAMETER e1stop_param;
+	T_RV_RETURN return_path;
+
+	if (!melody_E1_name[0])
+		return (ATI_FAIL);
+	strcpy(e1stop_param.melody_name, melody_E1_name);
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_melody_E1_stop(&e1stop_param, return_path) == AUDIO_OK)
 		return (ATI_CMPL);
 	else
 		return (ATI_FAIL);
 }
 
+static char melody_E2_name[AUDIO_PATH_NAME_MAX_SIZE];
+
 /* AT@E2 - play an E2 format melody */
 GLOBAL T_ATI_RSLT atAtE2 ( char *cl, UBYTE srcId )
 {
@@ -250,9 +273,10 @@
 
 	return_path.addr_id        = NULL;
 	return_path.callback_func  = audio_callback;
-	if (audio_melody_E2_start(&e2_param, return_path) == AUDIO_OK)
+	if (audio_melody_E2_start(&e2_param, return_path) == AUDIO_OK) {
+		strcpy(melody_E2_name, e2_param.melody_E2_name);
 		return (ATI_CMPL);
-	else
+	} else
 		return (ATI_FAIL);
 }
 
@@ -272,6 +296,24 @@
 		return (ATI_FAIL);
 }
 
+/* AT@E2STOP - stop melody started with AT@E2 */
+GLOBAL T_ATI_RSLT atAtE2STOP ( char *cl, UBYTE srcId )
+{
+	T_AUDIO_MELODY_E2_STOP_PARAMETER e2stop_param;
+	T_RV_RETURN return_path;
+
+	if (!melody_E2_name[0])
+		return (ATI_FAIL);
+	strcpy(e2stop_param.melody_E2_name, melody_E2_name);
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_melody_E2_stop(&e2stop_param, return_path) == AUDIO_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
 /* AT@TONE - exercise TONES through RiViera Audio Service API */
 GLOBAL T_ATI_RSLT atAtTONE ( char *cl, UBYTE srcId )
 {
--- a/src/g23m-aci/aci/ati_cmd.c	Sun Jan 06 22:33:33 2019 +0000
+++ b/src/g23m-aci/aci/ati_cmd.c	Sun Jan 06 23:37:13 2019 +0000
@@ -753,8 +753,10 @@
 #endif
 EXTERN T_ATI_RSLT atAtSND (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtE1 (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtE1STOP (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtE2 (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtE2LSI (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtE2STOP (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtTONE (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtTSTOP (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtVMP (char *cl, UBYTE srcId);
@@ -1213,8 +1215,10 @@
 #endif
     {"@SND",	AT_CMD_AT_SND,   atAtSND,	0,	0,	0},
     {"@E1",	AT_CMD_AT_E1,    atAtE1,	0,	0,	0},
+    {"@E1STOP",	AT_CMD_AT_E1STOP,atAtE1STOP,	0,	0,	0},
     {"@E2",	AT_CMD_AT_E2,    atAtE2,	0,	0,	0},
     {"@E2LSI",	AT_CMD_AT_E2LSI, atAtE2LSI,	0,	0,	0},
+    {"@E2STOP",	AT_CMD_AT_E2STOP,atAtE2STOP,	0,	0,	0},
     {"@TONE",	AT_CMD_AT_TONE,  atAtTONE,	0,	0,	0},
     {"@TSTOP",	AT_CMD_AT_TSTOP, atAtTSTOP,	0,	0,	0},
     {"@VMP",	AT_CMD_AT_VMP,   atAtVMP,	0,	0,	0},