To use the API, it is recommended to first call PenAttachNotificationListener(function) with whichever function you have defined to interpret the notifications. This will enable you to receive any error notifications that may occur during PenStart.
To start tracking you would need to call PenStart(integrationKey) with your assigned integration key, which would start the camera and tracking algorithms running, and create the data structures to hold all the settings. If you want the API to return the pose with length units other than the default mm, call the PenSetUnits(unitLength) function.
You need to get the tracker’s pose relative to the attached headset system’s tracker. This is found by calling PenGetTrackerPose( typeInt, &x, &y, &z, &qr, &qx, &qy, &qz) specifying the correct typeInt that corresponds to the type of headset system you are running, this provides you with the pose filled into the variables.
Then you would register the callback by calling PenAttachFullPoseListener(function) with whichever function you have defined to be your full pose callback. If you want information about the pen’s capacitive sensor and surface sensor, you would register the callback
PenAttachFullStateListener(function) with whichever function you have defined to be your full state callback. PenSimpleBuzz(duration) can be called at any time to vibrate the pen’s haptic feedback motor for the specified duration in ms.
When you have finished you would call PenStop() for the program to release its resources and close. The PenStop() also deregisters your notification callback in preparation for closing down the whole API. However, if you want to start it up again without unloading the DLL it is fine to just call PenAttachNotificationListener(function) again and then PenStart(integrationKey) to start the tracking up again.