Bluetooth Driver services: Difference between revisions
No edit summary |
|||
(16 intermediate revisions by 3 users not shown) | |||
Line 527: | Line 527: | ||
This is used by [[BTM_services|btm]]. | This is used by [[BTM_services|btm]]. | ||
[12.0.0+] If [[Settings_services#BluetoothDevicesSettings|TrustedServices]] is 0, value 0x100000 is used. When bit20 is set, HID is initialized for this device, otherwise when bitmask 0xC0000 is set (<code>if((TrustedServices & 0xC0000) != 0)</code>) [[#OpenAudioConnection|audio]] is initialized for this device. | |||
== GetPairedDeviceInfo == | == GetPairedDeviceInfo == | ||
Line 962: | Line 964: | ||
This is essentially the same as the other [12.0.0+] Get*EventInfo cmds, however in this case the output type is set to value 0 when no event is available. | This is essentially the same as the other [12.0.0+] Get*EventInfo cmds, however in this case the output type is set to value 0 when no event is available. | ||
See [[#AudioEventInfo]]. | |||
== OpenAudioConnection == | == OpenAudioConnection == | ||
Line 985: | Line 989: | ||
== StartAudioOut == | == StartAudioOut == | ||
Takes an input u32, a [[#PcmParameter]], a nn::TimeSpan, returns an output nn::TimeSpan and u64. | Takes an input u32 [[#OpenAudioOut|audio_handle]], a [[#PcmParameter]], a nn::TimeSpan latency, returns an output nn::TimeSpan latency and u64. | ||
This eventually uses BSA to start an AV stream. The codec is "Raw PCM". Synchronous feeding mode is used. | |||
== StopAudioOut == | == StopAudioOut == | ||
Takes an input u32, no output. | Takes an input u32 [[#OpenAudioOut|audio_handle]], no output. | ||
This eventually uses BSA to stop an AV stream. The pause flag is set to false. | |||
== GetAudioOutState == | == GetAudioOutState == | ||
Takes an input u32, returns an output [[#AudioOutState]]. | Takes an input u32 [[#OpenAudioOut|audio_handle]], returns an output [[#AudioOutState]]. | ||
== GetAudioOutFeedingCodec == | == GetAudioOutFeedingCodec == | ||
Takes an input u32, returns an output [[#AudioCodec]]. | Takes an input u32 [[#OpenAudioOut|audio_handle]], returns an output [[#AudioCodec]]. | ||
== GetAudioOutFeedingParameter == | == GetAudioOutFeedingParameter == | ||
Takes an input u32, returns an output [[#PcmParameter]]. | Takes an input u32 [[#OpenAudioOut|audio_handle]], returns an output [[#PcmParameter]]. | ||
== AcquireAudioOutBufferAvailableEvent == | == AcquireAudioOutBufferAvailableEvent == | ||
Takes an input u32, returns an output Event handle. | Takes an input u32 [[#OpenAudioOut|audio_handle]], returns an output Event handle. | ||
sdknso uses an user-specified EventClearMode. | sdknso uses an user-specified EventClearMode. | ||
This gets an Event which was previously initialized. | |||
== SendAudioData == | == SendAudioData == | ||
Takes an input u32, a type-0x9 input buffer, returns an output u64. | Takes an input u32 [[#OpenAudioOut|audio_handle]], a type-0x9 input buffer, returns an output u64 transferred_size. | ||
This eventually uses BSA to send the specified buffer to the required UIPC channel. If transferred_size doesn't match the buffer size, error 0x177A71 is returned. transferred_size is always either 0 (error occured) or the buffer size. | |||
== AcquireAudioControlInputStateChangedEvent == | == AcquireAudioControlInputStateChangedEvent == | ||
Line 1,011: | Line 1,023: | ||
sdknso uses an user-specified EventClearMode. | sdknso uses an user-specified EventClearMode. | ||
This gets an Event which was previously initialized. | |||
== GetAudioControlInputState == | == GetAudioControlInputState == | ||
Takes a type-0xA output buffer containing an array of [[#AudioControlButtonState]], returns an output s32. | Takes a type-0xA output buffer containing an array of [[#AudioControlButtonState]], returns an output s32 total_out. | ||
A maximum of 0xF entries can be returned. | |||
== AcquireAudioConnectionStateChangedEvent == | == AcquireAudioConnectionStateChangedEvent == | ||
Line 1,019: | Line 1,035: | ||
sdknso uses an user-specified EventClearMode. | sdknso uses an user-specified EventClearMode. | ||
This gets an Event which was previously initialized. | |||
== GetConnectedAudioDevice == | == GetConnectedAudioDevice == | ||
Takes a type-0xA output buffer containing an array of [[#Address]], returns an output s32. | Takes a type-0xA output buffer containing an array of [[#Address]], returns an output s32 total_out. | ||
A maximum of 0x8 entries can be returned. | |||
== IsManufacturingMode == | == IsManufacturingMode == | ||
Line 1,491: | Line 1,511: | ||
|} | |} | ||
[1.0.0- | [1.0.0-8.1.1] [[#EventType|Type7]]: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,498: | Line 1,518: | ||
! Size | ! Size | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x6 || Device [[#Address|address]]. | ||
|- | |- | ||
| | | 0x6 || 0x2 || Padding | ||
|- | |- | ||
| | | 0x8 || 0x4 || Status, always 0 except with [[#ConnectionEventType|event0]]: 2 = ACL Link is now Resumed (BSA_SEC_RESUMED_EVT), 9 = connection failed (pairing/authentication failed, or opening the hid connection failed). | ||
|- | |- | ||
| 0xC || 0x4 || [[#ConnectionEventType]] | | 0xC || 0x4 || [[#ConnectionEventType]] | ||
|} | |} | ||
[ | [9.0.0-11.0.1] [[#EventType|Type7]]: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,516: | Line 1,537: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || 0x4 || [[#ConnectionEventType]] | | 0x0 || 0x4 || Status, always 0 except with [[#ConnectionEventType|event0]]: 2 = ACL Link is now Resumed (BSA_SEC_RESUMED_EVT), 9 = connection failed (pairing/authentication failed, or opening the hid connection failed). | ||
|- | |- | ||
| 0x4 || 0x6 || Device [[#Address|address]]. | | 0x4 || 0x6 || Device [[#Address|address]]. | ||
|- | |- | ||
| 0xA || 0xFE || Reserved | | 0xA || 0x2 || Padding | ||
|- | |||
| 0xC || 0x4 || [[#ConnectionEventType]] | |||
|} | |||
[12.0.0+] [[#EventType|Type4]]: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x4 || [[#ConnectionEventType]] | |||
|- | |||
| 0x4 || 0x6 || Device [[#Address|address]]. | |||
|- | |||
| 0xA || 0xFE || Reserved | |||
|} | |} | ||
Line 1,614: | Line 1,652: | ||
[[#HidEventType|Type0]], for [[#GetHidEventInfo]]: | [[#HidEventType|Type0]], for [[#GetHidEventInfo]]: | ||
[1.0.0-11.0.1] | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 1,624: | Line 1,663: | ||
| 0x6 || 0x2 || Padding | | 0x6 || 0x2 || Padding | ||
|- | |- | ||
| 0x8 || 0x4 || Status: | | 0x8 || 0x4 || Status: 0 = hid connection opened, 2 = hid connection closed, 8 = failed to open hid connection. | ||
|} | |||
[12.0.0+] 0 = hid connection closed, 1 = hid connection opened, 2 = failed to open hid connection. | [12.0.0+] | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x4 || Status: 0 = hid connection closed, 1 = hid connection opened, 2 = failed to open hid connection. | |||
|- | |||
| 0x4 || 0x6 || Device [[#Address|address]]. | |||
|} | |} | ||
Line 1,889: | Line 1,937: | ||
This is "nn::bluetooth::hal::AudioEventType". This is an u32 enum. | This is "nn::bluetooth::hal::AudioEventType". This is an u32 enum. | ||
= PcmParameter = | {| class="wikitable" border="1" | ||
|- | |||
! Value | |||
! Name | |||
! Description | |||
|- | |||
| 0 || || None | |||
|- | |||
| 1 || || Connection | |||
|} | |||
= AudioEventInfo = | |||
This is the output buffer for [[#GetAudioEventInfo]]. The data stored here depends on the [[#AudioEventType]]. | |||
[[#AudioEventType|Type1]]: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x4 || Status: 0 = AV connection closed, 1 = AV connection opened, 2 = failed to open AV connection. | |||
|- | |||
| 0x4 || 0x6 || Device [[#Address|address]]. | |||
|- | |||
| 0xA || 0x2 || Padding | |||
|} | |||
= PcmParameter = | |||
This is "nn::bluetooth::system::PcmParameter". This is a 0xC-byte struct with 4-byte alignment. | This is "nn::bluetooth::system::PcmParameter". This is a 0xC-byte struct with 4-byte alignment. | ||
The sysmodule will Abort if any of these fields are invalid. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x4 || Must be 0-3. Controls number of channels: 0 = mono, non-zero = stereo. | |||
|- | |||
| 0x4 || 0x4 || s32 SampleRate. Must be one of the following: 16000, 32000, 44100, 48000. | |||
|- | |||
| 0x8 || 0x4 || Bits per sample. Must be 8 or 16. | |||
|} | |||
= AudioOutState = | = AudioOutState = | ||
This is "nn::bluetooth::system::AudioOutState". This is an u32 enum. | This is "nn::bluetooth::system::AudioOutState". This is an u32 enum. | ||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Stopped | |||
|- | |||
| 1 || Started | |||
|} | |||
= AudioCodec = | = AudioCodec = | ||
This is "nn::bluetooth::system::AudioCodec". This is an u32 enum. | This is "nn::bluetooth::system::AudioCodec". This is an u32 enum. | ||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Raw PCM | |||
|} | |||
= AudioControlButtonState = | = AudioControlButtonState = | ||
Line 1,999: | Line 2,109: | ||
| CYW4356A3_001.004.009.0092.0095 | | CYW4356A3_001.004.009.0092.0095 | ||
|- | |- | ||
| [12.0.0] | | [12.0.0-12.0.2] | ||
| BSA0106_01.60.00_ | | BSA0106_01.60.00_ | ||
| Hayward_T3_RC_20210224 | | Hayward_T3_RC_20210224 |