For London Green Hackathon I hacked together a proof-of-concept Kindlet (Kindle Applet) for monitoring environmental data in real-time that runs on a Kindle 3. Its actually a generic MQTT client that runs on a Kindle, but MQTT is a very popular protocol for transmitting environmental data so I think I can argue the ‘green’ values of this project. After all, Nanode is just an Arduino with an Ethernet port, that gets green badges.
All the code was written after 1AM, thought the night and into the next day. Its somewhat rough around the edges. But given we were not sure if it would work at all, I am very happy with the result.
The Kindle is NOT intended as a general use computing device. There is a SDK, but its closed and so far as I know very little has been done with it. Its basically for creating interactive books, not applications. Seems current bets are that is will remain this way. Hardware limitations aside, the software is really quite fragile. I am guessing there is a single JVM process for everything, and there is no sand-boxing. Any unhandled exceptions trigger a JVM restart.
Installing apps on a Kindle requires several hacks to be applied to the device first. In order: jail-brake, usb-network, developer certificate and changes to the JVM security manager configuration. The last one is not required for all apps, but it was needed for this hack.
All Kindlets must be signed. Most people share the same certificate (keeps things simple) and this needs to be copied into `/var/local/java/keystore/developer.keystore’ on Kindle.
Java security manager: MQTT requires permission to open a socket. By default the Kindle only allows Kindlets to do HTTP and HTTPS. By editing `/opt/amazon/ebook/security/external.policy’ and adding `permission java.net.SocketPermission “*:80-“, “accept, connect, listen, resolve”;’ we can get around this blocker.
AWT / Kindle GUI: JavaDoc for the Kindle GUI tools. Its basically AWT with a custom set of widgets specially for the Kindle. Not the most clear guide but a good start. Generally I was able to deduce the remaining 10% of data by trial-and-try-angai-until-it-works-dam-it.
But the final result? A funky Kindlet that can connect to any MQTT broker and tail the content of a topic space. Oh, and a greatly increased knowledge of how a Kindle hangs together. It really is an awesome device.