2#include "../Headers/VncDefines.h"
3#include <NDEVR/NDEVRMouseManager.h>
4#include <NDEVR/Device.h>
5#include <NDEVR/BaseValues.h>
6#include <NDEVR/String.h>
68 bool sendCommand(
const char*
const command,
uint04 min_response_size,
uint04 retry_count);
71 void sendContinuousUpdateRequest(
bool enable);
72 void sendUpdateFrameBufferRequest(
bool force_refresh_all);
73 void sendRequestDesktopSize(QSize
size,
fltp08 scale_factor = 1.0);
75 void sendKeyEvent(
bool is_pressed, QKeyEvent* event);
76 void sendKeyEvent(
bool is_pressed,
const KeyEvent& event);
77 bool setupVncConnection(
const String& password);
80 QByteArray desHash(QByteArray challenge, QString passStr);
81 uint02 makeU16(quint8 l, quint8 h);
82 uint04 makeU32(quint16 l, quint16 h);
83 uint04 makeU32(quint8 lowest, quint8 low, quint8 high, quint8 highest);
84 static quint32 TranslateRfbKey(
int key,
bool modifier);
85 void readFrameBufferMessage();
86 void setFrameBufferSize(
const QSize&
size);
88 void onServerMessage();
124 static constexpr uint01 s_screen_count = 2;
131 void mousePressEvent(QMouseEvent* event)
override;
163 bool event(QEvent* event)
override;
164 void paintEvent(QPaintEvent*)
override;
165 void keyPressEvent(QKeyEvent* event)
override;
166 void keyReleaseEvent(QKeyEvent* event)
override;
167 void resizeEvent(QResizeEvent* event)
override;
172 QImage m_screen_buffer[s_screen_count];
173 uint01 m_screen_index = 0;
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
The equivelent of std::vector but with a bit more control.
Device(const Model &model, LogPtr log, QObject *parent=nullptr)
Constructs a Device from a Model with the given log and optional Qt parent.
Describes a user key press event used to trigger behavior in the NDEVR API.
Vector< 3, fltp08 > size() const
Returns the size (extents) of the model's bounding box.
Describes a mouse or touch input event with position, button, and modifier information.
Handles converting QEvents into NDEVR MouseEvents and queuing them up appropriately.
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
A TcpServer allows the software to receive socket connections from external sources.
Stores a time span, or difference between two times, with an optional start time.
Represents a timestamp with utilities for manipulation and conversion.
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
A Device subclass that manages the VNC RFB protocol, handling connection setup, framebuffer updates,...
QImage m_copy_image
Intermediate image for framebuffer compositing.
bool m_supports_continuous_updates
Whether the server supports continuous updates.
NDEVRMouseManager m_mouse_manager
Manages mouse event translation for the VNC protocol.
void postKeyEvent(QKeyEvent *event, bool is_down)
Forwards a key event to the VNC server.
bool connectToVncServer()
Reconnects to the previously configured VNC server.
bool m_is_ready
Whether the connection is fully established and ready.
bool m_is_continuous_mode
Whether continuous update mode is active.
int m_port
VNC server port number.
bool connectToVncServer(const StringView &ip, const StringView &password, int port=5900)
Connects to a VNC server at the given address.
bool m_setup_connection
Whether the connection setup handshake is pending.
Time m_last_refresh_time
Timestamp of the last incremental refresh.
PixelFormat m_pixel_format
Pixel format negotiated with the server.
bool isConnectedToServer()
Checks whether the device is currently connected to a VNC server.
bool m_supports_extended_size
Whether the server supports extended desktop size.
void disconnectFromVncServer()
Disconnects from the VNC server and releases resources.
void update(Time time) override
Called to update the device with only the current time.
bool m_has_sent_frame_request
Whether a framebuffer update request is pending.
String m_password
VNC authentication password.
virtual TimeSpan updateInterval() const override
Returns the time interval between automatic updates.
fltp04 m_jpg_quality
JPEG quality level for Tight encoding.
Time m_last_full_refresh_time
Timestamp of the last full refresh request.
QTcpSocket * m_socket
TCP socket for the VNC connection.
QSize m_frame_size
Current remote framebuffer size.
Buffer< KeyEvent > m_key_events
Buffered key events awaiting dispatch.
void requestFullRefresh()
Requests a full framebuffer refresh from the server.
bool m_request_full_refresh
Whether a full refresh has been requested.
VncDevice(VncClientWidget *parent)
Constructs the VNC device for the given client widget.
Buffer< VncScreen > m_screens
Screens reported by the VNC server.
bool m_request_client_resize
Whether a client-side resize request is pending.
bool m_request_disconnect
Whether a disconnect has been requested.
String m_connection
Connection string (IP address or hostname).
BitFlag m_mouse_button_flag
Current mouse button state mask.
bool postEvent(QEvent *event)
Forwards a generic event to the VNC server as input.
VncClientWidget * m_widget
The owning client widget.
Buffer< bool > m_key_down_events
Key press/release state for buffered events.
The primary namespace for the NDEVR SDK.
@ BitFlag
Per-vertex bit flags (selected, hidden, etc.).
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Describes a single screen reported by a VNC server, including its ID, bounds, and flags.
uint04 id
Server-assigned screen identifier.
uint04 flags
Server-defined screen flags.
QRect rect
Screen bounding rectangle in pixels.