mServiceUuids = new string[device.ServiceCount];
mServiceUuids = device.ServiceUuidList.ToArray();
mServiceMask = device.GetMaskFromUuid(mServiceUuids);
- if ((mServiceMask & BluetoothServiceClassType.A2dp) == BluetoothServiceClassType.A2dp)
+ if ((mServiceMask & BluetoothServiceClassType.A2dp) == BluetoothServiceClassType.A2dp ||
+ (mServiceMask & BluetoothServiceClassType.Hsp) == BluetoothServiceClassType.Hsp)
{
Log.Info(SettingBluetooth.LogTag, "A2dp supported");
mIsA2dpSupported = true;
+ if (device.IsProfileConnected(BluetoothProfileType.AdvancedAudioDistribution) ||
+ device.IsProfileConnected(BluetoothProfileType.AdvancedAudioDistributionSink) ||
+ device.IsProfileConnected(BluetoothProfileType.Headset))
+ {
+ Log.Info(SettingBluetooth.LogTag, "A2dp connected");
+ mIsA2dpConnected = true;
+ }
}
if ((mServiceMask & BluetoothServiceClassType.Hid) == BluetoothServiceClassType.Hid)
{
Log.Info(SettingBluetooth.LogTag, "Hid supported");
mIsHidSupported = true;
+ if (device.IsProfileConnected(BluetoothProfileType.HumanInterfaceDevice))
+ {
+ Log.Info(SettingBluetooth.LogTag, "Hid connected");
+ mIsHidConnected = true;
+ }
}
}
this.Add(new Device(btDevice));
}
}
- //this.Add(new Device(btDevice));
- Log.Info(SettingBluetooth.LogTag, "device(" + btDevice.Address + ") added");
}
internal void RemoveDevice(BtDevice btDevice)
if (device.Address == btDevice.Address)
{
this.Remove(device);
- Log.Info(SettingBluetooth.LogTag, "device(" + device.Address + ") removed");
break;
}
}
{
mSearched.AddDevice(btDevice);
UpdateState(btDevice); // TODO: don't need to find device item. let's use return value from above function
+ Log.Info(SettingBluetooth.LogTag, "device(" + btDevice.Address + ") added in searched list");
}
internal void AddToPaired(BtDevice btDevice)
}
mPaired.AddDeviceFront(btDevice);
UpdateState(btDevice); // TODO: don't need to find device item. let's use return value from above function
+ Log.Info(SettingBluetooth.LogTag, "device(" + btDevice.Address + ") added in paired list");
}
internal void RemoveFromSearched(BtDevice btDevice)
{
mSearched.RemoveDevice(btDevice);
+ Log.Info(SettingBluetooth.LogTag, "device(" + btDevice.Address + ") removed in searched list");
}
internal void RemoveFromPaired(BtDevice btDevice)
{
mPaired.RemoveDevice(btDevice);
- mPaired.Clear();
if (mPaired.Count == 0)
{
this.Remove(mPaired);
}
+ Log.Info(SettingBluetooth.LogTag, "device(" + btDevice.Address + ") removed in paired list");
}
internal void RemoveAllSearchedDevices()
case BtDeviceState.Unpaired:
if (mDeviceSource.FindInSearched(ev.BtDevice) == null)
{
- // TODO: need to add in front of the list
- try
- {
- mDeviceSource.AddToSearched(ev.BtDevice);
- }
- catch (Exception e)
- {
- Log.Debug(SettingBluetooth.LogTag, "Exception : " + e.Message);
- }
+ // TODO: need to add in front of the list
+ try
+ {
+ mDeviceSource.AddToSearched(ev.BtDevice);
+ }
+ catch (Exception e)
+ {
+ Log.Debug(SettingBluetooth.LogTag, "Exception : " + e.Message);
+ }
+
}
if (mDeviceSource.FindInPaired(ev.BtDevice) != null)
{
case BtDeviceState.Connected:
if (mDeviceSource.FindInPaired(ev.BtDevice) != null)
{
- mDeviceSource.RemoveFromPaired(ev.BtDevice);
- mDeviceSource.AddToPaired(ev.BtDevice);
mDeviceSource.UpdateState(ev.BtDevice);
}
else
case BtDeviceState.Disconnecting:
if (mDeviceSource.FindInPaired(ev.BtDevice) != null)
{
- mDeviceSource.RemoveFromPaired(ev.BtDevice);
- mDeviceSource.AddToPaired(ev.BtDevice);
mDeviceSource.UpdateState(ev.BtDevice);
}
break;