21 #include "../../gsmcomon.h" 22 #include "../../misc/coding/coding.h" 23 #include "../../gsmphones.h" 24 #include "../../gsmstate.h" 25 #include "../../service/gsmmisc.h" 26 #include "../../protocol/obex/obex.h" 33 #ifdef GSM_ENABLE_OBEXGEN 38 #define MOBEX_TIMEOUT 10 43 unsigned char *buffer = NULL;
44 size_t len = 0, total;
64 smprintf(s,
"Unknown length of data file: %ld\n", (
long int)len);
69 total = (buffer[0] << 8) + buffer[1];
71 *used = (buffer[2] << 8) + buffer[3];
72 *free_records = total - *used;
73 smprintf (s,
"total: %d, used: %d\n", (
int)total, (
int)*used);
112 appdata[1] = (location & 0xff00) >> 8;
113 appdata[2] = (location & 0xff);
115 smprintf (s,
"appdata: 0x%02x 0x%02x 0x%02x\n", appdata[0], appdata[1], appdata[2]);
139 appdata[1] = (location & 0xff00) >> 8;
140 appdata[2] = (location & 0xff);
164 error = MOBEX_GetEntry(s,
"m-obex/contacts/read", Entry->
Location, Entry->
MemoryType, &data);
188 error = MOBEX_GetEntry(s,
"m-obex/calendar/read", Entry->
Location, 1, &data);
212 error = MOBEX_GetEntry(s,
"m-obex/calendar/read", Entry->
Location, 2, &data);
228 GSM_Error MOBEX_GetNextEntry(
GSM_StateMachine *s,
const char *path,
const gboolean start,
int *nextid,
int *nexterror,
unsigned char **data,
size_t *pos,
size_t *size,
char **entry,
int *location,
int type)
247 *pos += ((*data)[*pos + 2] << 8) + (*data)[*pos + 3];
259 if (*nexterror == 0) {
262 appdata[1] = (*nextid & 0xff00) >> 8;
263 appdata[2] = (*nextid & 0xff);
282 if (*pos + 4 > *size) {
290 *entry = *data + *pos + 4;
291 *location = ((*data)[*pos + 0] << 8) + (*data)[*pos + 1];
293 smprintf(s,
"Read data part at %d:\n%s\n", *location, *entry);
306 error = MOBEX_GetNextEntry(s,
"m-obex/contacts/load",
322 data[pos] == 0x0D && data[pos + 1] == 0x0A) {
341 error = MOBEX_GetNextEntry(s,
"m-obex/calendar/load", start, &Priv->
m_obex_calendar_nextid, &Priv->
m_obex_calendar_nexterror, &Priv->
m_obex_calendar_buffer, &Priv->
m_obex_calendar_buffer_pos, &Priv->
m_obex_calendar_buffer_size, &data, &(Entry->
Location), 1);
362 error = MOBEX_GetNextEntry(s,
"m-obex/calendar/load", start, &Priv->
m_obex_calendar_nextid, &Priv->
m_obex_calendar_nexterror, &Priv->
m_obex_calendar_buffer, &Priv->
m_obex_calendar_buffer_pos, &Priv->
m_obex_calendar_buffer_size, &data, &(Entry->
Location), 2);
GSM_Error MOBEX_GetTodo(GSM_StateMachine *s, GSM_ToDoEntry *Entry)
GSM_Error MOBEX_CreateEntry(GSM_StateMachine *s, const char *path, unsigned char type, int *location, const char *data)
GSM_Error MOBEX_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *Entry)
size_t m_obex_contacts_buffer_pos
size_t m_obex_calendar_buffer_size
GSM_Error MOBEX_UpdateEntry(GSM_StateMachine *s, const char *path, const int location, unsigned char type, const char *data)
unsigned char * m_obex_calendar_buffer
GSM_MemoryType MemoryType
size_t m_obex_calendar_buffer_pos
unsigned char * m_obex_appdata
unsigned char * m_obex_contacts_buffer
GSM_Error OBEXGEN_SetFile(GSM_StateMachine *s, const char *FileName, const unsigned char *Buffer, size_t Length, gboolean HardDelete)
int m_obex_calendar_nextid
struct GSM_Phone_Data::@2 Priv
GSM_Error MOBEX_GetStatus(GSM_StateMachine *s, const char *path, unsigned char type, int *free_records, int *used)
const char * GSM_ErrorString(GSM_Error e)
GSM_Error OBEXGEN_GetTextFile(GSM_StateMachine *s, const char *FileName, char **Buffer)
int m_obex_contacts_nexterror
int m_obex_calendar_nexterror
GSM_Error MOBEX_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Entry, gboolean start)
GSM_Error GSM_DecodeVCARD(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_MemoryEntry *Pbk, GSM_VCardVersion Version)
GSM_Error GSM_DecodeVCALENDAR_VTODO(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer)
int m_obex_contacts_nextid
size_t m_obex_contacts_buffer_size
GSM_Error OBEXGEN_GetBinaryFile(GSM_StateMachine *s, const char *FileName, unsigned char **Buffer, size_t *len)
GSM_Error MOBEX_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *Entry, gboolean start)
GSM_Error MOBEX_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Entry)
GSM_Error MOBEX_GetNextTodo(GSM_StateMachine *s, GSM_ToDoEntry *Entry, gboolean start)
int smprintf(GSM_StateMachine *s, const char *format,...)