XREALCameraDevice Class¶
This type is an EasyAR Sense API in C#: XREALCameraDevice . Some descriptions may not apply to Unity environment on this page.
Some parts of the Sense API may have already been wrapped into Unity components, and directly usages may not be necessary.
Description¶
XREALCameraDevice implements a camera device based on XREAL Enterprise Native SDK Plugin, which outputs InputFrame (image, camera parameters, timestamp, 6DOF location, and tracking status cannot be accessed).
After creation, start/stop can be invoked to start or stop data collection. Start must not be called before isDeviceSupported returns true.
When the component is not needed anymore, call close function to close it. It shall not be used after calling close.
XREALCameraDevice outputs InputFrame from inputFrameSource. inputFrameSource shall be connected to InputFrameSink for use. Refer to Overview .
bufferCapacity is the capacity of InputFrame buffer. If the count of InputFrame which has been output from the device and have not been released is more than this number, the device will not output new InputFrame , until previous InputFrame have been released. This may cause screen stuck. Refer to Overview .
Methods¶
isAvailable¶
- C#
public static bool isAvailable()
Checks if the component is available. It returns true only when XREAL eyewear is connected on the device supported.
isDeviceSupported¶
- C#
public static Optional<bool> isDeviceSupported()
Checks if the eyewear is supported. Has value only after XREAL finishes initialization on devices where isAvailable is ture.
bufferCapacity¶
- C#
public virtual int bufferCapacity()
InputFrame buffer capacity. The default is 8.
setBufferCapacity¶
- C#
public virtual void setBufferCapacity(int capacity)
Sets InputFrame buffer capacity.
inputFrameSource¶
- C#
public virtual InputFrameSource inputFrameSource()
InputFrame output port.
getMotionInputData¶
- C#
public virtual Optional< MotionInputData > getMotionInputData()
Get synchoronous motion input data. Call after isDeviceSupported return true.
receivedFrameCount¶
- C#
public virtual int receivedFrameCount()
Received frame count from camera. It should continously increase after start, otherwise the device connection may not be stable or XREAL service/SDK not working correctly, and you need to get help from XREAL directly.
open¶
- C#
public virtual bool open()
Opens camera. Call after isDeviceSupported return true. XREAL license must be validated through XREAL official method on Air2 Ultra and some other devices before open.
getXREALError¶
- C#
public virtual Optional< XREALError > getXREALError()
Get XREAL error. It is normally used to acquire XREAL related error when open fail.
start¶
- C#
public virtual bool start()
Starts video stream capture.
stop¶
- C#
public virtual void stop()
Stops video stream capture.
close¶
- C#
public virtual void close()
Close. The component shall not be used after calling close.
type¶
- C#
public virtual CameraDeviceType type()
Camera type. Call after a successful open.
cameraOrientation¶
- C#
public virtual int cameraOrientation()
Angles rotation required to rotate clockwise and display camera image on device with natural orientation. Call after a successful open.
size¶
- C#
public virtual Vec2I size()
Gets the current preview size. Call after a successful open.
frameRate¶
- C#
public virtual double frameRate()
Gets the current frame rate. Call after a successful open.