# PC Driver SDK

# Preparation

# Connect to Device

Connect the Pimax headset to your PC and install the Pimax client software. When the connection is successful, you will be able to experience the content. The installation path here is C:\Program Files\Pimax\.

# Download the SDK

Download PC Windows SDK from Pimax Developer Center and install it. The installation path here is C:\Program Files\Pimax\Sdk\ (Please replace it with your actual path if you install the SDK at other directory).

Developers should have basic C, C++ programming skills.

# Set Up Compiler Options

A dynamic link library project is required for generate a PVR Driver (windows should be as .dll files). For Example, simple is used as the driver name, then make sure to generate a dynamic link library named driver_simple.dll. Add C:\Program Files\Pimax\Sdk\Include to the path that involves header file in developer's complied project. And related header file is involved in codes without linking extra Lib.

  1. VR:Virtual Reality
  2. PVR:Pimax VR
  3. HMD:Head Mounted Display
  4. PVR Runtime: The process that is used for managing Pimax devices and handling APP related requests.
  5. IPVRDriverContext:PVR Runtime provides a functional interface to each driver. The driver has functions to add/remove devices and get HMD internal posture, etc. For more details, you could see IPVRDriverContext declaration in pvr_driver.h.

# Main Function

# Use of Header files

Include PVR driver.h in the relevant code.

# Implement IPVRDriver

Each driver must have a instance that implement IPVRDriver interface, this instance will provide the init and cleanUp method to the PVR Runtime. The init method will be called when the PVR Runtime start, and the cleanUp method will be called when the PVR Runtime exit.

# Implement IPVRDevice

PVR Driver SDK currently supports deveice types such as HMD (for tracking only), Controller, Tracker, etc. (See more detials in PVRDeviceClass under pvr_driver.h ). The driver need to implement one or more device instance that implement IPVRDevice interface according to the requirements.

# Implement Component

The specific function of a device is not provided by itself directly, it is provided by different kinds of components which could be get by getComponent method of IPVRDevice interface. The components currently provided are IPVRTrackedComponent (for device posture), IPVRPropertyComponent (for device properties) and IPVRControllerComponent (for controller device only, it could provide buttons state, and vibrate function).

# Add Device

A device instance can be added to the PVR Runtime by call the addDevice method of IPVRDriverContext and the device class must be assigned at the same time.

*(Notes: Once an IPVRDvice instance has been added, the life cycle of it will be owned by the PVR runtime. And could only be removed by call removeDevice method of IPVRDriverContext, also the related resource including itself can only be cleanup in the implementation of destroy method of IPVRDevice).

# Remove Device

A device instance could be removed from the PVR Runtime by call the removeDevice method of IPVRDriverContext.

*(Notes: That do the device related cleanup including itself in the destroy implementation, and do not cleanup immediately after removeDevice call).

# Implement Drive Export

Add DECLAR_PVRDRIVER_INTERFACE_VERSIONS(), and implement function PVRDRIVER_CREATE_ENTRY(interface_name) which will return the IPVRDriver instance to the calling PVR Runtime.

# Multi Threads Notes

The implemented interface method could be called in any thread context, so the developer should make sure the thread safety of the shared resources accessed between all these implementations.

# Install

Use the driver named simple as an example.

(1) Create a directory named 'simple' in the location C:\Program Files\Pimax\Runtime\drivers

(2) Create a directory named 'bin' in the previous step folder 'simple'

(3) Create two directory named by 'win32' and 'win64' in the previous step folder 'bin', then you should get two directories

  • C:\Program Files\Pimax\Runtime\drivers\simple\bin\win32
  • C:\Program Files\Pimax\Runtime\drivers\simple\bin\win64

Then copy the generated 32bit driver_simple.dll file into the above A directory, and 64bit driver_simple.dll into the above B directory. Restart the PiServiceLauncher service in windows services program. The “simple” driver should be loaded and used by the PVR Runtime.

*(Notes: If there is an error, developer can check the runtime log for detail fail reason (the log file is located C:\Users\{current user name}\AppData\Local\Pimax\runtime\pvr_srv_log.txt).

# Samples

SimplePVRDriver: Run a simple PVR Driver for developer reference.