changeset 566:f6f599aad453

aci3: AT-over-RVT mechanism extended to support long messages
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 09 Jan 2019 07:09:47 +0000
parents 96c1d047b3c6
children 41742552e98b
files src/g23m-aci/aci/ati_src_rvt.c
diffstat 1 files changed, 24 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/g23m-aci/aci/ati_src_rvt.c	Mon Jan 07 01:06:46 2019 +0000
+++ b/src/g23m-aci/aci/ati_src_rvt.c	Wed Jan 09 07:09:47 2019 +0000
@@ -3,13 +3,6 @@
  * a mechanism for passing AT commands and responses over RVTMUX.
  */
 
-#if 0
-#include "config.h"
-#include "fixedconf.h"
-#include "condat-features.h"
-#include "aci_conf.h"
-#endif
-
 /* includes copied from ati_cmd.c */
 
 #undef DUMMY_ATI_STRINGS
@@ -100,29 +93,41 @@
 {
     T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, rvt_src_id,
 						 search_ati_src_id);
+    USHORT offset;
 
     ati_user_output_cfg[rvt_src_id].atE = 0;
 
-    if (src_params->text_mode EQ CMD_MODE)
+    if (aci_cmd_req->cmd_len && aci_cmd_req->cmd_seq[0] == 0x01)
     {
-      TRACE_FUNCTION ("ati_src_rvt_proc_cmd () CMD MODE");
+      TRACE_FUNCTION ("ati_src_rvt_proc_cmd () unterminated");
 
-      aci_cmd_req->cmd_seq[aci_cmd_req->cmd_len] = '\r';     /* make it V.25 ter compatible */
-      aci_cmd_req->cmd_seq[(aci_cmd_req->cmd_len) + 1] = '\0';
-      aci_cmd_req->cmd_len++;
+      aci_cmd_req->cmd_seq[aci_cmd_req->cmd_len] = '\0';
+      offset = 1;
     }
-    else /* text has to be terminated by Ctrl-Z */
+    else
     {
-      TRACE_FUNCTION ("ati_src_rvt_proc_cmd () TEXT MODE");
+      offset = 0;
+      if (src_params->text_mode EQ CMD_MODE)
+      {
+        TRACE_FUNCTION ("ati_src_rvt_proc_cmd () CMD MODE");
 
-      aci_cmd_req->cmd_seq[aci_cmd_req->cmd_len] = 0x1a;     /* make it V.25 ter compatible */
-      aci_cmd_req->cmd_seq[(aci_cmd_req->cmd_len) + 1] = '\0';
-      aci_cmd_req->cmd_len++;
+        aci_cmd_req->cmd_seq[aci_cmd_req->cmd_len] = '\r';     /* make it V.25 ter compatible */
+        aci_cmd_req->cmd_seq[(aci_cmd_req->cmd_len) + 1] = '\0';
+        aci_cmd_req->cmd_len++;
+      }
+      else /* text has to be terminated by Ctrl-Z */
+      {
+        TRACE_FUNCTION ("ati_src_rvt_proc_cmd () TEXT MODE");
+
+        aci_cmd_req->cmd_seq[aci_cmd_req->cmd_len] = 0x1a;     /* make it V.25 ter compatible */
+        aci_cmd_req->cmd_seq[(aci_cmd_req->cmd_len) + 1] = '\0';
+        aci_cmd_req->cmd_len++;
+      }
     }
 
     return (ati_execute (rvt_src_id,
-                         aci_cmd_req->cmd_seq,
-                         aci_cmd_req->cmd_len));
+                         aci_cmd_req->cmd_seq + offset,
+                         aci_cmd_req->cmd_len - offset));
 }
 
 /*