I'm creating a Leap motion mac app in objective-c and I need to be able to detect whether the leap motion device is connected on start up and freeze the app and notify the user if it is not connected. How do I do this? All the apps in the airspace store are able to do this but I can't figure out how.

有帮助吗?

解决方案

Larme was right. Call this in the onInit method.

-(void)checkIfDeviceConnected {

    if ([controller devices].count>0) {
         NSLog(@"Device Connected");

    }
    else {
         NSLog(@"Device Not Connected");
    }
}

其他提示

The Controller is the interface from your Leap Motion Controller and your Program.

if( controller.isConnected) { //do some stuff }

If you are using an listener to interact with the frames from the leap motion controller, the method onConnect() will be fired if you are going to connect your Leap Motion Devise to your running program. You can write your own listener by extending the leap.listener and do you action on this

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top