Class FelixClientThreadExtension520

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class FelixClientThreadExtension520 : public FelixClientThreadExtension423

Public Types

typedef std::function<void(uint64_t fid, std::span<const uint8_t> data, uint8_t status)> OnDataCallbackV2

Data callback executed by the event loop (network reactor) thread.

Attention

Blocking in this function blocks the eventloop, return as soon as possible.

Param fid:

The fid (e-link identifier) from which the message originates

Param data:

The data

Param status:

One-byte field used to report errors in the message, see felix_client_status.h

typedef std::function<void(std::span<const uint8_t> data)> OnBufferCallback

Data callback executed by the event loop (network reactor) thread returning entire buffer.

Attention

Blocking in this function blocks the eventloop, return as soon as possible.

Param data:

The data of the entire network buffer (undecoded)

typedef std::function<void(uint64_t fid)> OnConnectionRefusedCallback

Callback reporting that a connection has been refused.

Param fid:

The fid for which the connection is refused.

typedef std::function<void(const std::set<std::uint64_t> &fids)> OnSubscriptionsLostCallback

Callback reporting that a set of subscriptions has been lost.

Param fid:

The fids for which the connection is down.

typedef std::function<void(std::uint64_t fid)> OnResubscriptionCallback

Callback reporting that a link is resubscribed (after being lost).

Param fid:

The fid for which the connection is re-established.

Public Functions

virtual void init_send_data_nb(std::uint64_t fid) = 0

Asynchronously initialize a send connection to FELIX.

This function checks if a connection has to be established and opens a new connection if needed. The function will return immediately. The result is communicated through the on_connect callback. If the connection is refused, the on_refused callback is called. If already the connection request fails, an exception is thrown.

Throws:

felix::BusException – if the tag is not found in the bus

Parameters:

fid – The tag to send data to

virtual void init_send_data(std::uint64_t fid, std::chrono::milliseconds timeout) = 0

Initialize a send connection to FELIX.

This function checks if a connection has to be established and opens a new connection if needed. The function will block until the connection is established or the timeout is reached. If the function returns without throwing an exception, the connection is established.

Throws:
Parameters:
  • fid – The tag to send data to

  • timeout – The timeout for establishing the connection

virtual void send_data(std::uint64_t fid, std::span<const std::uint8_t> data, bool flush) = 0

Function to send a message to a remote fid.

This function sends a single message to FELIX. If a buffered sender is used (depending on information in the bus), the flush parameter can be used to flush the buffer and send the message immediately.

Note

Can be called without init_send_data but this behavior will change and throw an exception in the future.

Throws:
Parameters:
  • fid – The tag to send data to

  • data – The data to send

  • flush – Flush the buffer

virtual void send_data(std::uint64_t fid, const std::vector<std::span<const std::uint8_t>> &msgs) = 0

Function to send multiple messages to a remote fid.

This function sends multiple messages to FELIX. If a buffered sender is used (depending on information in the bus) it is the same as calling send_data for each message. For unbuffered sending, messages will still be send together in one transaction (or as slittle as possible to fit into buffers).

Note

Can be called without init_send_data but this behavior will change and throw an exception in the future.

Throws:
Parameters:
  • fid – The tag to send data to

  • data – The data to send

  • flush – Flush the buffer

virtual void subscribe(std::uint64_t fid, std::chrono::milliseconds timeout) = 0

Synchronously subscribe to an fid.

The remote endpoint is identified from the felix-bus and a connection is established if not already present. The function will block until the link is subscribed or the timeout is reached. If the function returns without throwing an exception, the connection is established. In case the subscription fails the exception will contain more information about the cause.

Throws:
Parameters:
  • fid – The fid to subscribe to

  • timeout – The timeout for establishing the connection

virtual void subscribe(const std::vector<uint64_t> &fids, std::chrono::milliseconds timeout) = 0

Synchronously subscribe to a vector of fids.

The remote endpoints are identified from the felix-bus and connections are established if not already present. The function will block until the links are subscribed or the timeout is reached. If the function returns without throwing an exception, the connections are established. In case the subscription fails the exception will contain more information about the cause.

Throws:
Parameters:
  • fids – The fids to subscribe to

  • timeout – The timeout for establishing the connection

virtual void subscribe_nb(std::uint64_t fid) = 0

Synchronously subscribe to an fid.

The remote endpoint is identified from the felix-bus and a connection is established if not already present. The function will return immediately. A success is communicated through the on_connect callback. If the subscription request fails, an exception is thrown. Other failures are not communicated (but the on_connect callback will not be called).

Throws:
Parameters:
  • fid – The fid to subscribe to

  • timeout – The timeout for establishing the connection

virtual void subscribe_nb(const std::vector<uint64_t> &fids) = 0

Aynchronously subscribe to a vector of fids.

The remote endpoints are identified from the felix-bus and connections are established if not already present. The function will return immediately. A success is communicated through the on_connect callback. If the subscription request fails, an exception is thrown. Other failures are not communicated (but the on_connect callback will not be called).

Throws:
Parameters:
  • fids – The fids to subscribe to

  • timeout – The timeout for establishing the connection

virtual void unsubscribe(std::uint64_t fid, std::chrono::milliseconds timeout) = 0

Synchronously unsubscribe from a tag.

This function unsubscribes from a tag. The function will block until the link is unsubscribed or the timeout is reached. If the function returns without throwing an exception, the link is unsubscribed. In case the unsubscription fails the exception will contain more information about the cause.

Throws:
Parameters:
  • fid – The tag to unsubscribe from

  • timeout – The timeout for unsubscribing

