AI Device Management (TSAIManagerInterface)
This page covers device controls and AI-session bridging exposed by TSAIManagerInterface, including device status, audio settings, device finding, session events, and audio data exchange. For app-facing AI assistant, Q&A, translation, and other business capabilities, see TopStepAIKit.
Prerequisites
- AI-capable device must be connected and paired with the iOS application
- Device must support AI chat functionality (verify with
isAIDeviceAPISupported) - Bluetooth connection must be active and stable
- Appropriate permissions for audio input/output must be granted by the user
- For voice wake-up features, device must support on-device wake-up capability
Data Models
TSAIDeviceBatteryInfoModel
Battery information for AI device.
| Property | Type | Description |
|---|---|---|
batteryLevel | NSInteger | Battery level from 0 to 100 representing the charge percentage |
isCharging | BOOL | Indicates whether the device is currently charging |
TSAIDeviceStatusInfoModel
Current status information for the AI device.
| Property | Type | Description |
|---|---|---|
leftConnectionStatus | TSAIDeviceConnectionStatus | Connection status of the left device |
rightConnectionStatus | TSAIDeviceConnectionStatus | Connection status of the right device |
leftInCaseStatus | TSAIDeviceInCaseStatus | In-case status of the left device |
rightInCaseStatus | TSAIDeviceInCaseStatus | In-case status of the right device |
leftBatteryInfo | TSAIDeviceBatteryInfoModel * | Battery information for the left device |
rightBatteryInfo | TSAIDeviceBatteryInfoModel * | Battery information for the right device |
TSAIDeviceFindStatusInfoModel
Find status information for the AI device.
| Property | Type | Description |
|---|---|---|
leftFindStatus | TSAIDeviceFindStatus | Find status of the left device |
rightFindStatus | TSAIDeviceFindStatus | Find status of the right device |
Enumerations
TSAIVendor
| Value | Number | Description |
|---|---|---|
TSAIVendorUnknown | 0 | No vendor selected |
TSAIVendorStarBurst | 1 | StarBurst AI solution |
TSAIVendorMltCloud | 2 | MltCloud AI solution |
TSAIChatStatusType
AI chat status types during conversation.
| Value | Description |
|---|---|
TSAIChatStatusTypeEnterChatGPT | Enter AI chat session |
TSAIChatStatusTypeStartRecording | Start recording audio input |
TSAIChatStatusTypeEndRecording | End recording audio input |
TSAIChatStatusTypeExitChatGPT | Exit AI chat session |
TSAIChatStatusTypeReminderOpenApp | Reminder to open app |
TSAIChatStatusTypeIdentificationFailed | Speech recognition failed |
TSAIChatStatusTypeIdentificationSuccessful | Speech recognition successful |
TSAIChatStatusTypeConfirmContent | Confirm recognized content |
TSAIChatStatusTypeStartAnswer | Start generating answer |
TSAIChatStatusTypeAnswerCompleted | Answer generation completed |
TSAIChatStatusTypeAnswering | Currently generating answer |
TSAIChatStatusTypeAbnormalNoNetWork | Error: no network connection |
TSAIChatStatusTypeAbnormalSensitiveWord | Error: sensitive word detected |
TSAIChatStatusTypeAbnormalCustom | Error: custom error |
TSAIDevicePresetEQ
Preset equalizer settings for the device.
| Value | Description |
|---|---|
TSAIDevicePresetEQUnknown | Unknown or unset equalizer |
TSAIDevicePresetEQSoundEffect1 | Sound Effect 1 preset |
TSAIDevicePresetEQSoundEffect2 | Sound Effect 2 preset |
TSAIDevicePresetEQSoundEffect3 | Sound Effect 3 preset |
TSAIDevicePresetEQSoundEffect4 | Sound Effect 4 preset |
TSAIDevicePresetEQSoundEffect5 | Sound Effect 5 preset |
TSAIDevicePresetEQSoundEffect6 | Sound Effect 6 preset |
TSAIDeviceNoiseReductionMode
Noise reduction mode settings.
| Value | Description |
|---|---|
TSAIDeviceNoiseReductionModeUnknown | Unknown noise reduction mode |
TSAIDeviceNoiseReductionModeOff | Noise reduction off |
TSAIDeviceNoiseReductionModeOn | Noise reduction on |
TSAIDeviceNoiseReductionModeTransparency | Transparency mode (hear ambient sound) |
TSAIDeviceLowLatencyMode
Low latency mode settings.
| Value | Description |
|---|---|
TSAIDeviceLowLatencyModeUnknown | Unknown low latency mode |
TSAIDeviceLowLatencyModeOff | Low latency mode off |
TSAIDeviceLowLatencyModeOn | Low latency mode on |
TSAIDeviceConnectionStatus
Device connection status.
| Value | Description |
|---|---|
TSAIDeviceConnectionStatusUnknown | Unknown connection status |
TSAIDeviceConnectionStatusDisconnected | Device is disconnected |
TSAIDeviceConnectionStatusConnected | Device is connected |
TSAIDeviceInCaseStatus
Device in-case status.
| Value | Description |
|---|---|
TSAIDeviceInCaseStatusUnknown | Unknown in-case status |
TSAIDeviceInCaseStatusOut | Device is out of case |
TSAIDeviceInCaseStatusIn | Device is in case |
TSAIDeviceFindStatus
Device find status.
| Value | Description |
|---|---|
TSAIDeviceFindStatusUnknown | Unknown find status |
TSAIDeviceFindStatusNotFinding | Device is not in finding mode |
TSAIDeviceFindStatusFinding | Device is currently finding (emitting sound) |
TSAIDeviceFindEvent
Events related to device finding.
| Value | Description |
|---|---|
TSAIDeviceFindEventUnknown | Unknown find event |
TSAIDeviceFindEventFindLeft | Start finding left device |
TSAIDeviceFindEventFindRight | Start finding right device |
TSAIDeviceFindEventStopFindLeft | Stop finding left device |
TSAIDeviceFindEventStopFindRight | Stop finding right device |
TSAIDeviceSide
Device side selection.
| Value | Description |
|---|---|
TSAIDeviceSideLeft | Left device/earbud |
TSAIDeviceSideRight | Right device/earbud |
TSAIDeviceChatSessionEvent
AI chat session events requested by device.
| Value | Description |
|---|---|
TSAIDeviceChatSessionEventUnknown | Unknown chat session event |
TSAIDeviceChatSessionEventTerminate | Terminate current AI chat session |
TSAIDeviceChatSessionEventInitiateWithSCO | Initiate new session via SCO channel |
TSAIDeviceChatSessionEventInitiateWithOpus | Initiate new session via Opus encoding |
TSAIChatAudioChannel
Audio channel type used for AI chat communication.
| Value | Description |
|---|---|
TSAIChatAudioChannelUnknown | Unknown or unavailable audio channel |
TSAIChatAudioChannelSco | SCO (Synchronous Connection-Oriented) channel |
TSAIChatAudioChannelOpusInA2dpOut | Opus encoded input with A2DP output |
TSAIChatAudioChannelOpusInOpusOut | Opus encoded input and output |
TSAIEnableState
Enable/disable state.
| Value | Description |
|---|---|
TSAIEnableStateUnknown | Unknown enable state |
TSAIEnableStateOff | Feature is disabled |
TSAIEnableStateeOn | Feature is enabled |
Callback Types
TSAIDeviceStatusBlock
typedef void(^TSAIDeviceStatusBlock)(TSAIDeviceStatusInfoModel *latestStatusInfo);
Invoked when device status changes.
| Parameter | Type | Description |
|---|---|---|
latestStatusInfo | TSAIDeviceStatusInfoModel * | Latest device status information model |
TSAIDeviceEqualizerBlock
typedef void(^TSAIDeviceEqualizerBlock)(BOOL success, TSAIDevicePresetEQ currentEQ, NSError * _Nullable error);
Invoked when equalizer query completes.
| Parameter | Type | Description |
|---|---|---|
success | BOOL | Whether the query succeeded |
currentEQ | TSAIDevicePresetEQ | Current equalizer preset |
error | NSError * _Nullable | Error object if query failed, nil on success |
TSAIDeviceNoiseReductionModeBlock
typedef void(^TSAIDeviceNoiseReductionModeBlock)(BOOL success, TSAIDeviceNoiseReductionMode mode, NSError * _Nullable error);
Invoked when noise reduction mode query completes.
| Parameter | Type | Description |
|---|---|---|
success | BOOL | Whether the query succeeded |
mode | TSAIDeviceNoiseReductionMode | Current noise reduction mode |
error | NSError * _Nullable | Error object if query failed, nil on success |
TSAIDeviceLowLatencyModeBlock
typedef void(^TSAIDeviceLowLatencyModeBlock)(BOOL success, TSAIDeviceLowLatencyMode mode, NSError * _Nullable error);
Invoked when low latency mode query completes.
| Parameter | Type | Description |
|---|---|---|
success | BOOL | Whether the query succeeded |
mode | TSAIDeviceLowLatencyMode | Current low latency mode |
error | NSError * _Nullable | Error object if query failed, nil on success |
TSAIDeviceStatusInfoBlock
typedef void(^TSAIDeviceStatusInfoBlock)(BOOL success, TSAIDeviceStatusInfoModel * _Nullable statusInfo, NSError * _Nullable error);
Invoked when device status information query completes.
| Parameter | Type | Description |
|---|---|---|
success | BOOL | Whether the query succeeded |
statusInfo | TSAIDeviceStatusInfoModel * _Nullable | Device status information model, nil if error |
error | NSError * _Nullable | Error object if query failed, nil on success |
TSAIDeviceFirmwareVersionBlock
typedef void(^TSAIDeviceFirmwareVersionBlock)(BOOL success, NSString * _Nullable version, NSError * _Nullable error);
Invoked when firmware version query completes.
| Parameter | Type | Description |
|---|---|---|
success | BOOL | Whether the query succeeded |
version | NSString * _Nullable | Firmware version string, nil if error |
error | NSError * _Nullable | Error object if query failed, nil on success |
TSAIDeviceFindStatusInfoBlock
typedef void(^TSAIDeviceFindStatusInfoBlock)(BOOL success, TSAIDeviceFindStatusInfoModel * _Nullable statusInfo, NSError * _Nullable error);
Invoked when find status information query completes.
| Parameter | Type | Description |
|---|---|---|
success | BOOL | Whether the query succeeded |
statusInfo | TSAIDeviceFindStatusInfoModel * _Nullable | Device find status information model, nil if error |
error | NSError * _Nullable | Error object if query failed, nil on success |
TSAIDeviceFindEventBlock
typedef void(^TSAIDeviceFindEventBlock)(TSAIDeviceFindEvent findEvent);
Invoked when find status changes.
| Parameter | Type | Description |
|---|---|---|
findEvent | TSAIDeviceFindEvent | Find event type |
API Reference
Check if device supports AI chat
- (BOOL)isAIDeviceAPISupported;
| Parameter | Type | Description |
|---|---|---|
| Return | BOOL | YES if device supports AI chat, NO otherwise |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
if ([aiManager isAIDeviceAPISupported]) {
TSLog(@"Device supports AI chat");
} else {
TSLog(@"Device does not support AI chat");
}
Query current equalizer preset
- (void)queryAIDeviceEqualizerWithCompletion:(_Nullable TSAIDeviceEqualizerBlock)completion;
| Parameter | Type | Description |
|---|---|---|
completion | TSAIDeviceEqualizerBlock | Callback block invoked with query result |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager queryAIDeviceEqualizerWithCompletion:^(BOOL success, TSAIDevicePresetEQ currentEQ, NSError * _Nullable error) {
if (success) {
TSLog(@"Current EQ: %ld", (long)currentEQ);
} else {
TSLog(@"Failed to query EQ: %@", error.localizedDescription);
}
}];
Set equalizer preset
- (void)setAIDeviceEqualizer:(TSAIDevicePresetEQ)eq
completion:(_Nullable TSCompletionBlock)completion;
| Parameter | Type | Description |
|---|---|---|
eq | TSAIDevicePresetEQ | The equalizer preset to apply |
completion | TSCompletionBlock | Callback block invoked when operation completes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager setAIDeviceEqualizer:TSAIDevicePresetEQSoundEffect2
completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
TSLog(@"EQ set successfully");
} else {
TSLog(@"Failed to set EQ: %@", error.localizedDescription);
}
}];
Register for equalizer change notifications
- (void)registerAIDeviceEqualizerDidChanged:(void(^ _Nullable )(TSAIDevicePresetEQ latestEQ))equalizerBlock;
| Parameter | Type | Description |
|---|---|---|
equalizerBlock | void(^ _Nullable )(TSAIDevicePresetEQ) | Callback invoked when device EQ changes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager registerAIDeviceEqualizerDidChanged:^(TSAIDevicePresetEQ latestEQ) {
TSLog(@"Device EQ changed to: %ld", (long)latestEQ);
}];
Query current noise reduction mode
- (void)queryAIDeviceNoiseReductionModeWithCompletion:(_Nullable TSAIDeviceNoiseReductionModeBlock)completion;
| Parameter | Type | Description |
|---|---|---|
completion | TSAIDeviceNoiseReductionModeBlock | Callback block invoked with query result |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager queryAIDeviceNoiseReductionModeWithCompletion:^(BOOL success, TSAIDeviceNoiseReductionMode mode, NSError * _Nullable error) {
if (success) {
TSLog(@"Current noise reduction mode: %ld", (long)mode);
} else {
TSLog(@"Failed to query noise reduction mode: %@", error.localizedDescription);
}
}];
Set noise reduction mode
- (void)setAIDeviceNoiseReductionMode:(TSAIDeviceNoiseReductionMode)mode
completion:(_Nullable TSCompletionBlock)completion;
| Parameter | Type | Description |
|---|---|---|
mode | TSAIDeviceNoiseReductionMode | The noise reduction mode to apply |
completion | TSCompletionBlock | Callback block invoked when operation completes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager setAIDeviceNoiseReductionMode:TSAIDeviceNoiseReductionModeTransparency
completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
TSLog(@"Noise reduction mode set successfully");
} else {
TSLog(@"Failed to set noise reduction mode: %@", error.localizedDescription);
}
}];
Register for noise reduction mode change notifications
- (void)registerAIDeviceNoiseReductionModeDidChanged:(void(^ _Nullable )(TSAIDeviceNoiseReductionMode latestMode))noiseReductionModeBlock;
| Parameter | Type | Description |
|---|---|---|
noiseReductionModeBlock | void(^ _Nullable )(TSAIDeviceNoiseReductionMode) | Callback invoked when device noise reduction mode changes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager registerAIDeviceNoiseReductionModeDidChanged:^(TSAIDeviceNoiseReductionMode latestMode) {
TSLog(@"Device noise reduction mode changed to: %ld", (long)latestMode);
}];
Query current low latency mode
- (void)queryAIDeviceLowLatencyModeWithCompletion:(_Nullable TSAIDeviceLowLatencyModeBlock)completion;
| Parameter | Type | Description |
|---|---|---|
completion | TSAIDeviceLowLatencyModeBlock | Callback block invoked with query result |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager queryAIDeviceLowLatencyModeWithCompletion:^(BOOL success, TSAIDeviceLowLatencyMode mode, NSError * _Nullable error) {
if (success) {
TSLog(@"Current low latency mode: %ld", (long)mode);
} else {
TSLog(@"Failed to query low latency mode: %@", error.localizedDescription);
}
}];
Set low latency mode
- (void)setAIDeviceLowLatencyMode:(TSAIDeviceLowLatencyMode)mode
completion:(_Nullable TSCompletionBlock)completion;
| Parameter | Type | Description |
|---|---|---|
mode | TSAIDeviceLowLatencyMode | The low latency mode to apply |
completion | TSCompletionBlock | Callback block invoked when operation completes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager setAIDeviceLowLatencyMode:TSAIDeviceLowLatencyModeOn
completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
TSLog(@"Low latency mode enabled");
} else {
TSLog(@"Failed to set low latency mode: %@", error.localizedDescription);
}
}];
Register for low latency mode change notifications
- (void)registerAIDeviceLowLatencyModeDidChanged:(void(^ _Nullable)(TSAIDeviceLowLatencyMode latestMode))lowLatencyModeBlock;
| Parameter | Type | Description |
|---|---|---|
lowLatencyModeBlock | void(^ _Nullable)(TSAIDeviceLowLatencyMode) | Callback invoked when device low latency mode changes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager registerAIDeviceLowLatencyModeDidChanged:^(TSAIDeviceLowLatencyMode latestMode) {
TSLog(@"Device low latency mode changed to: %ld", (long)latestMode);
}];
Query device status
- (void)queryAIDeviceStatusWithCompletion:(_Nullable TSAIDeviceStatusInfoBlock)completion;
| Parameter | Type | Description |
|---|---|---|
completion | TSAIDeviceStatusInfoBlock | Callback block invoked with device status |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager queryAIDeviceStatusWithCompletion:^(BOOL success, TSAIDeviceStatusInfoModel * _Nullable statusInfo, NSError * _Nullable error) {
if (success && statusInfo) {
TSLog(@"Left connection: %ld, Right connection: %ld",
(long)statusInfo.leftConnectionStatus,
(long)statusInfo.rightConnectionStatus);
} else {
TSLog(@"Failed to query device status: %@", error.localizedDescription);
}
}];
Register for device status change notifications
- (void)registerAIDeviceStatusDidChanged:(void(^ _Nullable)(TSAIDeviceStatusInfoModel *latestStatusInfo))statusBlock;
| Parameter | Type | Description |
|---|---|---|
statusBlock | void(^ _Nullable)(TSAIDeviceStatusInfoModel *) | Callback invoked when device status changes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager registerAIDeviceStatusDidChanged:^(TSAIDeviceStatusInfoModel *latestStatusInfo) {
if (latestStatusInfo.leftBatteryInfo) {
TSLog(@"Left battery: %ld%%", (long)latestStatusInfo.leftBatteryInfo.batteryLevel);
}
}];
Query firmware version
- (void)queryAIDeviceFirmwareVersionWithCompletion:(_Nullable TSAIDeviceFirmwareVersionBlock)completion;
| Parameter | Type | Description |
|---|---|---|
completion | TSAIDeviceFirmwareVersionBlock | Callback block invoked with firmware version |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager queryAIDeviceFirmwareVersionWithCompletion:^(BOOL success, NSString * _Nullable version, NSError * _Nullable error) {
if (success && version) {
TSLog(@"Firmware version: %@", version);
} else {
TSLog(@"Failed to query firmware version: %@", error.localizedDescription);
}
}];
Query find status
- (void)queryAIDeviceFindStatusInfoWithCompletion:(_Nullable TSAIDeviceFindStatusInfoBlock)completion;
| Parameter | Type | Description |
|---|---|---|
completion | TSAIDeviceFindStatusInfoBlock | Callback block invoked with find status |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager queryAIDeviceFindStatusInfoWithCompletion:^(BOOL success, TSAIDeviceFindStatusInfoModel * _Nullable statusInfo, NSError * _Nullable error) {
if (success && statusInfo) {
TSLog(@"Left finding: %ld", (long)statusInfo.leftFindStatus);
}
}];
Trigger find device
- (void)findAIDeviceWithSide:(TSAIDeviceSide)side
completion:(_Nullable TSCompletionBlock)completion;
| Parameter | Type | Description |
|---|---|---|
side | TSAIDeviceSide | The side to find (Left or Right) |
completion | TSCompletionBlock | Callback block invoked when operation completes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager findAIDeviceWithSide:TSAIDeviceSideLeft
completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
TSLog(@"Find initiated for left device");
} else {
TSLog(@"Failed to initiate find: %@", error.localizedDescription);
}
}];
Stop find device
- (void)stopFindAIDeviceWithSide:(TSAIDeviceSide)side
completion:(_Nullable TSCompletionBlock)completion;
| Parameter | Type | Description |
|---|---|---|
side | TSAIDeviceSide | The side to stop finding (Left or Right) |
completion | TSCompletionBlock | Callback block invoked when operation completes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager stopFindAIDeviceWithSide:TSAIDeviceSideLeft
completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
TSLog(@"Find stopped for left device");
} else {
TSLog(@"Failed to stop find: %@", error.localizedDescription);
}
}];
Register for find status change notifications
- (void)registerAIDeviceFindStatusDidChanged:(_Nullable TSAIDeviceFindEventBlock)findEventBlock;
| Parameter | Type | Description |
|---|---|---|
findEventBlock | TSAIDeviceFindEventBlock | Callback invoked when find status changes |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager registerAIDeviceFindStatusDidChanged:^(TSAIDeviceFindEvent findEvent) {
switch (findEvent) {
case TSAIDeviceFindEventFindLeft:
TSLog(@"Finding left device");
break;
case TSAIDeviceFindEventStopFindLeft:
TSLog(@"Stopped finding left device");
break;
default:
break;
}
}];
Register for AI-chat session events
- (void)registerOnAIChatSessionEvent:(void(^_Nullable)(TSAIDeviceChatSessionEvent event))block;
| Parameter | Type | Description |
|---|---|---|
block | void(^_Nullable)(TSAIDeviceChatSessionEvent) | Callback invoked when device requests AI-chat event |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager registerOnAIChatSessionEvent:^(TSAIDeviceChatSessionEvent event) {
switch (event) {
case TSAIDeviceChatSessionEventInitiateWithSCO:
TSLog(@"Device requests to initiate AI chat via SCO");
break;
case TSAIDeviceChatSessionEventTerminate:
TSLog(@"Device requests to terminate AI chat");
break;
default:
break;
}
}];
Register for delta voice data
- (void)registerOnAIChatDeltaOpusVoiceData:(void(^_Nullable)(NSData * _Nullable deltaOpusVoiceData, NSData * _Nullable deltaVoiceData))block;
| Parameter | Type | Description |
|---|---|---|
block | void(^_Nullable)(NSData *, NSData *) | Callback with Opus and PCM voice data |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager registerOnAIChatDeltaOpusVoiceData:^(NSData * _Nullable deltaOpusVoiceData, NSData * _Nullable deltaVoiceData) {
if (deltaVoiceData) {
TSLog(@"Received %lu bytes of PCM audio data", (unsigned long)deltaVoiceData.length);
}
}];
Send AI bridge data
- (void)sendAIBridgeData:(NSData *)data;
| Parameter | Type | Description |
|---|---|---|
data | NSData * | The AI bridge data to send |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
NSData *aiBridgeData = [[NSData alloc] initWithBytes:"AI_DATA" length:7];
[aiManager sendAIBridgeData:aiBridgeData];
Register for received AI bridge data
- (void)registerOnAIBridgeDataReceived:(void(^ _Nullable)(NSData *data))block;
| Parameter | Type | Description |
|---|---|---|
block | void(^ _Nullable)(NSData *) | Callback when AI bridge data is received |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
[aiManager registerOnAIBridgeDataReceived:^(NSData *data) {
TSLog(@"Received AI bridge data: %lu bytes", (unsigned long)data.length);
}];
Send WP auth bridge data
- (void)sendWPAuthBridgeData:(NSData *)data;
| Parameter | Type | Description |
|---|---|---|
data | NSData * | The WP auth bridge data to send |
Code Example:
id<TSAIManagerInterface> aiManager = [tsDevice getInterface:@protocol(TSAIManagerInterface)];
NSData *authData = [[NSData alloc] initWithBytes:"AUTH_DATA" length:9];
[aiManager sendWPAuthBridgeData:authData];
Register for received WP-auth bridge data
- (void)registerOnWPAuthBridgeDataReceived:(void (^)(NSData *data))block;
[aiManager registerOnWPAuthBridgeDataReceived:^(NSData *data) {
TSLog(@"Received WP-auth bridge data: %lu bytes", (unsigned long)data.length);
}];
Bridge payloads are defined by the app and device protocol; the SDK does not interpret them. Never log tokens, keys, or complete authentication payloads.
Report session initiation results
[aiManager reportAIChatSessionInitiateSuccess:^(BOOL success,
BOOL deviceEncounteredException,
NSError *error) {
if (!success) {
TSLog(@"Failed to report successful initiation: %@", error.localizedDescription);
}
}];
[aiManager reportAIChatSessionInitiateFailedOrTerminated:^(BOOL success, NSError *error) {
if (!success) {
TSLog(@"Failed to report failure or termination: %@", error.localizedDescription);
}
}];
Register device initiate and terminate requests
[aiManager registerOnRequestInitiateAIChat:^{
// Prepare recording, network, and AI-session resources.
}];
[aiManager registerOnRequestTerminateAIChat:^{
// Stop the session and release its resources.
}];
Audio channel and on-device voice wake-up
TSAIChatAudioChannel channel = [aiManager aiChatAudioChannel];
BOOL supportsVoiceWakeUp = [aiManager allowVoiceWakeUpOnDevice];
if (supportsVoiceWakeUp) {
[aiManager setOnDeviceVoiceWakeUpEnabled:YES
completion:^(BOOL success, NSError *error) {
if (!success) {
TSLog(@"Failed to enable on-device voice wake-up: %@", error.localizedDescription);
}
}];
}
[aiManager queryOnDeviceVoiceWakeUpEnableStateWithCompletion:^(BOOL success,
TSAIEnableState enableState,
NSError *error) {
if (success) {
TSLog(@"On-device voice wake-up state: %ld", (long)enableState);
}
}];
Check allowVoiceWakeUpOnDevice before calling the setter. aiChatAudioChannel identifies the audio channel used by the current device for AI chat.
Additional device capabilities
BOOL supportsXimalaya = [aiManager isSupportedXimalaya];
[aiManager queryAIDeviceBluetoothNameAndMacAddressWithCompletion:^(BOOL success,
NSString *name,
NSString *macAddress,
NSError *error) {
if (success) {
TSLog(@"AI device Bluetooth name: %@", name);
}
}];
Treat a MAC address as device-identifying information and avoid storing it in plaintext logs or analytics.
Notes
- Check
isAIDeviceAPISupportedbefore using this interface. - These device-management APIs belong to TopStepComKit; app-facing AI capabilities are provided by the standalone TopStepAIKit.
- Unregister session, audio, and bridge callbacks with
nilwhen they are no longer needed. - Callback queues are provider-specific. Dispatch UI updates to the main queue.