# Leotec Simma

> Para agentes: Qué entrega el Leotec Simma GPS (LESW42K, chip JL7012) por Bluetooth y cómo se lee: las familias de histórico del canal `0x8803` (pasos, pulso, entrenos, series de cadencia y ritmo, oxígeno, estrés, sueño, siesta, GPS), la petición por `0x8801` id 29, la regla de guardar antes de confirmar y la recuperación de la ruta cuando su hora no cae dentro del entreno. Formato de trama, secuencia de conexión y los 22 ajustes de `0x8801` (más la propiedad 44, de solo lectura) con sus campos. Incluye la renovación del AGPS (campo 6 de `0x8801` id 3, paquete de efemérides por `0x9901` con tipo 6) y, en corto, el formato del fichero de esferas (cabecera de 8.376 bytes, regla del puntero) y la transferencia con CRC sobre el fichero parcheado. Cada dato lleva su nivel de verificación: una sola unidad y un solo firmware.

Palabras clave: Leotec Simma GPS, LESW42K, Jieli JL7012, Bluetooth LE, datos de salud, GPS, esferas, ingeniería inversa

## Guía para agentes de IA

This document describes how the Leotec Simma GPS watch hands over its data and the format
of its dial files. It is written to be used as working context by an AI agent. Every
important claim carries one of these labels:

- `[verified]` — reproduced against real hardware and/or real captures.
- `[inferred]` — follows from measurements or code, but was not confirmed on hardware.
- `[untested]` — stated as a hypothesis; do not rely on it.
- `[unknown]` — an open question: nobody has measured it yet.

The field numbers, ids and rules below are taken from the companion app's source, which
talks to the watch every day; the repository is private, so this page is the reference.

---

### Scope and verification status

| Item | Value | Label |
|---|---|---|
| Watch | Leotec Smartwatch MultiSport Simma GPS | `[verified]` |
| SKU | `LESW42K` | `[verified]` |
| Chip | Jieli `JL7012` | `[verified]` |
| Screen | 360x360, round | `[verified]` |
| Advertised BLE name | `LESW42` | `[verified]` |
| Advertised service | `0x8800` | `[verified]` |
| Official app | Apex Wear | `[verified]` |
| Firmware of the reference unit | `AP0.1B4.0R0.9` | `[verified]` |
| History families `3001`, `3003`–`3009`, `3013`, `3996` | Reach the phone and decode | `[verified]` |
| GPS track (`3004` + `3996`) | Draws in the app | `[verified]` |
| Battery (`0x8801` id 9, field 2) | Percent, read on every link (e.g. `ea040009001057ef` = 87) | `[verified]` |
| Watch settings (`0x8801`, 22 settings plus read-only id 44) | Read, written and read back; see «Watch settings» | `[verified]` |
| AGPS update (`0x8801` id 3 field 6, `0x9901` type 6) | Package accepted, date moves | `[verified]` |
| Sleep nodes (`3002`) | Arrive; the node's meaning is unknown | `[unknown]` |
| Nap payload (`3018`) | Layout never captured | `[untested]` |
| Dial transfer protocol (`0x9901` / `0x9902`) | Working on real hardware | `[verified]` |
| CRC16-CCITT-FALSE over the whole file | Confirmed against 3 independent samples | `[verified]` |
| Pointer rule (`+8376`) | Confirmed on dials of 394956, 432216 and 492836 B | `[verified]` |
| Behaviour on a second unit or firmware | Never tested | `[untested]` |

Scope limit: everything below was measured on **one unit** with firmware
`AP0.1B4.0R0.9`. Read the other unit's firmware first and compare.

---

### Transport

#### GATT profile

| Service | Characteristic | Properties | Use |
|---|---|---|---|
| `0x8800` | `0x8801` | write-no-resp, notify | configuration |
| `0x8800` | `0x8802` | write-no-resp, notify | settings and live data |
| `0x8800` | `0x8803` | write-no-resp, notify | events and history |
| `0x9900` | `0x9901` | write-no-resp, notify | dial transfer control |
| `0x9900` | `0x9902` | write-no-resp | dial bulk data |

`[verified]` Expand the 16-bit UUIDs to the SIG base:
`0000XXXX-0000-1000-8000-00805f9b34fb`.

