TripQube Developer APIs

← Back to Home

Multiple integration options for different use cases. Build companion apps with Bluetooth, track locations with REST APIs, or integrate hardware devices via MQTT.

👓 New: Bluetooth Low Energy API

Now you can build HUD glasses, smartwatch apps, and custom displays that receive real-time navigation data from TripQube over Bluetooth. Jump to guide →

Integration Methods

📡 Bluetooth Low Energy

Build companion apps receiving real-time navigation data.

  • HUD glasses displays
  • Smartwatch integration
  • Custom dashboard apps
  • Real-time position & navigation

🔧 REST API

Register and authenticate devices via HTTP endpoints.

  • RESTful API design
  • 5-digit PIN authentication
  • No user auth required
  • JSON request/response

📍 HTTP Location Tracking

Push real-time location data via HTTP POST requests.

  • Single or batch updates
  • Offline buffering support
  • Real-time trip tracking
  • Python & Node.js examples

💬 MQTT/IoT

Connect hardware GPS devices and IoT applications.

📡 Bluetooth Low Energy Integration

Build companion apps that receive real-time navigation data from TripQube over Bluetooth Low Energy. Perfect for HUD glasses, smartwatch displays, custom dashboards, and IoT devices.

What You Can Receive

Service & Characteristic UUIDs

Service UUID: 7b8f0001-4c2a-4f1d-9a6e-2f3b5c8d1e40
Navigation State: 7b8f0002-4c2a-4f1d-9a6e-2f3b5c8d1e40
Status (Optional): 7b8f0003-4c2a-4f1d-9a6e-2f3b5c8d1e40
Protocol Version: 6 (Stable)

Quick Start: Connect and Listen

// Scan for TripQube Bluetooth service
val scanner = bluetoothAdapter?.bluetoothLeScanner ?: return
val filter = ScanFilter.Builder()
    .setServiceUuid(ParcelUuid(SERVICE_UUID))
    .build()
scanner.startScan(listOf(filter), scanSettings(), scanCallback)

// Listen for navigation data
gatt.setCharacteristicNotification(navCharacteristic, true)

override fun onCharacteristicChanged(
    gatt: BluetoothGatt,
    characteristic: BluetoothGattCharacteristic,
    value: ByteArray
) {
    val frame = decode(value)  // Parse the binary frame
    when (frame) {
        is NavUpdate -> updateNavigation(frame)
        is Position -> updatePosition(frame)
        // Handle other frame types...
    }
}

Frame Types

Type Frequency Purpose Example
TYPE_NAV (1) ~1 Hz Maneuver & instruction "Turn right on Main St, 250m"
TYPE_POSITION (2) ~1 Hz Current location & speed Lat/Lng, bearing, 45 km/h
TYPE_ROUTE_BEGIN (3) On route change Route started signal Generation ID, point count
TYPE_ROUTE_CHUNK (4) On route change Route geometry (delta-encoded) 50+ points per packet
TYPE_STOPS (5) On waypoint change Waypoints & destination Multiple stops with status
TYPE_TRAVELLED_* (8-9) Continuous Path already ridden For visual playback

Maneuver Codes Reference

Code Maneuver Code Maneuver
1 Straight 13 Roundabout
2 Turn Left 14 Destination
3 Turn Right 15 Depart
4 Slight Left 20 Free Drive (no route)
5 Slight Right 6-7 Sharp Left/Right
8-9 U-Turn 10-12 Keep/Merge

Parse Navigation Frame

data class NavUpdate(
    val maneuverCode: Int,
    val distanceMetres: Int,
    val arrivalMinutes: Int?,
    val instruction: String,
    val altitudeMetres: Int?
)

// Frame format (9+ bytes):
// Offset  Size  Field
// 0       1     Version (6)
// 1       1     Type (1 = NAV)
// 2       1     Maneuver code
// 3..4    2     Distance metres (uint16)
// 5..6    2     Arrival minutes (0xFFFF = unknown)
// 7..8    2     Altitude metres (0x7FFF = unknown)
// 9+      var   Instruction text (UTF-8)

Parse Position Frame

data class Position(
    val latitude: Double,
    val longitude: Double,
    val bearingDegrees: Float?,
    val speedKph: Int
)

// Frame format (14 bytes):
// Offset  Size  Field
// 0       1     Version (6)
// 1       1     Type (2 = POSITION)
// 2..5    4     Latitude (degrees × 10^7, int32)
// 6..9    4     Longitude
// 10..11  2     Bearing tenths of degree (0xFFFF = unknown)
// 12      1     Speed km/h (uint8)

Permissions Required

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />

Performance Tips

📚 Full Documentation

For complete protocol specifications, advanced examples, and reference implementations, see:


🔌 REST API (HTTP) Integration

Integrate GPS tracking and location services using our HTTP REST API. Perfect for web applications, server-side integrations, and general-purpose development.

📝 Register Approved Device

Register a new hardware device to the TripQube system. This is a public endpoint that does not require user authentication.

Endpoint: https://registerapproveddevice-3y3utatgia-uc.a.run.app
Method: POST
Authentication: None (Public)
Content-Type: application/json

Request Body

{
  "device_id": "TRK-ABC-12345",
  "pin": "98765",
  "firmware_version": "2.1.0",
  "manufacturer": "TripQube Hardware"
}

Request Parameters

Field Type Required Description
device_id string ✅ Yes Unique device identifier (max 100 chars)
pin string ✅ Yes 5-digit authentication PIN
firmware_version string ✅ Yes Device firmware version (max 50 chars)
manufacturer string ✅ Yes Device manufacturer name (max 100 chars)

Success Response (200 OK)

{
  "success": true,
  "message": "Approved device registered successfully.",
  "device_id": "TRK-ABC-12345"
}

📍 Push Tracker Location

Push location data from your hardware device to update tracker position. Supports both single location updates and buffered batch updates for offline scenarios.

Endpoint: https://pushtrackerlocation-3y3utatgia-uc.a.run.app
Method: POST
Authentication: Device credentials (device_id + pin)
Rate Limiting: None

Single Location Update

{
  "device_id": "TRK-ABC-12345",
  "pin": "98765",
  "latitude": 37.7749,
  "longitude": -122.4194,
  "battery_level": 85,
  "timestamp": 1705012345000
}

Buffered Locations (Batch Update)

{
  "device_id": "TRK-ABC-12345",
  "pin": "98765",
  "location_buffer": [
    {
      "latitude": 37.7749,
      "longitude": -122.4194,
      "timestamp": 1705012345000,
      "speed": 15.5,
      "altitude": 50
    },
    {
      "latitude": 37.7750,
      "longitude": -122.4195,
      "timestamp": 1705012375000,
      "speed": 20.2,
      "altitude": 55
    }
  ],
  "battery_level": 84
}

Request Parameters

Field Type Required Description
device_id string ✅ Yes Hardware device identifier
pin string ✅ Yes 5-digit authentication PIN
latitude number ⚠️ Conditional* Latitude (-90 to 90) for single update
longitude number ⚠️ Conditional* Longitude (-180 to 180) for single update
battery_level number ❌ Optional Battery percentage (0-100)
timestamp number ❌ Optional Unix timestamp (ms or seconds)
location_buffer array ⚠️ Conditional* Array of location objects for batch update

* Either (latitude AND longitude) OR location_buffer must be provided.

💻 Integration Examples

Python

Simple Python implementation for pushing location data via HTTP.

import requests
import time

DEVICE_ID = "TRK-ABC-12345"
PIN = "98765"
PUSH_URL = "https://pushtrackerlocation-3y3utatgia-uc.a.run.app"

def push_location(lat, lon, battery=None):
    payload = {
        "device_id": DEVICE_ID,
        "pin": PIN,
        "latitude": lat,
        "longitude": lon,
        "timestamp": int(time.time() * 1000)
    }
    
    if battery is not None:
        payload["battery_level"] = battery
    
    response = requests.post(PUSH_URL, json=payload)
    return response.json()

# Usage
result = push_location(37.7749, -122.4194, battery=85)
print(result)

JavaScript/Node.js

Example implementation for Node.js server applications.

const axios = require('axios');

const DEVICE_ID = 'TRK-ABC-12345';
const PIN = '98765';
const PUSH_URL = 'https://pushtrackerlocation-3y3utatgia-uc.a.run.app';

async function pushLocation(lat, lon, battery = null) {
  const payload = {
    device_id: DEVICE_ID,
    pin: PIN,
    latitude: lat,
    longitude: lon,
    timestamp: Date.now()
  };

  if (battery !== null) {
    payload.battery_level = battery;
  }

  const response = await axios.post(PUSH_URL, payload);
  return response.data;
}

// Usage
pushLocation(37.7749, -122.4194, 85)
  .then(result => console.log(result));

💬 Support & Resources

Need Help?

Get in touch with our developer support team or explore additional resources.

  • 📧 Email: tripqube@gmail.com
  • 📖 Full API Documentation: Coming soon
  • 💬 Developer Community: Coming soon
  • 🐛 Report Issues: Coming soon