virtual void unsubscribe_nb(std::uint64_t fid) = 0

Asynchronously unsubscribe from a tag.

This function unsubscribes from a tag. The function will return immediately. A success is communicated through the on_disconnect callback. If the unsubscription request fails, an exception is thrown. Other failures are not communicated (but the on_disconnect callback will not be called).

Throws:
Parameters:

fid – The tag to unsubscribe from

virtual void create_trickle_config() = 0

This function creates a new blank trickle configuration.

virtual void append_trickle_config(const std::uint64_t fid, const std::vector<uint8_t> &payload) = 0

Adds data to the current trickle configuration.

Throws:

felix::TrickleLogicException – if called before create_trickle_config()

Parameters:
  • elink – The fid of the FE device

  • payload – The binary payload data

virtual void send_trickle_config(std::uint64_t fid) = 0

Send trickle configuration to a FELIX device.

Throws:
Parameters:
  • fid – The target FELIX device ID

  • data – The binary payload for the trickle configuration

virtual void start_trickle(std::uint64_t fid) = 0

Start trickle sending on a FELIX device.

This function sends a command to start trickle sending on a FELIX device.

Throws:
Parameters:

fid – The target FELIX device ID

virtual void stop_trickle(std::uint64_t fid) = 0

Stop trickle sending on a FELIX device.

This function sends a command to stop trickle sending on a FELIX device.

Throws:
Parameters:

fid – The target FELIX device ID

virtual void select_trickle_bcids(std::uint64_t fid, std::uint32_t first_bcid, std::uint32_t last_bcid) = 0

Configure BCID range for trickle sending.

This function sends a command to configure the BCID range for trickle sending. DISCALIMER: it has not yet been implemented.

Throws:
Parameters:
  • fid – The target FELIX device ID

  • first_bcid – First BCID in the range

  • last_bcid – Last BCID in the range

virtual void throttle_trickle(std::uint64_t fid, std::uint32_t throttle_factor) = 0

Configure throttling factor for trickle sending.

This function sends a command to configure the throttling factor that slows firmware trickling. DISCLAIMER: it has not yet been implemented.

Throws:
Parameters:
  • fid – The target FELIX device ID

  • throttle_factor – slows trickling by N times [1 = no throttle]

virtual void user_timer_start(std::chrono::milliseconds interval) = 0

Start user timer function in the eventloop thread.

Parameters:

interval – interval time

virtual std::map<std::uint64_t, std::size_t> get_available_send_buffers() = 0

Get the number of available buffers of all senders per FID.

Returns the minimum number of buffers since the last call to this function per FID.

Returns:

Number of buffers per FID for all senders

virtual std::map<std::uint64_t, BlockDecoderStats> get_block_decoder_stats() const = 0

Get the statistics for the block decoder.

Returns the statistics for the block decoder, such as the number of processed blocks, dropped blocks, invalid data blocks, invalid header blocks, out-of-sequence blocks, and corrupted streams if block decoding is used.

Returns:

Block decoder statistics

virtual std::map<std::string, std::vector<felix::BitFieldRecord>> read_register(const felix::DeviceId &dev_id, const std::string &name) const = 0

Reads register, i2c register, alias or group.

Throws:

felix::FelixIoException – if any felix_io error occurred

Parameters:
  • dev_id – device id pointing to the device to be read

  • name – register, i2c, alias or group name

Returns:

map of list of bitfields, accessible by name

virtual void write_register(const felix::DeviceId &dev_id, const std::string &name, std::uint64_t value) const = 0

Writes a register.

Throws:

felix::FelixIoException – if any felix_io error occurred

Parameters:
  • dev_id – device id pointing to the device to be written

  • name – register name

  • value – value to be written

virtual std::map<felix::DeviceId, std::vector<std::uint64_t>> translate(const std::vector<std::uint64_t> &fids) = 0

translates fids into device ids. The actual return is in the form of a map so that a relation between fid and device_id can be reconstructed.

Throws:

felix::BusException – if any fid was not found

Parameters:

fids – list of fids to be translated

Returns:

map of list of fids, accessible by device id

void user_timer_start(unsigned long interval) = 0

start user timer function in the eventloop thread

Parameters:

interval – interval time in ms.

struct BlockDecoderStats

Statistics for the block decoder.

This structure contains statistics about the block decoder, such as the number of processed blocks, dropped blocks, invalid data blocks, invalid header blocks, out-of-sequence blocks, and corrupted streams.

Public Members

std::uint64_t processed_blocks = {}

Number of processed blocks.

std::uint64_t dropped_blocks = {}

Number of dropped blocks.

std::uint64_t invalid_data_blocks = {}

Number of blocks with invalid data.

std::uint64_t invalid_header_blocks = {}

Number of blocks with invalid header.

std::uint64_t oos_blocks = {}

Number of blocks with out-of-sequence data.

std::uint64_t corrupted_streams = {}

Number of chunks with corrupted streams.

struct ConfigV2

Data structure that includes both configuration parameters and pointers to callbacks using new on data callback.

Public Members

OnDataCallbackV2 on_data_callback = {nullptr}
OnBufferCallback on_buffer_callback = {nullptr}
OnInitCallback on_init_callback = {nullptr}
OnConnectCallback on_connect_callback = {nullptr}
OnDisconnectCallback on_disconnect_callback = {nullptr}
OnConnectionRefusedCallback on_refused_callback = {nullptr}
OnSubscriptionsLostCallback on_subscriptions_lost_callback = {nullptr}
OnResubscriptionCallback on_resubscription_callback = {nullptr}
Properties property = {}