`[verified]` The watch does not expose the Nordic UART Service. Everything is
write-without-response plus notify, with no bonding and no encryption. Negotiated MTU:
`247`.

`[verified]` BLE libraries report the declaration handle; captures carry the value handle,
which is the declaration handle + 1. Mixing them up makes a capture parser find nothing.

#### Frame format

```
EA <len:u16 LE> <id:u16 LE> <protobuf payload> EF
```

`[verified]` One format on every channel. `len` counts the two id bytes plus the payload.
The payload is unencrypted protobuf (proto3: fields equal to 0 are left out). Examples:
`ea040009001057ef` is id 9 with `{2: 87}`; `ea0500282308a946ef` is id `0x2328` = 9000 with
`{1: 9001}`.

`[verified]` Older notes (and the Python toolkit) split the id of the transfer channel into a
"direction" byte (`0x29`/`0x28`) and a "command" byte (`0x23`). That is the same two bytes read
as one little-endian `u16`: `29 23` is id 9001 phone→watch, `28 23` is id 9000 watch→phone.
Both readings put the same bytes on the wire; use the `u16` one, because history and report
ids (`3001`, `2007`) do not fit in one byte.

`[verified]` A notification can carry part of a frame, or more than one. Reassemble per
channel using `len`. Writes longer than the MTU must be cut into pieces of at most MTU − 3
bytes; the watch reassembles them the same way. A frame truncated by the OS is ignored
silently. The per-app switches (id 34) are the case that bites: 364 bytes read back on the
reference unit, more when written with every app.

#### Messages per channel

| Channel | Direction | Ids |
|---|---|---|
| `0x8801` | both | `2` GET, `1` SET ack, property ids (`3`–`53`) |
| `0x8802` | watch→phone | `2006` handshake, `2007` live data, `2001` operation |
| `0x8802` | phone→watch | `2000` ack of every pushed message |
| `0x8803` | watch→phone | history families `3001`–`3996` |
| `0x8803` | phone→watch | `3000` ack of a history chunk |
| `0x9901` | both | `9001` transfer request, `9000` transfer state |
| `0x9902` | phone→watch | raw file bytes, no framing |

`[verified]` Every message the watch pushes on `0x8802` (except an ack) is answered with
`2000` `{1: <its id>}` on `0x8802`; the ack of `2006` is `ea0500d00708d60fef`. `2006` itself
carries `{1: 244}` (`ea0500d60708f401ef`); `[inferred]` 244 is the largest write the link
accepts (MTU 247 − 3). `2007` live data only flows while `0x8801` id 52 (live-data
switch) is `{1: 1}`; write `{1: 0}` to stop it. `2007` fields: `1` steps, `2` small
calories, `3` centimetres, `4` duration s, `5` bpm, `6` stress, `7` SpO2, `8` battery %;
each message carries only the fields that changed, so merge them.

#### Connection sequence

`[verified]` What the companion app does on every link. The order of steps 3–5 is the
app's choice, not a watch requirement: the only hard rule is one exchange at a time (see
below), and in a real log the `29` request goes out before the first GET.

1. Connect, discover `0x8800` and `0x9900`, subscribe to `0x8801`, `0x8802`, `0x8803` and
   `0x9901`. Wait for the OS to confirm the three `0x88xx` subscriptions: replies that
   arrive before that are lost on the phone side.
2. On a fresh connection, wait up to 3 s for `2006` on `0x8802` and ack it with `2000`. If
   the OS already held the watch connected, `2006` never comes: do not wait.
3. GETs, one at a time, 1.5 s timeout each: `9` battery, `4` profile, `15` goals, `3`
   device info, then the settings.
4. `5` clock, once per connection, only once no GET is in flight.
5. `29` history request, if history is wanted; store and ack each `0x8803` chunk until
   `2001` op 8 closes the sync.
6. `52` `{1: 1}` while a screen shows live data.

#### Configuration channel

```
TX  cmd=0x0002 {1:N}  ->  GET property N   (watch replies with cmd=N)
TX  cmd=N      {fields} ->  SET property N (watch replies cmd=0x0001 {1:N})
```

