Skip to content

sendVIEW

Jason Watkins edited this page Jun 2, 2015 · 3 revisions

Sets the camera view in X-Plane.

Note: This command currently works on Windows only.

Syntax

Language Signature
C int sendVIEW(XPCSocket sock, VIEW_TYPE view)
MATLAB sendVIEW(view, socket )
Java void sendVIEW(ViewType view)
Python sendVIEW(view)
Parameters

sock (C): The socket used to send the command.

view: The view to set. In Python, the ViewType class provides named constants. The MATLAB client expects an instance from the Java gov.nasa.xpc.ViewType enum.

socket (MATLAB): An optional reference to a socket opened with openUDP that should be used to send the command.

Return value

C: A negative value if an error occurs, otherwise 0.

Remarks

The current view can be checked using the sim/graphics/view/view_type dataref, however the value returned does not correspond to the command values used for this command.

Exceptions

C Error Code Java Exception Python Error Description
-1 -------------- ValueError The specified view is not valid.
-3 IOException OSError The client is unable to send the command

Examples

C
#include "xplaneConnect.h"
XPCSocket sock = openUDP(IP);

// Set the view to the chase camera
sendVIEW(sock, XPC_VIEW_CHASE);

closeUDP(sock);
MATLAB
import XPlaneConnect.*;

% Set the view to the chase camera
sendVIEW(sock, gov.nasa.xpc.ViewType.Chase);
Java
import gov.nasa.xpc.XPlaneConnect;

try(XPlaneConnect xpc = new XPlaneConnect())
{
    // Set the view to the chase camera
    xpc.sendVIEW(ViewType.Chase);
}
Python
import xpc

with xpc.XPlaneConnect() as client:
    # Set the view to the chase camera
    client.sendVIEW(xpc.ViewType.Chase)