Translation update done using Pootle.
[gammu.git] / tests / sms-nokia-07.c
blob5a755dbd439ef3e90c3c96331bcd989f2da0b16f
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 unsigned char data[] = {
14 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x4C, 0x00, 0x00, 0x00, 0x00,
15 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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 0x8C, 0x84, 0x8D, 0x92, 0x8B, 0x6D, 0x65, 0x6A, 0x68, 0x6B, 0x79, 0x65, 0x65, 0x31, 0x6C, 0x7A,
26 0x39, 0x65, 0x36, 0x68, 0x63, 0x31, 0x36, 0x00, 0x85, 0x04, 0x49, 0x89, 0x69, 0x29, 0x84, 0x83,
27 0x46, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65,
28 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x01, 0x00,
29 0x5B, 0x01, 0x00, 0x01, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
30 0x03, 0x00, 0x3E, 0x00, 0x46, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x64, 0x00,
31 0x20, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x72, 0x00, 0x65, 0x00, 0x74, 0x00, 0x72, 0x00,
32 0x69, 0x00, 0x65, 0x00, 0x76, 0x00, 0x65, 0x00, 0x20, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00,
33 0x20, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x61, 0x00, 0x67, 0x00, 0x65, 0x00,
34 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00
37 /* This is not part of API! */
38 extern GSM_Error N6510_DecodeFilesystemSMS(GSM_StateMachine * s, GSM_MultiSMSMessage * sms, GSM_File * FFF, int location);
40 int main(int argc UNUSED, char **argv UNUSED)
42 GSM_Debug_Info *debug_info;
43 GSM_StateMachine *s;
44 GSM_File file;
45 GSM_Error error;
46 GSM_MultiSMSMessage sms;
48 debug_info = GSM_GetGlobalDebug();
49 GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info);
50 GSM_SetDebugLevel("textall", debug_info);
52 /* Allocates state machine */
53 s = GSM_AllocStateMachine();
54 test_result(s != NULL);
56 debug_info = GSM_GetDebug(s);
57 GSM_SetDebugGlobal(TRUE, debug_info);
59 /* Init file */
60 file.Buffer = malloc(sizeof(data));
61 memcpy(file.Buffer, data, sizeof(data));
62 file.Used = sizeof(data);
63 file.ID_FullName[0] = 0;
64 file.ID_FullName[1] = 0;
65 GSM_GetCurrentDateTime(&(file.Modified));
67 /* Parse it */
68 error = N6510_DecodeFilesystemSMS(s, &sms, &file, 0);
69 free(file.Buffer);
70 if (error != ERR_CORRUPTED)
71 return 1;
73 /* Free state machine */
74 GSM_FreeStateMachine(s);
76 return 0;
79 /* Editor configuration
80 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: