Translation update done using Pootle.
[gammu.git] / tests / sms-nokia-10.c
blob00fd0c58109aa9925f3e137baedf238cc3b9ccd3
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, 0x00, 0x00, 0x00, 0x01, 0x91, 0x00, 0x5B, 0x00, 0x42,
17 0x00, 0x75, 0x00, 0x67, 0x00, 0x20, 0x00, 0x32, 0x00, 0x31, 0x00, 0x33, 0x00, 0x36, 0x00, 0x33,
18 0x00, 0x39, 0x00, 0x5D, 0x00, 0x20, 0x00, 0x52, 0x00, 0x65, 0x00, 0x3A, 0x00, 0x20, 0x00, 0x50,
19 0x00, 0x72, 0x00, 0x6F, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x20, 0x00, 0x77,
20 0x00, 0x69, 0x00, 0x74, 0x00, 0x68, 0x00, 0x20, 0x00, 0x49, 0x00, 0x44, 0x00, 0x45, 0x00, 0x20,
21 0x00, 0x44, 0x00, 0x56, 0x00, 0x44, 0x00, 0x2D, 0x00, 0x52, 0x00, 0x57, 0x00, 0x00, 0x00, 0x62,
22 0x00, 0x69, 0x00, 0x67, 0x00, 0x6C, 0x00, 0x40, 0x00, 0x61, 0x00, 0x66, 0x00, 0x66, 0x00, 0x2E,
23 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x2E, 0x00, 0x70, 0x00, 0x6C, 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 0x01, 0x00, 0xDE, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x01, 0x00, 0x0B,
28 0x00, 0x01, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00,
29 0x00, 0x27, 0x00, 0x01, 0x00, 0x23, 0x00, 0x04, 0x00, 0x00, 0x09, 0xA6, 0x26, 0x00, 0x01, 0x00,
30 0x04, 0x00, 0x20, 0x00, 0x62, 0x00, 0x69, 0x00, 0x67, 0x00, 0x6C, 0x00, 0x40, 0x00, 0x61, 0x00,
31 0x66, 0x00, 0x66, 0x00, 0x2E, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x2E, 0x00, 0x70, 0x00,
32 0x6C, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x12, 0x00, 0x04, 0x35, 0xEA,
33 0x6E, 0xD2, 0x24, 0x00, 0x01, 0x00, 0x04, 0x00, 0x36, 0x00, 0x72, 0x00, 0x75, 0x00, 0x73, 0x00,
34 0x6C, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x2E, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00,
35 0x74, 0x00, 0x73, 0x00, 0x6B, 0x00, 0x69, 0x00, 0x79, 0x00, 0x40, 0x00, 0x67, 0x00, 0x6D, 0x00,
36 0x61, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x2E, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x00, 0x07,
37 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x12, 0x00, 0x04, 0x35, 0xEA, 0x6E, 0xD2, 0x24, 0x00,
38 0x01, 0x01, 0x22, 0x00, 0x01, 0x84, 0x25, 0x00, 0x0E, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x73, 0x00,
39 0x7A, 0x00, 0x65, 0x00, 0x6B, 0x00, 0x00, 0x20, 0x00, 0x17, 0x47, 0x6D, 0x61, 0x69, 0x6C, 0x49,
40 0x64, 0x31, 0x31, 0x63, 0x31, 0x33, 0x30, 0x31, 0x32, 0x39, 0x31, 0x33, 0x64, 0x30, 0x61, 0x66,
41 0x37,
44 const char text[] = "";
46 /* This is not part of API! */
47 extern GSM_Error N6510_DecodeFilesystemSMS(GSM_StateMachine * s, GSM_MultiSMSMessage * sms, GSM_File * FFF, int location);
49 int main(int argc UNUSED, char **argv UNUSED)
51 GSM_Debug_Info *debug_info;
52 GSM_StateMachine *s;
53 GSM_File file;
54 GSM_Error error;
55 GSM_MultiSMSMessage sms;
57 debug_info = GSM_GetGlobalDebug();
58 GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info);
59 GSM_SetDebugLevel("textall", debug_info);
61 /* Allocates state machine */
62 s = GSM_AllocStateMachine();
63 test_result(s != NULL);
65 debug_info = GSM_GetDebug(s);
66 GSM_SetDebugGlobal(TRUE, debug_info);
68 /* Init file */
69 file.Buffer = malloc(sizeof(data));
70 memcpy(file.Buffer, data, sizeof(data));
71 file.Used = sizeof(data);
72 file.ID_FullName[0] = 0;
73 file.ID_FullName[1] = 0;
74 GSM_GetCurrentDateTime(&(file.Modified));
76 /* Parse it */
77 error = N6510_DecodeFilesystemSMS(s, &sms, &file, 0);
79 /* Display message */
80 DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL);
81 DisplayMultiSMSInfo(&sms, TRUE, TRUE, NULL, NULL);
83 /* Free state machine */
84 GSM_FreeStateMachine(s);
86 /* Check expected text */
87 test_result(strcmp(text, DecodeUnicodeString(sms.SMS[0].Text)) == 0);
89 gammu_test_result(error, "N6510_DecodeFilesystemSMS");
91 return 0;
94 /* Editor configuration
95 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: