SRS-control 0.1.4
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 <expected>
6#include <string_view>
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'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 constexpr auto FEC_DAQ_RECEIVE_PORT = 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 = 32;
48 constexpr auto SRS_TIMESTAMP_LOW_BIT_LENGTH = 10;
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
65
66 enum class ActionMode : uint8_t
67 {
73 };
74
75 using RawDelimSizeType = uint32_t;
76} // namespace srs::common
constexpr auto FLAG_BIT_POSITION
constexpr auto FEC_ID_BIT_LENGTH
constexpr auto WRITE_COMMAND_BITS
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_CHANNEL_ADDRE
constexpr auto DEFAULT_DATA_QUEUE_SIZE
constexpr auto GZIP_DEFAULT_COMPRESSION_LEVEL
constexpr auto SRS_TIMESTAMP_LOW_BIT_LENGTH
constexpr auto DEFAULT_ROOT_HTTP_SERVER_PERIOD
constexpr auto DEFAULT_DISPLAY_PERIOD
uint32_t RawDelimSizeType
constexpr auto INIT_COUNT_VALUE
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 WRITE_CMD
constexpr auto FEC_DAQ_RECEIVE_PORT
constexpr auto CMD_TYPE
constexpr auto DEFAULT_CMD_LENGTH
constexpr auto SMALL_READ_MSG_BUFFER_SIZE
constexpr auto DEFAULT_TIMEOUT_SECONDS
constexpr auto READ_CMD
constexpr auto DEFAULT_SRS_CONTROL_PORT