Product18 Nov 2025 to 9 Aug 2026
GeoTag Pro
A native iOS app that streams iPhone GPS to a Sony camera over Bluetooth Low Energy, built around a byte-exact packet encoder and tests that run without a camera.
Built with an AI pair programmer, then reviewed and tested by me. The tests and decision records below are how I hold that work to account.
- Packet95bytes, big-endian, no checksum
- Golden vectors4generated by an independent oracle
- Tests43XCTest methods, counted in source
The problem
Most Sony Alpha bodies have no GPS. The camera can take a location from a phone over Bluetooth Low Energy and write it into each photo's EXIF, but the phone link I had kept dropping. When it drops, the camera's GPS session lapses and the next photos carry no location. Nothing on the camera says so. You find out at home.
I wanted a set-and-forget bridge: pair once, pocket the phone, and every photo gets a geotag. That means keeping a BLE link and a stream of location packets alive while iOS works to freeze a backgrounded app.
GeoTag Pro is a native iOS app that does this. It is pre-launch and independent of Sony. I have tested it on one camera body, a Sony A7C, and I make no claims about any other.
Constraints
- One physical camera, so almost everything had to be provable without it.
- Apple frameworks only, with no third-party dependencies.
- The camera is strict and silent: a slow handshake, a late first location reading or a gap in packets fails without an error.
- iOS background limits: foreground timers stop firing, and an app with no active background mode gets frozen.
- No hosted CI. The gate is one local make test, headless in the Simulator.
- A Protocol Log: every change to the packet format, handshake, timing or UUIDs is appended with a date and a reason.
What I built
The app is Swift and SwiftUI on CoreBluetooth, CoreLocation, StoreKit 2 and XCTest, with the project generated by XcodeGen. A location reading flows from CoreLocation into GeotaggingPipeline, which filters by distance and time, then into an encoder, then over BLE to the camera's location characteristic, DD11.
The packet is documented publicly by the community in the ILCE7M3ExternalGps protocol notes, and I built on that work. It is 95 bytes, big-endian, with no checksum:
| Bytes | Field | Encoding |
|---|---|---|
| 0–1 | Payload length | uint16, always 93 |
| 2–10 | Fixed header and flag | constant bytes |
| 11–14 | Latitude | int32, degrees × 10,000,000 |
| 15–18 | Longitude | int32, degrees × 10,000,000 |
| 19–25 | UTC date and time | uint16 year, then one byte per part |
| 26–90 | Padding | 65 zero bytes |
| 91–92 | Time zone offset | int16 minutes |
| 93–94 | DST offset | int16 minutes |
Decode these bytes in the Signal Lab
The packet alone is not enough. A camera that actually keeps the data also depends on a validation handshake and timing beyond the public spec, which I do not publish here or anywhere on this site. The Signal Lab covers the public packet only.
The source is 32 Swift files and 7,965 lines. I built this with an AI pair programmer; every change went through tests and my review.
Decisions that mattered
Golden vectors from an independent oracle
A packet encoder is easy to get almost right, so I wanted a contract that fails on a single wrong byte. golden-vectors.json holds inputs and the expected hex of each packet. Saving the app encoder's own output would only prove it agrees with itself. Instead, a standalone Swift script re-implements the format from the spec and generates the file (make vectors), and GoldenVectorsTests asserts the app against every vector.
There are 4 vectors: null island, Sydney, San Francisco and Tokyo. The TypeScript codec behind this site's Signal Lab is a third implementation held to the same four. They are self-consistent anchors, not yet reconciled against bytes captured from a camera, and the docs say so.
An injectable time zone, evaluated at the fix
The encoder read TimeZone.current at send time for bytes 91–94, so the same input produced different bytes on machines in different zones. Leaving it meant golden tests could never pin those bytes. I added a timeZone parameter that defaults to the device zone, and the offset is now evaluated at the payload's own timestamp rather than at send time. Real-world output did not change, and tests became deterministic. It is the first entry in the Protocol Log.
Three test tiers behind one command
Until June 2026 the project had no test target, and every regression was one camera outing away. I split testing by how much reality each tier needs. Tier 1 runs headless: byte-exact encoder tests plus a mock camera and mock location source driving the real pipeline. Tier 2 is a virtual camera, a macOS CBPeripheralManager tool that a real iPhone connects to over the real radio. Tier 3 records a real camera session and replays it. Tier 1 is done, Tier 3 capture is shipped, and Tier 2 is planned.
Append-only capture, recorded at the call site
A real camera session is one-shot, so captures are JSONL: one event per line, appended as it happens. A crash still leaves every earlier event on disk, and make capture reports which lines survived a truncated tail. Where to record mattered too. didWriteValueFor looked like one clean interception point, but write-only characteristics never echo their value through it. So every outgoing write goes through one capturedWrite wrapper, and notifications are recorded before any parsing. Capture exists only in debug builds and is a no-op when idle.
Hard problems
Writes the camera accepted and threw away
Following the public spec alone is not enough. Without one extra validation step in the handshake, the camera accepts every location write, raises no error, and discards the data. There is no failure to debug, only an absence. The step is not in the public spec, and I am not publishing it. The lesson I kept: with hardware, "no error" is not evidence of success. I judge protocol changes by the EXIF in a real photo, never by write callbacks.
Geotags lost in a pocket: BLE in the background on iOS
The heartbeat re-sends the latest location reading so a stationary phone still feeds the camera. The first version drove it with Timer.scheduledTimer, which does not fire in the background. With the phone in a pocket the heartbeat went quiet, the session lapsed, and photos lost their geotags with no visible error. The heartbeat moved to DispatchSourceTimer during the December 2025 hardware pass, and a staleness guard stops it re-sending an old reading. That exposed the next problem: iOS freezes an app with no active background mode. Significant-location monitoring now stays on, at minimal battery cost, so the process survives for CoreBluetooth state restoration, and reconnects try the cached peripheral, then an already-connected one, then a scan.
A crash I introduced the day before
On 4 Jul 2026 I shipped a redesign built from a design handoff, with the tab bar styled through UITabBarAppearance. The next day I found it crashed on iOS 27: calling UITabBar.appearance() inside a SwiftUI View.init() sent _setContext: to a dispatch object. The fix deleted the UIKit styling and used SwiftUI's .toolbarBackground(_:for:) on each tab, keeping .tint() for the active colour, and the file got 23 lines shorter. Reaching into UIKit's global appearance proxies from SwiftUI is borrowing against the next OS release.
How it is tested
The suite has 43 XCTest methods across 7 test classes, counted in source. The last recorded green run was 30 Tier-1 tests, at the June milestone and again after the redesign. The other 13, the capture recorder tests, were added in August 2026 while the simulator service on my machine was stale, so they are recorded as compiled but not yet run, rather than claimed green.
A round-trip test proves captured hex decodes to the exact bytes sent. The tests also settled a documentation bug: an early spec said 97 bytes, and the tests pin 95, a 2-byte length header plus a 93-byte payload.
One gap is documented rather than hidden. The pipeline reads Date() directly, so Tier 1 cannot assert heartbeat cadence. Instead of a large clock-injection refactor, cadence is left to the device tiers, and captures store timestamps as milliseconds since session start so replay can assert it later.
The site's TypeScript port found one more trap: Swift rounds halves away from zero and JavaScript's Math.round does not for negative halves. None of the four vectors exercise it, so the site's tests add negative-half cases.
Results
The encoder matches all 4 golden vectors byte for byte, and a full manual feature pass on a Sony A7C passed in December 2025. What the project does not have yet is a committed capture from a real session.
What I would do next
- Record one real A7C session, build the replay harness, and reconcile the golden vectors against captured bytes. Until then the vectors prove consistency, not camera truth.
- Build the Tier 2 virtual camera so discovery, reconnect and state restoration run without the camera.
- Add a clock seam so Tier 1 can assert cadence.
- Test more camera bodies before claiming support for any of them.
Milestones
What shipped, and when.
First build of the iPhone-to-camera GPS bridge
Background heartbeat keeps the camera's GPS session alive
Golden-vector contract: an independent oracle checks every byte
Three test tiers behind one local command
Camera-grade interface redesign
Record and replay of real camera sessions
Decisions
7 decision records shown here, 1 of them superseded and kept on the list. Open one to read its context and consequence.
Dispatch timers keep the heartbeat alive in the background
Drive the heartbeat with DispatchSourceTimer and re-send the latest fix only while it is fresh.- Context
- Timer.scheduledTimer does not fire while an iOS app is in the background, so a heartbeat built on it goes quiet with the phone in a pocket and the camera's GPS session lapses.
- Consequence
- Geotagging continues with the app in the background on the tested camera. Heartbeat cadence is left to the device test tiers, because headless tests cannot assert it yet.
Inject the encoder's time zone and evaluate it at the fix
The encoder takes a timeZone parameter that defaults to the device zone, and evaluates the offset at the payload's own timestamp.- Context
- The encoder read TimeZone.current at send time for the offset bytes, so the same input produced different packets on different machines and byte-exact tests were impossible.
- Consequence
- Tests are deterministic and real-world output is unchanged. It is the first entry in the append-only Protocol Log.
Golden vectors generated by an independent oracle
A standalone Swift script re-implements the 95-byte format and generates golden-vectors.json, and GoldenVectorsTests asserts the app's encoder against every vector.- Context
- Asserting an encoder against its own saved output only proves that it agrees with itself.
- Consequence
- Four vectors pin the format, and any other encoder, including this site's Signal Lab, must match them byte for byte. They are not yet reconciled against bytes captured from a camera.
Three test tiers behind one local command
Test headless with a mock camera in make test, then against a virtual camera over the real radio, then by recording and replaying a real session.- Context
- The project had no test target and only one camera body, so every regression was one camera outing away.
- Consequence
- The headless tier is done and was green at 30 tests. Capture for replay shipped in August 2026, and the virtual camera is planned.
Style the tab bar through UITabBarAppearance
Configure UITabBar.appearance() from inside the SwiftUI tab view's initialiser.- Context
- The Camera-pro redesign, built from a design handoff, needed an amber active tab and muted inactive tabs.
- Consequence
- It crashed on iOS 27 and was replaced the next day.
Style tabs with SwiftUI modifiers only
Use .toolbarBackground(_:for:) on each tab and keep .tint() for the active colour.- Context
- Calling UITabBar.appearance() inside a SwiftUI View.init() crashed on iOS 27 with a dispatch object receiving _setContext:.
- Consequence
- The crash is gone and the tab view is 23 lines shorter.
Append-only capture, recorded at the call site
Write captures as append-only JSONL, recording every outgoing write through one wrapper at the call site and every notification before parsing.- Context
- A real camera session is one-shot and expensive to repeat, and write-only characteristics never echo their value back through didWriteValueFor.
- Consequence
- A crash mid-session still leaves every earlier event recoverable. Capture exists only in debug builds and is a no-op when idle.
Live status
No live check runs for this project yet.