`[verified]` Besides the settings below: `0x03` device info, `0x05` date and time
(written once per connection), `0x09` battery (field 2, percent) and `0x1d` (29) history
request. `[inferred]` `0x14` weather and `0x1e` watch status, identified by their payloads
but never written.

`[verified]` Device info (id 3): fields 1, 2, 3, 5 and 7 are plain ASCII strings: device
id (18 digits), model (`LESW42`), firmware (`AP0.1B4.0R0.9`), serial number and BLE
address (`xx:xx:xx:xx:xx:xx`). Field 6 is `agps_update_timestamp` (see AGPS).
`[unknown]` Fields 8–18 are small integers whose meaning was never pinned down.

`[verified]` Clock (id 5) is written in **local** time: `{1 year, 2 month, 3 day, 4 hour,
5 minute, 6 second, 7 24-hour clock (1), 8 zone sign (0 UTC, 1 east, 2 west), 9 zone hours,
10 zone minutes}`. The app writes every field, zeros included.

`[verified]` GETs must go out one at a time and wait for the answer; firing them back to
back loses replies. Writes on `0x8801` also wait for the three notification subscriptions
and, on a fresh connection, for the watch's `2006` handshake.

`[verified]` The watch handles one exchange at a time. A command (clock `id 5`, history
request `id 29`, any SET) written while a GET is waiting for its answer makes the watch drop
one of the two silently: the GET times out, or the command never gets its ack. Seen on
16-nov-2026 with GET 9 vs `id 29` and GET 10 vs a brightness SET. Hold commands while a GET
is in flight, and hold the next GET until the command's ack (`{1: <cmd>}`, ~60 ms).

`[verified]` When the phone attaches to a watch the system already holds connected, the
watch does not send `2006` at all: waiting for it only adds the grace delay.

#### Watch settings

`[verified]` Bodies are **proto3**: a field equal to 0 is left out. An empty answer is "all
zeros", not a refusal: SET vibration `{1:0}` reads back as `ea02003500ef`. Decode an absent
field as 0, and compare a read-back with absent fields as 0.

`[verified]` The ack of a SET only proves the message arrived. Read the property again to
know what the watch kept. A SET carries the whole message: read it, change the field, write
it all back.

Field numbers in braces. Times are hour and minute in separate fields; `weekDays` is a mask,
bit 0 Sunday … bit 6 Saturday. `[unknown]` The sedentary reminder reads back `weekDays` 255
(bit 7 set too); what bit 7 means is not known.

| id | Property | Fields and notes |
|---|---|---|
| 4 | user profile | `{1 sex, 2 age, 3 height cm, 4 weight g, 5 hand, 6 skin}` |
| 7 | brightness | `{1 level}`, levels 1–5 of the watch menu (1 dimmest). A SET is acked and read back but the screen does not change |
| 8 | screen timeout | `{1 seconds}` |
| 10 | language | `{1 type, 2 repeated {1 available type}}` |
| 11 / 24 / 25 | units / distance / weight format | `{1}`: 0 metric/km/kg, 1 British/miles/pounds |
| 13 | do not disturb | `{1 app switch, 2–3 begin, 4–5 end, 6 watch switch, 7 weekDays}` |
| 15 | daily goals | five nested `{1 on, 2 goal}` in fields 1–5: steps, calories, distance, duration, sleep |
| 16 | sleep window | `{1 weekDays, 2–3 begin, 4–5 end}`; `weekDays == 0` disables it |
| 17 | auto heart rate | `{1 interval min}`, 0 = off |
| 18 | sedentary | `{1 interval min, 2 weekDays, 3–4 begin, 5–6 end, 7 step threshold, 8 switch, 9 noon switch, 10–13 noon window}`; field 8: **10 off, 11 on**; field 1 is 0 when off |
| 21 | notification categories | one `{1 on, 2 action}` per category in fields 1–6: call, missed call, SMS, social, email, schedule |
| 26 | heart-rate alarm | `{1 on, 2 max bpm, 3 min bpm}` |
| 27 | basal calories | `{1 on}`; acked, but a non-zero value reads back empty: not kept on this unit |
| 28 | raise to wake | `{1 source, 2–3 begin, 4–5 end}`; source 0 off, 1 all day, 2 inside the window |
| 31 | menu pages | `{1 repeated {1 page}}` up to seven, `{2 repeated {1 page}}` the supported ones |
| 34 | per-app notification switches | `{1 repeated {1 on}}`, one per app in the official app's enum order, which is not published here; longer than the MTU, so it needs chunked writes |
| 37 | auto monitor | `{1 heart rate, 2 blood oxygen, 3 blood pressure, 4 check time}`; **never answers a GET** on this unit |
| 44 | project settings | feature list, read-only |
| 50 / 51 | blood-oxygen / stress monitoring | `{1 on, 2 minutes}`; turning it off also sets the interval to 0, so write `{1: 0, 2: 0}` |
| 53 | vibration intensity | `{1}`: 0 light, 1 medium, 2 strong, 3 none; field 2 (`support_bit`) is read-only, do not echo it |

