Translation update done using Pootle.
[gammu.git] / tests / sms-nokia-13.c
blob5737118303eae61fc5ba783e703fea0b76dab4a2
1 /* Test for decoding SMS on Nokia 6510 driver */
3 #include <gammu.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <string.h>
8 #include "common.h"
10 #include "../libgammu/protocol/protocol.h" /* Needed for GSM_Protocol_Message */
11 #include "../libgammu/gsmstate.h" /* Needed for state machine internals */
13 #include "../helper/message-display.h"
15 unsigned char data[] = {
16 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x9A, 0x00, 0x00, 0x04, 0x53, 0x00, 0x00, 0x00, 0x00,
17 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
25 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27 0x51, 0x02, 0x0B, 0x81, 0x40, 0x42, 0x14, 0x59, 0x01, 0xF2, 0x00, 0x08, 0xFF, 0x8C, 0x05, 0x00,
28 0x03, 0x02, 0x03, 0x01, 0x00, 0x44, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x20, 0x00, 0x6E,
29 0x00, 0x6F, 0x00, 0x20, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x64, 0x00, 0xED, 0x00, 0x61, 0x00, 0x20,
30 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x72, 0x00, 0x20, 0x00, 0x65, 0x00, 0x6E,
31 0x00, 0x20, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x61, 0x00, 0x73, 0x00, 0x20, 0x00, 0x70,
32 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x20, 0x00, 0x61, 0x00, 0x20,
33 0x00, 0x6C, 0x00, 0x61, 0x00, 0x20, 0x00, 0x76, 0x00, 0x65, 0x00, 0x7A, 0x00, 0x20, 0x00, 0x2E,
34 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x50, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x20, 0x00, 0x65,
35 0x00, 0x73, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x6F, 0x00, 0x20,
36 0x00, 0x61, 0x00, 0x20, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x73, 0x01, 0x03, 0x06, 0x01, 0x00, 0x01,
37 0x01, 0x03, 0x01, 0x26, 0x00, 0x44, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x20, 0x00, 0x6E,
38 0x00, 0x6F, 0x00, 0x20, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x64, 0x00, 0xED, 0x00, 0x61, 0x00, 0x20,
39 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x72, 0x00, 0x20, 0x00, 0x65, 0x00, 0x6E,
40 0x00, 0x20, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x61, 0x00, 0x73, 0x00, 0x20, 0x00, 0x70,
41 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x20, 0x00, 0x61, 0x00, 0x20,
42 0x00, 0x6C, 0x00, 0x61, 0x00, 0x20, 0x00, 0x76, 0x00, 0x65, 0x00, 0x7A, 0x00, 0x20, 0x00, 0x2E,
43 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x50, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x20, 0x00, 0x65,
44 0x00, 0x73, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x6F, 0x00, 0x20,
45 0x00, 0x61, 0x00, 0x20, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x73, 0x00, 0x20, 0x00, 0x6D, 0x00, 0x61,
46 0x00, 0x64, 0x00, 0x72, 0x00, 0x65, 0x00, 0x73, 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x20,
47 0x00, 0x46, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x7A, 0x00, 0x20, 0x00, 0x64, 0x00, 0xED,
48 0x00, 0x61, 0x00, 0xA1, 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x50, 0x00, 0x6F,
49 0x00, 0x72, 0x00, 0x20, 0x00, 0x75, 0x00, 0x64, 0x00, 0x73, 0x00, 0x20, 0x00, 0x73, 0x00, 0x6F,
50 0x00, 0x6D, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x20, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x71,
51 0x00, 0x75, 0x00, 0x65, 0x00, 0x20, 0x00, 0x73, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x6F, 0x00, 0x73,
52 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x47, 0x00, 0x72, 0x00, 0x61, 0x00, 0x63,
53 0x00, 0x69, 0x00, 0x61, 0x00, 0x73, 0x00, 0x20, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x20,
54 0x00, 0x65, 0x00, 0x78, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x69, 0x00, 0x72, 0x00, 0x2E,
55 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x04, 0x00, 0x18, 0x00, 0x30, 0x00,
56 0x34, 0x00, 0x32, 0x00, 0x34, 0x00, 0x34, 0x00, 0x31, 0x00, 0x39, 0x00, 0x35, 0x00, 0x31, 0x00,
57 0x30, 0x00, 0x32, 0x00, 0x00, 0x0C, 0x00, 0x03, 0x65, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05,
58 0x00, 0x01, 0x09, 0x04, 0x00, 0x18, 0x00, 0x30, 0x00, 0x34, 0x00, 0x32, 0x00, 0x34, 0x00, 0x34,
59 0x00, 0x39, 0x00, 0x39, 0x00, 0x38, 0x00, 0x37, 0x00, 0x34, 0x00, 0x39, 0x00, 0x00, 0x0C, 0x00,
60 0x03, 0x65, 0x33, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x09, 0x04, 0x00, 0x18, 0x00,
61 0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x36, 0x00, 0x30, 0x00, 0x32, 0x00, 0x33, 0x00, 0x32, 0x00,
62 0x33, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x0C, 0x00, 0x03, 0x65, 0x36, 0x00, 0x07, 0x00, 0x01,
63 0x00, 0x05, 0x00, 0x01, 0x09, 0x04, 0x00, 0x18, 0x00, 0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x34,
64 0x00, 0x34, 0x00, 0x33, 0x00, 0x33, 0x00, 0x34, 0x00, 0x39, 0x00, 0x37, 0x00, 0x35, 0x00, 0x00,
65 0x0C, 0x00, 0x03, 0x65, 0x39, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x09, 0x04, 0x00,
66 0x18, 0x00, 0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x38, 0x00, 0x32, 0x00,
67 0x34, 0x00, 0x33, 0x00, 0x38, 0x00, 0x36, 0x00, 0x00, 0x0C, 0x00, 0x03, 0x65, 0x63, 0x00, 0x07,
68 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x09, 0x04, 0x00, 0x18, 0x00, 0x30, 0x00, 0x34, 0x00, 0x31,
69 0x00, 0x36, 0x00, 0x33, 0x00, 0x33, 0x00, 0x33, 0x00, 0x33, 0x00, 0x30, 0x00, 0x34, 0x00, 0x36,
70 0x00, 0x00, 0x0C, 0x00, 0x03, 0x65, 0x66, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x09,
71 0x04, 0x00, 0x18, 0x00, 0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x36, 0x00, 0x37, 0x00, 0x34, 0x00,
72 0x31, 0x00, 0x30, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x00, 0x0C, 0x00, 0x03, 0x66, 0x32,
73 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x09, 0x04, 0x00, 0x18, 0x00, 0x30, 0x00, 0x34,
74 0x00, 0x31, 0x00, 0x34, 0x00, 0x34, 0x00, 0x30, 0x00, 0x37, 0x00, 0x39, 0x00, 0x36, 0x00, 0x30,
75 0x00, 0x30, 0x00, 0x00, 0x0C, 0x00, 0x03, 0x66, 0x35, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00,
76 0x01, 0x09, 0x04, 0x00, 0x18, 0x00, 0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x36, 0x00, 0x32, 0x00,
77 0x33, 0x00, 0x34, 0x00, 0x35, 0x00, 0x35, 0x00, 0x39, 0x00, 0x37, 0x00, 0x00, 0x0C, 0x00, 0x03,
78 0x66, 0x38, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x09, 0x04, 0x00, 0x18, 0x00, 0x30,
79 0x00, 0x34, 0x00, 0x31, 0x00, 0x36, 0x00, 0x36, 0x00, 0x34, 0x00, 0x35, 0x00, 0x30, 0x00, 0x30,
80 0x00, 0x38, 0x00, 0x34, 0x00, 0x00, 0x0C, 0x00, 0x03, 0x66, 0x62, 0x00, 0x07, 0x00, 0x01, 0x00,
81 0x05, 0x00, 0x01, 0x09, 0x04, 0x00, 0x18, 0x00, 0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x32, 0x00,
82 0x37, 0x00, 0x35, 0x00, 0x32, 0x00, 0x36, 0x00, 0x32, 0x00, 0x35, 0x00, 0x34, 0x00, 0x00, 0x0C,
83 0x00, 0x03, 0x66, 0x65, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x09, 0x06, 0x00, 0x04,
84 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00,
85 0x00, 0x00, 0x00
88 const char text[] = "Dios no podía estar en todas partes a la vez ... Por eso creo a las";
89 char decoded_text[200];
91 /* This is not part of API! */
92 extern GSM_Error N6510_DecodeFilesystemSMS(GSM_StateMachine * s, GSM_MultiSMSMessage * sms, GSM_File * FFF, int location);
94 int main(int argc UNUSED, char **argv UNUSED)
96 GSM_Debug_Info *debug_info;
97 GSM_StateMachine *s;
98 GSM_File file;
99 GSM_Error error;
100 GSM_MultiSMSMessage sms;
102 /* Init locales for proper output */
103 GSM_InitLocales(NULL);
105 debug_info = GSM_GetGlobalDebug();
106 GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info);
107 GSM_SetDebugLevel("textall", debug_info);
109 /* Allocates state machine */
110 s = GSM_AllocStateMachine();
111 test_result(s != NULL);
113 debug_info = GSM_GetDebug(s);
114 GSM_SetDebugGlobal(TRUE, debug_info);
116 /* Init file */
117 file.Buffer = malloc(sizeof(data));
118 memcpy(file.Buffer, data, sizeof(data));
119 file.Used = sizeof(data);
120 file.ID_FullName[0] = 0;
121 file.ID_FullName[1] = 0;
122 GSM_GetCurrentDateTime(&(file.Modified));
124 /* Parse it */
125 error = N6510_DecodeFilesystemSMS(s, &sms, &file, 0);
127 /* Display message */
128 DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL);
129 DisplayMultiSMSInfo(&sms, TRUE, TRUE, NULL, NULL);
131 /* Free state machine */
132 GSM_FreeStateMachine(s);
134 /* Check expected text */
135 /* We do not compare full text due to locales problem */
136 EncodeUTF8(decoded_text, sms.SMS[0].Text);
137 test_result(strcmp(text, decoded_text) == 0);
139 gammu_test_result(error, "N6510_DecodeFilesystemSMS");
141 return 0;
144 /* Editor configuration
145 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: