iOS SBeacon Framework - scopetech/Mobile-Public GitHub Wiki

iOS SBeacon Framework Documentation

Version 1.0.8

Welcome to the iOS SBeacon Framework documentation. This SDK enables your iOS application to communicate with SBeacon Bluetooth Low Energy (BLE) devices for trip tracking, driving behavior analysis, and incident detection.


Features

  • Trip Tracking: Automatic detection of trip start/end with status monitoring
  • Driving Behavior Analysis: Real-time detection of harsh acceleration, braking, and cornering
  • Incident Detection: Automatic collision/accident detection with detailed event data
  • Beacon Management: Scan, pair, and manage SBeacon devices
  • Data Synchronization: Retrieve trip records, incidents, and driving behavior events from beacon storage
  • Accelerometer Calibration: Ensure accurate driving behavior detection
  • Background Operation: Continue BLE communication while app is backgrounded

Quick Start

import BLEFramework

// 1. Initialize the framework
// Import the framework and access the singleton manager
let beaconManager = SBeaconManager.shared

// 2. Set up callbacks
beaconManager.tripStatusChanged = { [weak self] status in
    print("Trip status changed: \(status)")
}

beaconManager.realTimeDrivingBehaviorEventDetected = { [weak self] event in
    print("Driving event detected: \(event.eventType)")
}

// 3. Start scanning for beacons
beaconManager.startScan()

// 4. Pair a discovered beacon
// When you find an unpaired beacon in beaconManager.unpairedSBeacons
SCPBeaconManager.shared.pairBeacon(
    uuid: beacon.uuid,
    major: beacon.major,
    minor: beacon.minor,
    macAddress: nil  // Will be received via callback
)

// 5. Monitor connected beacons
let connectedBeacons = beaconManager.getConnectedBeacons()
for beacon in connectedBeacons {
    print("Beacon \(beacon.macAddress ?? "") connected")
}

Documentation

Page Description
Installation Framework integration, dependencies, and permissions
Initialization Setup, permissions, and background configuration
Beacon Scanning Discovering and listing SBeacon devices
Beacon Pairing Pairing and connection management
Trip Management Trip lifecycle and data retrieval
Driving Behavior Harsh driving detection and configuration
Calibration Accelerometer calibration for accurate detection
Event Handling Callback-based event system
Data Models Model structures and type reference
API Reference Complete method documentation

Requirements

  • iOS 15.6+ (iOS 16+ recommended)
  • Swift 5.5+
  • Xcode 14.0+
  • Physical device with BLE capability
  • SBeacon hardware device

Architecture Overview

The iOS SBeacon Framework uses a callback-based architecture with singleton managers:

Core Managers:

  • SBeaconManager - Main BLE manager for SBeacon communication
  • SCPBeaconManager - CoreData persistence and beacon lifecycle

Key Features:

  • Background BLE communication with bluetooth-central mode
  • CoreData persistence for paired beacons
  • Automatic reconnection to paired beacons
  • Battery level monitoring with low-battery notifications
  • Firmware over-the-air (OTA) updates

Communication Flow:

App → SBeaconManager → CBPeripheral → SBeacon Device
                ↓
         Callbacks (closures)
                ↓
    App receives events/data

Support

For SDK-related questions or issues:


Copyright 2026 Scope Technology. All rights reserved.