---

### History

#### Request and acknowledgement

`[verified]` History is requested with `0x8801` id 29, field 1 = 1. There is no filter:
the watch decides what it has pending and pushes it over `0x8803`.

`[verified]` **The watch hands each record out exactly once.** Acknowledging a chunk is
what makes it drop the data. The ACK goes on `0x8803`: id `3000` with
`{1: <family id of the chunk>, 2: <field 1 of the chunk>}`, and it is sent only after the chunk is durably stored. If the write fails, do not ACK:
the record would be lost on both sides.

`[verified]` `0x8802` id 2001 carries an operation in field 1. Operation 8 closes the sync
(seen as `0808`); operation 6 is the watch asking for fresh AGPS. Treating every 2001 as the
end of the sync misreads the second one.

`[verified]` Records arrive interleaved, out of order, and one family may be split across
several messages. Store the raw payload with its message id, `commonFlag` and arrival time,
then decode. Nothing needs to be asked twice.

`[verified]` Only one BLE client is accepted at a time, and what one client downloads the
other never sees: with Apex Wear still installed, every sync here starves the official app.
The companion app syncs on its own when it connects and keeps a pause switch as an
emergency brake.

#### Families

| Id | Content | Label |
|---|---|---|
`ts` is a Unix second.

| Id | Record fields | Label |
|---|---|---|
| `3001` | Day bucket: `{1 ts, 2 steps, 3 small calories, 4 centimetres}` | `[verified]` |
| `3002` | Sleep: `{1 ts, 2 node}`; node semantics unknown, keep the raw value | `[unknown]` |
| `3003` | Heart rate: `{1 ts, 2 bpm}` | `[verified]` |
| `3004` | GPS track: `{1 ts, 2 lat, 3 lon}` as doubles | `[verified]` |
| `3005` | Workout aggregate, see below | `[verified]` |
| `3006` | SpO2: `{1 ts, 2 percent}` | `[verified]` |
| `3007` | Stress: `{1 ts, 2 stress, 3 level}` | `[verified]` |
| `3008` | Workout cadence: `{1 ts, 2 steps per minute}` | `[verified]` |
| `3009` | Workout pace: `{1 ts, 2 s per km (per mile if 3), 3 is_mile}` | `[verified]` |
| `3013` | Workout heart rate: same shape as `3003` | `[verified]` |
| `3012` | Seen on 16-nov-2026 next to a sleep sync: one record `{1: 80, 2 ts, 3 ts}`, the two timestamps matching the first and last `3002` node. Not decoded by the app; acknowledge it like any chunk | `[unknown]` |
| `3018` | Nap: timestamp; the rest of the layout was never captured | `[untested]` |
| `3996` | Raw GPS point: `{1 ts, 2 lat, 3 lon, 4 satellites}` | `[verified]` |

`[verified]` Chunk shape, for every family: `{1 commonFlag, 2 repeated record}`. Each field 2
is a length-delimited sub-message with the fields of the table. Small calories are
calories × 1000 (divide by 1000 for kcal).

`[verified]` `3005` record. Every metric is a plain `uint32` varint (no zigzag) except field 15
(`float`, wire type 5). For the optional metrics a 0 means "not measured".

