Bluetooth Driver services: Difference between revisions
No edit summary |
|||
(24 intermediate revisions by 4 users not shown) | |||
Line 215: | Line 215: | ||
|- | |- | ||
| 100 || [12.0.0+] [[#IsBluetoothEnabled]] | | 100 || [12.0.0+] [[#IsBluetoothEnabled]] | ||
|- | |||
| 101 || [15.0.0+] ForceEnableBluetooth | |||
|- | |||
| 102 || [15.0.0+] EnableBluetoothStub | |||
|- | |- | ||
| 128 || [12.0.0+] [[#AcquireAudioEvent]] | | 128 || [12.0.0+] [[#AcquireAudioEvent]] | ||
Line 248: | Line 252: | ||
| 143 || [12.0.0+] [[#GetAudioControlInputState]] | | 143 || [12.0.0+] [[#GetAudioControlInputState]] | ||
|- | |- | ||
| 144 || [12.0.0 | | 144 || [12.0.0-13.2.1] [[#AcquireAudioConnectionStateChangedEvent]] | ||
|- | |- | ||
| 145 || [12.0.0 | | 145 || [12.0.0-13.2.1] [[#GetConnectedAudioDevice]] | ||
|- | |- | ||
| 146 || [13.0.0+] [[#CloseAudioControlInput]] | | 146 || [13.0.0+] [[#CloseAudioControlInput]] | ||
Line 259: | Line 263: | ||
|- | |- | ||
| 149 || [13.0.0+] [[#SendAudioControlSetAbsoluteVolumeCommand]] | | 149 || [13.0.0+] [[#SendAudioControlSetAbsoluteVolumeCommand]] | ||
|- | |||
| 150 || [14.0.0+] AcquireAudioSinkVolumeLocallyChangedEvent | |||
|- | |||
| 151 || [14.0.0+] AcquireAudioSinkVolumeUpdateRequestCompletedEvent | |||
|- | |||
| 152 || [14.0.0+] GetAudioSinkVolume | |||
|- | |||
| 153 || [14.0.0+] RequestUpdateAudioSinkVolume | |||
|- | |||
| 154 || [14.0.0+] IsAudioSinkVolumeSupported | |||
|- | |||
| 155 || [15.0.0+] IsAudioSinkVolumeSupported2 | |||
|- | |- | ||
| 256 || [5.0.0+] [[#IsManufacturingMode]] | | 256 || [5.0.0+] [[#IsManufacturingMode]] | ||
Line 329: | Line 345: | ||
[12.0.0+] The Enable vfunc called above for Audio does the following: | [12.0.0+] The Enable vfunc called above for Audio does the following: | ||
* Calls a func which does the following: | * Calls a func which does the following: | ||
** Uses BSA to enable AV. Besides the callback, the only field in the passed struct which is set is <code>features</code>. This is ORRed to set bit0 for "remote control target", which with [13.0.0+] is only done if [[System_Settings|system-setting]] <code>bluetooth_debug!is_av_rc_tg</code> is set to true. | ** Uses BSA to enable AV. Besides the callback, the only field in the passed struct which is set is <code>features</code>. This is ORRed to set bit0 for "remote control target", which with [13.0.0+] is only done if [[System_Settings|system-setting]] <code>bluetooth_debug!is_av_rc_tg</code> is set to true. With [14.0.0+] this is also ORRed with value 0xA (bit1/bit3) when [[System_Settings|system-setting]] <code>bluetooth_debug!is_av_rc_ct</code> is set to true (which is the case for [14.0.0+]). | ||
** Error handling + state setup is done. | ** Error handling + state setup is done. | ||
** Uses BSA to register AV twice, with the default input struct. | ** Uses BSA to register AV twice, with the default input struct. | ||
Line 518: | Line 534: | ||
== TriggerConnection == | == TriggerConnection == | ||
Takes an input [[#Address]] and | Takes an input [[#Address]] and a u16 timeout, no output. | ||
This is used by [[BTM_services|btm]]. | This is used by [[BTM_services|btm]]. | ||
Line 525: | Line 541: | ||
The funcptr does the following: | The funcptr does the following: | ||
* Calls a func, returning the ret on failure. This uses a BSA extension (message 0x8CE), with the | * Calls a func, returning the ret on failure. This uses a BSA extension (message 0x8CE), with the u16 timeout being used with this. | ||
* Then another func is called, with the input [[#Address]], with the ret from here being returned. This throws an error if the device isn't paired. This opens a HID-Host connection to the specified [[#Address]]. The passed sec_mask is 0x12 (Inbound/outbound authentication required), and brcm_mask is set for enabling TBFC Page. | * Then another func is called, with the input [[#Address]], with the ret from here being returned. This throws an error if the device isn't paired. This opens a HID-Host connection to the specified [[#Address]]. The passed sec_mask is 0x12 (Inbound/outbound authentication required), and brcm_mask is set for enabling TBFC Page. | ||
The handler for the above message with the used bit flag does the following: | The handler for the above message with the used bit flag does the following: | ||
* Uses HCI vendor command 0xFCC2 with param_len=0xE. Param data: | * Uses HCI vendor command 0xFCC2 (TBFC Write Parameters) with param_len=0xE. Param data: u16 timeout value is inserted into the following tAPP_TM_TBFC_PARAM structure initialized with default values. The default host trigger timeout used elsewhere is 0x1800. | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
! Value | |||
|- | |||
| 0x0 | |||
| 0x1 | |||
| BfcEnable | |||
| 0x1 | |||
|- | |||
| 0x1 | |||
| 0x1 | |||
| Frequency1 | |||
| 0x0 | |||
|- | |||
| 0x2 | |||
| 0x1 | |||
| Frequency2 | |||
| 0x18 | |||
|- | |||
| 0x3 | |||
| 0x1 | |||
| Frequency3 | |||
| 0x4E | |||
|- | |||
| 0x4 | |||
| 0x1 | |||
| AccessCodeLength | |||
| 0x20 | |||
|- | |||
| 0x5 | |||
| 0x2 | |||
| HostScanInterval | |||
| 0x200 | |||
|- | |||
| 0x7 | |||
| 0x2 | |||
| HostTriggerTimeout | |||
| timeout | |||
|- | |||
| 0x9 | |||
| 0x2 | |||
| HidScanInterval | |||
| 0x200 | |||
|- | |||
| 0xB | |||
| 0x1 | |||
| HidScanRetry | |||
| 0x3 | |||
|- | |||
| 0xC | |||
| 0x1 | |||
| DontDisturb | |||
| 0x0 | |||
|- | |||
| 0xD | |||
| 0x1 | |||
| WakeUpMask | |||
| 0x0 | |||
|} | |||
== AddPairedDeviceInfo == | == AddPairedDeviceInfo == | ||
Line 795: | Line 873: | ||
== ConnectGattServer == | == ConnectGattServer == | ||
Takes an input u8, an [[#Address]], a bool, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. | Takes an input u8 client_if, an [[#Address]], a bool, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. | ||
This is used by [[BTM_services|btm]]. | This is used by [[BTM_services|btm]]. | ||
The input bool and AppletResourceUserId are unused. | |||
The is_direct field passed to BSA is value 1. | |||
== CancelConnectGattServer == | == CancelConnectGattServer == | ||
Line 948: | Line 1,030: | ||
== SetBleScanParameter == | == SetBleScanParameter == | ||
Takes two input u16s, no output. | Takes two input u16s, no output. | ||
The first u16 is scan_interval, the second u16 is scan_window. | |||
This is used by [[BTM_services|btm]]. | This is used by [[BTM_services|btm]]. | ||
Line 1,840: | Line 1,924: | ||
This is "nn::bluetooth::BleAdvertiseFilter". This is a 0x3E-byte struct. | This is "nn::bluetooth::BleAdvertiseFilter". This is a 0x3E-byte struct. | ||
= BleAdvertisePacketParameter = | {| class="wikitable" border="1" | ||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || FilterId | |||
|- | |||
| 0x1 || 0x1 || CondDataSize. Only used with CondType Manu. | |||
|- | |||
| 0x2 || 0x1 || CondType | |||
|- | |||
| 0x3 || 0x1D || CondData, content depends on CondType. | |||
|- | |||
| 0x20 || 0x1D || Mask. Only used with CondType Manu. +0 = u16 CompanyIdMask, then {pattern mask}. | |||
|- | |||
| 0x3D || 0x1 || MaskSize. Only used with CondType Manu. | |||
|} | |||
CondType: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Name | |||
! Description | |||
|- | |||
| 2-3 || || ServiceUuid16. CondData = 16bit UUID which is byteswapped. | |||
|- | |||
| 4-5 || || ServiceUuid32. CondData = 32bit UUID which is byteswapped. | |||
|- | |||
| 6-7 || || ServiceUuid128. CondData = 128bit UUID which is copied raw into the param struct. | |||
|- | |||
| 255 || || Manu. CondData: u16 CompanyId, then {pattern data}. | |||
|} | |||
To pass filtering, the BLE advert data should be: data & Mask == CondData (following the type field in the advert entry with the matching type). | |||
= BleAdvertisePacketParameter = | |||
This is "nn::bluetooth::BleAdvertisePacketParameter". This is a 8-byte struct with 1-byte alignment. | This is "nn::bluetooth::BleAdvertisePacketParameter". This is a 8-byte struct with 1-byte alignment. | ||
[[BTM_services#StartBleScanForGeneral|StartBleScanForGeneral]] generates a [[#BleAdvertiseFilter]] from this. CondType = Manu, CondDataSize = 0xA. CondData: +0 = u16 CompanyId, u8 +2 = 0x1, +3 = {data copied from PatternData, then an u8 with value 0x0}. MaskSize = 0x9, Mask = {all 0xFF}. | |||
[[BTM_services#StartBleScanForPaired|StartBleScanForPaired]] generates a [[#BleAdvertiseFilter]] from this, similar to the above. CondType = Manu, CondDataSize = 0x11. CondData: +0 = u16 CompanyId, u8 +2 = 0x1, +3 = {data copied from PatternData, then an u8 with value 0x0, then {6-byte system btaddr}}. MaskSize = 0x10, Mask = {all 0xFF except u8 +0x9 which is 0x0}. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x2 || CompanyId | |||
|- | |||
| 0x2 || 0x6 || PatternData | |||
|} | |||
= BleScanResult = | = BleScanResult = | ||
Line 1,856: | Line 1,992: | ||
| 0x1 || 0x6 || [[#Address]] | | 0x1 || 0x6 || [[#Address]] | ||
|- | |- | ||
| | | 0x7 || || Array of entries where each entry is 0x1F-bytes. hid compares +1 with 0xFF and +0x2 with the cached output from [[#BTM_services#GetBleScanParameterGeneral|GetBleScanParameterGeneral]] (entry+0x4 is skipped over). | ||
|- | |- | ||
| 0x140 || 0x4 || s32 Total entries in the array at 0x8. | | 0x140 || 0x4 || s32 Total entries in the array at 0x8. | ||
Line 2,218: | Line 2,354: | ||
| CYW4356A3_001.004.009.0092.0095 | | CYW4356A3_001.004.009.0092.0095 | ||
|- | |- | ||
| [12.0.0- | | [12.0.0-14.1.2] | ||
| BSA0106_01.60.00_ | | BSA0106_01.60.00_ | ||
| Hayward_T3_RC_20210224 | | Hayward_T3_RC_20210224 | ||
| CYW4356A3_001.004.009.0092.0095 | | CYW4356A3_001.004.009.0092.0095 | ||
|- | |||
| [15.0.0-20.1.0] | |||
| BSA0106_01.60.00_ | |||
| Hayward_T3_RC_20210224 | |||
| BCM4356A3 UART 37.4 MHz wlbga_bu | |||
|} | |} | ||
<code>bsa_sv_tm_read_version_excback</code> copies bsa_version_string and concats with bsa_version_info_string to generate <code>tBSA_TM_READ_VERSION.bsa_server_version</code>. | <code>bsa_sv_tm_read_version_excback</code> copies bsa_version_string and concats with bsa_version_info_string to generate <code>tBSA_TM_READ_VERSION.bsa_server_version</code>. | ||
* [15.0.0]: In the HCI memwrite data, only config data was changed, no code changes. | |||
[[Category:Services]] | [[Category:Services]] |