summaryrefslogtreecommitdiff
path: root/packages/gsm/files/0005-Add-ask-ds-option-forSMS.patch
blob: e9f49bd7d2b44fe226a6cb41aed0d11746f365a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
diff --git a/include/gsmd/usock.h b/include/gsmd/usock.h
index 236ad78..66cdf48 100644
--- a/include/gsmd/usock.h
+++ b/include/gsmd/usock.h
@@ -332,6 +332,7 @@ struct gsmd_sms {
 struct gsmd_sms_submit {
 	struct gsmd_addr addr;
 	struct gsmd_sms payload;
+	int ask_ds;
 };
 
 /* Refer to GSM 07.05 subclause 4.4 */
diff --git a/include/libgsmd/sms.h b/include/libgsmd/sms.h
index 3ada62d..9808442 100644
--- a/include/libgsmd/sms.h
+++ b/include/libgsmd/sms.h
@@ -46,6 +46,7 @@ struct lgsm_sms {
 	enum gsmd_sms_alphabet alpha;
 	u_int8_t data[LGSM_SMS_DATA_MAXLEN+1];
 	int length;
+	int ask_ds;
 };
 
 /* GSM 03.40 subclause 9.2.2.2 and GSM 07.05 subclause 4.4 and subclause 3.1 */
diff --git a/src/gsmd/sms_pdu.c b/src/gsmd/sms_pdu.c
index d1235dd..d461999 100644
--- a/src/gsmd/sms_pdu.c
+++ b/src/gsmd/sms_pdu.c
@@ -247,7 +247,8 @@ int sms_pdu_make_smssubmit(char *dest, const struct gsmd_sms_submit *src)
 		GSMD_SMS_TP_MTI_SUBMIT |
 		(0 << 2) |		/* Reject Duplicates: 0 */
 		GSMD_SMS_TP_VPF_NOT_PRESENT |
-		GSMD_SMS_TP_SRR_STATUS_REQUEST |
+		(src->ask_ds ? GSMD_SMS_TP_SRR_STATUS_REQUEST :
+		 GSMD_SMS_TP_SRR_NOT_REQUEST) |
 		(src->payload.has_header ? GSMD_SMS_TP_UDHI_WITH_HEADER :
 		 GSMD_SMS_TP_UDHI_NO_HEADER) |
 		GSMD_SMS_TP_RP_NOT_SET;
diff --git a/src/libgsmd/libgsmd_sms.c b/src/libgsmd/libgsmd_sms.c
index 22d7dbf..bbc8689 100644
--- a/src/libgsmd/libgsmd_sms.c
+++ b/src/libgsmd/libgsmd_sms.c
@@ -126,6 +126,7 @@ int lgsm_sms_send(struct lgsm_handle *lh,
 	if (lgsm_number2addr(&gss->addr, sms->addr, 1))
 		return -EINVAL;
 
+	gss->ask_ds = sms->ask_ds;
 	gss->payload.has_header = 0;
 	gss->payload.length = sms->length;
 	gss->payload.coding_scheme = sms->alpha;
@@ -161,6 +162,7 @@ int lgsm_sms_write(struct lgsm_handle *lh,
 	if (lgsm_number2addr(&gsw->sms.addr, sms_write->sms.addr, 1))
 		return -EINVAL;
 
+	gsw->sms.ask_ds = sms_write->sms.ask_ds;
 	gsw->sms.payload.has_header = 0;
 	gsw->sms.payload.length = sms_write->sms.length;
 	gsw->sms.payload.coding_scheme = sms_write->sms.alpha;
diff --git a/src/util/shell.c b/src/util/shell.c
index f902126..f26e17e 100644
--- a/src/util/shell.c
+++ b/src/util/shell.c
@@ -355,7 +355,7 @@ static int shell_help(void)
 		"\tsd\tSMS Delete (sd=index,delflg)\n"
 		"\tsl\tSMS List (sl=stat)\n"
 		"\tsr\tSMS Read (sr=index)\n"
-		"\tss\tSMS Send (ss=number,text|[\"text\"])\n"
+		"\tss\tSMS Send (ss=ask_ds,number,text|[\"text\"])\n"
 		"\tsw\tSMS Write (sw=stat,number,text)\n"
 		"\tsm\tSMS Storage stats\n"
 		"\tsM\tSMS Set preferred storage (sM=mem1,mem2,mem3)\n"
@@ -563,33 +563,29 @@ int shell_main(struct lgsm_handle *lgsmh)
 				struct lgsm_sms sms;
 
 				ptr = strchr(buf, '=');
+				sms.ask_ds = atoi(ptr+1);
 				fcomma = strchr(buf, ',');
-				if (!ptr || !fcomma) {
-					printf("Wrong command format\n");
-				} else {
-					strncpy(sms.addr, ptr+1, fcomma-ptr-1);
-					sms.addr[fcomma-ptr-1] = '\0';
-
-					/* todo define \" to allow " in text */
-					if (fcomma[1] == '"' &&
-						!strchr(fcomma+2, '"')) {
+				lcomma = strchr(fcomma+1, ',');
+				strncpy(sms.addr, fcomma+1, lcomma-fcomma-1);
+				sms.addr[lcomma-fcomma-1] = '\0';
+				/* todo define \" to allow " in text */
+				if (lcomma[1]=='"' &&
+						!strchr(lcomma+2, '"')) {
 						/* read until closing '"' */
 						rc = fscanf(stdin, "%[^\"]\"",
-							fcomma+strlen(fcomma));
+							lcomma+strlen(lcomma));
 						if (rc == EOF) {
 							printf("EOF\n");
 							return -1;
 						}
 						/* remove brackets */
-						fcomma++;
-						fcomma[strlen(fcomma)] = '\0';
-					}
-
-					printf("Send SMS\n");
-					packing_7bit_character(fcomma+1, &sms);
+						lcomma++;
+						lcomma[strlen(lcomma)] = '\0';
+				}				
+				printf("Send SMS\n");
+				packing_7bit_character(lcomma+1, &sms);
 
-					lgsm_sms_send(lgsmh, &sms);
-				}
+				lgsm_sms_send(lgsmh, &sms);
 			} else if ( !strncmp(buf, "sw", 2)) {	
 				printf("Write SMS\n");				
 				struct lgsm_sms_write sms_write;
@@ -603,6 +599,7 @@ int shell_main(struct lgsm_handle *lgsmh)
 				sms_write.sms.addr[lcomma-fcomma-1] = '\0';
 				packing_7bit_character(
 						lcomma+1, &sms_write.sms);
+				sms_write.sms.ask_ds = 0;
 
 				lgsm_sms_write(lgsmh, &sms_write);
 			} else if (!strncmp(buf, "sm", 2)) {
-- 
1.5.2.1