1 /* Test for decoding SMS on Nokia 6510 driver */
7 #include "../libgammu/protocol/protocol.h" /* Needed for GSM_Protocol_Message */
8 #include "../libgammu/gsmstate.h" /* Needed for state machine internals */
10 #include "../helper/message-display.h"
14 unsigned char data
[] = {
15 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x02, 0x48, 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, 0x35,
21 0x00, 0x39, 0x00, 0x35, 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 0x04, 0x03, 0x81, 0x95, 0xF5, 0x00, 0x00, 0x70, 0x40, 0x41, 0x70, 0x24, 0x43, 0x80, 0x6F, 0xD6,
27 0x37, 0x39, 0x6C, 0x7E, 0xBB, 0xCB, 0xA0, 0x66, 0x79, 0x3E, 0x2F, 0xBB, 0xCF, 0x65, 0xB9, 0x0B,
28 0x04, 0x0D, 0xCB, 0xC3, 0xA0, 0xF1, 0xDB, 0x5D, 0x1E, 0xD3, 0xC3, 0x72, 0x7A, 0x19, 0x44, 0x2E,
29 0xCF, 0xC9, 0x65, 0x50, 0x99, 0x0D, 0x1A, 0xB2, 0xD3, 0x65, 0x37, 0xBD, 0x0C, 0x82, 0x0E, 0x41,
30 0xF4, 0x3A, 0x28, 0x49, 0x04, 0x91, 0xCB, 0xA0, 0x66, 0x79, 0x3E, 0x2F, 0xBB, 0xCF, 0x65, 0x39,
31 0xA8, 0x3C, 0xD7, 0x81, 0xCA, 0x73, 0x98, 0x0C, 0x16, 0x93, 0xC1, 0x6A, 0x33, 0x50, 0x1E, 0x44,
32 0xAF, 0x83, 0xC6, 0xEC, 0xB0, 0xBD, 0x0C, 0x2A, 0xCF, 0x75, 0xA0, 0x99, 0x0D, 0x76, 0xCB, 0xB9,
33 0x00, 0x01, 0x01, 0x24, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0D, 0x2B, 0x33, 0x34, 0x36, 0x30,
34 0x37, 0x30, 0x30, 0x33, 0x31, 0x31, 0x30, 0x00, 0x03, 0x00, 0xE0, 0x00, 0x56, 0x00, 0x6F, 0x00,
35 0x64, 0x00, 0x61, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x20, 0x00, 0x4D, 0x00,
36 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00,
37 0x2E, 0x00, 0x20, 0x00, 0x50, 0x00, 0x61, 0x00, 0x72, 0x00, 0x61, 0x00, 0x20, 0x00, 0x63, 0x00,
38 0x6F, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00,
39 0x65, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00, 0x73, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00,
40 0x65, 0x00, 0x6C, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x65, 0x00, 0x6E, 0x00,
41 0x74, 0x00, 0x65, 0x00, 0x20, 0x00, 0x50, 0x00, 0x43, 0x00, 0x20, 0x00, 0x74, 0x00, 0x75, 0x00,
42 0x20, 0x00, 0x49, 0x00, 0x44, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00, 0x4D, 0x00,
43 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00,
44 0x20, 0x00, 0x65, 0x00, 0x73, 0x00, 0x3A, 0x00, 0x20, 0x00, 0x65, 0x00, 0x73, 0x00, 0x30, 0x00,
45 0x32, 0x00, 0x30, 0x00, 0x31, 0x00, 0x32, 0x00, 0x30, 0x00, 0x35, 0x00, 0x33, 0x00, 0x20, 0x00,
46 0x79, 0x00, 0x20, 0x00, 0x74, 0x00, 0x75, 0x00, 0x20, 0x00, 0x63, 0x00, 0x6C, 0x00, 0x61, 0x00,
47 0x76, 0x00, 0x65, 0x00, 0x20, 0x00, 0x65, 0x00, 0x73, 0x00, 0x3A, 0x00, 0x20, 0x00, 0x33, 0x00,
48 0x36, 0x00, 0x30, 0x00, 0x37, 0x00, 0x39, 0x00, 0x2E, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x35,
49 0x00, 0x39, 0x00, 0x35, 0x00, 0x00, 0x0C, 0x00, 0x01, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00,
50 0x01, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x0B, 0x00, 0x01,
51 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
54 /* This is not part of API! */
55 extern GSM_Error
N6510_DecodeFilesystemSMS(GSM_StateMachine
* s
, GSM_MultiSMSMessage
* sms
, GSM_File
* FFF
, int location
);
57 int main(int argc UNUSED
, char **argv UNUSED
)
59 GSM_Debug_Info
*debug_info
;
63 GSM_MultiSMSMessage sms
;
65 debug_info
= GSM_GetGlobalDebug();
66 GSM_SetDebugFileDescriptor(stderr
, FALSE
, debug_info
);
67 GSM_SetDebugLevel("textall", debug_info
);
69 /* Allocates state machine */
70 s
= GSM_AllocStateMachine();
71 test_result(s
!= NULL
);
73 debug_info
= GSM_GetDebug(s
);
74 GSM_SetDebugGlobal(TRUE
, debug_info
);
75 GSM_SetDebugFileDescriptor(stderr
, FALSE
, debug_info
);
76 GSM_SetDebugLevel("textall", debug_info
);
79 file
.Buffer
= malloc(sizeof(data
));
80 memcpy(file
.Buffer
, data
, sizeof(data
));
81 file
.Used
= sizeof(data
);
82 file
.ID_FullName
[0] = 0;
83 file
.ID_FullName
[1] = 0;
84 GSM_GetCurrentDateTime(&(file
.Modified
));
87 error
= N6510_DecodeFilesystemSMS(s
, &sms
, &file
, 0);
89 /* Check expected text */
90 test_result(strcmp("Vodafone Messenger. Para conectarte desde el Cliente PC tu ID de Messenger es: es02012053 y tu clave es: 36079.",
91 DecodeUnicodeConsole(sms
.SMS
[0].Text
)) == 0);
94 DisplayMultiSMSInfo(&sms
, FALSE
, TRUE
, NULL
, NULL
);
95 DisplayMultiSMSInfo(&sms
, TRUE
, TRUE
, NULL
, NULL
);
97 /* Free state machine */
98 GSM_FreeStateMachine(s
);
100 gammu_test_result(error
, "N6510_DecodeFilesystemSMS");
105 /* Editor configuration
106 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: