root / proj / project / include / hltp.h @ 364
History | View | Annotate | Download (1.66 KB)
1 | 289 | up20180642 | #ifndef HLTP_H_INCLUDED
|
---|---|---|---|
2 | #define HLTP_H_INCLUDED
|
||
3 | |||
4 | 334 | up20180642 | /**
|
5 | * @defgroup hltp hltp
|
||
6 | 357 | up20180642 | * @ingroup proj
|
7 | 334 | up20180642 | * @brief HLTP (High-Level Transfer Protocol) module.
|
8 | *
|
||
9 | * @{
|
||
10 | */
|
||
11 | |||
12 | 289 | up20180642 | #include "uart.h" |
13 | 311 | up20180655 | #include "proj_structures.h" |
14 | 289 | up20180642 | |
15 | 336 | up20180642 | /**
|
16 | * @brief Data types that HLTP is familiar with (i.e., can send and intepret).
|
||
17 | */
|
||
18 | 289 | up20180642 | typedef enum{ |
19 | hltp_type_invalid = 0x00,
|
||
20 | 311 | up20180655 | hltp_type_string = 0x53,
|
21 | 320 | up20180655 | hltp_type_host = 0x48,
|
22 | hltp_type_remote = 0x52,
|
||
23 | hltp_type_bullet = 0x42
|
||
24 | 289 | up20180642 | } hltp_type; |
25 | |||
26 | 334 | up20180642 | /**
|
27 | * @brief Send string.
|
||
28 | * @param p Pointer to string to be sent
|
||
29 | * @return SUCCESS if operation was successful, other value otherwise
|
||
30 | */
|
||
31 | 289 | up20180642 | int hltp_send_string(const char *p); |
32 | 334 | up20180642 | /**
|
33 | * @brief Send host_info.
|
||
34 | * @param p Pointer to host_info to be sent
|
||
35 | * @return SUCCESS if operation was successful, other value otherwise
|
||
36 | */
|
||
37 | 311 | up20180655 | int hltp_send_host_info(const host_info_t *p); |
38 | 334 | up20180642 | /**
|
39 | * @brief Send remote_info.
|
||
40 | * @param p Pointer to remote_info to be sent
|
||
41 | * @return SUCCESS if operation was successful, other value otherwise
|
||
42 | */
|
||
43 | 311 | up20180655 | int hltp_send_remote_info(const remote_info_t *p); |
44 | 334 | up20180642 | /**
|
45 | * @brief Send bullet_info.
|
||
46 | * @param p Pointer to bullet_info to be sent
|
||
47 | * @return SUCCESS if operation was successful, other value otherwise
|
||
48 | */
|
||
49 | 320 | up20180655 | int hltp_send_bullet_info(const bullet_info_t *p); |
50 | 334 | up20180642 | /**
|
51 | * @brief Interpret message received as one of the structs HLTP knows.
|
||
52 | * @param p Pointer to beginning of message
|
||
53 | * @param sz Size of message
|
||
54 | * @param dest Pointer to void*, to where the interpreted message will be saved
|
||
55 | * @return Code of the interpreted message
|
||
56 | */
|
||
57 | 289 | up20180642 | hltp_type hltp_interpret(const uint8_t *p, const size_t sz, void **dest); |
58 | 334 | up20180642 | |
59 | /**
|
||
60 | * @}
|
||
61 | */
|
||
62 | |||
63 | 289 | up20180642 | #endif //HLTP_H_INCLUDED |