![]() |
nRF5 SDK
v16.0.0
|
| Choose documentation: | nRF5 SDK | S112 SoftDevice API | S113 SoftDevice API | S132 SoftDevice API | S140 SoftDevice API | S212 SoftDevice API | S312 SoftDevice API | S332 SoftDevice API | S340 SoftDevice API |
This module encodes and decodes SLIP packages. More...
Modules | |
| SLIP encoding and decoding configuration | |
Data Structures | |
| struct | slip_t |
| Representation of a SLIP packet. More... | |
Enumerations | |
| enum | slip_read_state_t { SLIP_STATE_DECODING, SLIP_STATE_ESC_RECEIVED, SLIP_STATE_CLEARING_INVALID_PACKET } |
| Status information that is used while receiving and decoding a packet. More... | |
Functions | |
| ret_code_t | slip_encode (uint8_t *p_output, uint8_t *p_input, uint32_t input_length, uint32_t *p_output_buffer_length) |
| Function for encoding a SLIP packet. More... | |
| ret_code_t | slip_decode_add_byte (slip_t *p_slip, uint8_t c) |
| Function for decoding a SLIP packet. More... | |
This module encodes and decodes SLIP packages.
The SLIP protocol is described in RFC1055.
| enum slip_read_state_t |
Status information that is used while receiving and decoding a packet.
| ret_code_t slip_decode_add_byte | ( | slip_t * | p_slip, |
| uint8_t | c | ||
| ) |
Function for decoding a SLIP packet.
The decoded packet is put into p_slip::p_buffer. The index and buffer state is updated.
Ensure that p_slip is properly initialized. The initial state must be set to SLIP_STATE_DECODING.
| [in,out] | p_slip | State of the decoding process. |
| [in] | c | Byte to decode. |
| NRF_SUCCESS | If a packet has been parsed. The received packet can be retrieved from p_slip. |
| NRF_ERROR_NULL | If p_slip is NULL. |
| NRF_ERROR_NO_MEM | If there is no more room in the buffer provided by p_slip. |
| NRF_ERROR_BUSY | If the packet has not been parsed completely yet. |
| NRF_ERROR_INVALID_DATA | If the packet is encoded wrong. In this case, p_slip::state is set to SLIP_STATE_CLEARING_INVALID_PACKET, and decoding will stay in this state until the END byte is received. |
| ret_code_t slip_encode | ( | uint8_t * | p_output, |
| uint8_t * | p_input, | ||
| uint32_t | input_length, | ||
| uint32_t * | p_output_buffer_length | ||
| ) |
Function for encoding a SLIP packet.
The maximum size of the output data is (2*input size + 1) bytes. Ensure that the provided buffer is large enough.
| [in,out] | p_output | The buffer where the encoded SLIP packet is stored. Ensure that it is large enough. |
| [in,out] | p_input | The buffer to be encoded. |
| [in,out] | input_length | The length of the input buffer. |
| [out] | p_output_buffer_length | The length of the output buffer after the input has been encoded. |
| NRF_SUCCESS | If the input was successfully encoded into output. |
| NRF_ERROR_NULL | If one of the provided parameters is NULL. |