...
This commit is contained in:
55
net/adc_device_netmsg.h
Normal file
55
net/adc_device_netmsg.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common/adc_utils.h"
|
||||
#include "adc_netmsg.h"
|
||||
|
||||
namespace adc
|
||||
{
|
||||
|
||||
/* ABSTRACT DEVICE DEFAULT APPLICATION-LEVEL NETWORK PROTOCOL DEFINITIONS */
|
||||
|
||||
namespace constants
|
||||
{
|
||||
|
||||
static constexpr char ADC_DEFAULT_KEY_PARAM_DELIMITER[] = " ";
|
||||
static constexpr char ADC_DEFAULT_PARAM_PARAM_DELIMITER[] = " ";
|
||||
|
||||
} // namespace constants
|
||||
|
||||
|
||||
template <traits::adc_output_char_range ByteSeqT>
|
||||
class AdcDeviceNetMessage : protected AdcKeyValueMessage<ByteSeqT, constants::ADC_DEFAULT_KEY_PARAM_DELIMITER>
|
||||
{
|
||||
using base_t = AdcKeyValueMessage<ByteSeqT, constants::ADC_DEFAULT_KEY_PARAM_DELIMITER>;
|
||||
|
||||
public:
|
||||
static constexpr std::span keyParamDelimiter{constants::ADC_DEFAULT_KEY_PARAM_DELIMITER,
|
||||
sizeof(constants::ADC_DEFAULT_KEY_PARAM_DELIMITER)};
|
||||
|
||||
static constexpr std::span paramParamDelimiter{constants::ADC_DEFAULT_PARAM_PARAM_DELIMITER,
|
||||
sizeof(constants::ADC_DEFAULT_PARAM_PARAM_DELIMITER)};
|
||||
|
||||
|
||||
AdcDeviceNetMessage(ByteSeqT& byte_seq) : base_t(byte_seq) {}
|
||||
|
||||
template <traits::adc_char_view VT>
|
||||
VT keyword() const
|
||||
{
|
||||
auto v = utils::AdcTrimSpaces(base_t::template key<VT>());
|
||||
return VT(v.begin(), v.end());
|
||||
}
|
||||
|
||||
auto keyword() const
|
||||
{
|
||||
return keyword<std::string_view>();
|
||||
}
|
||||
|
||||
|
||||
template <traits::adc_range_of_view_char_range R>
|
||||
auto params(size_t start = 0, size_t N = std::numeric_limits<size_t>::max())
|
||||
{
|
||||
auto val = base_t::template value<std::ranges::range_value_t<R>>();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace adc
|
||||
Reference in New Issue
Block a user