nRF5 SDK v11.0.0
Data Structures | Enumerations | Functions
SLIP encoding decoding

This module encodes and decodes slip packages (RFC1055). More...

Data Structures

struct  buffer_t


enum  slip_state_t {


uint32_t slip_encode (uint8_t *p_output, uint8_t *p_input, uint32_t input_length, uint32_t output_buffer_length)
 Encodes a slip packet. More...
uint32_t slip_decoding_add_char (uint8_t c, buffer_t *p_buf, slip_state_t *current_state)
 Decodes a slip packet. More...

Detailed Description

This module encodes and decodes slip packages (RFC1055).

The standard is described in

Function Documentation

uint32_t slip_decoding_add_char ( uint8_t  c,
buffer_t p_buf,
slip_state_t *  current_state 

Decodes a slip packet.

When decoding a slip packet, a state must be preserved. Initial state must be set to SLIP_DECODING.

Return values
NRF_SUCCESSwhen a packet is parsed. The length of the packet can be read out from p_buf->current_index
NRF_ERROR_BUSYwhen packet is not finished parsing
NRF_ERROR_INVALID_DATAwhen packet is encoded wrong. This moves the decoding to SLIP_CLEARING_INVALID_PACKET, and will stay in this state until SLIP_END is encountered.
uint32_t slip_encode ( uint8_t *  p_output,
uint8_t *  p_input,
uint32_t  input_length,
uint32_t  output_buffer_length 

Encodes a slip packet.

Note that the encoded output data will be longer than the input data.

Return values
Thelength of the encoded packet. If it is smaller than the input length, an error has occurred.

Documentation feedback | Developer Zone | Updated