Translation update done using Pootle.
[gammu.git] / tests / sms-nokia-09.c
blobcc1bc98c0fa72a01feee7b9f1cf035988f1c4238
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, 0x7B, 0x00, 0x00, 0x02, 0x9F, 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 0x11, 0x0D, 0x0D, 0x91, 0x34, 0x96, 0x19, 0x69, 0x38, 0x91, 0xF9, 0x00, 0x00, 0xFF, 0x7B, 0x4F,
28 0x39, 0x1D, 0xFD, 0x86, 0xBB, 0x40, 0x4B, 0x24, 0xE8, 0x58, 0x96, 0xCF, 0xE9, 0xE8, 0xB7, 0x59,
29 0x71, 0x4D, 0x97, 0xD9, 0xE5, 0x76, 0xD8, 0x3D, 0x3F, 0xBB, 0x40, 0x32, 0x1C, 0x0B, 0x14, 0x8B,
30 0xE1, 0x60, 0x8A, 0x39, 0x3D, 0x4C, 0x4F, 0xBF, 0xDD, 0xA0, 0x20, 0x0B, 0xA4, 0x4D, 0xBB, 0x40,
31 0xB1, 0x18, 0x4C, 0x71, 0x2F, 0xCB, 0xC9, 0x65, 0x90, 0xFD, 0x2D, 0x0F, 0xD7, 0xE7, 0xF3, 0xF4,
32 0x18, 0x4D, 0x67, 0xBB, 0x40, 0xCD, 0xB7, 0xFC, 0x5C, 0x76, 0x83, 0x9E, 0x70, 0x17, 0xC8, 0x04,
33 0x32, 0xCB, 0xCB, 0x75, 0x50, 0x3B, 0x3D, 0x46, 0xB3, 0x40, 0xF7, 0xB2, 0xDB, 0x0D, 0x4A, 0xA3,
34 0xE5, 0x20, 0x6D, 0x39, 0x4D, 0x07, 0xA1, 0xC3, 0x62, 0xBA, 0x0B, 0x01, 0x01, 0x71, 0x01, 0x00,
35 0x01, 0x01, 0x03, 0x00, 0xF8, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x74, 0x00, 0x68, 0x00, 0x6F, 0x00,
36 0x70, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x4B, 0x00, 0x48, 0x00, 0x20, 0x00, 0x47, 0x00, 0x65, 0x00,
37 0x72, 0x00, 0x73, 0x00, 0x74, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x66, 0x00, 0x0A, 0x00, 0x57, 0x00,
38 0x69, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00,
39 0x67, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x38, 0x00, 0x2C, 0x00, 0x20, 0x00, 0x31, 0x00,
40 0x31, 0x00, 0x38, 0x00, 0x30, 0x00, 0x0A, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x74, 0x00,
41 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x41, 0x00, 0x2C, 0x00, 0x20, 0x00, 0x5A, 0x00,
42 0x69, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x0A, 0x00, 0x77, 0x00,
43 0x65, 0x00, 0x72, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00, 0x76, 0x00, 0x6F, 0x00, 0x72, 0x00,
44 0x61, 0x00, 0x75, 0x00, 0x73, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00, 0x68, 0x00, 0x74, 0x00,
45 0x6C, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x67, 0x00, 0x65, 0x00,
46 0x6E, 0x00, 0x20, 0x00, 0x4F, 0x00, 0x70, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x26, 0x00, 0x20, 0x00,
47 0x66, 0x00, 0x72, 0x00, 0x65, 0x00, 0x75, 0x00, 0x20, 0x00, 0x6D, 0x00, 0x69, 0x00, 0x63, 0x00,
48 0x68, 0x00, 0x2C, 0x00, 0x20, 0x00, 0x77, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x6E, 0x00, 0x20, 0x00,
49 0x69, 0x00, 0x68, 0x00, 0x72, 0x00, 0x20, 0x00, 0x5A, 0x00, 0x65, 0x00, 0x69, 0x00, 0x74, 0x00,
50 0x20, 0x00, 0x68, 0x00, 0x61, 0x00, 0x62, 0x00, 0x74, 0x00, 0x2E, 0x00, 0x00, 0x04, 0x00, 0x1E,
51 0x00, 0x2B, 0x00, 0x34, 0x00, 0x33, 0x00, 0x36, 0x00, 0x39, 0x00, 0x39, 0x00, 0x31, 0x00, 0x39,
52 0x00, 0x36, 0x00, 0x38, 0x00, 0x33, 0x00, 0x31, 0x00, 0x39, 0x00, 0x39, 0x00, 0x00, 0x0C, 0x00,
53 0x02, 0x35, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x02, 0x04, 0x00, 0x1E, 0x00, 0x2B,
54 0x00, 0x34, 0x00, 0x33, 0x00, 0x36, 0x00, 0x39, 0x00, 0x39, 0x00, 0x31, 0x00, 0x32, 0x00, 0x30,
55 0x00, 0x39, 0x00, 0x34, 0x00, 0x35, 0x00, 0x39, 0x00, 0x34, 0x00, 0x00, 0x0C, 0x00, 0x02, 0x36,
56 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x02, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
57 0x08, 0x00, 0x01, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
60 const char text[] = "Orthop. KH Gersthof\nWielemansg. 28, 1180\nstation A, Zi. 110\nwerde voraussichtl. Morgen Op. & freu mich, wenn ihr Zeit habt.";
62 /* This is not part of API! */
63 extern GSM_Error N6510_DecodeFilesystemSMS(GSM_StateMachine * s, GSM_MultiSMSMessage * sms, GSM_File * FFF, int location);
65 int main(int argc UNUSED, char **argv UNUSED)
67 GSM_Debug_Info *debug_info;
68 GSM_StateMachine *s;
69 GSM_File file;
70 GSM_Error error;
71 GSM_MultiSMSMessage sms;
73 debug_info = GSM_GetGlobalDebug();
74 GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info);
75 GSM_SetDebugLevel("textall", debug_info);
77 /* Allocates state machine */
78 s = GSM_AllocStateMachine();
79 test_result(s != NULL);
81 debug_info = GSM_GetDebug(s);
82 GSM_SetDebugGlobal(TRUE, debug_info);
84 /* Init file */
85 file.Buffer = malloc(sizeof(data));
86 memcpy(file.Buffer, data, sizeof(data));
87 file.Used = sizeof(data);
88 file.ID_FullName[0] = 0;
89 file.ID_FullName[1] = 0;
90 GSM_GetCurrentDateTime(&(file.Modified));
92 /* Parse it */
93 error = N6510_DecodeFilesystemSMS(s, &sms, &file, 0);
95 /* Display message */
96 DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL);
97 DisplayMultiSMSInfo(&sms, TRUE, TRUE, NULL, NULL);
99 /* Free state machine */
100 GSM_FreeStateMachine(s);
102 /* Check expected text */
103 test_result(strcmp(text, DecodeUnicodeString(sms.SMS[0].Text)) == 0);
105 gammu_test_result(error, "N6510_DecodeFilesystemSMS");
107 return 0;
110 /* Editor configuration
111 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: