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