Skip to main content

BLE Services Reference

The Melody device exposes several BLE services for configuration and low-latency control.
  • Device name (BLE): MEL-############, where ############ - 6-byte BLE MAC address.
  • UUID width: 16-bit
  • Byte order: Little-endian
All characteristics must be interpreted using little-endian byte ordering.

🛜 Service 0x1001 — WiFi Setup

Configure WiFi credentials and read available access point list.
CharTypeR/WDescription
0x0001stringWSSID (write "" to clear)
0x0002stringWPassword (write "" to clear)
0x0003boolR/WUpdate AP list (write 1, wait until it returns 0)
0x0004string[128]RAP list, newline (\n) separated, \0 terminated

â„šī¸ Service 0x1002 — Device Information

Static device metadata and identifiers.
CharTypeR/WDescription
0x0001stringRDevice name (e.g., "Melody")
0x0002stringRDevice type (e.g., "melody")
0x0003stringRFirmware version (CI/CD name)
0x0004stringRHardware revision
0x0005uint32RFactory activation time (Unix timestamp)
0x0006stringR/WFactory serial number (one-time write)
0x0007stringRBLE MAC address

📡 Service 0x1003 — Device Status

Live operational status and power / temperature information.
CharTypeR/WDescription
0x0001uint64RDevice time (ms)
0x0002uint8RBattery level (0–100%)
0x0003floatRBattery voltage (10.0–15.0 V)
0x0004int32RWiFi RSSI (dB, -100 to 10)
0x0005floatRTemperature sensor 1 (°C, near charger)
0x0006floatRTemperature sensor 2 (°C, near motor)
0x0007boolWPower down (write 1 to shut down the device)
0x0008boolRConnected to WiFi and server

📍 Service 0x1004 — Stroker Status

Current motion and target state of the stroker actuator.
CharTypeR/WDescription
0x0001floatRCurrent position (rad)
0x0002int32RCurrent position (points, 0–10000)
0x0003floatRTarget position (rad)
0x0004int32RTarget position (points, 0–10000)
0x0005floatRCurrent velocity (rad/s)
0x0006int32RCurrent velocity (points/s)

âš™ī¸ Service 0x1005 — Stroker Settings

Software motion limits in normalized percentage form.
CharTypeR/WDescription
0x0001uint32R/WLow position shift (0–100%, default 0)
0x0002uint32R/WHigh position shift (0–100%, default 0)

🔐 Service 0x1006 — OTP

Generate and read short-lived OTP codes for secure pairing / token flows.
CharTypeR/WDescription
0x0001boolR/WUpdate OTP (write 1, wait for 0 when ready)
0x0002string[6]ROTP token (6 characters)

🎛 Service 0x2001 — HDC (Haptics Direct Control)

Immediate position control. New commands interrupt current movement (not queued).
CharTypeR/WSizeDescription
0x0001uint16[2]W4 bytesPosition + time command
Binary format (little-endian):
  • Bytes 0–1: Position (uint16, 0–10000)
  • Bytes 2–3: Time (uint16, ms, 0–65535)

📈 Service 0x2002 — HPS (Haptics Point Stream)

Stream position/time points. Velocity is calculated from time delta between points.
Minimum 2 points required for valid motion.
Limits:
  • Max 64 points/message
  • Max 128 points total buffer
CharTypeR/WSizeDescription
0x0001[uint16, uint32] arrayW6 bytes/pointAdd points (position + time)
0x0002boolR/W1 bytePlay/pause
0x0003boolW1 byteFlush buffer
0x0004boolR/W1 byteLoop enable
0x0005floatR/W4 bytesPlayback rate
0x0006uint32W4 bytesSync timestamp (ms)
Binary format for 0x0001 (per point, little-endian):
  • Bytes 0–1: Position (uint16, 0–10000)
  • Bytes 2–5: Time (uint32, ms)

🔁 Service 0x2003 — HLC (Haptics Loop Control)

Automatic up/down stroking loop with configurable range and speed.
CharTypeR/WDescription
0x0001uint32R/WVelocity (0–100% of max speed)
0x0002uint32R/WLow limit (0–99%, must be < high limit)
0x0003uint32R/WHigh limit (1–100%, must be > low limit)
0x0004boolWPlay (write 1 to start loop)
0x0005boolWPause (write 1 to stop loop)

🔎 Notes & Best Practices

  • Always respect little-endian ordering for all numeric values.
  • Use WiFi API for higher-level orchestration (scripts, sessions, debug) and BLE for low-latency or local control.
  • For robust apps:
    • Use HPS for smooth real-time motion.
    • Reserve HDC for simple, interruptible target moves.
    • Configure HLC as a simple, automatic loop mode driven by firmware.
  • OTP and WiFi setup over BLE are ideal for first-time device provisioning and pairing flows.