Wednesday, 5 October 2011

Metawatch phone based watch menus

So a common request is to add the ability to send a menu to the phone and have the phone draw it and send back the users selection. My first attempt at this is shown below.

To use it send a Message type "GeneralPurposeWatchMsg" with option set at 0x43. The length set to max and the first byte of the string is the Length of the original string in characters. The rest of the payload is a Huffman encoded space separated list of strings. These represents the menu items to display. The huffman encoding uses a fixed tree based on the frequency of characters in the English language. This allows us to send all the text in one message and hopefully keep latency to a minimum. I haven't got around to writing the java to encode the string but I have written a python script that generates the bye sequence needed for a given string which you can then place in a payload and send. For example to menu shown above (Ignore the bad layout that will be fixed!) the strings would be "toggle next back volup voldown". this string is 30 characters long so too long to fit in our payload but once encoded takes up just 20 characters.

On selection the watch sends back a GeneralPurposePhoneMsg with the type set to 0x43and the index of the menu item selected as the first byte of payload.

It's possible that menus with more items more like a list view would be required and up and down could be used to select items. This would be more useful for browsing music on the phone or other larger datasets.
I'll maybe have a go at this tomorrow.

No comments:

Post a Comment