Examples

AhaKey X1

Works with Nexting · keyboard case

Nexting Devices SDK · AhaKey X1 integration guide

Connect AhaKey keys and its device microphone to Nexting

This guide defines how an integrated AhaKey X1 will control a remote Agent as a third-party Nexting device. The target path carries AhaKey microphone audio through a CH582/CH58x-targeted firmware port and BLE into the Nexting App, never through a substituted phone microphone. The exact production controller, PCM binding, and board verification are still pending.

What the public devices/ directory is

The devices/ directory on GitHub is the public contract between hardware developers and the Nexting App. It is not the App or cloud source. A device uses this contract to declare capabilities, send physical input, and receive bounded state. The official App owns authorization, speech-to-text, Agent selection, and the remote session.

AreaCurrent public 0.4Still pending
SPEC.md / schemas / protocol/vectorsTen profiles including device-audio/1 wire rules, schema, and vectorsNo further wire change; board evidence is still pending
sdk/c / reference/jsPortable C99 SDK, JavaScript reference, device-audio codecs, fragmentation, and receive boundsProduct Host remains the official Nexting App
firmwareZephyr reference boards plus the AhaKey adapter, CH58x-targeted port, Device Info template, and transport descriptorProduction PCM bind, target build, and physical-board verification
tests / CIProtocol, firmware-build, export, boundary, audio simulator, loss, timeout, flow-control, and invalid-input coverageiPhone/Android unknown-stream fail-closed parity
docs0.4 how-to guides, interfaces, evidence levels, and AhaKey integration/bring-up guidesA board-verified claim is not made
The public directory contains no Nexting App source, Agent routing, accounts, cloud addresses, production keys, or production firmware. The AhaKey work publishes only the device-side interface and a verifiable protocol boundary.

The actual data path

AhaKey → Nexting → Agenttext
physical voice key
  → AhaKey microphone
  → CH582/CH58x-targeted firmware port: PCM16 / 16 kHz / mono
  → IMA ADPCM + CRC32C + BLE fragmentation
  → Nexting App: reassembly, decode, speech-to-text
  → Agent selected when recording began
  → App / LED / OLED state feedback

AhaKey is the nearby input device; the Agent may run on another computer. The keyboard never receives Agent credentials, internal session IDs, account data, or cloud routes. Those remain inside the Nexting App and its trusted Host.

Hardware capability mapping

X1 hardwareTarget Nexting interfaceBehavior
Approval keysapproval/1Answers the pending request as Allow or Deny
General keyskeys/1 slots 0–3Sends Host-defined generic key actions
Physical leverkeys/1 slot 7Press away from rest, release on return
LED stripstatus/1Shows working, waiting, complete, or error
OLED 160×80text/1Shows bounded title and body text
Battery Service 0x180FDevice InfoReports battery capability to the App
Device microphone + physical voice keydevice-audio/1PCM16 → IMA ADPCM → encrypted BLE → App

A production AhaKey integration must bind the physical voice key. It may reuse a configurable key or use a separate input. The public protocol does not dictate the product layout, and Device Info declares only capabilities that exist and have passed hardware verification.

How the Nexting App stays vendor-neutral

The App core has no AhaKey model branch and does not parse stock AhaKey commands. It handles Device Info, generic profiles, and four logical channels. AhaKey GATT UUIDs and A0–A3 opcodes live only in a declarative transport descriptor and the firmware adapter. A future device can use different UUIDs, chips, and controls while reusing the same App audio and Agent pipeline.

Three integration modes

ModeWhat changesKeys/lights/displayDevice microphone
Compatibility Tunnel firmware (preferred)Add a narrow layer to X1 firmware while preserving the stock 0x7340 serviceCore-tested adapter; target build and board verification pendingProduction PCM hook and hardware verification pending
Native Nexting GATTAdd the standard Nexting service to X1 firmwareProtocol path defined; target build and board verification pendingProduction PCM hook and hardware verification pending
Stock firmware + bridge dongleLeave keyboard firmware untouched and add a BLE dongleDesign only; dongle implementation and board test pendingUnavailable unless stock firmware exposes real PCM
A bridge dongle cannot invent keyboard microphone data and cannot substitute the phone microphone. If stock firmware does not expose PCM, bridge mode must not declaredevice-audio/1.

Connection and recording lifecycle

  1. Pair, bond, and encrypt

    The App connects only after the signed-in user explicitly authorizes the third-party device. Revocation, logout, or disconnect terminates capture and clears temporary state.
  2. Read Device Info

    The device declares identity, controls, display, battery, and the exact profiles it implements. Undeclared capabilities stay disabled.
  3. Load the transport descriptor

    The descriptor maps vendor GATT onto control_down, control_up, audio_up, and flow_down. The App above that layer sees logical channels only.
  4. Prepare the recording session

    The App sends audio_config to say authorization and buffers are ready. It may prepare capture, but it cannot remotely start the AhaKey microphone.
  5. Start from the physical key

    The firmware creates audio_begin and uploads frames only after physical input. The App decodes them into its existing speech-to-text and Agent-send path.
  6. Stop, cancel, and wipe on failure

    A release at or after 450 ms submits. A release before 450 ms latches recording and the next physical press submits. Cancel, timeout, disconnect, CRC failure, or a credit stall ends and wipes the stream. A stale result cannot enter a new device or Agent session.

device-audio/1 rules that matter

ItemRule
SamplingPCM16, 16 kHz, mono; 320 samples per 20 ms frame
EncodingIMA ADPCM with sequence, sample position, and CRC32C per frame
TransportBonded and encrypted BLE; at least a 64-byte ATT payload, MTU 247 preferred
Flow control8 initial credits, at most 10 queued frames, cancel after a continuous 500 ms stall
FragmentationAt most 4 fragments per logical frame
Sequence0…5999; sample index must equal sequence × 320 and final sample count must match exactly
LossIgnore duplicates; insert 20 ms silence for one missing frame; abort after 3 consecutive or 10 total missing frames
Integrity failureExperimental 0.4 requires bad CRC, unknown stream, inconsistent fragments, invalid ADPCM metadata, or uncertain sample position to abort and wipe the stream; unknown-stream fail-closed parity is still pending in the mobile development builds
Duration120 seconds maximum; reconnect never restores a recording
PrivacyOnly physical device input may begin capture; always-on capture and pre-key pre-roll are forbidden
Phone microphoneThe device-audio/1 path does not request, start, or fall back to the phone microphone

voice/1 keeps its existing meaning: lifecycle control for the Host or phone microphone, with no audio bytes.device-audio/1 is a separately negotiated profile carrying audio sampled by the physical device itself. They are not interchangeable.

What the CH58x-targeted firmware port must connect

Public AhaKey release and flashing material targets the CH582 family and CH58x tooling, but no public BOM, schematic, or chip-marking evidence confirms the exact production controller. Experimental 0.4 implements encoding, fragmentation, flow control, lifecycle, and the Compatibility Tunnel. A production port must connect microphone, BLE, and display callbacks; no Agent or Nexting App logic belongs in the keyboard.

Files in the 0.4 public releasetext
devices/sdk/c/include/nexting_device.h
devices/sdk/c/src/nexting_device.c
devices/sdk/c/include/nexting_device_audio.h
devices/sdk/c/src/nexting_device_audio.c
devices/firmware/ahakey-x1/CMakeLists.txt
devices/firmware/ahakey-x1/ahakey_proto.h
devices/firmware/ahakey-x1/ahakey_proto.c
devices/firmware/ahakey-x1/nexting_ahakey_adapter.h
Production firmware callback boundaryc
notify_7344(...);          // BLE notify
vendor_7343_write(...);    // preserve stock command handling
microphone_start(...);     // PCM16 / 16 kHz / mono / 320 samples
microphone_stop(...);      // user submits
microphone_cancel(...);    // stop now and wipe DMA / ring buffers
render_audio_state(...);   // ready / receiving / transcribing / submitted / error

The upstream public firmware repository supplies CH582 release HEX files and flashing instructions, but not buildable v1.1.0 production source, a schematic, or a public PCM callback. This guide therefore does not invent a final ADC/I2S/PDM symbol. Bind it after production source and a physical unit are available.

Connecting the keys

Stock HID key assignments remain configurable and can be saved to flash. This is a reference mapping for approvals and generic keys, not a required product layout. A production port must call the physical audio entry point for the chosen voice key.

Reference key maptext
Key1 → F18   approval/1 Allow
Key2 → F19   approval/1 Deny
Key3 → F13   keys/1 slot 0
Key4 → F14   keys/1 slot 1
lever        keys/1 slot 7 (press / release)
voice down   nexting_ahakey_port_voice_pressed(...)
voice up     nexting_ahakey_port_voice_released(...)
voice cancel nexting_ahakey_port_voice_cancel(...)

Current availability and evidence

device-audio/1 protocol and firmware coreSchemas, vectors, C99/JavaScript codecs, simulator, AhaKey lifecycle, and transport descriptor have automated coverage.Core tested
Generic device-audio path in the Nexting AppiOS and Android development builds negotiate capabilities and reuse the existing speech-to-text and Agent pipeline without AhaKey business branches. Unknown-stream fail-closed parity remains pending, so this is not yet a full conformance claim.Integration exists; conformance pending
Public GitHub integration kitExperimental 0.4 is the current public SDK identity. The audited devices/ export publishes the AhaKey kit with the rest of the 0.4 tree.Public 0.4
CH58x-targeted microphone port and physical unitProduction PCM hook, flashing, iPhone/Android testing, BLE capture, range, and power measurements remain.Board bring-up pending
Until the physical checklist is complete, the accurate claim is “protocol and adapter Core tested,” not “AhaKey fully compatible” or “Board verified.” Public App enrollment for third-party devices is a separate availability gate.

Verify each item when hardware arrives

  1. Confirm the controller and wire PCM

    Confirm the production controller from the physical unit or vendor BOM, connect its real microphone driver, and verify every sampling, frame-size, and pre-key capture rule above.
  2. Wire physical input and state

    Call the voice press/release entry points and visibly render ready, receiving, transcribing, submitted, and error.
  3. Publish real Device Info

    Set a stable per-device UUID and real firmware version. Declare device-audio/1 only after microphone tests pass.
  4. Exercise both phone platforms

    Verify start, tap-to-latch, release-to-submit, cancel, disconnect, and reconnect on iPhone and Android.
  5. Prove the audio source

    Complete a recording with phone microphone permission disabled and capture BLE evidence tying audio_begin and frames to the physical key and device.
  6. Stress the failure paths

    Stop credits and inject loss or CRC faults. Verify every flow-control, loss, cancellation, queue, and wipe limit in the table above.