コード例 #1
0
 public override void OnConnectionStateChange(ABluetooth.BluetoothGatt gatt, ABluetooth.GattStatus status, ABluetooth.ProfileState newState)
 {
     System.Diagnostics.Debug.WriteLine($"ConnectionStateChanged {status}");
     if (newState == ABluetooth.ProfileState.Connected)
     {
         _owner._connected = true;
         _owner._connectedHandle.Set();
         gatt.DiscoverServices();
     }
 }
コード例 #2
0
        public override void OnConnectionStateChange(bt.BluetoothGatt gatt, [GeneratedEnum] bt.GattStatus status, [GeneratedEnum] bt.ProfileState newState)
        {
            base.OnConnectionStateChange(gatt, status, newState);

            ConnectionStateChange?.Invoke(this, new ConnectionStateChangeEventArgs(gatt, status, newState));

            if (!_servicesDiscovered)
            {
                gatt.DiscoverServices();
            }
        }
コード例 #3
0
ファイル: BleGattCallback.cs プロジェクト: ytabuchi/BleSample
        // �ڑ��󋵂��ω��������ɔ��΂��郁�\�b�h
        public override void OnConnectionStateChange(BluetoothGatt gatt, [GeneratedEnum] GattStatus status, [GeneratedEnum] ProfileState newState)
        {
            base.OnConnectionStateChange(gatt, status, newState);

            if (newState == ProfileState.Connected)
            {
                // �ڑ���ԂɂȂ�����T�[�r�X���������
                // �T�[�r�X�����‚�������OnServicesDiscovered������
                gatt.DiscoverServices();
            }
            else if(newState == ProfileState.Disconnected)
            {
                //�|�b�v�A�b�v�Ȃǂ�o���āA�C�ӂ�Activity�Ɉړ�����Ȃǂ��Ă�������
            }
        }
コード例 #4
0
 public override void OnConnectionStateChange(ABluetooth.BluetoothGatt gatt, ABluetooth.GattStatus status, ABluetooth.ProfileState newState)
 {
     System.Diagnostics.Debug.WriteLine($"ConnectionStateChanged {status} {newState}");
     _owner.ConnectionStateChanged?.Invoke(_owner, new ConnectionStateEventArgs {
         Status = status, State = newState
     });
     if (newState == ABluetooth.ProfileState.Connected)
     {
         if (!_owner._servicesDiscovered)
         {
             gatt.DiscoverServices();
         }
     }
     else
     {
         _owner.Device.OnGattServerDisconnected();
     }
 }
 public void DiscoverServices()
 {
     _gatt.DiscoverServices();
 }