Archive for the ‘ iPhone ’ Category

Hello world… from iPhone using an external keyboard

This is my first post using an external Bluetooth keyboard with the iPhone. 🙂
It all started as an itch I had for having an external keyboard to use with the iPhone. While iPhone is definately a great device, having an external keyboard has it’s advantages. Being a software engineer, I am much faster with a full sized keyboard than a small touch screen one. And having your fingers feel the contours of a physical keyboard has a joy of it’s own. Another reason for trying to pair an external keyboard was that I will be going on a week long bike trip of southern India during the first week fo August. Hence I wanted a blogging device that is really light to carry.

Apple wireless keyboard with iPhone

Apple wireless keyboard with iPhone

Now that I had the reasons, I wanted a Bluetooth library that will allow me to pair HID devices. I did find a few of them but faced lot of problems in getting them to compile on iPhone. I almost spent 3 – 4 weeks trying to get atleast one of them to compile. When I was almost giving up hope, I stumbled upon this project called ‘ibluetoothproject’ on Google code. It compiled beautifully without any errors. Given a ray of hope, I started looking into the code and started tinkering around with it. Within 2 weeks or so, I was successfully getting keypress messages from the keyboard. Now The challenge was to get these messages posted as keypress events on the phone. I was reminded of the approach used by Ralf Ackermann. In his version of the library, after receiving the keyboard messages, he posted them as ‘KeyEvent’ to a on board VNC server which would then interpret them as keypress events and do the needful. After a bit of googling I found that the protocol used was pretty simple. Within a few hours, the RFB protocol was implemented and the whole thing started working perfectly. This got me really excited. I wanted more. I wanted to install the wordpress app. Unfortunately the one available on the App Store worked only with firmware 3.0. I started medling with the idea of upgrading to 3.0 firmware (currently that is what I am running). While the code works on 3.0 I found a rather funny bug. The key presses are registered only in landscape mode! I am not sure whether this is a hint by Apple that they will soon be introducing a device with an attached keyboard (which may be unlikely) or whether the problem is with the VNC server. Another problem is that Cydia doesn’t have a GCC compiler for 3.0. So I am not sure how long I may be sticking with 3.0. I may downgrade back to 2.2.1 to continue development of this library.
All said and done, I am seeing that using a external keyboard is still not the best way to use a touch screen device. Once in a while I have to switch from keyboard to touch screen and back. The problem is partially due to the fact that arrow keys are not recognized by the iPhone. Thus whenever I want to go back to a line to correct something, I have to use the touch screen. I am hoping that I’ll be able to fix this problem.

Till then… Happy typing 🙂