Learn how to evaluate and integrate the VNC SDK

We're here if you need help.

Viewer

class vncsdk.Viewer

A VNC-compatible Viewer showing the screen of and controlling a remote computer.

Constructor Summary

Modifier and Type Method and Description

__init__()

Creates and returns a new viewer.

Method Summary

Modifier and Type Method and Description
bytes

get_viewer_fb_data(x, y, w, h)

Returns the viewer framebuffer data for the given rectangle.

set_viewer_fb(pixels, pf, width, height, stride)

Sets the viewer framebuffer.

destroy()

Destroys the viewer.

disconnect()

Disconnects this viewer from the server.

enable_audio(enable)

Enables receipt of audio from the Server by the Viewer.

vncsdk.AnnotationManager

get_annotation_manager()

Obtains the Viewer’s vncsdk.AnnotationManager for handling annotation operations.

vncsdk.ConnectionHandler

get_connection_handler()

Returns the viewer’s vncsdk.ConnectionHandler for accepting connections.

vncsdk.Viewer.ConnectionStatus

get_connection_status()

Returns the status of the viewer’s connection.

str or None

get_disconnect_message()

Returns a human-readable message sent by the server for the last disconnection, or None if the last disconnection was not initiated by the server.

str or None

get_disconnect_reason()

Returns a string ID representing the reason for the last viewer disconnection.

vncsdk.DisplayManager

get_display_manager()

Obtains the Viewer’s vncsdk.DisplayManager, for managing the list of displays made available by the Server to the Viewer.

vncsdk.Viewer.EncryptionLevel

get_encryption_level()

Returns the Viewer’s current encryption level.

vncsdk.MessagingManager

get_messaging_manager()

Obtains the Viewer’s Messaging Manager for handling messaging For more information, see vnc_Viewer_getMessagingManager().

str

get_peer_address()

Returns the address of the viewer’s server.

vncsdk.Viewer.PictureQuality

get_picture_quality()

Returns the viewer’s current picture quality.

vncsdk.DataBuffer

get_server_pointer_fb_data()

Gets the current mouse cursor image from the Server for rendering locally.

int

get_server_pointer_fb_height()

Gets the height of the pointer framebuffer.

vncsdk.PixelFormat

get_server_pointer_fb_pixel_format()

Gets the pixel format of the pointer framebuffer.

int

get_server_pointer_fb_width()

Gets the width of the pointer framebuffer.

int

get_server_pointer_x_offset()

Gets the X offset of the “hotspot” of the pointer.

int

get_server_pointer_y_offset()

Gets the Y offset of the “hotspot” of the pointer.

int

get_viewer_fb_height()

Gets the height of the viewer framebuffer.

vncsdk.PixelFormat

get_viewer_fb_pixel_format()

Gets the pixel format of the viewer framebuffer.

int

get_viewer_fb_stride()

Returns the stride of the viewer framebuffer data in pixels, that is, the number of pixels from the start of each row until the start of the next.

int

get_viewer_fb_width()

Gets the width of the viewer framebuffer.

release_all_keys()

Send key up events for all currently pressed keys.

send_authentication_response(ok, user, passwd)

Provides the SDK with the result of a username/password request.

send_clipboard_text(text)

Copies the given text to the server’s clipboard.

send_key_down(keysym, key_code)

Sends a key down (press) event to the server.

send_key_up(key_code)

Sends a key up (release) event to the server.

send_peer_verification_response(ok)

Provides the SDK with the response to the Viewer.PeerVerificationCallbackverifyPeer() request.

send_pointer_event(x, y, button_state, rel)

Sends a pointer event to the server.

send_scroll_event(delta, axis)

Sends a scroll wheel event to the server.

set_authentication_callback(callback)

Sets the callback to be called when a username and/or password is required.

set_connection_callback(callback)

Sets the callbacks for the Viewer to call when various events occur during its lifetime.

set_encryption_level(level)

Sets the desired encryption level of the session from the range of options enumerated by ENCRYPTION_LEVEL.

set_framebuffer_callback(callback)

Sets the framebuffer callback for this viewer.

set_peer_verification_callback(callback)

Sets the callbacks to be called to verify the identity of the peer (server).

set_picture_quality(quality)

Sets the desired picture quality of the session from the range of options enumerated by PICTURE_QUALITY.

set_server_event_callback(callback)

Sets the server event callback for this viewer.

set_server_pointer_callback(callback)

Sets the server pointer callback for this viewer.

set_server_pointer_fb_pixel_format(pf)

Sets the pixel format of the pointer framebuffer.

set_server_pointer_pos_period(period_ms)

Sets the rate with which serverPointerPos callback will be called.

Constructor

vncsdk.Viewer.__init__()

Creates and returns a new viewer.

For more information, see vnc_Viewer_create().

Methods

Viewer.get_viewer_fb_data(x, y, w, h)

Returns the viewer framebuffer data for the given rectangle.

Parameters:
  • x (int) –
  • y (int) –
  • w (int) –
  • h (int) –
Return type:

bytes

Viewer.set_viewer_fb(pixels, pf, width, height, stride)

Sets the viewer framebuffer. Note: The viewer does not keep a strong reference to any user-allocated framebuffer passed in via the pixels parameter, therefore users must keep their own reference to the framebuffer to prevent it from being garbage collected while it is being used by the viewer.

Parameters:
Viewer.destroy()

Destroys the viewer.

For more information, see vnc_Viewer_destroy().

Viewer.disconnect()

Disconnects this viewer from the server.

For more information, see vnc_Viewer_disconnect().

Viewer.enable_audio(enable)

Enables receipt of audio from the Server by the Viewer.

For more information, see vnc_Viewer_enableAudio().

Parameters:enable (bool) –
Viewer.get_annotation_manager()

Obtains the Viewer’s vncsdk.AnnotationManager for handling annotation operations.

For more information, see vnc_Viewer_getAnnotationManager().

Return type:vncsdk.AnnotationManager
Viewer.get_connection_handler()

Returns the viewer’s vncsdk.ConnectionHandler for accepting connections.

For more information, see vnc_Viewer_getConnectionHandler().

Return type:vncsdk.ConnectionHandler
Viewer.get_connection_status()

Returns the status of the viewer’s connection.

For more information, see vnc_Viewer_getConnectionStatus().

Return type:vncsdk.Viewer.ConnectionStatus
Viewer.get_disconnect_message()

Returns a human-readable message sent by the server for the last disconnection, or None if the last disconnection was not initiated by the server.

For more information, see vnc_Viewer_getDisconnectMessage().

Return type:str or None
Viewer.get_disconnect_reason()

Returns a string ID representing the reason for the last viewer disconnection.

For more information, see vnc_Viewer_getDisconnectReason().

Return type:str or None
Viewer.get_display_manager()

Obtains the Viewer’s vncsdk.DisplayManager, for managing the list of displays made available by the Server to the Viewer.

For more information, see vnc_Viewer_getDisplayManager().

Return type:vncsdk.DisplayManager
Viewer.get_encryption_level()

Returns the Viewer’s current encryption level.

For more information, see vnc_Viewer_getEncryptionLevel().

Return type:vncsdk.Viewer.EncryptionLevel
Viewer.get_messaging_manager()

Obtains the Viewer’s Messaging Manager for handling messaging

For more information, see vnc_Viewer_getMessagingManager().

Return type:vncsdk.MessagingManager
Viewer.get_peer_address()

Returns the address of the viewer’s server.

For more information, see vnc_Viewer_getPeerAddress().

Return type:str
Viewer.get_picture_quality()

Returns the viewer’s current picture quality.

For more information, see vnc_Viewer_getPictureQuality().

Return type:vncsdk.Viewer.PictureQuality
Viewer.get_server_pointer_fb_data()

Gets the current mouse cursor image from the Server for rendering locally.

For more information, see vnc_Viewer_getServerPointerFbData().

Return type:vncsdk.DataBuffer
Viewer.get_server_pointer_fb_height()

Gets the height of the pointer framebuffer.

For more information, see vnc_Viewer_getServerPointerFbHeight().

Return type:int
Viewer.get_server_pointer_fb_pixel_format()

Gets the pixel format of the pointer framebuffer.

For more information, see vnc_Viewer_getServerPointerFbPixelFormat().

Return type:vncsdk.PixelFormat
Viewer.get_server_pointer_fb_width()

Gets the width of the pointer framebuffer.

For more information, see vnc_Viewer_getServerPointerFbWidth().

Return type:int
Viewer.get_server_pointer_x_offset()

Gets the X offset of the “hotspot” of the pointer.

For more information, see vnc_Viewer_getServerPointerXOffset().

Return type:int
Viewer.get_server_pointer_y_offset()

Gets the Y offset of the “hotspot” of the pointer.

For more information, see vnc_Viewer_getServerPointerYOffset().

Return type:int
Viewer.get_viewer_fb_height()

Gets the height of the viewer framebuffer.

For more information, see vnc_Viewer_getViewerFbHeight().

Return type:int
Viewer.get_viewer_fb_pixel_format()

Gets the pixel format of the viewer framebuffer.

For more information, see vnc_Viewer_getViewerFbPixelFormat().

Return type:vncsdk.PixelFormat
Viewer.get_viewer_fb_stride()

Returns the stride of the viewer framebuffer data in pixels, that is, the number of pixels from the start of each row until the start of the next.

For more information, see vnc_Viewer_getViewerFbStride().

Return type:int
Viewer.get_viewer_fb_width()

Gets the width of the viewer framebuffer.

For more information, see vnc_Viewer_getViewerFbWidth().

Return type:int
Viewer.release_all_keys()

Send key up events for all currently pressed keys.

For more information, see vnc_Viewer_releaseAllKeys().

Viewer.send_authentication_response(ok, user, passwd)

Provides the SDK with the result of a username/password request.

For more information, see vnc_Viewer_sendAuthenticationResponse().

Parameters:
  • ok (bool) –
  • user (str or None) –
  • passwd (str or None) –
Viewer.send_clipboard_text(text)

Copies the given text to the server’s clipboard.

For more information, see vnc_Viewer_sendClipboardText().

Parameters:text (str) –
Viewer.send_key_down(keysym, key_code)

Sends a key down (press) event to the server.

For more information, see vnc_Viewer_sendKeyDown().

Parameters:
  • keysym (int) –
  • key_code (int) –
Viewer.send_key_up(key_code)

Sends a key up (release) event to the server.

For more information, see vnc_Viewer_sendKeyUp().

Parameters:key_code (int) –
Viewer.send_peer_verification_response(ok)

Provides the SDK with the response to the Viewer.PeerVerificationCallbackverifyPeer() request.

For more information, see vnc_Viewer_sendPeerVerificationResponse().

Parameters:ok (bool) –
Viewer.send_pointer_event(x, y, button_state, rel)

Sends a pointer event to the server.

For more information, see vnc_Viewer_sendPointerEvent().

Parameters:
Viewer.send_scroll_event(delta, axis)

Sends a scroll wheel event to the server.

For more information, see vnc_Viewer_sendScrollEvent().

Parameters:
Viewer.set_authentication_callback(callback)

Sets the callback to be called when a username and/or password is required.

For more information, see vnc_Viewer_setAuthenticationCallback().

Parameters:callback (vncsdk.Viewer.AuthenticationCallback or None) –
Viewer.set_connection_callback(callback)

Sets the callbacks for the Viewer to call when various events occur during its lifetime.

For more information, see vnc_Viewer_setConnectionCallback().

Parameters:callback (vncsdk.Viewer.ConnectionCallback or None) –
Viewer.set_encryption_level(level)

Sets the desired encryption level of the session from the range of options enumerated by ENCRYPTION_LEVEL.

For more information, see vnc_Viewer_setEncryptionLevel().

Parameters:level (vncsdk.Viewer.EncryptionLevel) –
Viewer.set_framebuffer_callback(callback)

Sets the framebuffer callback for this viewer.

For more information, see vnc_Viewer_setFramebufferCallback().

Parameters:callback (vncsdk.Viewer.FramebufferCallback or None) –
Viewer.set_peer_verification_callback(callback)

Sets the callbacks to be called to verify the identity of the peer (server).

For more information, see vnc_Viewer_setPeerVerificationCallback().

Parameters:callback (vncsdk.Viewer.PeerVerificationCallback or None) –
Viewer.set_picture_quality(quality)

Sets the desired picture quality of the session from the range of options enumerated by PICTURE_QUALITY.

For more information, see vnc_Viewer_setPictureQuality().

Parameters:quality (vncsdk.Viewer.PictureQuality) –
Viewer.set_server_event_callback(callback)

Sets the server event callback for this viewer.

For more information, see vnc_Viewer_setServerEventCallback().

Parameters:callback (vncsdk.Viewer.ServerEventCallback or None) –
Viewer.set_server_pointer_callback(callback)

Sets the server pointer callback for this viewer.

For more information, see vnc_Viewer_setServerPointerCallback().

Parameters:callback (vncsdk.Viewer.ServerPointerCallback or None) –
Viewer.set_server_pointer_fb_pixel_format(pf)

Sets the pixel format of the pointer framebuffer.

For more information, see vnc_Viewer_setServerPointerFbPixelFormat().

Parameters:pf (vncsdk.PixelFormat) –
Viewer.set_server_pointer_pos_period(period_ms)

Sets the rate with which serverPointerPos callback will be called.

For more information, see vnc_Viewer_setServerPointerPosPeriod().

Parameters:period_ms (int) –
×