| Field | Meaning |
|---|---|
| 1 | sport type: 0 daily, 1 walk, 2 run, 3 hike, 4 mountaineering, 5 trail run, 6 ride, 7 open-water swim, 8 stepper, 9 treadmill, 10 workout, 11 indoor ride, 12 elliptical, 13 yoga, 14 rowing machine, 15 pool swim, 128 fast walking |
| 2 / 3 | begin / end ts |
| 4 | steps |
| 5 | small calories |
| 6 | distance, centimetres |
| 7 | duration, seconds |
| 8–13 | seconds in each effort zone: normal, warm-up, fat burn, aerobic, anaerobic, limit |
| 14 / 21 / 22 | average / maximum / minimum bpm |
| 15 | average temperature, °C (`float`) |
| 16 | average speed, km/h × 100 |
| 17 | average pace, s per km |
| 18 | cadence |
| 19 | average stride, cm |
| 20 | average altitude, cm |
| 23 | `support_gps` |

`[inferred]` A `3017` family (`multi_sports_data_ea`, zigzag `sint32` fields) exists in the
official app's proto but never arrived from this watch; do not decode `3005` with it.

#### GPS

`[verified]` Coordinates are `double` (wire type 1). An integer encoding is also accepted
and divided as semicircles, but that fallback is unverified; keep the raw payload.

`[verified]` `3004` and `3996` overlap and both carry the same position when the watch
sends a raw fix; on a run the raw points are often the only ones that arrive. Merge both
families, then:

1. drop non-finite values, out-of-range angles and `0, 0` (a missing double decodes to
   zero);
2. sort by timestamp;
3. keep one point per second.

`[verified]` A track needs at least two points to be drawn.

`[verified]` **The GPS clock does not always fall inside the workout's `[begin, end]`.**
Filtering the stored points by that window leaves a walk with a full track showing no map.
The fix is to recover the records that were delivered together with the workout message,
which belong to it even when their timestamp says otherwise.

`[verified]` Distance comes from the workout aggregate, never from the path. The path only
feeds the map and the per-kilometre splits, which the watch does not compute.

---

### Dial format

#### Pointer rule

```
real_position = declared_pointer + 8376
```

`[verified]` The header occupies 8376 bytes and every pointer in it is relative to the
start of the data. This applies to the background, every sprite and the thumbnail. The
authoritative way to locate the background is to read the pointer of the header element
whose type is `0x01` and add `8376`.

#### Header and images

| Item | Value | Label |
|---|---|---|
| Type list | at `0x8c`, one byte per element, terminated by `0x00` | `[verified]` |
| First record | `0xb4`, packed with no gaps | `[verified]` |
| Slot sizes | `12` B (`0x01`), `132` B (`0x06`), `136` B (`0x0b`), `24` B (`0x02`) | `[verified]` |
| Offset table | u32 little-endian from `0xc8` | `[verified]` |
| Background | RGB565 big-endian, 360x360, 720 B/row, 259200 B | `[verified]` |
| Thumbnail | Same format, 180x180 | `[verified]` |

`[verified]` No encryption or compression (measured entropy 2.96 bits/byte). The screen is
round: the corners of the 360x360 square must be pure black.

`[verified]` The type list and the records must stay in sync; append only. Never disable an
element by deleting its byte from the type list: every later record would be orphaned.

`[verified]` Type `0x06` records store no canvas, only `x`/`y` and pointers. Recover the
sprite size from the bank: consecutive pointers differ by one sprite in big-endian RGB565
plus 4 bytes of padding. `(stride - 4) / 2` is the exact pixel count; the split into width
and height is not in the file. `[inferred]` A factor-pair heuristic works when the winner
stands out. Strides differ between dials, so every file must be taken apart.

`[verified]` Blocks align to the byte with 4 bytes of padding: the background must end
exactly where the first sprite begins. That is the validation criterion.

#### Traps

- `[verified]` Time, date and metrics are drawn by the watch on top of the background;
  painting them into it hides them.
- `[verified]` Sprite memory ranges overlap. Zeroing the needle leaves digit `9` in black.
- `[verified]` To disable an element: move it off screen, set `w`/`h` to 0, then remove its
  entry from the type list. Never only delete the type-list byte.
- `[verified]` A free offset sweep falls in a preview area around `0x32a0` and returns a
  plausible but wrong value.
