srs-control 0.2.2
Loading...
Searching...
No Matches
CommonDefinitions.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <cstdint>
5#include <string_view>
6#include <vector>
7
8namespace srs::common
9{
10 constexpr auto BYTE_BIT_LENGTH = 8;
11
12 // Connections:
13 constexpr auto DEFAULT_SRS_IP = std::string_view{ "10.0.0.2" };
14 constexpr auto DEFAULT_TIMEOUT_SECONDS = 2;
15 constexpr auto WRITE_COMMAND_BITS = uint8_t{ 0xaa };
16 constexpr auto DEFAULT_TYPE_BITS = uint8_t{ 0xaa };
17 constexpr auto DEFAULT_CHANNEL_ADDRE = uint16_t{ 0xff };
18 constexpr auto COMMAND_LENGTH_BITS = uint16_t{ 0xffff };
19 constexpr auto ZERO_UINT16_PADDING = uint16_t{};
20 constexpr auto SMALL_READ_MSG_BUFFER_SIZE = 96;
21 constexpr auto LARGE_READ_MSG_BUFFER_SIZE = 80'000;
22
23 constexpr auto DEFAULT_CMD_LENGTH = uint16_t{ 0xffff };
24 constexpr auto CMD_TYPE = uint8_t{ 0xaa };
25 constexpr auto WRITE_CMD = uint8_t{ 0xaa };
26 constexpr auto READ_CMD = uint8_t{ 0xbb };
27 constexpr auto I2C_ADDRESS = uint16_t{ 0x0042 }; /* device address = 0x21 */
28 constexpr auto NULL_ADDRESS = uint16_t{ 0x000f }; /* device address = 0x21 */
29
30 constexpr auto INIT_COUNT_VALUE = uint32_t{ 0x80000000 };
31 constexpr auto DEFAULT_STATUS_WAITING_TIME_SECONDS = std::chrono::seconds{ 5 };
32
33 // port numbers:
34 constexpr auto DEFAULT_SRS_CONTROL_PORT = 6600;
35 const auto FEC_DAQ_RECEIVE_PORT = std::vector<int>{ 6006 };
36
40 static constexpr int FEC_CONTROL_LOCAL_PORT = 6007;
41
42 // Data processor:
43 constexpr auto DEFAULT_DISPLAY_PERIOD = std::chrono::milliseconds{ 200 };
44 constexpr auto DEFAULT_ROOT_HTTP_SERVER_PERIOD = std::chrono::milliseconds{ 1000 };
45 constexpr auto FEC_ID_BIT_LENGTH = 8;
46 constexpr auto HIT_DATA_BIT_LENGTH = 48;
47 constexpr auto SRS_TIMESTAMP_HIGH_BIT_LENGTH = 32U;
48 constexpr auto SRS_TIMESTAMP_LOW_BIT_LENGTH = 10U;
49 constexpr auto FLAG_BIT_POSITION = 15; // zero based
51 constexpr auto PROTOBUF_ENABLE_GZIP = true;
52 constexpr auto DEFAULT_DATA_QUEUE_SIZE = 100;
53
54 // Default filenames
55 constexpr auto DEFAULT_LOG_FILE = std::string_view{ "srs-control/srs-control.log" };
56 constexpr auto DEFAULT_CONFIG_FILE = std::string_view{ "srs-control/config.yaml" };
57
58 // Log parameters
59 constexpr auto rotating_file_nums = 5;
60 constexpr auto file_max_size = 1048576 * 10;
61 constexpr auto exit_logger_begin = std::string_view{ "------->>" };
62 constexpr auto exit_logger_end = std::string_view{ "<<-------" };
64 std::string_view{ "----------------------new log instance----------------------" };
65
77
78 enum class ActionMode : uint8_t
79 {
85 };
86
90 template <typename T>
91 struct MinMax
92 {
93 T min{};
94 T max{};
95 };
96 using RawDelimSizeType = uint32_t;
97
98} // namespace srs::common
constexpr auto FLAG_BIT_POSITION
constexpr auto file_logger_new_instance_str
constexpr auto FEC_ID_BIT_LENGTH
constexpr auto WRITE_COMMAND_BITS
constexpr auto rotating_file_nums
constexpr auto I2C_ADDRESS
static constexpr int FEC_CONTROL_LOCAL_PORT
Default value of the listening port number used for the FEC communications.
constexpr auto DEFAULT_CONFIG_FILE
constexpr auto DEFAULT_CHANNEL_ADDRE
constexpr auto DEFAULT_DATA_QUEUE_SIZE
constexpr auto GZIP_DEFAULT_COMPRESSION_LEVEL
constexpr auto SRS_TIMESTAMP_LOW_BIT_LENGTH
const auto FEC_DAQ_RECEIVE_PORT
constexpr auto DEFAULT_ROOT_HTTP_SERVER_PERIOD
constexpr auto DEFAULT_DISPLAY_PERIOD
uint32_t RawDelimSizeType
constexpr auto INIT_COUNT_VALUE
constexpr auto file_max_size
file size limited to 10 MB.
constexpr auto DEFAULT_TYPE_BITS
constexpr auto DEFAULT_STATUS_WAITING_TIME_SECONDS
constexpr auto ZERO_UINT16_PADDING
constexpr auto PROTOBUF_ENABLE_GZIP
constexpr auto BYTE_BIT_LENGTH
constexpr auto NULL_ADDRESS
DataPrintMode
Print mode of the status line.
@ print_header
Print the header of the data structure.
@ print_raw
Print the raw binary data.
@ print_speed
Print the data reading rate.
constexpr auto DEFAULT_SRS_IP
constexpr auto HIT_DATA_BIT_LENGTH
constexpr auto SRS_TIMESTAMP_HIGH_BIT_LENGTH
constexpr auto COMMAND_LENGTH_BITS
constexpr auto LARGE_READ_MSG_BUFFER_SIZE
size of the data array for reading a UDP package
constexpr auto DEFAULT_LOG_FILE
constexpr auto WRITE_CMD
constexpr auto exit_logger_begin
constexpr auto CMD_TYPE
constexpr auto DEFAULT_CMD_LENGTH
constexpr auto SMALL_READ_MSG_BUFFER_SIZE
constexpr auto DEFAULT_TIMEOUT_SECONDS
constexpr auto exit_logger_end
constexpr auto READ_CMD
constexpr auto DEFAULT_SRS_CONTROL_PORT
Struct to store minimum and maximum values.