1 /* (c) 2003 by Marcin Wiacek */
2 /* (c) 2006 by Michal Cihar */
3 
4 /**
5  * \file obexgen.h
6  * @author Michal Čihař
7  * @author Marcin Wiacek
8  */
9 /**
10  * @addtogroup Phone
11  * @{
12  */
13 /**
14  * @addtogroup OBEXPhone
15  * @{
16  */
17 #ifndef obexgen_h
18 #define obexgen_h
19 
20 #ifndef GSM_USED_IRDAOBEX
21 #  define GSM_USED_IRDAOBEX
22 #endif
23 #ifndef GSM_USED_BLUEOBEX
24 #  define GSM_USED_BLUEOBEX
25 #endif
26 
27 /**
28  * Service type we want to use on OBEX.
29  */
30 typedef enum {
31 	/**
32 	 * No specific service requested.
33 	 */
34 	OBEX_None = 1,
35 	/**
36 	 * IrMC synchronisation service.
37 	 */
38 	OBEX_IRMC,
39 	/**
40 	 * Browsing for folders.
41 	 */
42 	OBEX_BrowsingFolders,
43 	/**
44 	 * m-obex service for Samsung phones.
45 	 */
46 	OBEX_m_OBEX,
47 } OBEX_Service;
48 
49 /**
50  * Description of what is IrMC end point able to do.
51  */
52 typedef struct {
53 	/**
54 	 * Information Exchange Level.
55 	 */
56 	int IEL;
57 	/**
58 	 * Support for hard deletes?
59 	 */
60 	gboolean HD;
61 } IRMC_Capability;
62 
63 typedef struct {
64 	int				FilesLocationsUsed;
65 	int				FilesLocationsCurrent;
66 	GSM_File			Files[500];
67 	gboolean				FileLastPart;
68 
69 	int				FrameSize;
70 	OBEX_Service			Service;
71 	/**
72 	 * Initial service used in configuration (this will be used for filesystem browsing)
73 	 */
74 	OBEX_Service			InitialService;
75 
76 	/**
77 	 * Number of entries in phonebook
78 	 */
79 	int				PbCount;
80 	/**
81 	 * Offsets of entries in phonebook data
82 	 */
83 	int				*PbOffsets;
84 	/**
85 	 * Index - location translation map for phonebook
86 	 */
87 	int				*PbIndex;
88 	/**
89 	 * Number of entries in PbIndex list.
90 	 */
91 	int				PbIndexCount;
92 	/**
93 	 * LUID - location translation map for phonebook
94 	 */
95 	char				**PbLUID;
96 	/**
97 	 * Number of entries in PbLUID list.
98 	 */
99 	int				PbLUIDCount;
100 	/**
101 	 * Whether to update PbLUID after this request.
102 	 */
103 	gboolean				UpdatePbLUID;
104 	/**
105 	 * Capabilities for phonebook.
106 	 */
107 	IRMC_Capability			PbCap;
108 	/**
109 	 * Complete phonebook data.
110 	 */
111 	char				*PbData;
112 	/**
113 	 * Number of read phonebook entries.
114 	 */
115 	int				ReadPhonebook;
116 	/**
117 	 * Number of entries in todo
118 	 */
119 	int				TodoCount;
120 	/**
121 	 * Offsets of todo entries in calendar data
122 	 */
123 	int				*TodoOffsets;
124 	/**
125 	 * Index - location translation map for todo
126 	 */
127 	int				*TodoIndex;
128 	/**
129 	 * Number of entries in TodoIndex list.
130 	 */
131 	int				TodoIndexCount;
132 	/**
133 	 * LUID - location translation map for todo
134 	 */
135 	char				**TodoLUID;
136 	/**
137 	 * Number of entries in TodoLUID list.
138 	 */
139 	int				TodoLUIDCount;
140 	/**
141 	 * Whether to update TodoLUID after this request.
142 	 */
143 	gboolean				UpdateTodoLUID;
144 	/**
145 	 * Number of read todo entries.
146 	 */
147 	int				ReadTodo;
148 	/**
149 	 * Number of entries in calendar
150 	 */
151 	int				CalCount;
152 	/**
153 	 * Offsets of calendar entries in calendar data
154 	 */
155 	int				*CalOffsets;
156 	/**
157 	 * Index - location translation map for calendar
158 	 */
159 	int				*CalIndex;
160 	/**
161 	 * Number of entries in CalIndex list.
162 	 */
163 	int				CalIndexCount;
164 	/**
165 	 * LUID - location translation map for calendar
166 	 */
167 	char				**CalLUID;
168 	/**
169 	 * Number of entries in CalLUID list.
170 	 */
171 	int				CalLUIDCount;
172 	/**
173 	 * Whether to update CalLUID after this request.
174 	 */
175 	gboolean				UpdateCalLUID;
176 	/**
177 	 * Capabilities for calendar.
178 	 */
179 	IRMC_Capability			CalCap;
180 	/**
181 	 * Complete calendar data.
182 	 */
183 	char				*CalData;
184 	/**
185 	 * Number of read calendar entries.
186 	 */
187 	int				ReadCalendar;
188 	/**
189 	 * Number of entries in note
190 	 */
191 	int				NoteCount;
192 	/**
193 	 * Offsets of entries in note data
194 	 */
195 	int				*NoteOffsets;
196 	/**
197 	 * Index - location translation map for note
198 	 */
199 	int				*NoteIndex;
200 	/**
201 	 * Number of entries in NoteIndex list.
202 	 */
203 	int				NoteIndexCount;
204 	/**
205 	 * LUID - location translation map for note
206 	 */
207 	char				**NoteLUID;
208 	/**
209 	 * Number of entries in NoteLUID list.
210 	 */
211 	int				NoteLUIDCount;
212 	/**
213 	 * Whether to update NoteLUID after this request.
214 	 */
215 	gboolean				UpdateNoteLUID;
216 	/**
217 	 * Capabilities for note.
218 	 */
219 	IRMC_Capability			NoteCap;
220 	/**
221 	 * Complete note data.
222 	 */
223 	char				*NoteData;
224 	/**
225 	 * Capability data.
226 	 */
227 	char				*OBEXCapability;
228 	/**
229 	 * Devinfo data.
230 	 */
231 	char				*OBEXDevinfo;
232 	/**
233 	 * m-obex return code.
234 	 */
235 	int				m_obex_error;
236 	/**
237 	 * m-obex application data length.
238 	 */
239 	int				m_obex_appdata_len;
240 	/**
241 	 * m-obex application data content.
242 	 */
243 	unsigned char			*m_obex_appdata;
244 	/**
245 	 * m-obex location of newly created entry.
246 	 */
247 	int				m_obex_newid;
248 	/**
249 	 * m-obex counter for reading contacts
250 	 */
251         int				m_obex_contacts_nextid;
252 	/**
253 	 * last error of m-obex reading contacts operation.
254 	 */
255         int				m_obex_contacts_nexterror;
256 	/**
257 	 * m-obex counter for reading calendar
258 	 */
259         int				m_obex_calendar_nextid;
260 	/**
261 	 * last error of m-obex reading calendar operation.
262 	 */
263         int				m_obex_calendar_nexterror;
264 	/**
265 	 * m-obex contacts buffer.
266 	 */
267 	unsigned char			*m_obex_contacts_buffer;
268 	/**
269 	 * m-obex contacts buffer position.
270 	 */
271 	size_t				m_obex_contacts_buffer_pos;
272 	/**
273 	 * m-obex contacts buffer size.
274 	 */
275 	size_t				m_obex_contacts_buffer_size;
276 	/**
277 	 * m-obex calendar buffer.
278 	 */
279 	unsigned char			*m_obex_calendar_buffer;
280 	/**
281 	 * m-obex calendar buffer position.
282 	 */
283 	size_t				m_obex_calendar_buffer_pos;
284 	/**
285 	 * m-obex calendar buffer size.
286 	 */
287 	size_t				m_obex_calendar_buffer_size;
288 	/**
289 	 * OBEX connection ID.
290 	 */
291 	unsigned char			connection_id[4];
292 } GSM_Phone_OBEXGENData;
293 
294 GSM_Error OBEXGEN_GetBinaryFile(GSM_StateMachine *s, const char *FileName, unsigned char ** Buffer, size_t *len);
295 GSM_Error OBEXGEN_GetTextFile(GSM_StateMachine *s, const char *FileName, char ** Buffer);
296 GSM_Error OBEXGEN_SetFile(GSM_StateMachine *s, const char *FileName, const unsigned char *Buffer, size_t Length, gboolean HardDelete);
297 
298 #endif
299 /*@}*/
300 /*@}*/
301 
302 /* How should editor hadle tabs in this file? Add editor commands here.
303  * vim: noexpandtab sw=8 ts=8 sts=8:
304  */
305