Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
smp_dummy.h File Reference

Dummy transport for the mcumgr SMP protocol for unit testing. More...

Go to the source code of this file.

Functions

void smp_dummy_clear_state (void)
 Clears internal dummy SMP state and resets semaphore.
 
void dummy_mcumgr_add_data (uint8_t *data, uint16_t data_size)
 Adds SMPC data to the internal buffer to be processed.
 
struct net_bufsmp_dummy_get_outgoing (void)
 Processes a single line (fragment) coming from the mcumgr response to be used in tests.
 
bool smp_dummy_wait_for_data (uint32_t wait_time_s)
 Waits for a period of time for outgoing SMPC data to be ready and returns either when a full message is ready or when the timeout has elapsed.
 
void smp_dummy_add_data (void)
 Calls dummy_mcumgr_add_data with the internal SMPC receive buffer.
 
uint16_t smp_dummy_get_send_pos (void)
 Gets current send buffer position.
 
uint16_t smp_dummy_get_receive_pos (void)
 Gets current receive buffer position.
 
int smp_dummy_tx_pkt (const uint8_t *data, int len)
 Converts input data to go out through the internal SMPC buffer.
 
void smp_dummy_enable (void)
 Enabled the dummy SMP module (will process sent/received data)
 
void smp_dummy_disable (void)
 Disables the dummy SMP module (will not process sent/received data)
 
bool smp_dummy_get_status (void)
 Returns status on if the dummy SMP system is active.
 

Detailed Description

Dummy transport for the mcumgr SMP protocol for unit testing.

Function Documentation

◆ dummy_mcumgr_add_data()

void dummy_mcumgr_add_data ( uint8_t data,
uint16_t  data_size 
)

Adds SMPC data to the internal buffer to be processed.

Parameters
dataInput data buffer
data_sizeSize of data (in bytes)

◆ smp_dummy_add_data()

void smp_dummy_add_data ( void  )

Calls dummy_mcumgr_add_data with the internal SMPC receive buffer.

◆ smp_dummy_clear_state()

void smp_dummy_clear_state ( void  )

Clears internal dummy SMP state and resets semaphore.

◆ smp_dummy_disable()

void smp_dummy_disable ( void  )

Disables the dummy SMP module (will not process sent/received data)

◆ smp_dummy_enable()

void smp_dummy_enable ( void  )

Enabled the dummy SMP module (will process sent/received data)

◆ smp_dummy_get_outgoing()

struct net_buf * smp_dummy_get_outgoing ( void  )

Processes a single line (fragment) coming from the mcumgr response to be used in tests.

Return values
netbuffer of processed data

◆ smp_dummy_get_receive_pos()

uint16_t smp_dummy_get_receive_pos ( void  )

Gets current receive buffer position.

Return values
Currentreceive buffer position (in bytes)

◆ smp_dummy_get_send_pos()

uint16_t smp_dummy_get_send_pos ( void  )

Gets current send buffer position.

Return values
Currentsend buffer position (in bytes)

◆ smp_dummy_get_status()

bool smp_dummy_get_status ( void  )

Returns status on if the dummy SMP system is active.

Return values
trueif dummy SMP is enabled, false otherwise

◆ smp_dummy_tx_pkt()

int smp_dummy_tx_pkt ( const uint8_t data,
int  len 
)

Converts input data to go out through the internal SMPC buffer.

Parameters
dataInput data buffer
lenSize of data (in bytes)
Return values
0on success, negative on error.

◆ smp_dummy_wait_for_data()

bool smp_dummy_wait_for_data ( uint32_t  wait_time_s)

Waits for a period of time for outgoing SMPC data to be ready and returns either when a full message is ready or when the timeout has elapsed.

Parameters
wait_time_sTime to wait for data (in seconds)
Return values
trueon message received successfully, false on timeout