ARMEBS4  revision-26.06.2015
androsensor.h
Go to the documentation of this file.
1 /*************************************************************************//**
2  * \file androsensor.h
3  * \brief Androsensor protocol
4  * \author marc dot pignat at hevs dot ch
5  *
6  * \defgroup androsensor Androsensor
7  * @{
8  *
9  * \ingroup libraries
10  *
11  * \brief Communication with an android device
12  *
13  * This library provides communication between a stm32f4 and an Android device
14  * over USB.
15  *
16  ****************************************************************************/
17 
18 #ifndef HEIVS_ANDROSENSOR_H
19 #define HEIVS_ANDROSENSOR_H
20 
21 #include "heivs/config.h"
22 #if (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE)
23 
24 #include "heivs/error.h"
25 #include <stdint.h>
26 #include <stddef.h>
27 
28 #include "heivs/time.h"
29 enum androsensor_state
30 {
31  STATE_UNKNOWN = 0,
32  STATE_CONNECTED = 1,
33 };
34 
35 struct androsensor_t
36 {
37  timeout_t keepalive_out_timeout;
38  timeout_t keepalive_in_timeout;
39  enum androsensor_state state;
40  uint8_t inbuff[64];
41  size_t insize;
42  uint32_t keepalivefatal;
43 };
44 
45 #ifdef __cplusplus
46  extern "C" {
47 #endif
48 
49 
50 void androsensor_process(struct androsensor_t *as);
51 status_e androsensor_init_master(struct androsensor_t *as, const char* manufacture, const char* model, const char* description, const char* version, const char* uri, const char* serial);
52 uint32_t androsensor_active(struct androsensor_t *as);
53 status_e androsensor_write(struct androsensor_t *as, const uint8_t *data, size_t len);
54 status_e androsensor_read(struct androsensor_t *as, uint8_t *data, size_t len, size_t *rlen);
55 
56 #ifdef __cplusplus
57  }
58 #endif
59 
60 #endif /* HEIVS_ANDROSENSOR_H */
61 
62 /************************************************************************//**
63  * @}
64  ***************************************************************************/
65 
66 #endif /* (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE) */
simple time abstraction
libheivs configuration file
Errors definitions.
Timeout structure.
Definition: time.h:34
status_e
Known errors.
Definition: error.h:21