- `[verified]` Solid-colour images and two-colour halves cannot detect a shift: an 11-row
  error still gives mean error 0.00. Use an asymmetric pattern with marks at known
  positions.
- `[verified]` Autocorrelation is only meaningful over the region with content, where it
  gives a peak around `r = 0.9`.

---

### Dial transfer

`[verified]` Sequence:

1. Phone→watch on `0x9901`: start command, id `9001`.
2. Watch→phone on `0x9901`: id `9000` accepting, `{1: 9001}`.
3. Phone→watch on `0x9902`: the raw file in 128-byte chunks, no headers.
4. Watch→phone on `0x9901`: id `9000` progress ACK every 2048 bytes.
5. Watch→phone on `0x9901`: id `9000` FIN (`f2=5`), meaning the dial was applied.

Start command `[verified]`: `f1=7` (type watchface), `f2="1"` (slot as a string),
`f3=f4` file size, `f5` CRC, `f6` id, `f7=2048` (ACK window), `f8=f9=f12=1`.

`[verified]` Progress ACK: `f1`=9001, `f2=3`, `f3`=cumulative bytes. `[inferred]` Older notes
call `f1` a session id; it is always 9001, the id of the request being answered. After the last
window the watch sends `f2=5`; waiting for another `f2=3` hangs.

`[verified]` Send 2048 bytes (16 chunks) and wait for the ACK before the next window.
Observed speed: about 11.8 KB/s, roughly 35 s for a 394956 B dial. The dial applies by
itself; a restart is only needed to reconnect over BLE.

`[verified]` CRC16-CCITT-FALSE: polynomial `0x1021`, init `0xFFFF`, not reflected, xorout
`0`. It is computed over the **complete file after patching**. If the image changes and the
CRC is not recomputed, the transfer fails.

`[unknown]` The meaning of the start-command `id` field is unresolved; the app uses
`111149056`, and changing it allows re-sending.

---

### AGPS (ephemeris update)

`[verified]` `0x8801` id 3 (device info) field 6 is `agps_update_timestamp`: the Unix second
of the last AGPS file the watch accepted, `0` if never. Apex Wear reads it on every
connection and refreshes when `|now - timestamp| >= 86400 s`.

`[verified]` It downloads three ephemeris files (GPS, BeiDou, Galileo), packs them and sends
them through the same `0x9901`/`0x9902` transfer as a dial:

- Package: a 36-byte header (u32 LE Unix second, then the u32 LE offset of each record from
  the start of the file, up to eight) followed by one record per file: one constellation
  byte and the file as downloaded.
- Start command `0x9901` id 9001: `{1: 6 (agps), 3: size, 4: size, 5: crc, 7: 2048, 9: 1}`.
  CRC16-CCITT-FALSE over the whole package.
- The watch answers id 9000: no state (accepted), state 3 with bytes received every 2048,
  state 5 when done; 1 rejected, 2 already has this file, 4 CRC error.

`[verified]` Two quirks of Apex Wear are reproduced as is, because that is what the watch
accepts: the constellation byte is `0` for all three files (the app picks it from the file
path and every path contains "gps"), and the CRC goes through a signed 16-bit value, so one
of `0x8000` or more arrives sign-extended (`0xFFFF8000`...).

`[verified]` A 151716-byte package was accepted in about 8 s, and field 6 read back as the
send time.

---

### App surfaces

`[verified]` The companion app has five tabs: today (steps, heart rate, sleep, stress,
SpO2), workouts (list with a route thumbnail and a detail with map, heart-rate zones,
cadence and pace series, kilometre splits), history, watch settings, and accounts. All of
it is stored in a local database on the phone.

`[verified]` The workout detail used to read the tables by the `[begin, end]` window, which
is why a walk with a full GPS track showed neither map nor pulse.

---

### Open questions

- `[unknown]` The meaning of the sleep nodes (`3002`).
- `[unknown]` The field layout of the nap payload (`3018`).
- `[unknown]` What applies the brightness level (`0x8801` id 7) to the screen.
- `[unknown]` The meaning of the start-command `id` field.
- `[unknown]` The split of a type `0x06` sprite into width and height; a factor-pair
  heuristic works when the winner stands out.
- `[untested]` Another unit of the same model, or another firmware.
