mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 878728 - Support in-band ringtone, r=echou
This commit is contained in:
parent
a5e7321f19
commit
fd338741a0
@ -32,6 +32,21 @@
|
||||
#define MOBILE_CONNECTION_VOICE_CHANGED "mobile-connection-voice-changed"
|
||||
#define BLUETOOTH_SCO_STATUS_CHANGED "bluetooth-sco-status-changed"
|
||||
|
||||
/**
|
||||
* BRSF bitmask of AG supported features. See 4.34.1 "Bluetooth Defined AT
|
||||
* Capabilities" in Bluetooth hands-free profile 1.6
|
||||
*/
|
||||
#define BRSF_BIT_THREE_WAY_CALLING 1
|
||||
#define BSRF_BIT_EC_NR_FUNCTION (1 << 1)
|
||||
#define BRSF_BIT_VOICE_RECOGNITION (1 << 2)
|
||||
#define BRSF_BIT_IN_BAND_RING_TONE (1 << 3)
|
||||
#define BRSF_BIT_ATTACH_NUM_TO_VOICE_TAG (1 << 4)
|
||||
#define BRSF_BIT_ABILITY_TO_REJECT_CALL (1 << 5)
|
||||
#define BRSF_BIT_ENHANCED_CALL_STATUS (1 << 6)
|
||||
#define BRSF_BIT_ENHANCED_CALL_CONTROL (1 << 7)
|
||||
#define BRSF_BIT_EXTENDED_ERR_RESULT_CODES (1 << 8)
|
||||
#define BRSF_BIT_CODEC_NEGOTIATION (1 << 9)
|
||||
|
||||
/**
|
||||
* These constants are used in result code such as +CLIP and +CCWA. The value
|
||||
* of these constants is the same as TOA_INTERNATIONAL/TOA_UNKNOWN defined in
|
||||
@ -372,6 +387,13 @@ BluetoothHfpManager::Reset()
|
||||
mReceiveVgsFlag = false;
|
||||
mDialingRequestProcessed = true;
|
||||
|
||||
// We disable BSIR by default as it requires OEM implement BT SCO + SPEAKER
|
||||
// output audio path in audio driver. OEM can enable BSIR by setting
|
||||
// mBSIR=true here.
|
||||
//
|
||||
// Please see Bug 878728 for more information.
|
||||
mBSIR = false;
|
||||
|
||||
ResetCallArray();
|
||||
}
|
||||
|
||||
@ -711,7 +733,15 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
||||
// For more information, please refer to 4.34.1 "Bluetooth Defined AT
|
||||
// Capabilities" in Bluetooth hands-free profile 1.6
|
||||
if (msg.Find("AT+BRSF=") != -1) {
|
||||
SendCommand("+BRSF: ", 97);
|
||||
uint32_t brsf = BRSF_BIT_THREE_WAY_CALLING |
|
||||
BRSF_BIT_ABILITY_TO_REJECT_CALL |
|
||||
BRSF_BIT_ENHANCED_CALL_STATUS;
|
||||
|
||||
if (mBSIR) {
|
||||
brsf |= BRSF_BIT_IN_BAND_RING_TONE;
|
||||
}
|
||||
|
||||
SendCommand("+BRSF: ", brsf);
|
||||
} else if (msg.Find("AT+CIND=?") != -1) {
|
||||
// Asking for CIND range
|
||||
SendCommand("+CIND: ", 0);
|
||||
@ -1101,7 +1131,7 @@ BluetoothHfpManager::SendLine(const char* aMessage)
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothHfpManager::SendCommand(const char* aCommand, uint8_t aValue)
|
||||
BluetoothHfpManager::SendCommand(const char* aCommand, uint32_t aValue)
|
||||
{
|
||||
if (!IsConnected()) {
|
||||
NS_WARNING("Trying to SendCommand() without a SLC");
|
||||
@ -1109,7 +1139,6 @@ BluetoothHfpManager::SendCommand(const char* aCommand, uint8_t aValue)
|
||||
}
|
||||
|
||||
nsAutoCString message;
|
||||
int value = aValue;
|
||||
message += aCommand;
|
||||
|
||||
if (!strcmp(aCommand, "+CIEV: ")) {
|
||||
@ -1199,7 +1228,7 @@ BluetoothHfpManager::SendCommand(const char* aCommand, uint8_t aValue)
|
||||
}
|
||||
return rv;
|
||||
} else {
|
||||
message.AppendInt(value);
|
||||
message.AppendInt(aValue);
|
||||
}
|
||||
|
||||
return SendLine(message.get());
|
||||
@ -1300,6 +1329,11 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
|
||||
sStopSendingRingFlag = false;
|
||||
UpdateCIND(CINDType::CALLSETUP, CallSetupState::INCOMING, aSend);
|
||||
|
||||
if (mBSIR) {
|
||||
// Setup audio connection for in-band ring tone
|
||||
ConnectSco();
|
||||
}
|
||||
|
||||
nsAutoString number(aNumber);
|
||||
if (!mCLIP) {
|
||||
number.AssignLiteral("");
|
||||
|
@ -116,7 +116,7 @@ private:
|
||||
void NotifyStatusChanged(const nsAString& aType);
|
||||
void NotifyAudioManager(const nsAString& aAddress);
|
||||
|
||||
bool SendCommand(const char* aCommand, uint8_t aValue = 0);
|
||||
bool SendCommand(const char* aCommand, uint32_t aValue = 0);
|
||||
bool SendLine(const char* aMessage);
|
||||
void UpdateCIND(uint8_t aType, uint8_t aValue, bool aSend);
|
||||
void OnScoConnectSuccess();
|
||||
@ -125,6 +125,7 @@ private:
|
||||
|
||||
int mCurrentVgs;
|
||||
int mCurrentVgm;
|
||||
bool mBSIR;
|
||||
bool mCCWA;
|
||||
bool mCLIP;
|
||||
bool mCMEE;
|
||||
|
Loading…
Reference in New Issue
Block a user