diff options
Diffstat (limited to 'meta/recipes-connectivity/gsm/files/025_sms-status-report.patch')
-rw-r--r-- | meta/recipes-connectivity/gsm/files/025_sms-status-report.patch | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/gsm/files/025_sms-status-report.patch b/meta/recipes-connectivity/gsm/files/025_sms-status-report.patch new file mode 100644 index 0000000000..560e72e380 --- /dev/null +++ b/meta/recipes-connectivity/gsm/files/025_sms-status-report.patch | |||
@@ -0,0 +1,133 @@ | |||
1 | From: Erin Yueh <erin_yueh@openmoko.com> | ||
2 | Subject: [PATCH] SMS status report | ||
3 | |||
4 | I made a patch for SMS status report. It can change SMS-Submit messages | ||
5 | and ask for a status report. When the destination address receives our | ||
6 | message, the service center will send a SMS-STATUS-REPORT to us. We can | ||
7 | tell what messages we sent by TP-MR (message reference number) value and | ||
8 | can know the sending result by TP-ST (Status) value from status report | ||
9 | messages. | ||
10 | |||
11 | PS. if you don't want to ask a status report, you can change this value | ||
12 | back. Replace "GSMD_SMS_TP_SRR_STATUS_REQUEST" with | ||
13 | "GSMD_SMS_TP_SRR_NOT_REQUEST". | ||
14 | header[pos ++] = | ||
15 | GSMD_SMS_TP_MTI_SUBMIT | | ||
16 | (0 << 2) | /* Reject Duplicates: 0 */ | ||
17 | GSMD_SMS_TP_VPF_NOT_PRESENT | | ||
18 | - GSMD_SMS_TP_SRR_NOT_REQUEST | | ||
19 | + GSMD_SMS_TP_SRR_STATUS_REQUEST | | ||
20 | (src->payload.has_header ? GSMD_SMS_TP_UDHI_WITH_HEADER : | ||
21 | GSMD_SMS_TP_UDHI_NO_HEADER) | | ||
22 | GSMD_SMS_TP_RP_NOT_SET; | ||
23 | |||
24 | Signed-off-by: Jim Huang <jserv@openmoko.org> | ||
25 | --- | ||
26 | src/gsmd/sms_pdu.c | 54 +++++++++++++++++++++++++++++++++++++++++++----------- | ||
27 | src/util/event.c | 6 +++++- | ||
28 | 2 files changed, 48 insertions(+), 12 deletions(-) | ||
29 | |||
30 | Index: gsm/src/gsmd/sms_pdu.c | ||
31 | =================================================================== | ||
32 | --- gsm.orig/src/gsmd/sms_pdu.c 2007-09-06 11:14:34.000000000 +0800 | ||
33 | +++ gsm/src/gsmd/sms_pdu.c 2007-09-17 23:39:20.000000000 +0800 | ||
34 | @@ -139,6 +139,17 @@ | ||
35 | /* Skip TP-PID */ | ||
36 | len -= 9; | ||
37 | src += 9; | ||
38 | + | ||
39 | + /* TP-UDL */ | ||
40 | + dst->payload.length = src[0]; | ||
41 | + i = sms_data_bytelen(dst->payload.coding_scheme, src[0]); | ||
42 | + | ||
43 | + /* TP-UD */ | ||
44 | + if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN) | ||
45 | + return 1; | ||
46 | + memcpy(dst->payload.data, src + 1, i); | ||
47 | + dst->payload.data[i] = 0; | ||
48 | + | ||
49 | break; | ||
50 | case GSMD_SMS_TP_MTI_SUBMIT: | ||
51 | if (len < 4) | ||
52 | @@ -179,23 +190,44 @@ | ||
53 | src += vpf ? 3 : 2; | ||
54 | |||
55 | memset(dst->time_stamp, 0, 7); | ||
56 | + | ||
57 | + /* TP-UDL */ | ||
58 | + dst->payload.length = src[0]; | ||
59 | + i = sms_data_bytelen(dst->payload.coding_scheme, src[0]); | ||
60 | + | ||
61 | + /* TP-UD */ | ||
62 | + if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN) | ||
63 | + return 1; | ||
64 | + memcpy(dst->payload.data, src + 1, i); | ||
65 | + dst->payload.data[i] = 0; | ||
66 | break; | ||
67 | case GSMD_SMS_TP_MTI_STATUS_REPORT: | ||
68 | - /* TODO */ | ||
69 | + if (len < 3) | ||
70 | + return 1; | ||
71 | + | ||
72 | + /* TP-MR set it gsmd_sms_list.index*/ | ||
73 | + dst->index = (int) src[1]; | ||
74 | + /* TP-STATUS set it to coding_scheme */ | ||
75 | + dst->payload.coding_scheme = (int) src[len-1]; | ||
76 | + /* TP-RA */ | ||
77 | + i = sms_number_bytelen(src[3], src[2]); | ||
78 | + if (len < 13 + i) | ||
79 | + return 1; | ||
80 | + if (sms_address2ascii(&dst->addr, src + 2)) | ||
81 | + return 1; | ||
82 | + len -= 4 + i; | ||
83 | + src += 4 + i; | ||
84 | + /* TP-SCTS */ | ||
85 | + memcpy(dst->time_stamp, src, 7); | ||
86 | + /* TP-UD */ | ||
87 | + dst->payload.length = 0; | ||
88 | + dst->payload.data[0] = 0; | ||
89 | + break; | ||
90 | default: | ||
91 | /* Unknown PDU type */ | ||
92 | return 1; | ||
93 | } | ||
94 | |||
95 | - /* TP-UDL */ | ||
96 | - dst->payload.length = src[0]; | ||
97 | - i = sms_data_bytelen(dst->payload.coding_scheme, src[0]); | ||
98 | - | ||
99 | - /* TP-UD */ | ||
100 | - if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN) | ||
101 | - return 1; | ||
102 | - memcpy(dst->payload.data, src + 1, i); | ||
103 | - dst->payload.data[i] = 0; | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | @@ -215,7 +247,7 @@ | ||
108 | GSMD_SMS_TP_MTI_SUBMIT | | ||
109 | (0 << 2) | /* Reject Duplicates: 0 */ | ||
110 | GSMD_SMS_TP_VPF_NOT_PRESENT | | ||
111 | - GSMD_SMS_TP_SRR_NOT_REQUEST | | ||
112 | + GSMD_SMS_TP_SRR_STATUS_REQUEST | | ||
113 | (src->payload.has_header ? GSMD_SMS_TP_UDHI_WITH_HEADER : | ||
114 | GSMD_SMS_TP_UDHI_NO_HEADER) | | ||
115 | GSMD_SMS_TP_RP_NOT_SET; | ||
116 | Index: gsm/src/util/event.c | ||
117 | =================================================================== | ||
118 | --- gsm.orig/src/util/event.c 2007-09-06 11:14:34.000000000 +0800 | ||
119 | +++ gsm/src/util/event.c 2007-09-17 23:39:47.000000000 +0800 | ||
120 | @@ -128,8 +128,12 @@ | ||
121 | static int inds_handler(struct lgsm_handle *lh, int evt, | ||
122 | struct gsmd_evt_auxdata *aux) | ||
123 | { | ||
124 | - if (aux->u.ds.inlined) | ||
125 | + if (aux->u.ds.inlined) { | ||
126 | + struct gsmd_sms_list *sms; | ||
127 | + sms = (struct gsmd_sms_list *) aux->data; | ||
128 | printf("EVENT: Incoming Status Report\n"); | ||
129 | + printf("message ref = %d, status = %d\n", sms->index,sms->payload.coding_scheme); | ||
130 | + } | ||
131 | else | ||
132 | printf("EVENT: Incoming Status Report stored at location %i\n", | ||
133 | aux->u.ds.index); | ||