1 /* Test for vcard LUID and index parsing of OBEX 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 */
16 extern GSM_Error
OBEXGEN_InitLUID(GSM_StateMachine
*s
, const char *Name
,
17 const gboolean Recalculate
,
19 char **Data
, int **Offsets
, int *Count
,
20 char ***LUIDStorage
, int *LUIDCount
,
21 int **IndexStorage
, int *IndexCount
);
23 int main(int argc
, char **argv
)
25 GSM_Debug_Info
*debug_info
;
39 /* Check parameters */
41 printf("Not enough parameters!\nUsage: obex-vcard-split data num-entries\n");
45 if (stat(argv
[1], &sb
) != 0) {
46 printf("Could not stat %s\n", argv
[1]);
50 buffer
= malloc(sb
.st_size
+ 1);
52 printf("Failed to malloc %ld bytes\n", (long)sb
.st_size
);
57 f
= fopen(argv
[1], "r");
59 printf("Could not open %s\n", argv
[1]);
64 len
= fread(buffer
, 1, sb
.st_size
+ 1, f
);
66 printf("Could not read whole file %s\n", argv
[1]);
70 /* Zero terminate data */
76 /* Configure state machine */
77 debug_info
= GSM_GetGlobalDebug();
78 GSM_SetDebugFileDescriptor(stderr
, FALSE
, debug_info
);
79 GSM_SetDebugLevel("textall", debug_info
);
81 /* Allocates state machine */
82 s
= GSM_AllocStateMachine();
83 test_result(s
!= NULL
);
84 debug_info
= GSM_GetDebug(s
);
85 GSM_SetDebugGlobal(TRUE
, debug_info
);
88 error
= OBEXGEN_InitLUID(s
, "", TRUE
, "BEGIN:VCARD", &buffer
, &Offsets
, &Count
, &LUIDStorage
, &LUIDCount
, &IndexStorage
, &IndexCount
);
90 /* Free state machine */
91 GSM_FreeStateMachine(s
);
95 gammu_test_result(error
, "OBEXGEN_InitLUID");
96 test_result(atoi(argv
[2]) == Count
);
101 /* Editor configuration
102 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: