srs-control 0.2.2
Loading...
Searching...
No Matches
srs::common Namespace Reference

Namespaces

namespace  internal

Classes

struct  MinMax
 Struct to store minimum and maximum values. More...

Typedefs

using RawDelimSizeType = uint32_t

Enumerations

enum class  DataPrintMode : uint8_t { print_speed , print_header , print_raw , print_all }
 Print mode of the status line. More...
enum class  ActionMode : uint8_t {
  all , acq_on , acq_off , read_only ,
  none
}

Functions

template<std::size_t bit_size, std::size_t max, std::size_t min = 0>
constexpr auto subset (const std::bitset< bit_size > &bits) -> std::bitset< max - min >
template<std::size_t high_size, std::size_t low_size>
constexpr auto merge_bits (const std::bitset< high_size > &high_bits, const std::bitset< low_size > &low_bits) -> std::bitset< high_size+low_size >
template<std::size_t low_size, std::size_t total_size>
requires (total_size <= sizeof(std::uint64_t) * common::BYTE_BIT_LENGTH and total_size >= low_size)
constexpr auto get_low_bits (const std::bitset< total_size > &bits) -> std::bitset< low_size >
template<std::size_t high_size, std::size_t total_size>
requires (total_size <= sizeof(std::uint64_t) * common::BYTE_BIT_LENGTH and total_size >= high_size)
constexpr auto get_high_bits (const std::bitset< total_size > &bits) -> std::bitset< high_size >
template<std::size_t bit_size>
constexpr auto byte_swap (const std::bitset< bit_size > &bits)
template<typename T>
constexpr auto gray_to_binary (T gray_val)
template<typename T>
constexpr auto binary_to_gray (T bin_val)
constexpr auto get_shared_from_this (auto &&obj)
template<typename Enum>
consteval auto get_enum_names ()
constexpr auto insert_index_to_filename (std::string_view native_name, int idx) -> std::string
auto get_default_log_path () -> std::filesystem::path
auto get_default_config_path () -> std::filesystem::path
auto get_file_size (std::string_view filename) -> std::expected< std::size_t, std::string >

Variables

constexpr auto BYTE_BIT_LENGTH = 8
constexpr auto DEFAULT_SRS_IP = std::string_view{ "10.0.0.2" }
constexpr auto DEFAULT_TIMEOUT_SECONDS = 2
constexpr auto WRITE_COMMAND_BITS = uint8_t{ 0xaa }
constexpr auto DEFAULT_TYPE_BITS = uint8_t{ 0xaa }
constexpr auto DEFAULT_CHANNEL_ADDRE = uint16_t{ 0xff }
constexpr auto COMMAND_LENGTH_BITS = uint16_t{ 0xffff }
constexpr auto ZERO_UINT16_PADDING = uint16_t{}
constexpr auto SMALL_READ_MSG_BUFFER_SIZE = 96
constexpr auto LARGE_READ_MSG_BUFFER_SIZE = 80'000
 size of the data array for reading a UDP package
constexpr auto DEFAULT_CMD_LENGTH = uint16_t{ 0xffff }
constexpr auto CMD_TYPE = uint8_t{ 0xaa }
constexpr auto WRITE_CMD = uint8_t{ 0xaa }
constexpr auto READ_CMD = uint8_t{ 0xbb }
constexpr auto I2C_ADDRESS = uint16_t{ 0x0042 }
constexpr auto NULL_ADDRESS = uint16_t{ 0x000f }
constexpr auto INIT_COUNT_VALUE = uint32_t{ 0x80000000 }
constexpr auto DEFAULT_STATUS_WAITING_TIME_SECONDS = std::chrono::seconds{ 5 }
constexpr auto DEFAULT_SRS_CONTROL_PORT = 6600
const auto FEC_DAQ_RECEIVE_PORT = std::vector<int>{ 6006 }
static constexpr int FEC_CONTROL_LOCAL_PORT = 6007
 Default value of the listening port number used for the FEC communications.
constexpr auto DEFAULT_DISPLAY_PERIOD = std::chrono::milliseconds{ 200 }
constexpr auto DEFAULT_ROOT_HTTP_SERVER_PERIOD = std::chrono::milliseconds{ 1000 }
constexpr auto FEC_ID_BIT_LENGTH = 8
constexpr auto HIT_DATA_BIT_LENGTH = 48
constexpr auto SRS_TIMESTAMP_HIGH_BIT_LENGTH = 32U
constexpr auto SRS_TIMESTAMP_LOW_BIT_LENGTH = 10U
constexpr auto FLAG_BIT_POSITION = 15
constexpr auto GZIP_DEFAULT_COMPRESSION_LEVEL = 9
constexpr auto PROTOBUF_ENABLE_GZIP = true
constexpr auto DEFAULT_DATA_QUEUE_SIZE = 100
constexpr auto DEFAULT_LOG_FILE = std::string_view{ "srs-control/srs-control.log" }
constexpr auto DEFAULT_CONFIG_FILE = std::string_view{ "srs-control/config.yaml" }
constexpr auto rotating_file_nums = 5
constexpr auto file_max_size = 1048576 * 10
 file size limited to 10 MB.
constexpr auto exit_logger_begin = std::string_view{ "------->>" }
constexpr auto exit_logger_end = std::string_view{ "<<-------" }
constexpr auto file_logger_new_instance_str

Typedef Documentation

◆ RawDelimSizeType

Definition at line 96 of file CommonDefinitions.hpp.

Enumeration Type Documentation

◆ ActionMode

enum class srs::common::ActionMode : uint8_t
strong
Enumerator
all 
acq_on 
acq_off 
read_only 
none 

Definition at line 78 of file CommonDefinitions.hpp.

◆ DataPrintMode

enum class srs::common::DataPrintMode : uint8_t
strong

Print mode of the status line.

Enumerator
print_speed 

Print the data reading rate.

print_header 

Print the header of the data structure.

print_raw 

Print the raw binary data.

print_all 

Print everything.

Definition at line 70 of file CommonDefinitions.hpp.

Function Documentation

◆ binary_to_gray()

template<typename T>
auto srs::common::binary_to_gray ( T bin_val)
constexpr

Definition at line 92 of file CommonFunctions.hpp.

◆ byte_swap()

template<std::size_t bit_size>
auto srs::common::byte_swap ( const std::bitset< bit_size > & bits)
constexpr

Definition at line 71 of file CommonFunctions.hpp.

◆ get_default_config_path()

auto srs::common::get_default_config_path ( ) -> std::filesystem::path
inline

Definition at line 126 of file CommonFunctions.hpp.

◆ get_default_log_path()

auto srs::common::get_default_log_path ( ) -> std::filesystem::path
inline

Definition at line 117 of file CommonFunctions.hpp.

◆ get_enum_names()

template<typename Enum>
auto srs::common::get_enum_names ( )
consteval

Definition at line 103 of file CommonFunctions.hpp.

◆ get_file_size()

auto srs::common::get_file_size ( std::string_view filename) -> std::expected< std::size_t, std::string >
inline

Definition at line 135 of file CommonFunctions.hpp.

◆ get_high_bits()

template<std::size_t high_size, std::size_t total_size>
requires (total_size <= sizeof(std::uint64_t) * common::BYTE_BIT_LENGTH and total_size >= high_size)
auto srs::common::get_high_bits ( const std::bitset< total_size > & bits) -> std::bitset< high_size >
constexpr

Definition at line 63 of file CommonFunctions.hpp.

◆ get_low_bits()

template<std::size_t low_size, std::size_t total_size>
requires (total_size <= sizeof(std::uint64_t) * common::BYTE_BIT_LENGTH and total_size >= low_size)
auto srs::common::get_low_bits ( const std::bitset< total_size > & bits) -> std::bitset< low_size >
constexpr

Definition at line 54 of file CommonFunctions.hpp.

◆ get_shared_from_this()

auto srs::common::get_shared_from_this ( auto && obj)
constexpr

Definition at line 97 of file CommonFunctions.hpp.

◆ gray_to_binary()

template<typename T>
auto srs::common::gray_to_binary ( T gray_val)
constexpr

Definition at line 80 of file CommonFunctions.hpp.

◆ insert_index_to_filename()

auto srs::common::insert_index_to_filename ( std::string_view native_name,
int idx ) -> std::string
constexpr

Definition at line 109 of file CommonFunctions.hpp.

◆ merge_bits()

