Translation update done using Pootle.
[gammu.git] / tests / sms-nokia-01.c
blobd7f5693dd08e3b16cf8301fdfd21fddee9c21c93
1 /* Test for decoding SMS on Nokia 6110 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 */
9 #include "../helper/message-display.h"
11 #include "common.h"
13 unsigned char data[] = {
14 0x01, 0x08, 0x00, 0x08, 0x01, 0x02, 0x01, 0x00, 0x05, 0x91, 0x26, 0x18, 0x16, 0x42, 0x00, 0x00,
15 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x0D, 0x91, 0x26, 0x58, 0x26, 0x84, 0x88, 0x65,
16 0xF8, 0x00, 0x00, 0x00, 0x70, 0x90, 0x30, 0x10, 0x61, 0x63, 0x82, 0xD4, 0xF2, 0x9C, 0x0E, 0x9A,
17 0xB7, 0xE7
20 /* This is not part of API! */
21 extern GSM_Error N6110_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine * s);
23 int main(int argc UNUSED, char **argv UNUSED)
25 GSM_Debug_Info *debug_info;
26 GSM_StateMachine *s;
27 GSM_Protocol_Message msg;
28 GSM_Error error;
29 GSM_MultiSMSMessage sms;
31 debug_info = GSM_GetGlobalDebug();
32 GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info);
33 GSM_SetDebugLevel("textall", debug_info);
35 /* Allocates state machine */
36 s = GSM_AllocStateMachine();
37 test_result(s != NULL);
39 /* Init message */
40 msg.Type = 0x14;
41 msg.Length = sizeof(data);
42 msg.Buffer = data;
44 s->Phone.Data.GetSMSMessage = &sms;
46 /* Parse it */
47 error = N6110_ReplyGetSMSMessage(&msg, s);
49 /* Display message */
50 DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL);
51 DisplayMultiSMSInfo(&sms, TRUE, TRUE, NULL, NULL);
53 /* Free state machine */
54 GSM_FreeStateMachine(s);
56 gammu_test_result(error, "N6110_ReplyGetSMSMessage");
58 return 0;
61 /* Editor configuration
62 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: