Translation update done using Pootle.
[gammu.git] / tests / at-motorola.c
blob4b27cbaf8acbdd9eed6cd690f6b0ca2bae3eac08
1 /* Test for decoding Motorola replies */
3 #include <gammu.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <string.h>
7 #include "common.h"
8 #include "../libgammu/phone/at/atgen.h"
9 #include "../libgammu/phone/at/motorola.h"
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 #define BUFFER_SIZE ((size_t)16384)
16 int main(int argc UNUSED, char **argv UNUSED)
18 GSM_Debug_Info *debug_info;
19 GSM_Phone_ATGENData *Priv;
20 GSM_Phone_Data *Data;
21 GSM_StateMachine *s;
22 GSM_Error error;
23 GSM_CalendarEntry entry;
24 char buff[2048];
25 size_t pos;
27 /* Init locales to get proper encoding */
28 GSM_InitLocales(NULL);
30 /* Configure state machine */
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);
38 debug_info = GSM_GetDebug(s);
39 GSM_SetDebugGlobal(TRUE, debug_info);
41 /* Initialize AT engine */
42 Data = &s->Phone.Data;
43 Data->ModelInfo = GetModelData(NULL, NULL, "unknown", NULL);
44 Data->Cal = &entry;
45 Priv = &s->Phone.Data.Priv.ATGEN;
46 Priv->ReplyState = AT_Reply_OK;
47 Priv->SMSMode = SMS_AT_PDU;
48 Priv->Charset = AT_CHARSET_UTF8;
49 Priv->Manufacturer = AT_Motorola;
51 /* Perform real tests */
52 error = MOTOROLA_ParseCalendarSimple(s, "+MDBR: 0,\"Meeting\",1,0,\"17:00\",\"02-24-2006\",60,\"00:00\",\"00-00-2000\",0");
53 gammu_test_result(error, "Calendar 1");
55 pos = 0;
56 error = GSM_EncodeVCALENDAR(buff, sizeof(buff), &pos, &entry, FALSE, SonyEricsson_VCalendar);
57 gammu_test_result(error, "Encode Calendar 1");
59 printf("%s\n", buff);
61 error = MOTOROLA_ParseCalendarSimple(s, "+MDBR: 1,\"Breakfast\",1,1,\"10:00\",\"02-25-2006\",60,\"09:30\",\"02-25-2006\",2");
62 gammu_test_result(error, "Calendar 2");
64 pos = 0;
65 error = GSM_EncodeVCALENDAR(buff, sizeof(buff), &pos, &entry, FALSE, SonyEricsson_VCalendar);
66 gammu_test_result(error, "Encode Calendar 2");
68 printf("%s\n", buff);
70 /* Free state machine */
71 GSM_FreeStateMachine(s);
73 return 0;
76 /* Editor configuration
77 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: