1 /* Test for decoding SMS on Nokia 6510 driver */
10 #include "../libgammu/protocol/protocol.h" /* Needed for GSM_Protocol_Message */
11 #include "../libgammu/gsmstate.h" /* Needed for state machine internals */
12 #include "../libgammu/gsmphones.h" /* Phone data */
14 #include "../helper/message-display.h"
16 unsigned char data
[] = {
17 0x01, 0x5D, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20 const char text
[] = "";
21 char decoded_text
[200];
23 /* This is not part of API! */
24 extern GSM_Error
N6510_ReplyGetSMSMessage(GSM_Protocol_Message
*msg
, GSM_StateMachine
* s
);
26 int main(int argc UNUSED
, char **argv UNUSED
)
28 GSM_Debug_Info
*debug_info
;
30 GSM_Protocol_Message msg
;
32 GSM_MultiSMSMessage sms
;
34 /* Init locales for proper output */
35 GSM_InitLocales(NULL
);
37 debug_info
= GSM_GetGlobalDebug();
38 GSM_SetDebugFileDescriptor(stderr
, FALSE
, debug_info
);
39 GSM_SetDebugLevel("textall", debug_info
);
41 /* Allocates state machine */
42 s
= GSM_AllocStateMachine();
43 test_result(s
!= NULL
);
45 debug_info
= GSM_GetDebug(s
);
46 GSM_SetDebugGlobal(TRUE
, debug_info
);
47 GSM_SetDebugFileDescriptor(stderr
, FALSE
, debug_info
);
48 GSM_SetDebugLevel("textall", debug_info
);
50 s
->Phone
.Data
.ModelInfo
= GetModelData(NULL
, NULL
, "unknown", NULL
);
54 msg
.Length
= sizeof(data
);
57 s
->Phone
.Data
.GetSMSMessage
= &sms
;
60 error
= N6510_ReplyGetSMSMessage(&msg
, s
);
63 DisplayMultiSMSInfo(&sms
, FALSE
, TRUE
, NULL
, NULL
);
64 DisplayMultiSMSInfo(&sms
, TRUE
, TRUE
, NULL
, NULL
);
66 /* Free state machine */
67 GSM_FreeStateMachine(s
);
69 /* Check expected text */
70 /* We do not compare full text due to locales problem */
71 EncodeUTF8(decoded_text
, sms
.SMS
[0].Text
);
72 test_result(strcmp(text
, decoded_text
) == 0);
74 gammu_test_result(error
, "N6510_ReplyGetSMSMessage");
79 /* Editor configuration
80 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: