Skip to contentSkip to conversation

gatserver: Add send raw data function

PATCH In review Olivier Guiter 2 participants 3 messages Feb 11, 2011 – Feb 14, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gatserver: Add send raw data function

---
 gatchat/gatserver.c |   14 ++++++++++++++
 gatchat/gatserver.h |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)
gatchat/gatserver.c +14 -0
index 25b7ba4..f2ee34d 100644
@@ -252,6 +252,20 @@ void g_at_server_send_info(GAtServer *server, const char *line, gboolean last)
 	send_common(server, buf, len);
 }
 
+void g_at_server_send_data(GAtServer *server, const char *format, ...)
+{
+	char buf[MAX_TEXT_SIZE + 1];
+	unsigned int len;
+
+	va_list ap;
+
+	va_start(ap, format);
+	len = vsnprintf(buf, MAX_TEXT_SIZE, format, ap);
+	va_end(ap);
+
+	send_common(server, buf, len);
+}
+
 static gboolean get_result_value(GAtServer *server, GAtResult *result,
 						const char *command,
 						int min, int max, int *value)
gatchat/gatserver.h +1 -0
index f0c19da..911f20d 100644
@@ -112,6 +112,7 @@ void g_at_server_send_unsolicited(GAtServer *server, const char *result);
  * responses.
  */
 void g_at_server_send_info(GAtServer *server, const char *line, gboolean last);
+void g_at_server_send_data(GAtServer *server, const char *format, ...);
 
 #ifdef __cplusplus
 }
Signature · 1 line
1.7.1
#1 lore raw

Hi Olivier,

gatchat/gatserver.h void g_at_server_send_unsolicited(GAtServer *server, const char *result); · line 116

Quoted 6 lines
gatchat/gatserver.h +1 -0
@@ -112,6 +112,7 @@ void g_at_server_send_unsolicited(GAtServer *server, const char *result);
  * responses.
  */
 void g_at_server_send_info(GAtServer *server, const char *line, gboolean last);
+void g_at_server_send_data(GAtServer *server, const char *format, ...);
 

What is the target use case you're thinking of for this one?

gatchat/gatserver.h void g_at_server_send_unsolicited(GAtServer *server, const char *result); · line 118

Quoted 2 lines
gatchat/gatserver.h +0 -0
 #ifdef __cplusplus
 }

Regards,
-Denis

#2 lore raw

Hi Denis,
The purpose was to be able to send long AT commands answers (like the AT+CGDCONT?) without allocating buffers but, after reconsidering the code it is not really needed as i can use the "g_at_server_send_info" for the same purpose ;)
So you can ignore this patch.
Thanks
Olivier

Quoted 14 lines · Denis Kenzior

Hi Olivier,

gatchat/gatserver.h void g_at_server_send_unsolicited(GAtServer *server, const char *result); · line 116

Quoted 6 lines
gatchat/gatserver.h +1 -0
@@ -112,6 +112,7 @@ void g_at_server_send_unsolicited(GAtServer *server, const char *result);
   * responses.
   */
  void g_at_server_send_info(GAtServer *server, const char *line, gboolean last);
+void g_at_server_send_data(GAtServer *server, const char *format, ...);
 

What is the target use case you're thinking of for this one?

gatchat/gatserver.h void g_at_server_send_unsolicited(GAtServer *server, const char *result); · line 118

Quoted 2 lines
gatchat/gatserver.h +0 -0
  #ifdef __cplusplus
  }

Regards,
-Denis