plptools
Loading...
Searching...
No Matches
deviceendpoint.h
Go to the documentation of this file.
1/*
2 * This file is part of plptools.
3 *
4 * Copyright (c) 2026 Jason Morley <hello@jbmorley.co.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * along with this program; if not, see <https://www.gnu.org/licenses/>.
18 *
19 */
20#pragma once
21
22#include "config.h"
23
24#include <memory>
25#include <optional>
26#include <string>
27
28#include "connectionerror.h"
29#include "Enum.h"
30#include "device.h"
31
32class rclip;
33class RFSV;
34class RPCS;
35
37public:
38
39 static std::unique_ptr<DeviceEndpoint> connect(const std::string host, int port, Enum<ConnectionError> *error);
40
50 std::string id() const;
51
52 bool hasPersistentId() const;
53
62 std::optional<std::string> name() const;
63
71 Enum<RFSV::errs> setName(const std::string &name);
72
73 const std::unique_ptr<RFSV> rfsv_;
74 const std::unique_ptr<RPCS> rpcs_;
75 const std::unique_ptr<rclip> clip_;
76
77private:
78
79 DeviceEndpoint(const std::string &id,
80 const std::optional<std::string> &name,
81 bool hasPersistentConfiguration,
82 std::unique_ptr<RFSV> rfsv,
83 std::unique_ptr<RPCS> rpcs,
84 std::unique_ptr<rclip> clip);
85
86 const std::string id_;
87 std::optional<std::string> name_;
89};
const std::unique_ptr< RFSV > rfsv_
const std::unique_ptr< RPCS > rpcs_
bool hasPersistentConfiguration_
std::string id() const
Device identifier.
std::optional< std::string > name_
const std::string id_
bool hasPersistentId() const
Enum< RFSV::errs > setName(const std::string &name)
Set the device name.
DeviceEndpoint(const std::string &id, const std::optional< std::string > &name, bool hasPersistentConfiguration, std::unique_ptr< RFSV > rfsv, std::unique_ptr< RPCS > rpcs, std::unique_ptr< rclip > clip)
static std::unique_ptr< DeviceEndpoint > connect(const std::string host, int port, Enum< ConnectionError > *error)
const std::unique_ptr< rclip > clip_
std::optional< std::string > name() const
Device name.
Wrapper class featuring range-checking and string representation of enumerated values.
Definition Enum.h:135
Access remote file services of a Psion.
Definition rfsv.h:79
Remote procedure call services via PLP.
Definition rpcs.h:52
Remote ClipBoard services via PLP.
Definition rclip.h:44
static void error(int line)
Definition sismain.cpp:44