Translation update done using Pootle.
[gammu.git] / tests / sms-nokia-04.c
blobe12fdb2dbc3792b0da2d467385f100cf7b5cd03e
1 /* Test for decoding SMS on Nokia 6510 driver */
3 #include <gammu.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include "../libgammu/protocol/protocol.h" /* Needed for GSM_Protocol_Message */
7 #include "../libgammu/gsmstate.h" /* Needed for state machine internals */
8 #include "../libgammu/gsmphones.h" /* Phone data */
10 #include "../helper/message-display.h"
12 #include "common.h"
14 unsigned char data[] = {
15 0x01, 0x6A, 0x00, 0x03, 0x00, 0x07, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x31,
16 0x51, 0x00, 0x00, 0xF0, 0x00, 0x04, 0x82, 0x0B, 0x01, 0x07, 0x0A, 0x81, 0x70, 0x60, 0x50, 0x75,
17 0x85, 0x82, 0x0C, 0x02, 0x08, 0x07, 0x91, 0x64, 0x07, 0x05, 0x80, 0x99, 0xF9, 0x80, 0x0D, 0x09,
18 0x0A, 0x08, 0x0D, 0x02, 0x00, 0x07, 0x0B, 0x02, 0x00, 0x00, 0x08, 0x05, 0x01, 0xFF, 0x00,
21 /* This is not part of API! */
22 extern GSM_Error N6510_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine * s);
24 int main(int argc UNUSED, char **argv UNUSED)
26 GSM_Debug_Info *debug_info;
27 GSM_StateMachine *s;
28 GSM_Protocol_Message msg;
29 GSM_Error error;
30 GSM_MultiSMSMessage sms;
32 debug_info = GSM_GetGlobalDebug();
33 GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info);
34 GSM_SetDebugLevel("textall", debug_info);
36 /* Allocates state machine */
37 s = GSM_AllocStateMachine();
38 test_result(s != NULL);
40 debug_info = GSM_GetDebug(s);
41 GSM_SetDebugGlobal(TRUE, debug_info);
42 GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info);
43 GSM_SetDebugLevel("textall", debug_info);
45 s->Phone.Data.ModelInfo = GetModelData(NULL, NULL, "unknown", NULL);
47 /* Init message */
48 msg.Type = 0x14;
49 msg.Length = sizeof(data);
50 msg.Buffer = data;
52 s->Phone.Data.GetSMSMessage = &sms;
53 sms.SMS[0].Memory = MEM_ME;
55 /* Parse it */
56 error = N6510_ReplyGetSMSMessage(&msg, s);
58 /* Display message */
59 DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL);
60 DisplayMultiSMSInfo(&sms, TRUE, TRUE, NULL, NULL);
62 /* Free state machine */
63 GSM_FreeStateMachine(s);
65 gammu_test_result(error, "N6510_ReplyGetSMSMessage");
67 return 0;
70 /* Editor configuration
71 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: