Project

General

Profile

Statistics
| Revision:

root / proj / libs / uart / include / hltp.h @ 334

History | View | Annotate | Download (1.57 KB)

1 289 up20180642
#ifndef HLTP_H_INCLUDED
2
#define HLTP_H_INCLUDED
3
4 334 up20180642
/**
5
 * @defgroup    hltp    hltp
6
 * @ingroup nctp
7
 * @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
typedef enum{
16
    hltp_type_invalid = 0x00,
17 311 up20180655
    hltp_type_string  = 0x53,
18 320 up20180655
    hltp_type_host    = 0x48,
19
    hltp_type_remote  = 0x52,
20
    hltp_type_bullet  = 0x42
21 289 up20180642
} hltp_type;
22
23 334 up20180642
/**
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 289 up20180642
int hltp_send_string(const char *p);
29 334 up20180642
/**
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 311 up20180655
int hltp_send_host_info(const host_info_t *p);
35 334 up20180642
/**
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 311 up20180655
int hltp_send_remote_info(const remote_info_t *p);
41 334 up20180642
/**
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 320 up20180655
int hltp_send_bullet_info(const bullet_info_t *p);
47 334 up20180642
/**
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 289 up20180642
hltp_type hltp_interpret(const uint8_t *p, const size_t sz, void **dest);
55 334 up20180642
56
/**
57
 * @}
58
 */
59
60 289 up20180642
#endif //HLTP_H_INCLUDED