root / proj / libs / uart / include / hltp.h @ 337
History | View | Annotate | Download (1.66 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 |
/**
|
16 |
* @brief Data types that HLTP is familiar with (i.e., can send and intepret).
|
17 |
*/
|
18 |
typedef enum{ |
19 |
hltp_type_invalid = 0x00,
|
20 |
hltp_type_string = 0x53,
|
21 |
hltp_type_host = 0x48,
|
22 |
hltp_type_remote = 0x52,
|
23 |
hltp_type_bullet = 0x42
|
24 |
} hltp_type; |
25 |
|
26 |
/**
|
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 |
int hltp_send_string(const char *p); |
32 |
/**
|
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 |
int hltp_send_host_info(const host_info_t *p); |
38 |
/**
|
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 |
int hltp_send_remote_info(const remote_info_t *p); |
44 |
/**
|
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 |
int hltp_send_bullet_info(const bullet_info_t *p); |
50 |
/**
|
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 |
hltp_type hltp_interpret(const uint8_t *p, const size_t sz, void **dest); |
58 |
|
59 |
/**
|
60 |
* @}
|
61 |
*/
|
62 |
|
63 |
#endif //HLTP_H_INCLUDED |