Device Status Monitoring
Access device battery, GPS, and network status via JSON over BLE.
Overview
Using the Aero-Tracker proprietary service (3F6AECC7-5406-47AB-9A75-0F5CF12EAF8E
), you can retrieve detailed device status information including battery level, GPS status, cellular signal strength, and configuration details.
Status Data Protocol
Status data is transmitted as JSON objects terminated with the special marker ##END##
:
{"battery_capacity":85,"gps_fix":3,"modem_rsii":15,"version":"1.2.3"}##END##
Important: Always buffer incoming data until you encounter the ##END##
marker before attempting to parse the JSON.
Complete Status Interface
interface MyDeviceStatus {
id?: string;
salt?: string;
model?: string;
status?: 'paired' | 'not_paired';
adsl_address?: string; // ICAO address being transmitted
adsl_address_type?: number; // Address type (1=ICAO, 3=FLARM)
adsl_aircraft_type?: number; // Aircraft type code
battery_capacity?: number; // Battery level (0-100)
gps_altitude?: number; // GPS altitude in meters
gps_latitude?: number; // GPS latitude
gps_longitude?: number; // GPS longitude
gps_satellites?: number; // Number of GPS satellites
gps_fix?: number; // GPS fix status (0=no fix, 2=3D fix)
aircraft_lte_count?: number; // Aircraft detected via cellular
aircraft_air_count?: number; // Aircraft detected via radio
modem_apn?: string; // Cellular APN
modem_apn_password?: string; // Cellular APN password
modem_apn_username?: string; // Cellular APN username
modem_operator?: string; // Mobile network operator name
modem_pin?: string; // SIM PIN
modem_rsii?: number; // Cellular signal strength (0-100, inverted)
modem_imei?: any; // Device IMEI
modem_iccid?: any; // SIM card ICCID
safesky_uid?: string; // SafeSky user ID
version?: string; // Firmware version
model_chip?: string; // Hardware model/chip info
highlight_safesky_traffic?: string; // Traffic highlighting setting
wifi_name?: string; // WiFi network name
wifi_pass?: string; // WiFi password
}
Getting Device Status
Subscribe to the Aero-Tracker proprietary service to automatically receive status updates:
Required Service & Characteristic:
- Service UUID:
3F6AECC7-5406-47AB-9A75-0F5CF12EAF8E
- RX Characteristic (Notify):
E8A6196B-2B02-4EFE-ADC7-6702CBBA3605
let statusBuffer = '';
// Subscribe to status updates
const subscription = bluetoothLE.subscribe({
address: deviceAddress,
service: '3F6AECC7-5406-47AB-9A75-0F5CF12EAF8E',
characteristic: 'E8A6196B-2B02-4EFE-ADC7-6702CBBA3605'
}).subscribe(data => {
const chunk = bluetoothLE.bytesToString(
bluetoothLE.encodedStringToBytes(data.value)
);
statusBuffer += chunk;
// Check for complete status message
if (statusBuffer.includes('##END##')) {
const jsonData = statusBuffer.replace('##END##', '');
try {
const status = JSON.parse(jsonData);
handleDeviceStatus(status);
} catch (error) {
console.error('Failed to parse status JSON:', error);
}
statusBuffer = ''; // Reset buffer for next message
}
});
Processing Status Updates
function handleDeviceStatus(status: MyDeviceStatus) {
// Battery level (already as percentage 0-100)
const batteryLevel = status.battery_capacity || 0;
// Signal strength (inverted and normalized to 0-100)
const signalStrength = 100 - (status.modem_rsii || 100);
// Clean up operator name (remove duplicates)
const operatorName = (status.modem_operator || '')
.replace(/(\b\w+\b)(?=.*\b\1\b)/ig, '')
.trimStart();
// GPS status
const hasGpsFix = status.gps_fix === 2;
console.log('Device Status:', {
id: status.id,
battery: `${batteryLevel}%`,
signal: `${signalStrength}%`,
operator: operatorName,
gps: hasGpsFix ? 'Fixed' : 'No Fix',
satellites: status.gps_satellites || 0,
firmware: status.version,
broadcasting: status.adsl_address,
aircraftDetected: {
cellular: status.aircraft_lte_count || 0,
radio: status.aircraft_air_count || 0
}
});
}
Status Update Frequency
- Status messages are automatically sent every few seconds while connected
- No commands need to be sent to receive status updates
- The device will continuously broadcast its current state
- Status updates include both static info (firmware version, device ID) and dynamic data (battery, GPS, signal strength)