plptools
Loading...
Searching...
No Matches
rclip.h
Go to the documentation of this file.
1/*
2 * This file is part of plptools.
3 *
4 * Copyright (C) 1999-2001 Fritz Elfert <felfert@to.com>
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 "connectionerror.h"
23#include "rfsv.h"
24#include "Enum.h"
25#include <memory>
26
27class TCPSocket;
28class BufferStore;
29class BufferArray;
30
44class rclip {
45public:
46
47 static rclip *connect(const std::string &host, int port, Enum<ConnectionError> *error = nullptr);
48
54 rclip(std::unique_ptr<TCPSocket> socket);
55
59 ~rclip();
60
65 void reset();
66
73 void reconnect();
74
82
93
105
117
129
139
140protected:
144 enum commands {
147 RCLIP_LISTEN = 0x04
148 };
149
154 std::unique_ptr<TCPSocket> socket_;
155
160
174 bool sendCommand(enum commands cc);
176 const char *getConnectName();
177
178};
An array of BufferStores.
Definition: bufferarray.h:30
A generic container for an array of bytes.
Definition: bufferstore.h:36
Wrapper class featuring range-checking and string representation of enumerated values.
Definition: Enum.h:135
A class for dealing with sockets.
Definition: tcpsocket.h:37
Remote ClipBoard services via PLP.
Definition: rclip.h:44
Enum< RFSV::errs > sendListen()
Send listen request.
Definition: rclip.cc:123
Enum< RFSV::errs > status
The current status of the connection.
Definition: rclip.h:159
Enum< RFSV::errs > checkNotify()
Check for clipboard notification.
Definition: rclip.cc:131
Enum< RFSV::errs > getStatus()
Retrieves the current status of the connection.
Definition: rclip.cc:83
Enum< RFSV::errs > waitNotify()
Send listen request and wait for notification.
Definition: rclip.cc:150
bool sendCommand(enum commands cc)
Sends a command to the remote side.
Definition: rclip.cc:94
const char * getConnectName()
Definition: rclip.cc:87
Enum< RFSV::errs > getResponse(BufferStore &data)
Definition: rclip.cc:193
void reconnect()
Attempts to re-establish a remote connection by first closing the socket, then connecting again to th...
Definition: rclip.cc:62
~rclip()
Destructor.
Definition: rclip.cc:55
Enum< RFSV::errs > initClipbd()
Send initialization frame.
Definition: rclip.cc:176
commands
The possible commands.
Definition: rclip.h:144
@ RCLIP_LISTEN
Definition: rclip.h:147
@ RCLIP_INIT
Definition: rclip.h:145
@ RCLIP_NOTIFY
Definition: rclip.h:146
static rclip * connect(const std::string &host, int port, Enum< ConnectionError > *error=nullptr)
Definition: rclip.cc:33
Enum< RFSV::errs > notify()
Send a notification to the Psion.
Definition: rclip.cc:163
void reset()
Initializes a connection to the remote machine.
Definition: rclip.cc:67
std::unique_ptr< TCPSocket > socket_
The socket, used for communication with ncpd.
Definition: rclip.h:154
static void error(int line)
Definition: sismain.cpp:44