changeset 240:9034c3a7267e

Voice memo recording and playback test AT commands implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 22 Mar 2017 07:07:15 +0000
parents e0b9c21d7908
children 63c12cba5ed5
files src/aci2/aci/aci_cmh.h src/aci2/aci/ati_audio.c src/aci2/aci/ati_cmd.c
diffstat 3 files changed, 95 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/aci2/aci/aci_cmh.h	Wed Mar 22 04:51:29 2017 +0000
+++ b/src/aci2/aci/aci_cmh.h	Wed Mar 22 07:07:15 2017 +0000
@@ -485,6 +485,10 @@
   AT_CMD_AT_E2LSI,
   AT_CMD_AT_TONE,
   AT_CMD_AT_TSTOP,
+  AT_CMD_AT_VMP,
+  AT_CMD_AT_VMPS,
+  AT_CMD_AT_VMR,
+  AT_CMD_AT_VMRS,
   /* terminator */
   AT_CMD_MAX                  /* maximum command id */
 } T_ACI_AT_CMD;
--- a/src/aci2/aci/ati_audio.c	Wed Mar 22 04:51:29 2017 +0000
+++ b/src/aci2/aci/ati_audio.c	Wed Mar 22 07:07:15 2017 +0000
@@ -187,4 +187,87 @@
 		return (ATI_FAIL);
 }
 
+/* AT@VMP - play back a voice memo recording */
+GLOBAL T_ATI_RSLT atAtVMP ( char *cl, UBYTE srcId )
+{
+	T_AUDIO_VM_PLAY_PARAMETER play_param;
+	T_RV_RETURN return_path;
+
+	play_param.memo_name[0] = 0;
+	cl = parse(cl, "s", (LONG)(sizeof(play_param.memo_name) - 1),
+		   play_param.memo_name);
+	if (!play_param.memo_name[0])
+		return (ATI_FAIL);
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_vm_play_start(&play_param, return_path) == AUDIO_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+/* AT@VMPS - stop VM play started with AT@VMP */
+GLOBAL T_ATI_RSLT atAtVMPS ( char *cl, UBYTE srcId )
+{
+	T_RV_RETURN return_path;
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_vm_play_stop(return_path) == AUDIO_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+static const T_AUDIO_TONES_PARAMETER recorder_warning_tone = {
+	0, 500, 1400, -5,
+	0, 500, 0, 0,
+	0, 500, 0, 0,
+	500, 500, 15000, TONE_INFINITE
+};
+
+/* AT@VMR - record a voice memo */
+GLOBAL T_ATI_RSLT atAtVMR ( char *cl, UBYTE srcId )
+{
+	T_AUDIO_VM_RECORD_PARAMETER record_param;
+	int duration = 0, compression = 0;
+	LONG mic_gain = 0x100, network_gain = 0x100;
+	T_RV_RETURN return_path;
+
+	record_param.memo_name[0] = 0;
+	cl = parse(cl, "sddyy", (LONG)(sizeof(record_param.memo_name) - 1),
+		   record_param.memo_name, &duration, &compression,
+		   &mic_gain, &network_gain);
+	if (!record_param.memo_name[0] || !duration)
+		return (ATI_FAIL);
+	record_param.memo_duration = duration;
+	record_param.compression_mode = compression;
+	record_param.microphone_gain = mic_gain;
+	record_param.network_gain = network_gain;
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_vm_record_start(&record_param,
+				  (T_AUDIO_TONES_PARAMETER *)
+					&recorder_warning_tone,
+				  return_path) == AUDIO_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+/* AT@VMRS - stop VM recording started with AT@VMR */
+GLOBAL T_ATI_RSLT atAtVMRS ( char *cl, UBYTE srcId )
+{
+	T_RV_RETURN return_path;
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_vm_record_stop(return_path) == AUDIO_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
 #endif /* ATI_AUDIO_C */
--- a/src/aci2/aci/ati_cmd.c	Wed Mar 22 04:51:29 2017 +0000
+++ b/src/aci2/aci/ati_cmd.c	Wed Mar 22 07:07:15 2017 +0000
@@ -678,6 +678,10 @@
 EXTERN T_ATI_RSLT atAtE2LSI (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);
+EXTERN T_ATI_RSLT atAtVMPS (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtVMR (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtVMRS (char *cl, UBYTE srcId);
 
 LOCAL const ATCommand_bas cmds_bas[] =
 {
@@ -1072,6 +1076,10 @@
     {"@E2LSI",	AT_CMD_AT_E2LSI, atAtE2LSI,	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},
+    {"@VMPS",	AT_CMD_AT_VMPS,  atAtVMPS,	0,	0,	0},
+    {"@VMR",	AT_CMD_AT_VMR,   atAtVMR,	0,	0,	0},
+    {"@VMRS",	AT_CMD_AT_VMRS,  atAtVMRS,	0,	0,	0},
     /* terminator */
     {NULL,0,0,0,0,0}
 };