template<std::size_t high_size, std::size_t low_size>
auto srs::common::merge_bits ( const std::bitset< high_size > & high_bits,
const std::bitset< low_size > & low_bits ) -> std::bitset< high_size+low_size >
constexpr

Definition at line 39 of file CommonFunctions.hpp.

◆ subset()

template<std::size_t bit_size, std::size_t max, std::size_t min = 0>
auto srs::common::subset ( const std::bitset< bit_size > & bits) -> std::bitset< max - min >
constexpr

Definition at line 27 of file CommonFunctions.hpp.

Variable Documentation

◆ BYTE_BIT_LENGTH

auto srs::common::BYTE_BIT_LENGTH = 8
constexpr

Definition at line 10 of file CommonDefinitions.hpp.

◆ CMD_TYPE

auto srs::common::CMD_TYPE = uint8_t{ 0xaa }
constexpr

Definition at line 24 of file CommonDefinitions.hpp.

◆ COMMAND_LENGTH_BITS

auto srs::common::COMMAND_LENGTH_BITS = uint16_t{ 0xffff }
constexpr

Definition at line 18 of file CommonDefinitions.hpp.

◆ DEFAULT_CHANNEL_ADDRE

auto srs::common::DEFAULT_CHANNEL_ADDRE = uint16_t{ 0xff }
constexpr

Definition at line 17 of file CommonDefinitions.hpp.

◆ DEFAULT_CMD_LENGTH

auto srs::common::DEFAULT_CMD_LENGTH = uint16_t{ 0xffff }
constexpr

Definition at line 23 of file CommonDefinitions.hpp.

◆ DEFAULT_CONFIG_FILE

auto srs::common::DEFAULT_CONFIG_FILE = std::string_view{ "srs-control/config.yaml" }
constexpr

Definition at line 56 of file CommonDefinitions.hpp.

◆ DEFAULT_DATA_QUEUE_SIZE

auto srs::common::DEFAULT_DATA_QUEUE_SIZE = 100
constexpr

Definition at line 52 of file CommonDefinitions.hpp.

◆ DEFAULT_DISPLAY_PERIOD

auto srs::common::DEFAULT_DISPLAY_PERIOD = std::chrono::milliseconds{ 200 }
constexpr

Definition at line 43 of file CommonDefinitions.hpp.

◆ DEFAULT_LOG_FILE

auto srs::common::DEFAULT_LOG_FILE = std::string_view{ "srs-control/srs-control.log" }
constexpr

Definition at line 55 of file CommonDefinitions.hpp.

◆ DEFAULT_ROOT_HTTP_SERVER_PERIOD

auto srs::common::DEFAULT_ROOT_HTTP_SERVER_PERIOD = std::chrono::milliseconds{ 1000 }
constexpr

Definition at line 44 of file CommonDefinitions.hpp.

◆ DEFAULT_SRS_CONTROL_PORT

auto srs::common::DEFAULT_SRS_CONTROL_PORT = 6600
constexpr

Definition at line 34 of file CommonDefinitions.hpp.

◆ DEFAULT_SRS_IP

auto srs::common::DEFAULT_SRS_IP = std::string_view{ "10.0.0.2" }
constexpr

Definition at line 13 of file CommonDefinitions.hpp.

◆ DEFAULT_STATUS_WAITING_TIME_SECONDS

auto srs::common::DEFAULT_STATUS_WAITING_TIME_SECONDS = std::chrono::seconds{ 5 }
constexpr

Definition at line 31 of file CommonDefinitions.hpp.

◆ DEFAULT_TIMEOUT_SECONDS

auto srs::common::DEFAULT_TIMEOUT_SECONDS = 2
constexpr

Definition at line 14 of file CommonDefinitions.hpp.

◆ DEFAULT_TYPE_BITS

auto srs::common::DEFAULT_TYPE_BITS = uint8_t{ 0xaa }
constexpr

Definition at line 16 of file CommonDefinitions.hpp.

◆ exit_logger_begin

auto srs::common::exit_logger_begin = std::string_view{ "------->>" }
constexpr

Definition at line 61 of file CommonDefinitions.hpp.

◆ exit_logger_end

auto srs::common::exit_logger_end = std::string_view{ "<<-------" }
constexpr

Definition at line 62 of file CommonDefinitions.hpp.

◆ FEC_CONTROL_LOCAL_PORT

int srs::common::FEC_CONTROL_LOCAL_PORT = 6007
staticconstexpr

Default value of the listening port number used for the FEC communications.

Definition at line 40 of file CommonDefinitions.hpp.

◆ FEC_DAQ_RECEIVE_PORT

const auto srs::common::FEC_DAQ_RECEIVE_PORT = std::vector<int>{ 6006 }

Definition at line 35 of file CommonDefinitions.hpp.

◆ FEC_ID_BIT_LENGTH

auto srs::common::FEC_ID_BIT_LENGTH = 8
constexpr

Definition at line 45 of file CommonDefinitions.hpp.

◆ file_logger_new_instance_str

auto srs::common::file_logger_new_instance_str
constexpr
Initial value:
=
std::string_view{ "----------------------new log instance----------------------" }

Definition at line 63 of file CommonDefinitions.hpp.

◆ file_max_size

auto srs::common::file_max_size = 1048576 * 10
constexpr

file size limited to 10 MB.

Definition at line 60 of file CommonDefinitions.hpp.

◆ FLAG_BIT_POSITION

auto srs::common::FLAG_BIT_POSITION = 15
constexpr

Definition at line 49 of file CommonDefinitions.hpp.

◆ GZIP_DEFAULT_COMPRESSION_LEVEL

auto srs::common::GZIP_DEFAULT_COMPRESSION_LEVEL = 9
constexpr

Definition at line 50 of file CommonDefinitions.hpp.

◆ HIT_DATA_BIT_LENGTH

auto srs::common::HIT_DATA_BIT_LENGTH = 48
constexpr

Definition at line 46 of file CommonDefinitions.hpp.

◆ I2C_ADDRESS

auto srs::common::I2C_ADDRESS = uint16_t{ 0x0042 }
constexpr

Definition at line 27 of file CommonDefinitions.hpp.

◆ INIT_COUNT_VALUE

auto srs::common::INIT_COUNT_VALUE = uint32_t{ 0x80000000 }
constexpr

Definition at line 30 of file CommonDefinitions.hpp.

◆ LARGE_READ_MSG_BUFFER_SIZE

auto srs::common::LARGE_READ_MSG_BUFFER_SIZE = 80'000
constexpr

size of the data array for reading a UDP package

Definition at line 21 of file CommonDefinitions.hpp.

◆ NULL_ADDRESS

auto srs::common::NULL_ADDRESS = uint16_t{ 0x000f }
constexpr

Definition at line 28 of file CommonDefinitions.hpp.

◆ PROTOBUF_ENABLE_GZIP

auto srs::common::PROTOBUF_ENABLE_GZIP = true
constexpr

Definition at line 51 of file CommonDefinitions.hpp.

◆ READ_CMD

auto srs::common::READ_CMD = uint8_t{ 0xbb }
constexpr

Definition at line 26 of file CommonDefinitions.hpp.

◆ rotating_file_nums

auto srs::common::rotating_file_nums = 5
constexpr

Definition at line 59 of file CommonDefinitions.hpp.

◆ SMALL_READ_MSG_BUFFER_SIZE

auto srs::common::SMALL_READ_MSG_BUFFER_SIZE = 96
constexpr

Definition at line 20 of file CommonDefinitions.hpp.

◆ SRS_TIMESTAMP_HIGH_BIT_LENGTH

auto srs::common::SRS_TIMESTAMP_HIGH_BIT_LENGTH = 32U
constexpr

Definition at line 47 of file CommonDefinitions.hpp.

◆ SRS_TIMESTAMP_LOW_BIT_LENGTH

auto srs::common::SRS_TIMESTAMP_LOW_BIT_LENGTH = 10U
constexpr

Definition at line 48 of file CommonDefinitions.hpp.

◆ WRITE_CMD

auto srs::common::WRITE_CMD = uint8_t{ 0xaa }
constexpr

Definition at line 25 of file CommonDefinitions.hpp.

◆ WRITE_COMMAND_BITS

auto srs::common::WRITE_COMMAND_BITS = uint8_t{ 0xaa }
constexpr

Definition at line 15 of file CommonDefinitions.hpp.

◆ ZERO_UINT16_PADDING

auto srs::common::ZERO_UINT16_PADDING = uint16_t{}
constexpr

Definition at line 19 of file CommonDefinitions.hpp.