libvcomm  1.0
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
vactions.h
Go to the documentation of this file.
1 /** \file
2  * This file contains communication actions (like get or set IRframe, Eventmap ...)
3  * @author Tarmo Kople <tarmo@flycom.ee>
4  * @date 11.09.2012
5  */
6 
7 
8 #ifndef VACTIONS_H_
9 #define VACTIONS_H_
10 
11 #include "vcomm.h"
12 
13 #ifdef _WIN32
14 
15  /* You should define VCOMM_EXPORTS *only* when building the DLL. */
16  #ifdef VCOMM_EXPORTS
17  #define VCOMMAPI __declspec(dllexport)
18  #else
19  #define VCOMMAPI __declspec(dllimport)
20  #endif
21 
22  /* Define calling convention in one place, for convenience. */
23  #define VCOMMCALL __cdecl
24 
25 #else /* _WIN32 not defined. */
26 
27  /* Define with no value on non-Windows OSes. */
28  #define VCOMMAPI
29  #define VCOMMCALL
30 
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /**
38  * \brief Get single event from IRvoodoo.
39  *
40  * @ingroup vapi
41  * @param[in] vhandle IRvoodoo connection handle
42  * @param[out] ev event structure
43  * @param[in] eventnum in Eventmap
44  *
45  * @returns
46  * This function returns 0 on success or error code on error.
47  *
48  */
49 VCOMMAPI int VCOMMCALL Vget_event(hid_device **vhandle, irevent_t *ev, int eventnum);
50 /**
51  * \brief Get whole eventmap from IRvoodoo.
52  *
53  * @ingroup vapi
54  * @param[in] vhandle IRvoodoo connection handle
55  * @param[out] em eventmap structure
56  *
57  * @returns
58  * This function returns 0 on success or error code on error.
59  *
60  */
62 /**
63  * \brief Get last decoded IRcode from IRvoodoo.
64  *
65  * @ingroup vapi
66  * @param[in] vhandle IRvoodoo connection handle
67  * @param[out] ircode IRcode structure
68  *
69  * @returns
70  * This function returns 0 on success or error code on error.
71  *
72  */
73 VCOMMAPI int VCOMMCALL Vget_ircode(hid_device **vhandle, ircode_t *ircode);
74 /**
75  * \brief Get IRframe from IRvoodoo.
76  *
77  * @ingroup vapi
78  * @param[in] vhandle IRvoodoo connection handle
79  * @param[out] irframe IRframe structure
80  *
81  * @returns
82  * This function returns 0 on success or error code on error.
83  *
84  */
85 VCOMMAPI int VCOMMCALL Vget_irframe(hid_device **vhandle, irframe_t *irframe);
86 /**
87  * \brief Get IRvoodoo firmware version.
88  *
89  * @ingroup vapi
90  * @param[in] vhandle IRvoodoo connection handle
91  * @param[out] fwver firmware version
92  *
93  * @returns
94  * This function returns 0 on success or error code on error.
95  *
96  */
97 VCOMMAPI int VCOMMCALL Vget_fw_version(hid_device **vhandle, uint32_t *fwver);
98 /**
99  * \brief Get IRvoodoo hardware info.
100  * Gets MCU type and UUID
101  *
102  * @ingroup vapi
103  * @param[in] vhandle IRvoodoo connection handle
104  * @param[out] id hardware info structure #hwid_t
105  *
106  * @returns
107  * This function returns 0 on success or error code on error.
108  *
109  */
110 VCOMMAPI int VCOMMCALL Vget_id(hid_device **vhandle, hwid_t *id);
111 /**
112  * \brief Download firmware from IRvoodoo.
113  *
114  * Download (backup) whole flash memory content.
115  *
116  * @ingroup vapi
117  * @param[in] vhandle IRvoodoo connection handle
118  * @param[out] fwdata pointer to databuffer. @b NB! buffer size must equal to flash size (32 * 1024 bytes)
119  *
120  * @returns
121  * This function returns 0 on success or error code on error.
122  *
123  */
124 VCOMMAPI int VCOMMCALL Vget_fw(hid_device **vhandle, uint8_t *fwdata);
125 /**
126  * \brief Set IRvoodoo operation mode.
127  *
128  * Operation modes:
129  * -# #REQ_SET_MODE_NORMAL normal operation mode
130  * -# #REQ_SET_MODE_CFG configuration mode. Out events (keyboard, mouse, ...) are disabled.
131  * -# #REQ_SET_MODE_CAPT special capture mode for raw IR data capturing. Out events (keyboard, mouse, ...) are disabled.
132  * @ingroup vapi
133  * @param[in] vhandle IRvoodoo connection handle
134  * @param[in] mode operation mode
135  *
136  * @returns
137  * This function returns 0 on success or error code on error.
138  *
139  */
140 VCOMMAPI int VCOMMCALL Vset_mode(hid_device **vhandle, int mode);
141 /**
142  * \brief Switch led on or off.
143  *
144  * @ingroup vapi
145  * @param[in] vhandle IRvoodoo connection handle
146  * @param[in] ledstate (0 = LED off, 1 = LED on)
147  *
148  * @returns
149  * This function returns 0 on success or error code on error.
150  *
151  */
152 VCOMMAPI int VCOMMCALL Vset_led(hid_device **vhandle, int ledstate);
153 /**
154  * \brief Clear last decoded IRcode and IRframe.
155  *
156  *
157  * @ingroup vapi
158  * @param[in] vhandle IRvoodoo connection handle
159  *
160  * @returns
161  * This function returns 0 on success or error code on error.
162  *
163  */
165 /**
166  * \brief Clear eventmap in EEPROM
167  *
168  *
169  * @ingroup vapi
170  * @param[in] vhandle IRvoodoo connection handle
171  *
172  * @returns
173  * This function returns 0 on success or error code on error.
174  *
175  */
177 /**
178  * \brief Set and blast IRcode
179  *
180  * @ingroup vapi
181  * @param[in] vhandle IRvoodoo connection handle
182  * @param[in] ircode IRcode to blast
183  * @param[out] cmdstat Vset_ircode command response from IRvoodoo
184  *
185  * @returns
186  * This function returns 0 on success or error code on error.
187  *
188  */
189 VCOMMAPI int VCOMMCALL Vset_ircode(hid_device **vhandle, ircode_t *ircode, cmdstat_t *cmdstat );
190 /**
191  * \brief Create and save IRevent to eventmap
192  *
193  * @ingroup vapi
194  * @param[in] vhandle IRvoodoo connection handle
195  * @param[in] from_ircode from IRcode
196  * @param[in] to_ircode to IRcode
197  * @param[out] cmdstat command response from IRvoodoo
198  *
199  * @returns
200  * This function returns 0 on success or error code on error.
201  *
202  */
203 VCOMMAPI int VCOMMCALL Vset_event(hid_device **vhandle, ircode_t *from_ircode, ircode_t *to_ircode, cmdstat_t *cmdstat );
204 //TODO Vset_irframe_data doc ...
205 /**
206  * \brief Set ...
207  *
208  * @ingroup vapi
209  * @param[in] vhandle IRvoodoo connection handle
210  * @param[in] IRframe page number (0..15)
211  * @param[in] pointer to page data (12 * uint_32t)
212  * @param[out] cmdstat command response from IRvoodoo
213  *
214  * @returns
215  * This function returns 0 on success or error code on error.
216  *
217  */
218 VCOMMAPI int VCOMMCALL Vset_irframe_page(hid_device **vhandle, uint8_t page_num, uint32_t *page_data, cmdstat_t *cmdstat );
219 //TODO Vset_irframe_data doc ...
220 /**
221  * \brief Set ...
222  *
223  * @ingroup vapi
224  * @param[in] vhandle IRvoodoo connection handle
225  * @param[in] IRframe page number (0..15)
226  * @param[in] pointer to page data (12 * uint_32t)
227  * @param[out] cmdstat command response from IRvoodoo
228  *
229  * @returns
230  * This function returns 0 on success or error code on error.
231  *
232  */
233 VCOMMAPI int VCOMMCALL Vset_irframe_info(hid_device **vhandle, uint16_t num_pulses, cmdstat_t *cmdstat );
234 //TODO Vset_irframe_data doc ...
235 /**
236  * \brief Delete event from eventmap
237  *
238  * Find event from EventMap by IRcode and delete it.
239  *
240  * @ingroup vapi
241  * @param[in] vhandle IRvoodoo connection handle
242  * @param[in] ircode IRcode to find
243  * @param[out] cmdstat command response from IRvoodoo
244  *
245  * @returns
246  * This function returns 0 on success or error code on error.
247  *
248  */
249 VCOMMAPI int VCOMMCALL Vset_irframe(hid_device **vhandle, irframe_t *irframe);
250 /**
251  * \brief Delete event from eventmap
252  *
253  * Find event from EventMap by IRcode and delete it.
254  *
255  * @ingroup vapi
256  * @param[in] vhandle IRvoodoo connection handle
257  * @param[in] irframe IRframe to find
258  * @param[out] cmdstat command response from IRvoodoo
259  *
260  * @returns
261  * This function returns 0 on success or error code on error.
262  *
263  */
264 VCOMMAPI int VCOMMCALL Vclear_event_ircode(hid_device **vhandle, ircode_t *ircode, cmdstat_t *cmdstat );
265 /**
266  * \brief Delete event NUM from eventmap
267  *
268  *
269  * @ingroup vapi
270  * @param[in] vhandle IRvoodoo connection handle
271  * @param[in] eventnum Event number in eventmap
272  * @param[out] cmdstat command response from IRvoodoo
273  *
274  * @returns
275  * This function returns 0 on success or error code on error.
276  *
277  */
278 VCOMMAPI int VCOMMCALL Vclear_event_num(hid_device **vhandle, int eventnum, cmdstat_t *cmdstat );
279 /**
280  * \brief Get configuration from IRvoodoo.
281  *
282  * @ingroup vapi
283  * @param[in] vhandle IRvoodoo connection handle
284  * @param[out] config IRvoodoo configuration structure
285  *
286  * @returns
287  * This function returns 0 on success or error code on error.
288  *
289  */
290 VCOMMAPI int VCOMMCALL Vget_config(hid_device **vhandle, config_t *config );
291 /**
292  * \brief Set configuration.
293  *
294  * @ingroup vapi
295  * @param[in] vhandle IRvoodoo connection handle
296  * @param[out] config IRvoodoo configuration structure
297  *
298  * @returns
299  * This function returns 0 on success or error code on error.
300  *
301  */
302 VCOMMAPI int VCOMMCALL Vset_config(hid_device **vhandle, config_t *config );
303 /**
304  * \brief Reset configuration to default values.
305  *
306  * @ingroup vapi
307  * @param[in] vhandle IRvoodoo connection handle
308  *
309  * @returns
310  * This function returns 0 on success or error code on error.
311  *
312  */
314 /**
315  * \brief Get runtime statistics
316  *
317  * @ingroup vapi
318  * @param[in] vhandle IRvoodoo connection handle
319  * @param[out] stat IRvoodoo runtime statistics
320  *
321  * @returns
322  * This function returns 0 on success or error code on error.
323  *
324  */
325 VCOMMAPI int VCOMMCALL Vget_stat(hid_device **vhandle, stat_t *stat );
326 /**
327  * \brief Enter ISP mode
328  *
329  * Enter ISP mode (become USB MSC device) for firmware upgrade. Restart IRvoodoo after n sec
330  * @ingroup vapi
331  * @param[in] vhandle IRvoodoo connection handle
332  * @param[in] time ISP timeout (restart IRvoodoo to normal mode)
333  *
334  *
335  */
336 VCOMMAPI int VCOMMCALL Venter_isp(hid_device **vhandle, uint8_t time );
337 /**
338  * \brief Get button state. Useful for hardware testing
339  *
340  * @ingroup vapi
341  * @param[in] vhandle IRvoodoo connection handle
342  * @param[out] status IRvoodoo button status (1 button down, 0 button up)
343  *
344  * @returns
345  * This function returns 0 on success or error code on error.
346  *
347  */
348 VCOMMAPI int VCOMMCALL Vget_btn(hid_device **vhandle, uint8_t *state );
349 #ifdef __cplusplus
350 }
351 #endif
352 
353 #endif /* VACTIONS_H_ */