From 88e15062c1d36ed989ff154b1ecf644824a3728d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 25 Feb 2011 10:01:18 +0100 Subject: Imported Upstream version 1.29.91 --- tests/CMakeLists.txt | 14 +++++ tests/at-cnmi-reply.c | 4 +- tests/at-creg-reply.c | 4 +- tests/at-get-smsmemories.c | 4 +- tests/at-getmemory-reply.c | 4 +- tests/at-ussd-reply.c | 4 +- tests/get-model-at.c | 4 +- tests/get-smsc-at.c | 4 +- tests/nokia-6110-ringtone.c | 4 +- tests/samsung-get-memory.c | 4 +- tests/sms-at-parse.c | 4 +- tests/sms-nokia-01.c | 4 +- tests/sms-nokia-02.c | 4 +- tests/sms-nokia-04.c | 4 +- tests/sms-nokia-14.c | 4 +- tests/sms-nokia-15.c | 4 +- tests/sms-nokia-17.c | 121 +++++++++++++++++++++++++++++++++++++++++ tests/sms-nokia-18.c | 127 ++++++++++++++++++++++++++++++++++++++++++++ 18 files changed, 292 insertions(+), 30 deletions(-) create mode 100644 tests/sms-nokia-17.c create mode 100644 tests/sms-nokia-18.c (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f5ecca3..f8050bb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -333,6 +333,20 @@ if (WITH_NOKIA6510) add_test(sms-nokia-16 "${GAMMU_TEST_PATH}/sms-nokia-16${GAMMU_TEST_SUFFIX}") endif (WITH_NOKIA6510) +if (WITH_NOKIA6510) + add_executable(sms-nokia-17 sms-nokia-17.c) + target_link_libraries(sms-nokia-17 libGammu ${LIBINTL_LIBRARIES}) + target_link_libraries(sms-nokia-17 messagedisplay) + add_test(sms-nokia-17 "${GAMMU_TEST_PATH}/sms-nokia-17${GAMMU_TEST_SUFFIX}") +endif (WITH_NOKIA6510) + +if (WITH_NOKIA6510) + add_executable(sms-nokia-18 sms-nokia-18.c) + target_link_libraries(sms-nokia-18 libGammu ${LIBINTL_LIBRARIES}) + target_link_libraries(sms-nokia-18 messagedisplay) + add_test(sms-nokia-18 "${GAMMU_TEST_PATH}/sms-nokia-18${GAMMU_TEST_SUFFIX}") +endif (WITH_NOKIA6510) + if (WITH_NOKIA6110) # Nokia ringtone add_executable(nokia-6110-ringtone nokia-6110-ringtone.c) diff --git a/tests/at-cnmi-reply.c b/tests/at-cnmi-reply.c index bc6f98e..cfd03c9 100644 --- a/tests/at-cnmi-reply.c +++ b/tests/at-cnmi-reply.c @@ -12,7 +12,7 @@ #define BUFFER_SIZE 16384 -extern GSM_Error ATGEN_ReplyGetCNMIMode(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error ATGEN_ReplyGetCNMIMode(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc, char **argv) { @@ -78,7 +78,7 @@ int main(int argc, char **argv) SplitLines(msg.Buffer, msg.Length, &Priv->Lines, "\x0D\x0A", 2, "\"", 1, TRUE); /* Parse it */ - error = ATGEN_ReplyGetCNMIMode(msg, s); + error = ATGEN_ReplyGetCNMIMode(&msg, s); /* This is normally done by ATGEN_Terminate */ FreeLines(&Priv->Lines); diff --git a/tests/at-creg-reply.c b/tests/at-creg-reply.c index 8b684ed..6c0397e 100644 --- a/tests/at-creg-reply.c +++ b/tests/at-creg-reply.c @@ -12,7 +12,7 @@ #define BUFFER_SIZE 16384 -extern GSM_Error ATGEN_ReplyGetNetworkLAC_CID(GSM_Protocol_Message msg, GSM_StateMachine *s); +extern GSM_Error ATGEN_ReplyGetNetworkLAC_CID(GSM_Protocol_Message *msg, GSM_StateMachine *s); int main(int argc, char **argv) { @@ -81,7 +81,7 @@ int main(int argc, char **argv) SplitLines(msg.Buffer, msg.Length, &Priv->Lines, "\x0D\x0A", 2, "\"", 1, TRUE); /* Parse it */ - error = ATGEN_ReplyGetNetworkLAC_CID(msg, s); + error = ATGEN_ReplyGetNetworkLAC_CID(&msg, s); /* This is normally done by ATGEN_Terminate */ FreeLines(&Priv->Lines); diff --git a/tests/at-get-smsmemories.c b/tests/at-get-smsmemories.c index cb6dddd..37f22e1 100644 --- a/tests/at-get-smsmemories.c +++ b/tests/at-get-smsmemories.c @@ -12,7 +12,7 @@ #define BUFFER_SIZE 16384 -extern GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc, char **argv) { @@ -79,7 +79,7 @@ int main(int argc, char **argv) SplitLines(msg.Buffer, msg.Length, &Priv->Lines, "\x0D\x0A", 2, "\"", 1, TRUE); /* Parse it */ - error = ATGEN_ReplyGetSMSMemories(msg, s); + error = ATGEN_ReplyGetSMSMemories(&msg, s); /* This is normally done by ATGEN_Terminate */ FreeLines(&Priv->Lines); diff --git a/tests/at-getmemory-reply.c b/tests/at-getmemory-reply.c index 69f5c9d..87fb93d 100644 --- a/tests/at-getmemory-reply.c +++ b/tests/at-getmemory-reply.c @@ -14,7 +14,7 @@ #define BUFFER_SIZE 16384 -extern GSM_Error ATGEN_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error ATGEN_ReplyGetMemory(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc, char **argv) { @@ -92,7 +92,7 @@ int main(int argc, char **argv) s->Phone.Data.Memory = &memory; /* Parse it */ - error = ATGEN_ReplyGetMemory(msg, s); + error = ATGEN_ReplyGetMemory(&msg, s); /* This is normally done by ATGEN_Terminate */ FreeLines(&Priv->Lines); diff --git a/tests/at-ussd-reply.c b/tests/at-ussd-reply.c index 78fdb1f..d0b1cfa 100644 --- a/tests/at-ussd-reply.c +++ b/tests/at-ussd-reply.c @@ -12,7 +12,7 @@ #define BUFFER_SIZE 16384 -extern GSM_Error ATGEN_ReplyGetUSSD(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error ATGEN_ReplyGetUSSD(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc, char **argv) { @@ -80,7 +80,7 @@ int main(int argc, char **argv) SplitLines(msg.Buffer, msg.Length, &Priv->Lines, "\x0D\x0A", 2, "\"", 1, TRUE); /* Parse it */ - error = ATGEN_ReplyGetUSSD(msg, s); + error = ATGEN_ReplyGetUSSD(&msg, s); /* This is normally done by ATGEN_Terminate */ FreeLines(&Priv->Lines); diff --git a/tests/get-model-at.c b/tests/get-model-at.c index 529cf12..7053fc5 100644 --- a/tests/get-model-at.c +++ b/tests/get-model-at.c @@ -12,7 +12,7 @@ #define BUFFER_SIZE 16384 -extern GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc, char **argv) { @@ -78,7 +78,7 @@ int main(int argc, char **argv) SplitLines(msg.Buffer, msg.Length, &Priv->Lines, "\x0D\x0A", 2, "\"", 1, TRUE); /* Parse it */ - error = ATGEN_ReplyGetModel(msg, s); + error = ATGEN_ReplyGetModel(&msg, s); /* This is normally done by ATGEN_Terminate */ FreeLines(&Priv->Lines); diff --git a/tests/get-smsc-at.c b/tests/get-smsc-at.c index 9b0f334..e0ac44b 100644 --- a/tests/get-smsc-at.c +++ b/tests/get-smsc-at.c @@ -13,7 +13,7 @@ #define BUFFER_SIZE 16384 -extern GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc, char **argv) { @@ -79,7 +79,7 @@ int main(int argc, char **argv) s->Phone.Data.SMSC = &SMSC; /* Parse it */ - error = ATGEN_ReplyGetSMSC(msg, s); + error = ATGEN_ReplyGetSMSC(&msg, s); /* This is normally done by ATGEN_Terminate */ FreeLines(&Priv->Lines); diff --git a/tests/nokia-6110-ringtone.c b/tests/nokia-6110-ringtone.c index 93836b8..bd30fdd 100644 --- a/tests/nokia-6110-ringtone.c +++ b/tests/nokia-6110-ringtone.c @@ -32,7 +32,7 @@ unsigned char data[] = { }; /* This is not part of API! */ -extern GSM_Error N6110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error N6110_ReplyGetRingtone(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc UNUSED, char **argv UNUSED) { @@ -63,7 +63,7 @@ int main(int argc UNUSED, char **argv UNUSED) Ringtone.Format = RING_NOTETONE; /* Parse it */ - error = N6110_ReplyGetRingtone(msg, s); + error = N6110_ReplyGetRingtone(&msg, s); /* Free state machine */ GSM_FreeStateMachine(s); diff --git a/tests/samsung-get-memory.c b/tests/samsung-get-memory.c index 468a900..4750291 100644 --- a/tests/samsung-get-memory.c +++ b/tests/samsung-get-memory.c @@ -14,7 +14,7 @@ #define BUFFER_SIZE 16384 -extern GSM_Error SAMSUNG_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error SAMSUNG_ReplyGetMemory(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc, char **argv) { @@ -82,7 +82,7 @@ int main(int argc, char **argv) SplitLines(msg.Buffer, msg.Length, &Priv->Lines, "\x0D\x0A", 2, "\"", 1, TRUE); /* Parse it */ - error = SAMSUNG_ReplyGetMemory(msg, s); + error = SAMSUNG_ReplyGetMemory(&msg, s); gammu_test_result(error, "SAMSUNG_ReplyGetMemory"); /* This is normally done by ATGEN_Terminate */ diff --git a/tests/sms-at-parse.c b/tests/sms-at-parse.c index 7cbe0dd..89a4515 100644 --- a/tests/sms-at-parse.c +++ b/tests/sms-at-parse.c @@ -12,7 +12,7 @@ #include "common.h" -extern GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine * s); #define BUFFER_SIZE 16384 @@ -89,7 +89,7 @@ int main(int argc, char **argv) s->Phone.Data.GetSMSMessage = &sms; /* Parse it */ - error = ATGEN_ReplyGetSMSMessage(msg, s); + error = ATGEN_ReplyGetSMSMessage(&msg, s); sms.SMS[0].Memory = MEM_SM; /* Display message */ diff --git a/tests/sms-nokia-01.c b/tests/sms-nokia-01.c index 5f7a25f..d7f5693 100644 --- a/tests/sms-nokia-01.c +++ b/tests/sms-nokia-01.c @@ -18,7 +18,7 @@ unsigned char data[] = { }; /* This is not part of API! */ -extern GSM_Error N6110_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error N6110_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc UNUSED, char **argv UNUSED) { @@ -44,7 +44,7 @@ int main(int argc UNUSED, char **argv UNUSED) s->Phone.Data.GetSMSMessage = &sms; /* Parse it */ - error = N6110_ReplyGetSMSMessage(msg, s); + error = N6110_ReplyGetSMSMessage(&msg, s); /* Display message */ DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL); diff --git a/tests/sms-nokia-02.c b/tests/sms-nokia-02.c index aced96f..62bbc9d 100644 --- a/tests/sms-nokia-02.c +++ b/tests/sms-nokia-02.c @@ -26,7 +26,7 @@ unsigned char data[] = { }; /* This is not part of API! */ -extern GSM_Error N6110_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error N6110_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc UNUSED, char **argv UNUSED) { @@ -55,7 +55,7 @@ int main(int argc UNUSED, char **argv UNUSED) s->Phone.Data.GetSMSMessage = &sms; /* Parse it */ - error = N6110_ReplyGetSMSMessage(msg, s); + error = N6110_ReplyGetSMSMessage(&msg, s); /* Display message */ DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL); diff --git a/tests/sms-nokia-04.c b/tests/sms-nokia-04.c index 49d400c..e12fdb2 100644 --- a/tests/sms-nokia-04.c +++ b/tests/sms-nokia-04.c @@ -19,7 +19,7 @@ unsigned char data[] = { }; /* This is not part of API! */ -extern GSM_Error N6510_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error N6510_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc UNUSED, char **argv UNUSED) { @@ -53,7 +53,7 @@ int main(int argc UNUSED, char **argv UNUSED) sms.SMS[0].Memory = MEM_ME; /* Parse it */ - error = N6510_ReplyGetSMSMessage(msg, s); + error = N6510_ReplyGetSMSMessage(&msg, s); /* Display message */ DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL); diff --git a/tests/sms-nokia-14.c b/tests/sms-nokia-14.c index 41aff2a..fbbe16a 100644 --- a/tests/sms-nokia-14.c +++ b/tests/sms-nokia-14.c @@ -21,7 +21,7 @@ const char text[] = ""; char decoded_text[200]; /* This is not part of API! */ -extern GSM_Error N6510_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error N6510_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc UNUSED, char **argv UNUSED) { @@ -57,7 +57,7 @@ int main(int argc UNUSED, char **argv UNUSED) s->Phone.Data.GetSMSMessage = &sms; /* Parse it */ - error = N6510_ReplyGetSMSMessage(msg, s); + error = N6510_ReplyGetSMSMessage(&msg, s); /* Display message */ DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL); diff --git a/tests/sms-nokia-15.c b/tests/sms-nokia-15.c index 366dfd2..91837b9 100644 --- a/tests/sms-nokia-15.c +++ b/tests/sms-nokia-15.c @@ -29,7 +29,7 @@ const char text[] = "У меня истерика.Отпишитесь,как д char decoded_text[200]; /* This is not part of API! */ -extern GSM_Error N6510_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine * s); +extern GSM_Error N6510_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine * s); int main(int argc UNUSED, char **argv UNUSED) { @@ -65,7 +65,7 @@ int main(int argc UNUSED, char **argv UNUSED) s->Phone.Data.GetSMSMessage = &sms; /* Parse it */ - error = N6510_ReplyGetSMSMessage(msg, s); + error = N6510_ReplyGetSMSMessage(&msg, s); /* Display message */ DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL); diff --git a/tests/sms-nokia-17.c b/tests/sms-nokia-17.c new file mode 100644 index 0000000..343a1c3 --- /dev/null +++ b/tests/sms-nokia-17.c @@ -0,0 +1,121 @@ +/* Test for decoding SMS on Nokia 6510 driver */ + +#include +#include +#include +#include + +#include "common.h" + +#include "../libgammu/protocol/protocol.h" /* Needed for GSM_Protocol_Message */ +#include "../libgammu/gsmstate.h" /* Needed for state machine internals */ + +#include "../helper/message-display.h" + +unsigned char data[] = { + 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x9F, 0x00, 0x00, 0x02, 0x90, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, + 0x00, 0x34, 0x00, 0x38, 0x00, 0x35, 0x00, 0x30, 0x00, 0x35, 0x00, 0x36, 0x00, 0x31, 0x00, 0x34, + 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x0B, 0x91, 0x84, 0x05, 0x65, 0x41, 0x46, 0xF0, 0x00, 0x08, 0x11, 0x20, 0x21, 0x91, 0x43, + 0x03, 0x40, 0x8C, 0x05, 0x00, 0x03, 0x7B, 0x02, 0x01, 0x00, 0x49, 0x00, 0x20, 0x00, 0x74, 0x00, + 0x6F, 0x00, 0x20, 0x00, 0x6A, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x20, 0x00, 0x64, 0x00, + 0x6F, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x20, 0x00, 0x69, 0x00, 0x20, 0x00, 0x70, 0x00, + 0x65, 0x01, 0x42, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x70, 0x00, + 0x6F, 0x00, 0x77, 0x00, 0x69, 0x00, 0x65, 0x00, 0x64, 0x01, 0x7A, 0x00, 0x21, 0x00, 0x20, 0x00, + 0x3A, 0x00, 0x29, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x74, 0x00, 0x79, 0x00, + 0x20, 0x00, 0x67, 0x00, 0x61, 0x00, 0x64, 0x00, 0x61, 0x00, 0x73, 0x00, 0x7A, 0x00, 0x2C, 0x00, + 0x20, 0x00, 0x6A, 0x00, 0x61, 0x00, 0x6B, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x62, 0x00, 0x63, 0x00, + 0x69, 0x01, 0x05, 0x01, 0x7C, 0x00, 0x61, 0x01, 0x07, 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x20, 0x01, + 0x01, 0x3E, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x01, 0x00, 0x0B, 0x00, + 0x01, 0x00, 0x0F, 0x00, 0x02, 0x00, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x01, 0x00, 0x2A, 0x00, 0x01, 0x00, 0x2D, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x2F, 0x00, 0x01, 0x00, 0x23, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x26, + 0x00, 0x01, 0x00, 0x03, 0x00, 0xB2, 0x00, 0x49, 0x00, 0x20, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x20, + 0x00, 0x6A, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x20, 0x00, 0x64, 0x00, 0x6F, 0x00, 0x62, + 0x00, 0x72, 0x00, 0x61, 0x00, 0x20, 0x00, 0x69, 0x00, 0x20, 0x00, 0x70, 0x00, 0x65, 0x01, 0x42, + 0x00, 0x6E, 0x00, 0x61, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x77, + 0x00, 0x69, 0x00, 0x65, 0x00, 0x64, 0x01, 0x7A, 0x00, 0x21, 0x00, 0x20, 0x00, 0x3A, 0x00, 0x29, + 0x00, 0x20, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x74, 0x00, 0x79, 0x00, 0x20, 0x00, 0x67, + 0x00, 0x61, 0x00, 0x64, 0x00, 0x61, 0x00, 0x73, 0x00, 0x7A, 0x00, 0x2C, 0x00, 0x20, 0x00, 0x6A, + 0x00, 0x61, 0x00, 0x6B, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x62, 0x00, 0x63, 0x00, 0x69, 0x01, 0x05, + 0x01, 0x7C, 0x00, 0x61, 0x01, 0x07, 0x00, 0x2E, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x50, 0x00, 0x6F, + 0x00, 0x7A, 0x00, 0x64, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x69, 0x00, 0x65, 0x00, 0x6E, + 0x00, 0x69, 0x00, 0x61, 0x00, 0x20, 0x00, 0x64, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x20, 0x00, 0x4F, + 0x00, 0x6D, 0x00, 0x69, 0x00, 0x21, 0x00, 0x00, 0x02, 0x00, 0x0D, 0x2B, 0x34, 0x38, 0x35, 0x30, + 0x31, 0x32, 0x30, 0x30, 0x37, 0x37, 0x37, 0x00, 0x04, 0x00, 0x01, 0x00, 0x2B, 0x00, 0x1A, 0x00, + 0x2B, 0x00, 0x34, 0x00, 0x38, 0x00, 0x35, 0x00, 0x30, 0x00, 0x35, 0x00, 0x36, 0x00, 0x31, 0x00, + 0x34, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, + 0x00, 0x12, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x22, 0x00, 0x01, 0x00, + 0x01, 0x00, + +}; + +const char text[] = "I to jest dobra i pełna odpowiedź! :) Co ty gadasz, jak obciążać.. "; +char decoded_text[200]; + +/* This is not part of API! */ +extern GSM_Error N6510_DecodeFilesystemSMS(GSM_StateMachine * s, GSM_MultiSMSMessage * sms, GSM_File * FFF, int location); + +int main(int argc UNUSED, char **argv UNUSED) +{ + GSM_Debug_Info *debug_info; + GSM_StateMachine *s; + GSM_File file; + GSM_Error error; + GSM_MultiSMSMessage sms; + + /* Init locales for proper output */ + GSM_InitLocales(NULL); + + debug_info = GSM_GetGlobalDebug(); + GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info); + GSM_SetDebugLevel("textall", debug_info); + + /* Allocates state machine */ + s = GSM_AllocStateMachine(); + test_result(s != NULL); + + debug_info = GSM_GetDebug(s); + GSM_SetDebugGlobal(TRUE, debug_info); + + /* Init file */ + file.Buffer = malloc(sizeof(data)); + memcpy(file.Buffer, data, sizeof(data)); + file.Used = sizeof(data); + file.ID_FullName[0] = 0; + file.ID_FullName[1] = 0; + GSM_GetCurrentDateTime(&(file.Modified)); + + /* Parse it */ + error = N6510_DecodeFilesystemSMS(s, &sms, &file, 0); + + /* Display message */ + DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL); + DisplayMultiSMSInfo(&sms, TRUE, TRUE, NULL, NULL); + + /* Free state machine */ + GSM_FreeStateMachine(s); + + /* Check expected text */ + /* We do not compare full text due to locales problem */ + EncodeUTF8(decoded_text, sms.SMS[0].Text); + test_result(strcmp(text, decoded_text) == 0); + + gammu_test_result(error, "N6510_DecodeFilesystemSMS"); + + return 0; +} + +/* Editor configuration + * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: + */ + + diff --git a/tests/sms-nokia-18.c b/tests/sms-nokia-18.c new file mode 100644 index 0000000..4abcb86 --- /dev/null +++ b/tests/sms-nokia-18.c @@ -0,0 +1,127 @@ +/* Test for decoding SMS on Nokia 6510 driver */ + +#include +#include +#include +#include + +#include "common.h" + +#include "../libgammu/protocol/protocol.h" /* Needed for GSM_Protocol_Message */ +#include "../libgammu/gsmstate.h" /* Needed for state machine internals */ + +#include "../helper/message-display.h" + +unsigned char data[] = { + 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x9E, 0x00, 0x00, 0x02, 0xE2, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, + 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x31, 0x00, 0x32, 0x00, 0x36, 0x00, 0x39, 0x00, 0x36, + 0x00, 0x38, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x51, 0x00, 0x14, 0x91, 0x53, 0x58, 0x76, 0x98, 0x21, 0x43, 0x65, 0x87, 0x19, 0x32, 0x00, 0x00, + 0xFF, 0xA0, 0x05, 0x00, 0x03, 0x00, 0x02, 0x01, 0x82, 0x68, 0x16, 0x68, 0x5E, 0x97, 0xD3, 0x5D, + 0xA0, 0xE3, 0x9B, 0x4C, 0x07, 0x91, 0xEB, 0xA0, 0xB2, 0x1C, 0xB4, 0x7E, 0xB7, 0xDB, 0x65, 0x3A, + 0x08, 0xAD, 0x2E, 0xB7, 0x41, 0xEF, 0x33, 0x68, 0x1D, 0x76, 0x83, 0xE6, 0xEC, 0x30, 0x1C, 0x5E, + 0x06, 0x85, 0xCD, 0x20, 0x77, 0x9D, 0x05, 0x9A, 0x3F, 0x5C, 0x20, 0xA4, 0x3D, 0x3D, 0x07, 0x91, + 0xEB, 0x20, 0x7B, 0x58, 0x0E, 0x42, 0x97, 0xE5, 0xA0, 0x75, 0xDD, 0xED, 0x2E, 0x83, 0xC8, 0x75, + 0x90, 0xFA, 0x0D, 0x9A, 0x3F, 0x40, 0xF0, 0xF0, 0x7C, 0x5E, 0x76, 0x93, 0xCB, 0x20, 0x77, 0x7D, + 0x3E, 0x2F, 0x83, 0xDA, 0xE9, 0x33, 0x28, 0x0D, 0x42, 0xBF, 0xED, 0x65, 0xB2, 0xB8, 0xEE, 0x26, + 0x97, 0xDD, 0x2E, 0x50, 0xB3, 0xEC, 0x06, 0xB1, 0xD3, 0xE7, 0x32, 0x28, 0x0D, 0x22, 0x87, 0xCF, + 0xA0, 0xB2, 0x1C, 0x44, 0xAE, 0x83, 0xD8, 0x6F, 0x3B, 0x3B, 0x7D, 0xA6, 0x83, 0xEA, 0x01, 0x01, + 0x91, 0x01, 0x00, 0x01, 0x01, 0x03, 0x01, 0x4C, 0x00, 0x41, 0x00, 0x68, 0x00, 0x2C, 0x00, 0x20, + 0x00, 0x73, 0x00, 0x75, 0x00, 0x72, 0x00, 0x74, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x47, 0x00, 0x6F, + 0x00, 0x64, 0x00, 0x74, 0x00, 0x20, 0x00, 0x64, 0x00, 0x75, 0x00, 0x20, 0x00, 0x65, 0x00, 0x72, + 0x00, 0x20, 0x00, 0x6B, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x74, 0x00, 0x20, + 0x00, 0x68, 0x00, 0x6A, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x20, + 0x00, 0x6B, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x70, + 0x00, 0x70, 0x00, 0x65, 0x00, 0x20, 0x00, 0x61, 0x00, 0x66, 0x00, 0x20, 0x00, 0x6E, 0x00, 0x75, + 0x00, 0x2C, 0x00, 0x20, 0x00, 0x73, 0x00, 0xE5, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x48, 0x00, 0x76, + 0x00, 0x69, 0x00, 0x73, 0x00, 0x20, 0x00, 0x64, 0x00, 0x75, 0x00, 0x20, 0x00, 0x76, 0x00, 0x61, + 0x00, 0x72, 0x00, 0x20, 0x00, 0x68, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x6B, 0x00, 0x75, + 0x00, 0x6E, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x20, 0x00, 0x64, 0x00, 0x75, 0x00, 0x20, 0x00, 0x6A, + 0x00, 0x6F, 0x00, 0x20, 0x00, 0x73, 0x00, 0xE5, 0x00, 0x20, 0x00, 0x70, 0x00, 0x61, 0x00, 0x73, + 0x00, 0x73, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00, 0x6E, 0x00, 0x75, + 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x6D, 0x00, 0x69, 0x00, 0x67, 0x00, 0x20, + 0x00, 0x69, 0x00, 0x20, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x64, 0x00, 0x62, + 0x00, 0x75, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x4D, + 0x00, 0x65, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x67, 0x00, 0x65, 0x00, 0x20, + 0x00, 0x69, 0x00, 0x20, 0x00, 0x64, 0x00, 0x61, 0x00, 0x67, 0x00, 0x20, 0x00, 0x65, 0x00, 0x72, + 0x00, 0x20, 0x00, 0x64, 0x00, 0x75, 0x00, 0x20, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x6C, + 0x00, 0x69, 0x00, 0x67, 0x00, 0x74, 0x00, 0x20, 0x00, 0x75, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x73, + 0x00, 0x6B, 0x00, 0x79, 0x00, 0x6C, 0x00, 0x64, 0x00, 0x74, 0x00, 0x2E, 0x00, 0x20, 0x00, 0x3B, + 0x00, 0x29, 0x00, 0x00, 0x04, 0x00, 0x18, 0x00, 0x2B, 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, + 0x31, 0x00, 0x32, 0x00, 0x36, 0x00, 0x39, 0x00, 0x36, 0x00, 0x38, 0x00, 0x39, 0x00, 0x00, 0x0C, + 0x00, 0x02, 0x37, 0x00, 0x07, 0x00, 0x01, 0x0E, 0x05, 0x00, 0x01, 0x02, 0x06, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x01, 0x0E, 0x05, 0x00, 0x01, 0x07, 0x12, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x24, 0x00, 0x01, 0x00, 0x00, +}; + +const char text[] = "Ah, surt. Godt du er kommet hjem og kan slappe af nu, så. Hvis du var her kunne du jo så passende nusse mig i hovedbunden. Men lige i dag er du lovligt u"; +char decoded_text[200]; + +/* This is not part of API! */ +extern GSM_Error N6510_DecodeFilesystemSMS(GSM_StateMachine * s, GSM_MultiSMSMessage * sms, GSM_File * FFF, int location); + +int main(int argc UNUSED, char **argv UNUSED) +{ + GSM_Debug_Info *debug_info; + GSM_StateMachine *s; + GSM_File file; + GSM_Error error; + GSM_MultiSMSMessage sms; + + /* Init locales for proper output */ + GSM_InitLocales(NULL); + + debug_info = GSM_GetGlobalDebug(); + GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info); + GSM_SetDebugLevel("textall", debug_info); + + /* Allocates state machine */ + s = GSM_AllocStateMachine(); + test_result(s != NULL); + + debug_info = GSM_GetDebug(s); + GSM_SetDebugGlobal(TRUE, debug_info); + + /* Init file */ + file.Buffer = malloc(sizeof(data)); + memcpy(file.Buffer, data, sizeof(data)); + file.Used = sizeof(data); + file.ID_FullName[0] = 0; + file.ID_FullName[1] = 0; + GSM_GetCurrentDateTime(&(file.Modified)); + + /* Parse it */ + error = N6510_DecodeFilesystemSMS(s, &sms, &file, 0); + + /* Display message */ + DisplayMultiSMSInfo(&sms, FALSE, TRUE, NULL, NULL); + DisplayMultiSMSInfo(&sms, TRUE, TRUE, NULL, NULL); + + /* Free state machine */ + GSM_FreeStateMachine(s); + + /* Check expected text */ + /* We do not compare full text due to locales problem */ + EncodeUTF8(decoded_text, sms.SMS[0].Text); + test_result(strcmp(text, decoded_text) == 0); + + gammu_test_result(error, "N6510_DecodeFilesystemSMS"); + + return 0; +} + +/* Editor configuration + * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: + */ + + + -- cgit v1.2.3