1 /* Test for decoding Samsung replies */
8 #include "../libgammu/phone/at/atgen.h"
9 #include "../libgammu/phone/at/samsung.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
;
25 /* Init locales to get proper encoding */
26 GSM_InitLocales(NULL
);
28 /* Configure state machine */
29 debug_info
= GSM_GetGlobalDebug();
30 GSM_SetDebugFileDescriptor(stderr
, FALSE
, debug_info
);
31 GSM_SetDebugLevel("textall", debug_info
);
33 /* Allocates state machine */
34 s
= GSM_AllocStateMachine();
35 test_result(s
!= NULL
);
36 debug_info
= GSM_GetDebug(s
);
37 GSM_SetDebugGlobal(TRUE
, debug_info
);
39 /* Initialize AT engine */
40 Data
= &s
->Phone
.Data
;
41 Data
->ModelInfo
= GetModelData(NULL
, NULL
, "unknown", NULL
);
43 Priv
= &s
->Phone
.Data
.Priv
.ATGEN
;
44 Priv
->ReplyState
= AT_Reply_OK
;
45 Priv
->SMSMode
= SMS_AT_PDU
;
46 Priv
->Charset
= AT_CHARSET_UTF8
;
47 Priv
->Manufacturer
= AT_Samsung
;
49 /* Perform real tests */
50 error
= SAMSUNG_ParseAniversary(s
, "+ORGR: 67,2,,\"\002Laura Santiesteban Cabrera\003\",3,11,2009,9,0,,,,,,,1,3,0,4,,,,,");
51 gammu_test_result(error
, "Aniversary 1");
53 error
= SAMSUNG_ParseTask(s
, "+ORGR: 205,3,,\"\002Cemento\003\",13,3,2009,10,35,13,3,2009,,,,1,3,0,0,1,0,,,");
54 gammu_test_result(error
, "Task 1");
56 error
= SAMSUNG_ParseAppointment(s
,
57 "+ORGR: 161,1,\"\002Comprar lagrimas artificiales\003\",\"\002Farmacia\003\",2,4,2009,9,0,2,4,2009,9,10,\"Farmacia\",1,1,0,3,,,29,1,2010");
58 gammu_test_result(error
, "Appointment 1");
60 error
= SAMSUNG_ParseAppointment(s
, "+ORGR: 235,4,\"\002Curso\003\",\"\002Averiguar\003\",13,3,2009,9,50,13,3,2009,9,59,,1,1,0,,,,,,");
61 gammu_test_result(error
, "Appointment 2");
63 error
= SAMSUNG_ParseAppointment(s
, "+ORGR: 235,4,\"\002Curso\003\",\"\002\003\",13,3,2009,9,50,13,3,2009,9,59,,1,1,0,,,,,,");
64 gammu_test_result(error
, "Appointment 3");
66 /* Free state machine */
67 GSM_FreeStateMachine(s
);
72 /* Editor configuration
73 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: