Command Reference
This page documents all known commands for the S120 laser distance meter.
Command Format
Section titled “Command Format”All commands follow this structure:
F1 TT SS PP CC│ │ │ │ └─ Checksum: sum(bytes[1:]) % 256│ │ │ └──── Parameter byte│ │ └─────── Sub-type byte│ └────────── Type byte└───────────── Frame header (always 0xF1)Core Commands
Section titled “Core Commands”Measurement Control
Section titled “Measurement Control”| Command | Hex Code | Description |
|---|---|---|
| CLICK_MEASURE_BUTTON | F1 04 01 01 06 | Trigger single measurement |
| START_CONTINUE_MEASURE | F1 01 01 02 04 | Start continuous measuring |
| STOP_CONTINUE_MEASURE | F1 04 03 00 07 | Stop continuous measuring |
| RETURN | F1 04 00 01 05 | Return/cancel operation |
Device Information
Section titled “Device Information”| Command | Hex Code | Description |
|---|---|---|
| GET_DEVICE_MAC | F1 03 02 05 | Get device MAC address |
| GET_DEVICE_VERSION | F1 03 03 06 | Get firmware version |
| GET_DEVICE_BASE_INFO | F1 02 02 01 05 | Get device information |
Angle Reporting
Section titled “Angle Reporting”| Command | Hex Code | Description |
|---|---|---|
| OPEN_ANGLE_REPORT | F1 02 03 01 06 | Enable inclinometer data |
| CLOSE_ANGLE_REPORT | F1 02 03 00 05 | Disable inclinometer data |
History
Section titled “History”| Command | Hex Code | Description |
|---|---|---|
| SYNC_HISTORY_DATA | F1 03 01 14 18 | Request 20 history records |
Dynamic Commands
Section titled “Dynamic Commands”These commands require calculated parameters:
SWITCH_MEASURE_MODE
Section titled “SWITCH_MEASURE_MODE”Changes the active measurement mode.
F1 05 02 MM CC │ └─ Checksum └──── Mode code (see table below)SWITCH_MEASURE_UNIT
Section titled “SWITCH_MEASURE_UNIT”Changes the measurement unit.
F1 05 02 UU CC │ └─ Checksum └──── Unit codeSWITCH_MEASURE_DATUM
Section titled “SWITCH_MEASURE_DATUM”Changes the measurement reference point.
F1 05 02 DD CC │ └─ Checksum └──── Datum code (front/middle/rear)Mode Codes
Section titled “Mode Codes”| Code | Mode | Chinese | Description |
|---|---|---|---|
01 | Single | 单次测量 | Single distance measurement |
02 | Continuous | 连续测量 | Continuous measurement |
03 | Area | 面积测量 | Area (Length × Width) |
04 | Volume | 体积测量 | Volume (L × W × H) |
05 | Wall Area | 墙面面积测量 | Wall surface area |
06 | Camera Area | 摄像面积测量 | Camera-based area |
07 | Angle+Height | 测角测高 | Angle and height |
08 | Triangle Height | 求直角三角形高 | Right triangle height |
09 | Triangle Hypotenuse | 求直角三角形斜边 | Right triangle hypotenuse |
0A | Triangle Base Sum | 求三角形底边和 | Triangle base sum |
0B | Triangle Aux Height | 三角形辅助线高度测量 | Triangle auxiliary height |
0C | Triangle Area | 三角形面积测量 | Triangle area |
0D | Trapezoid Area | 梯形面积测量 | Trapezoid area |
0E | Cross-Section | 断面测量 | Cross-section |
0F | Slope | 坡面测量 | Slope measurement |
10 | Height Tracking | 高度跟踪 | Height tracking |
11 | Azimuth | 方位角测量 | Azimuth angle |
12 | Stakeout | 放样测量 | Stakeout |
13 | Level Bubble | 水平泡测量 | Level bubble |
Unit Codes
Section titled “Unit Codes”| Code | Unit | Format |
|---|---|---|
00 | Meters | 0.000 m |
01 | Feet-Inches | 0’00” 0/32 |
02 | Inches | 0.000 in |
03 | Feet (decimal) | 0.000 ft |
04 | Yards | 0.000 yd |
Code Examples
Section titled “Code Examples”import asynciofrom bleak import BleakClient
SERVICE_UUID = "0000ae30-0000-1000-8000-00805f9b34fb"CHAR_TX = "0000ae01-0000-1000-8000-00805f9b34fb"CHAR_RX = "0000ae02-0000-1000-8000-00805f9b34fb"
def build_command(type_byte, sub_byte, param_byte): """Build a command packet with checksum.""" packet = bytes([0xF1, type_byte, sub_byte, param_byte]) checksum = sum(packet[1:]) % 256 return packet + bytes([checksum])
async def trigger_measurement(client): """Send CLICK_MEASURE_BUTTON command.""" cmd = build_command(0x04, 0x01, 0x01) # F1 04 01 01 06 await client.write_gatt_char(CHAR_TX, cmd)
async def get_device_version(client): """Send GET_DEVICE_VERSION command.""" cmd = bytes([0xF1, 0x03, 0x03, 0x06]) await client.write_gatt_char(CHAR_TX, cmd)const SERVICE_UUID = '0000ae30-0000-1000-8000-00805f9b34fb';const CHAR_TX = '0000ae01-0000-1000-8000-00805f9b34fb';
function buildCommand(type, sub, param) { const packet = new Uint8Array([0xF1, type, sub, param]); const checksum = (type + sub + param) % 256; return new Uint8Array([...packet, checksum]);}
async function triggerMeasurement(characteristic) { const cmd = buildCommand(0x04, 0x01, 0x01); await characteristic.writeValue(cmd);}# Using mcbluetooth MCP tools
# Trigger measurementbt_ble_write --adapter hci0 \ --address 5B:A6:86:38:FA:CA \ --char-uuid 0000ae01-0000-1000-8000-00805f9b34fb \ --value "f104010106" \ --value-type hex
# Get device versionbt_ble_write --adapter hci0 \ --address 5B:A6:86:38:FA:CA \ --char-uuid 0000ae01-0000-1000-8000-00805f9b34fb \ --value "f1030306" \ --value-type hexResponse Handling
Section titled “Response Handling”After sending a command, responses arrive via notifications on 0xAE02 or indications on 0xAE05.
| Response Prefix | Type | Description |
|---|---|---|
F1 01 01 | ACK | Continuous measure started |
F1 02 01 | Data | Single measurement data |
F1 02 04 | Data | Continuous measurement data |
F1 03 00 | Info | MAC address response |
F1 03 01 | Info | History data response |
F1 03 02 | Info | Device version (JSON) |
F1 04 01 | Result | Measurement result |
F1 05 01 | Error | Device error |
See Response Reference for detailed response parsing.
Related Pages
Section titled “Related Pages”- Response Reference - Parse response packets
- BLE Service Reference - GATT characteristics
- Connecting Guide - Connection setup