changeset 383:f8c693d16978

fcup-smsendmult: UCS-2 send mode implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 09 Mar 2018 02:56:09 +0000
parents 88131632ce48
children 3eb92855f7b9
files uptools/atcmd/smsend_multmain.c
diffstat 1 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/uptools/atcmd/smsend_multmain.c	Fri Mar 09 02:48:41 2018 +0000
+++ b/uptools/atcmd/smsend_multmain.c	Fri Mar 09 02:56:09 2018 +0000
@@ -155,13 +155,39 @@
 	return(0);
 }
 
+process_msg_ucs2()
+{
+	u_short msgtext_uni[70];
+	unsigned msgtext_unilen;
+	int rc;
+
+	rc = utf8_to_ucs2(msgtext, msgtext_uni, 70, &msgtext_unilen);
+	if (rc == -1) {
+		fprintf(stderr, "input line %d: invalid UTF-8 message\n",
+			lineno);
+		exit(ERROR_USAGE);
+	}
+	if (rc == -2) {
+		fprintf(stderr,
+			"input line %d: message exceeds 70 UCS-2 chars\n",
+			lineno);
+		exit(ERROR_USAGE);
+	}
+	init_send_process();
+	send_pdu_ucs2(dest_addr, msgtext_uni, msgtext_unilen, 0, 0);
+	return(0);
+}
+
 main(argc, argv)
 	char **argv;
 {
 	process_cmdline(argc, argv);
 	for (lineno = 1; fgets(input_line, sizeof input_line, stdin); lineno++){
 		preen_input_line();
-		process_msg_gsm7();
+		if (ucs2_mode)
+			process_msg_ucs2();
+		else
+			process_msg_gsm7();
 	}
 	if (!initdone)
 		exit(0);