One of the things I wanted from Paper Workbench was pretty simple: being able to read my handwritten notes on my phone.
I love having a dedicated device for writing, but I don't necessarily have it with me when I need to look something up. Sometimes I'll be in a conversation and want to check something from an earlier meeting. Pulling out my phone is a lot easier than finding the notebook, opening it and navigating back through my notes.
So I built Paper Companion, a separate Android app for browsing and reading the notes I'd written on my Lenovo Smart Paper.
Of course, the two devices needed some way of talking to each other.
First, the easy bit
The initial solution was fairly conventional.
Paper Workbench would prepare a copy of each note, including the handwriting, and send it to a small service I called Paper Gateway. Companion would then pick it up and keep a local copy on my phone.
I deliberately wanted Companion to be a reading experience rather than another place to edit notes. The Smart Paper would remain where I wrote everything, and Companion would give me access to it elsewhere.
Once I'd got the automatic synchronisation working, it was great. I could write on the notebook and have those same handwritten pages available on my phone, complete with their original layout.
There was just one fairly obvious problem.
My notebook wasn't always online
I spend quite a bit of my working day in an office where the Smart Paper doesn't have access to Wi-Fi. And then there are the times I'm on a train or a plane.
Which meant I'd built a lovely automatic synchronisation system that couldn't always synchronise.
I could have lived with that. The notebook still worked perfectly well offline, and everything would eventually catch up when it connected again.
But I had a phone sitting right next to it, with Bluetooth built in. Surely I could use that?
That turned out to be a slightly more involved question than I'd expected.
How hard can Bluetooth be?
My first preference was to give the notebook an internet connection through the phone. That would have been ideal because the existing synchronisation process wouldn't need to know anything had changed.
I investigated Bluetooth PAN, the networking and tethering profile that might have made this possible. But the Smart Paper didn't expose a usable way to join the phone's Bluetooth network, and no transport network appeared when I disabled Wi-Fi. The existing synchronisation process had nowhere to connect to.
So I looked at Bluetooth Low Energy instead.
That got further, but maintaining a reliable connection proved difficult. The Smart Paper could connect to the phone and complete a small GATT transfer, but each session then terminated after about 30 seconds. Even a keepalive experiment didn't change that, so BLE wasn't viable for a sustained sync connection.
Not especially helpful when you're trying to transfer a collection of handwritten notes.
Eventually I tried RFCOMM, a more traditional Bluetooth connection that lets two devices exchange data over a serial-style link.
And that worked.
Turning the phone into a courier
Rather than trying to give the notebook full internet access, I changed the approach.
Workbench could send its pending note updates to Companion over Bluetooth. Companion could then pass them along to Gateway when it had connectivity.
The phone effectively became a courier.
Two ways notes reach Companion
Through Gateway
Normal sync: Paper Workbench, a Lenovo Smart Paper, sends notes to Paper Gateway, an OCI-hosted service, over Wi-Fi / internet. Paper Gateway provides them to Paper Companion, an Android phone.
Through Companion
Fallback sync: Paper Workbench, a Lenovo Smart Paper, sends updates to Paper Companion, an Android phone, over Bluetooth RFCOMM while the notebook is offline. Companion forwards them to Paper Gateway, an OCI-hosted service, when connectivity is available.
The normal path sends notes from Workbench through Gateway to Companion. The fallback path sends notes from Workbench to Companion over Bluetooth, then Companion forwards them to Gateway later.
I liked this approach because I didn't have to invent an entirely separate way of synchronising notes. The same note revisions still needed to reach Gateway, regardless of whether they travelled there directly or took a detour through my phone.
There were some fiddly details to work through, of course. What happens if a transfer finishes but the acknowledgement gets lost? How do we avoid sending the same change twice? What if a note has been deleted while everything's offline?
Those aren't particularly glamorous problems, but they're important when you're dealing with notes you actually want to keep.
We ended up testing those scenarios too, including interrupted acknowledgements and offline deletions.
Another thing I hadn't originally planned to build
The funny thing is that Bluetooth wasn't part of the original Paper Workbench idea at all.
I started out wanting a better way to organise notes on an e-ink notebook. Then I wanted to read them on my phone, so I built Companion and Gateway. Then I realised the notebook wasn't online for much of the day, so I ended up experimenting with Bluetooth protocols.
It's been a recurring pattern with this project. I'll solve one problem, start using the result, and discover something else that would make it a little more useful.
And because I'm building it for myself, I can decide that a fairly obscure Bluetooth fallback is worth the effort.
I doubt it would be particularly high on the roadmap for a commercial notebook app.
For mine, though, it makes sense.