private static event EventHandler<GattConnectionStateChangedEventArgs> s_connectionStateChanged;
private static Interop.Bluetooth.GattConnectionStateChangedCallBack s_connectionStateChangeCallback;
- internal BluetoothGattClient(string remoteAddress)
+ internal BluetoothGattClient(string remoteAddress, bool fromLe)
{
_impl = new BluetoothGattClientImpl(remoteAddress);
_remoteAddress = remoteAddress;
- StaticConnectionStateChanged += OnConnectionStateChanged;
+ if (fromLe == false)
+ {
+ StaticConnectionStateChanged += OnConnectionStateChanged;
+ }
+ else
+ {
+ // fromLe will be removed after BluetoothLeDevice.GattConnect removed for backward compatibility.
+ // BluetoothLeDevice.GattConnectionStateChanged event will be occured in this case.
+ }
}
/// <summary>
/// <since_tizen> 6 </since_tizen>
public static BluetoothGattClient CreateClient(string remoteAddress)
{
- BluetoothGattClient client = new BluetoothGattClient(remoteAddress);
+ BluetoothGattClient client = new BluetoothGattClient(remoteAddress, false);
+ return client.Isvalid() ? client : null;
+ }
+
+ internal static BluetoothGattClient CreateClient(string remoteAddress, bool fromLe)
+ {
+ BluetoothGattClient client = new BluetoothGattClient(remoteAddress, fromLe);
return client.Isvalid() ? client : null;
}