質問

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