- runs on Windows, Linux and Android (with Python for Android)
- looks more or less the same on each platform
- supports Twisted integration
- supports many touchscreen features like swiping, scrolling etc.
Kivy is a very nice framework, but many parts of it are still quite immature. Kivy uses its own Kv language to describe the layout. It works fine with simple widgets like buttons and labels. But many complex widgets like treeviews, spinners etc. are in reality compounds of simpler widgets. It is sometimes hard to access the properties of these "inner" widgets using Kv language. Occasionally it's necessary to overload existing widgets to achieve desired effects. Many times I had to browse the source code of some widgets to get things done (luckily after two years of dealing with Contiki OS, reading Python source code is a piece of cake :) ). On the other hand, some complicated stuff was very easy to achieve using Kivy - like swipe-to-close browsing cards, and animated screen transitions.
After finishing the communications layer and the GUI I decided to implement also some simple parser for RFC 6690 CoRE Link Format. I used link_header library from Asplake. I also added simple bookmarks support. After that I added icon and splash screen, and started working on the visuals. I discovered that designing a decent GUI for a mobile app is not that easy :) - maybe using a combination of blue and orange wasn't the best choice ;).
Big problem in making the browser was IPv4/IPv6 double stack operation. CoAP is meant to be used mostly with IPv6, but it's adoption is still not very wide. IPv4 support is simply a must. Linux (and Android) IPv6 UDP sockets can send and receive IPv4 packets, provided that the address is passed as IPv4-mapped IPv6 address (::ffff:X.X.X.X). That doesn't work on Windows (bug in Windows Python 2.7 code). Another thing was the DNS support. I had no idea how to tackle that problem, but at the end of 2013, new version 13.2 of Twisted framework was released, that supported RFC 6555 "Happy Eyeballs" algorithm. This algorithm was designed for TCP-based, human-operated client apps, however I managed to adapt it to work with UDP-based application. I had to change some parts of txThings blockwise code to allow for callbacks after every block (this can be useful later to implement progress bars for blockwise transfers). Currently the "Happy Eyeballs" works fine with normal and blockwise requests. I'm not entirely sure about observe requests - the algorithm will accept the first response and send RST to all subsequent responses, but if the response is NON it might not always cancel the observation. Proactive observe cancellation is being discussed by IETF right now, so maybe it will solve the problem.
The resulting application is more proof of concept than a perfect solution. Unfortunately the application starts quite slow on Android (around 2 seconds on my SGS3), probably because of Python interpreter. The download is rather big, because it's bundled with Python and its extensions. However the app does its job, runs on Linux and Windows, and at the time of writing it's the only CoAP browser for Android so it might be useful for researchers and testers. I used it successfully with CoAP test servers:
- TZI Universitat Bremen: coap://coap.me
- ETH Zurich: coap://vs0.inf.ethz.ch
I am planning to setup my own test server based on txThings and twistd.
Link to the app below: