Saturday, October 5, 2013

Debugging on Pebble

So I'm currently working on a fancy alarm clock app for Pebble for a friend of mine.  It allows up to 10 independent alarms, with different schedules (and different types of schedules, ie "every day at 9am" or "every 2 hours"), and the ability to sync (using HttPebble) with a web app so that the alarms can be managed from a web page, and to synchronize their status (since there's no persistence on the pebble itself).

Let me just say, this has been harder than I expected.

The first draft, to get the alarm functionality working, was actually pretty straightforward. I wrote the code, pushed it to the watch, and, with a couple obvious tweaks, it just worked. When does that ever happen?

The next step was to use the HttPebble protocol to sync stuff (yes,  my friend uses iOS) This has been the painful part.  Let me count the ways:

1. I have to do a fair bit of string manipulation in passing data back and forth. Anyone who's done much with C knows how primitive the string manipulation functions are. To top it all off, Pebble's limited environment doesn't even include all the standard C string functions, so I had to rewrite a simple implementation of a few of them.)

2. There's just no real testing/debugging tools for Pebble. During the kickstarter project they said there'd be an emulator, but it's pretty clear that they promised more than they could provide. When it doesn't work, it's really hard to tell why.

3. I've had some weird network issues at home that have made it even harder to test, because I'm never sure if it's my code or if my phone just can't talk to my test server.

Ugh.

I think I'm finally getting close. The watch properly (via the phone) sends the status of any repeating alarms to the server, which saves them and can echo them back to the pebble. The only thing I need to fix is the pebble parsing and understanding the alarm definitions that the server sends, which it's currently failing to do.

No comments:

NES Anguna

Well, I had a little bit of time still, while Frankengraphics is finishing up her game Project Blue, to have a little downtime on Halcyon, s...