Data Structures | Typedefs | Enumerations | Functions
acc_exploration_server_base.h File Reference
`#include <stdbool.h>`
`#include <stddef.h>`
`#include <stdint.h>`
`#include "acc_definitions_common.h"`

Go to the source code of this file.

## Data Structures
struct | exploration_server_interface_t
| Struct to handle input for acc_exploration_server_process_cmds. More...

## Typedefs
typedef void() | write_data_function_t(const void *data, uint32_t size)
| Function that writes data back to the client. More...
typedef void() | restart_input_function_t(void)
| Function that stops streaming. More...
typedef void() | set_baudrate_function_t(uint32_t baudrate)
| Set baudrate of server. More...
typedef uint32_t() | get_tick_function_t(void)
| Get tick function of server. More...

## Enumerations
enum | acc_exploration_server_state_t { ACC_EXPLORATION_SERVER_WAITING = 0, ACC_EXPLORATION_SERVER_STREAMING, ACC_EXPLORATION_SERVER_STOPPED }

## Functions
bool | acc_exploration_server_init (char *buffer, size_t buffer_size, const char *hw, acc_log_level_t log_level)
| Initialize the exploration server. More...
void | acc_exploration_server_stop_streaming (void)
| Stop the streaming from the exploration server. More...
void | acc_exploration_server_deinit (void)
| De-initialize the exploration server. More...
void | acc_exploration_server_put_buffer_from_client (const void *buffer, size_t buffer_size)
| Put string from client into input buffer. More...
void | acc_exploration_server_reset_input_buffer (void)
| Reset and clear the input buffer. More...
bool | acc_exploration_server_process (const exploration_server_interface_t *server_if, acc_exploration_server_state_t *state, int32_t *ticks_until_next)
| The exploration server process function. More...
void | acc_exploration_server_end (const exploration_server_interface_t *server_if)
| End exploration server session, called to send end message to client. More...
bool | acc_exploration_server_send_log (write_data_function_t write_func, acc_log_level_t level, const char *module, const char *buffer)
| Sends a log as a json package. More...

## Typedef Documentation

## ◆ get_tick_function_t

typedef uint32_t() get_tick_function_t(void)

Get tick function of server.

Definition at line 41 of file acc_exploration_server_base.h.

## ◆ restart_input_function_t

typedef void() restart_input_function_t(void)

Function that stops streaming.

Definition at line 31 of file acc_exploration_server_base.h.

## ◆ set_baudrate_function_t

typedef void() set_baudrate_function_t(uint32_t baudrate)

Set baudrate of server.

Definition at line 36 of file acc_exploration_server_base.h.

## ◆ write_data_function_t

typedef void() write_data_function_t(const void *data, uint32_t size)

Function that writes data back to the client.

Parameters

  [in] | data | The data to be written
  [in] | size | The size of the data in bytes

Definition at line 26 of file acc_exploration_server_base.h.

## Enumeration Type Documentation

## ◆ acc_exploration_server_state_t

enum acc_exploration_server_state_t

Enumerator
ACC_EXPLORATION_SERVER_WAITING |
ACC_EXPLORATION_SERVER_STREAMING |
ACC_EXPLORATION_SERVER_STOPPED |

Definition at line 13 of file acc_exploration_server_base.h.

## Function Documentation

## ◆ acc_exploration_server_deinit()

void acc_exploration_server_deinit | ( | void |  | ) |

De-initialize the exploration server.

## ◆ acc_exploration_server_end()

void acc_exploration_server_end | ( | const exploration_server_interface_t * | server_if | ) |

End exploration server session, called to send end message to client.

Parameters

  [in] | server_if | server interface functions

## ◆ acc_exploration_server_init()

bool acc_exploration_server_init | ( | char * | buffer,
|  | size_t | buffer_size,
|  | const char * | hw,
|  | acc_log_level_t | log_level
| ) |  |

Initialize the exploration server.

Parameters

  [in] | buffer | pointer to a command buffer
  [in] | buffer_size | the size, in bytes, of the command buffer
  [in] | hw | The hardware name (module/board/system)
  [in] | log_level | The log level to use

Returns
  true if successful

## ◆ acc_exploration_server_process()

bool acc_exploration_server_process | ( | const exploration_server_interface_t * | server_if,
|  | acc_exploration_server_state_t * | state,
|  | int32_t * | ticks_until_next
| ) |  |

The exploration server process function.

This function will:

- Check the input buffer and process any available commands.
- It will also get frames from the sensor in the selected update rate
- Send the sensor frames to the client. If the server cannot call this function at the rate it expects (the returned ticks until next), the client will not get the update rate it expects. There is no harm in calling this function too often.

When the returned state equals ACC_EXPLORATION_SERVER_WAITING the server should call the acc_exploration_server_process function when new client data have been received.

When the returned state equals ACC_EXPLORATION_SERVER_STREAMING the server should call the acc_exploration_server_process after maximum ticks_until_next ticks. The acc_exploration_server_process should be called immediately if state equals ACC_EXPLORATION_SERVER_STREAMING and ticks_until_next equals 0

Parameters

  [in] | server_if | server interface functions
  [out] | state | The state the exploration server is in
  [out] | ticks_until_next | the number of ticks until the next frame is ready

Returns
  true if successful

## ◆ acc_exploration_server_put_buffer_from_client()

void acc_exploration_server_put_buffer_from_client | ( | const void * | buffer,
|  | size_t | buffer_size
| ) |  |

Put string from client into input buffer.

Parameters

  [in] | buffer | data from client
  [in] | buffer_size | the size, in bytes, of the buffer

## ◆ acc_exploration_server_reset_input_buffer()

void acc_exploration_server_reset_input_buffer | ( | void |  | ) |

Reset and clear the input buffer.

## ◆ acc_exploration_server_send_log()

bool acc_exploration_server_send_log | ( | write_data_function_t | write_func,
|  | acc_log_level_t | level,
|  | const char * | module,
|  | const char * | buffer
| ) |  |

Sends a log as a json package.

Parameters

  [in] | write_func | See write_data_function_t
  [in] | level | The severity level for the log
  [in] | module | The name of the SW module from where the log is called
  [in] | buffer | The information to be logged

Returns
  true if successful

## ◆ acc_exploration_server_stop_streaming()

void acc_exploration_server_stop_streaming | ( | void |  | ) |

Stop the streaming from the exploration server.