Esempio n. 1
0
 internal AudioConnectionStateChangedEventArgs(int result, bool isConnected, string address, BluetoothAudioProfileType type)
 {
     _result      = result;
     _type        = type;
     _isConnected = isConnected;
     _address     = address;
 }
Esempio n. 2
0
        internal int Disconnect(string deviceAddress, BluetoothAudioProfileType type)
        {
            int ret = Interop.Bluetooth.Disconnect(deviceAddress, (int)type);

            if (ret != (int)BluetoothError.None)
            {
                Log.Error(Globals.LogTag, "Failed to disconnect device with the given profile type, Error - " + (BluetoothError)ret);
            }
            return(ret);
        }
Esempio n. 3
0
 /// <summary>
 /// Disconnects the remote device with the given audio profile.
 /// </summary>
 /// <remarks>
 /// The device must be connected by Connect(). If the disconnection request succeeds, the AudioConnectionStateChanged event will be invoked.
 /// If audio profile type is All and this request succeeds, then the AudioConnectionStateChanged event will be called twice when HspHfp <br/>
 /// and AdvancedAudioDistribution is disconnected.
 /// </remarks>
 /// <param name="type">The type of the audio profile.</param>
 /// <exception cref="NotSupportedException">Thrown when the Bluetooth is not supported.</exception>
 /// <exception cref="InvalidOperationException">Thrown when the Bluetooth is not enabled
 /// or when Disconnection attempt fails.</exception>
 /// <since_tizen> 3 </since_tizen>
 public void Disconnect(BluetoothAudioProfileType type)
 {
     if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
     {
         int ret = BluetoothAudioImpl.Instance.Disconnect(RemoteAddress, type);
         if (ret != (int)BluetoothError.None)
         {
             Log.Error(Globals.LogTag, "Failed to Disconnect - " + (BluetoothError)ret);
             BluetoothErrorFactory.ThrowBluetoothException(ret);
         }
     }
     else
     {
         BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
     }
 }