1 /* Test for decoding Motorola replies */
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
;
23 GSM_CalendarEntry entry
;
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
);
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");
56 error
= GSM_EncodeVCALENDAR(buff
, sizeof(buff
), &pos
, &entry
, FALSE
, SonyEricsson_VCalendar
);
57 gammu_test_result(error
, "Encode Calendar 1");
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");
65 error
= GSM_EncodeVCALENDAR(buff
, sizeof(buff
), &pos
, &entry
, FALSE
, SonyEricsson_VCalendar
);
66 gammu_test_result(error
, "Encode Calendar 2");
70 /* Free state machine */
71 GSM_FreeStateMachine(s
);
76 /* Editor configuration
77 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: