Skip to content

readDATA

Jason Watkins edited this page May 8, 2015 · 3 revisions

Reads X-Plane data.

Syntax

Language Signature
C int readDATA(XPCSocket sock, float data[][9], int rows)
MATLAB result = readDATA( socket )
Java float[][] readData()
Python readDATA()
Parameters

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

data (C): An array in which the resulting data will be stored

rows (C): The number of rows in readDATA.

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.

All others: A 2 dimensional array containing 0 or more rows of data. Each array in the result will have 9 elements, the first of which is the row number which that array represents data for, and the rest of which are the data elements in that row.

Remarks

This command is compatible with the built in X-Plane data format.

Exceptions

C Error Code Java Exception Python Error Description
-1 IOException OSError The client is unable to read data.

Examples

C
#include "xplaneConnect.h"

XPCSocket sock = aopenUDP("127.0.0.1", 49007);

// Read 2 rows of data
const int rows = 2;
float data[rows][9];
readDATA(sock, data, rows);

closeUDP(sock);

MATLAB

import XPlaneConnect.*

result = readDATA();
Java
import gov.nasa.xpc.XPlaneConnect;

try(XPlaneConnect xpc = new XPlaneConnect())
{
    float[][] result = xpc.readDATA();
}

Python

import xpc

with xpc.XPlaneConnect() as client:
    result = client.readDATA();