开发者

Bluetooth HID Device & iOS textFields

We are using a BT device, which acts as a keyboard, to talk to the iPad. We w开发者_C百科ant this bluetooth device to talk to 1 field in our app. (Which is on it's own view) All other textFields/areaFields we want to display the virtual keyboard.

Is this possible? Whenever the BT device is paired it disabled the on screen keyboard.

We thought of turning bluetooth off before the view with the 1 field that needs its input from the device is displayed and then turning it back on when the view is removed, but this has 2 problems. The iPad will not automatically connect to the device and there is no way to turn bluetooth off without using private API's.

This is a related question: Force on screen keyboard to show when bluetooth keyboard connected that has not yet got a satisfactory answer.

Any help will be greatly appreciated

Cheers Phil


Erica Sadun found a way of bringing back the keyboard by sending a GraphicsServices event. Post: http://www.tuaw.com/2010/06/02/hacksugar-bringing-back-the-on-screen-keyboard/ see link to source code. Sending GSEvents might not be AppStore ready, but maybe worth a try.


Phil,

I'm not sure if you've discovered the External Accessory Framework but that is probably your best bet to get what you're after and have an app that will be accepted in the store. I'm currently working through some similar issues and I think this is how I'll be able to detect which of our supported devices the user is using.

https://developer.apple.com/library/ios/#documentation/ExternalAccessory/Reference/ExternalAccessoryFrameworkReference/_index.html

EAAccessoryManager looks like it may give you back a list of attached devices. That's exactly what I'm looking for. It should allow me to then take the correct path to connect to the devices.

This may give you back what you're interested in...

#import <ExternalAccessory/ExternalAccessory.h>

- (void)_getAttachedDevices;
{
    EAAccessoryManager* accessoryManager = [EAAccessoryManager sharedAccessoryManager];
    if (accessoryManager)
    {
        NSArray* connectedAccessories = [accessoryManager connectedAccessories];
        NSLog(@"ConnectedAccessories = %@", connectedAccessories);
    }
}

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