38 auto rfsv = std::unique_ptr<RFSV>(
RFSV::connect(host, port, &internalError));
41 *
error = internalError;
48 auto deviceConfiguration = device::read_configuration(*rfsv, result);
49 std::string
id = deviceConfiguration ? deviceConfiguration->id() :
uuid::uuid4();
50 bool hasPersistentConfiguration =
static_cast<bool>(deviceConfiguration);
52 auto rpcs = std::unique_ptr<RPCS>(
RPCS::connect(host, port, &internalError));
55 *
error = internalError;
60 auto clip = std::unique_ptr<rclip>(
rclip::connect(host, port, &internalError));
63 *
error = internalError;
68 return std::unique_ptr<DeviceEndpoint>(
69 new DeviceEndpoint(
id, hasPersistentConfiguration, std::move(rfsv), std::move(rpcs), std::move(clip)));
73 bool hasPersistentConfiguration,
74 std::unique_ptr<RFSV> rfsv,
75 std::unique_ptr<RPCS> rpcs,
76 std::unique_ptr<rclip> clip)
77: rfsv_(
std::move(rfsv))
78, rpcs_(
std::move(rpcs))
79, clip_(
std::move(clip))
81, hasPersistentConfiguration_(hasPersistentConfiguration) {}
100 auto deviceConfiguration = device::read_configuration(*
rfsv_,
error);
113 name = deviceConfiguration->name();
118 auto deviceConfiguration = std::make_unique<DeviceConfiguration>(
id_, name);
119 auto result = device::write_configuration(*
rfsv_, *deviceConfiguration);
const std::unique_ptr< RFSV > rfsv_
DeviceEndpoint(const std::string &id, bool hasPersistentConfiguration, std::unique_ptr< RFSV > rfsv, std::unique_ptr< RPCS > rpcs, std::unique_ptr< rclip > clip)
bool hasPersistentConfiguration_
std::string id() const
Device identifier.
bool hasPersistentId() const
Enum< RFSV::errs > setName(const std::string &name)
Set the device name.
static std::unique_ptr< DeviceEndpoint > connect(const std::string host, int port, Enum< ConnectionError > *error)
Enum< RFSV::errs > getName(std::string &name) const
Get the device name.
Wrapper class featuring range-checking and string representation of enumerated values.
static RFSV * connect(const std::string &host, int port, Enum< ConnectionError > *error)
static RPCS * connect(const std::string &host, int port, Enum< ConnectionError > *error)
static rclip * connect(const std::string &host, int port, Enum< ConnectionError > *error=nullptr)
static void error(int line)