Skip to content

Core Segment Navigation Navigation

Mr.P edited this page Aug 29, 2026 · 2 revisions

Send Navigation Information

Create a NavigationInfoModel for the current route step and send it to the device.

Prerequisites

  • The device is connected and conforms to TurnByTurnNavigationAPI.
  • instruction and roadName are each no more than 128 bytes.
  • Distances and time use the units documented by the model.

API Reference

Framework

AIBuds.xcframework

Protocol

Swift

/// Turn by turn navigation API
protocol TurnByTurnNavigationAPI: DeviceAPI {
    /// Send navigation info
    /// - Parameters:
    ///   - info: Navigation info
    ///   - completion: A closure that is called when the operation completes.
    ///     - success: `true` if the operation was successful; otherwise `false`.
    ///     - statusCode: The status code returned by the device. `nil` if the operation failed.
    ///     - error: An `NSError` object that describes the error that occurred, or `nil` if the operation was successful.
    func sendNavigationInfo(
        _ info: NavigationInfoModel,
        completion: AIBudsStatusCodeCompletionHandler?
    )
}

Objective-C

/// Turn by turn navigation API
@protocol AIBudsTurnByTurnNavigationAPI <AIBudsDeviceAPI>
/// Send navigation info
/// - Parameters:
///   - info: Navigation info
///   - completion: Reports success, device status code, and an optional error.
- (void)sendNavigationInfo:(AIBudsNavigationInfoModel *_Nonnull)info
                completion:(AIBudsStatusCodeCompletionHandler _Nullable)completion;
@end

See sendNavigationInfo in the API Reference.

Navigation Model

Property Meaning
nextStepDistanceText Display-ready text such as 300m or 1.5km.
maneuver Raw value defined by Navigation Maneuvers.
instruction Instruction text, maximum 128 bytes.
roadName Road name text, maximum 128 bytes.
alertInfo Optional NavigationAlertInfoModel; use the values and parameter rules in Navigation Alerts.
mapProvider Raw value defined by NavigationMapProvider.
transportMode Raw value defined by NavigationTransportMode.
remainingTime Remaining time in seconds.
remainingDistance Remaining distance in meters.

Usage Examples

Swift

guard let device = device as? TurnByTurnNavigationAPI else { return }

let info = NavigationInfoModel()
info.nextStepDistanceText = "300m"
info.maneuver = NSNumber(value: NavigationManeuver.right.rawValue)
info.instruction = "Turn right"
info.roadName = "Market Street"
info.remainingTime = 420
info.remainingDistance = 1800

device.sendNavigationInfo(info) { success, statusCode, error in
    guard success else {
        print(error?.localizedDescription ?? "Navigation update failed")
        return
    }
    print("Navigation sent: \(statusCode?.stringValue ?? "Unavailable")")
}

Objective-C

id<AIBudsTurnByTurnNavigationAPI> device = (id<AIBudsTurnByTurnNavigationAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsTurnByTurnNavigationAPI)])
    return;

AIBudsNavigationInfoModel *info = [[AIBudsNavigationInfoModel alloc] init];
info.nextStepDistanceText = @"300m";
info.maneuver = @(AIBudsNavigationManeuverRight);
info.instruction = @"Turn right";
info.roadName = @"Market Street";
info.remainingTime = @420;
info.remainingDistance = @1800;

[device
    sendNavigationInfo:info
            completion:^(BOOL success, NSNumber *_Nullable statusCode, NSError *_Nullable error) {
                if (!success)
                    NSLog(@"Navigation update failed: %@", error.localizedDescription);
            }];

Error Handling

Validate byte limits before sending. Use success as the primary result and preserve the device statusCode; the public SDK does not currently document individual status-code meanings.

AIBuds SDK iOS Wiki

Clone this wiki locally