Hello, this LeapC sample causes the process to hang after a few events when no device is connected:
#include <LeapC.h>
#include <stdio.h>
LEAP_CONNECTION connection;
LEAP_CONNECTION_MESSAGE message;
int main(int argc, char** argv) {
if (LeapCreateConnection(NULL, &connection) != eLeapRS_Success)
return printf("Could not create connection\n"), 1;
if (LeapOpenConnection(connection) != eLeapRS_Success)
return printf("Could not open connection\n"), 1;
while (1) {
printf("Polling for events...\n");
LeapPollConnection(connection, 0, &message);
printf("Poll complete\n");
}
return 0;
}
This is problematic for me because I would like to create an application that works whether or not the user has Leap Motion hardware connected, but I can't find any way to determine whether Leap Motion hardware is available without polling for the LEAP_CONNECTION_EVENT
message, which causes the deadlock.
I'm using the 4.0.0+52173
version of the SDK. Any help would be appreciated!