private string[] mServiceUuids = null;
private BluetoothServiceClassType mServiceMask = 0;
private BtDeviceIcon mDeviceIcon;
+ private int mRssi = 0;
private bool mIsA2dpSupported = false;
private BluetoothAudio mBluetoothAudio = null;
mIsPaired = device.IsPaired;
mDeviceState = state;
mBluetoothDevice = device;
+ mRssi = device.Rssi;
if (device.ServiceCount > 0)
{
mServiceUuids = new string[device.ServiceCount];
}
}
+ internal int Rssi
+ {
+ get
+ {
+ return mRssi;
+ }
+ }
+
private void BluetoothDeviceBondCreated(object obj, BondCreatedEventArgs ev)
{
Log.Info(Program.LogTag, "BluetoothDeviceBondCreated. Address: " + ev.Device.Address + ", IsPaired: " + ev.Device.IsPaired);
public event PropertyChangedEventHandler PropertyChanged;
BtDevice mBtDevice;
private string mState;
+ private int mRssi;
private void OnPropertyChanged(string propertyName)
{
OnPropertyChanged("ImageUrl");
}
}
+
+ public int Rssi
+ {
+ get
+ {
+ return mRssi;
+ }
+ }
}
public class DeviceCollection : ObservableCollection<Device>
internal void AddDevice(BtDevice btDevice)
{
- this.Add(new Device(btDevice));
+ if (this.Count == 0)
+ {
+ this.Add(new Device(btDevice));
+ }
+ else
+ {
+ bool added = false;
+ foreach (var item in this)
+ {
+ if (btDevice.Rssi > item.Rssi)
+ {
+ int idx = this.IndexOf(item);
+ this.Insert(idx, new Device(btDevice));
+ added = true;
+ break;
+ }
+ }
+ if (added == false)
+ {
+ this.Add(new Device(btDevice));
+ }
+ }
+ //this.Add(new Device(btDevice));
Log.Info(Program.LogTag, "device(" + btDevice.Address + ") added");
}