Skip to content
This repository was archived by the owner on Nov 20, 2022. It is now read-only.

K2API: (1) Initialization and exiting

公彦赤屋先 edited this page Aug 30, 2021 · 1 revision

Connecting to the server

The server driver is created with various pipe and semaphore names,
and when we're trying to connect to K2Server, we need to connect to the exact same ones.

To initialize semaphores client-side, we want to call the following function:
(Declaration: https://github.com/KinectToVR/k2vr-application/blob/master/KinectToVR_API/KinectToVR_API.h#L847)

ktvr::init_k2api()

This function should return 0 if the connection was successful or -1: global error code
when some unknown unexpected exception has occurred, or we couldn't connect to the server.
If you've had problems with the connection, please check the server's log, it should say:

Driver's networking server init code: 0
... (and then)
Server thread started

Disconnecting from the server

When you're finished with the excecution, you may additionally cloase all WinAPI handles.
If you don't do this, nothing should happen (unlike with ZMQ), but it is overly better to exit gracefully.
When you're not calling K2API anymore, just call this function, and you should be able to properly exit.
(Declaration: https://github.com/KinectToVR/k2vr-application/blob/master/KinectToVR_API/KinectToVR_API.h#L858)

ktvr::close_k2api()

This one should return 0 for success too, the same as the previous one.
Now you're ready to be closing your app successfully!

Clone this wiki locally