コード例 #1
0
        public BatteryServiceWrapper(IBluetoothManager bluetoothManager)
        {
            IGattServiceBuilder builder = bluetoothManager.NewGattServiceBuilder();

            builder.SetUuid(BATTERY_SERVICE_UUID).SetServiceType(GattServiceType.Primary);
            BatteryLevelCharacteristicWrapper = new BatteryLevelCharacteristicWrapper(bluetoothManager);
            builder.AddCharacteristics(BatteryLevelCharacteristicWrapper.GattServerCharacteristic);
            GattServerService = builder.Build();
        }
コード例 #2
0
 public ClientRfcommServiceWrapper(IBluetoothManager bluetoothManager)
 {
     BluetoothManager             = bluetoothManager;
     AddressCharacteristicWrapper = new ClientRfcommAddressCharacteristicWrapper(this);
     GattServerService            = BluetoothManager.NewGattServiceBuilder()
                                    .SetUuid(Constants.ClientRfcommServiceGuid)
                                    .AddCharacteristics(AddressCharacteristicWrapper.GattServerCharacteristic)
                                    .Build();
 }
コード例 #3
0
        public GyroscopeServiceWrapper(IBluetoothManager bluetoothManager)
        {
            BluetoothManager = bluetoothManager;
            AngularVelocityCharacteristicWrapper = new GyroscopeAngularVelocityCharacteristicWrapper(this);
            IGattServiceBuilder builder = bluetoothManager.NewGattServiceBuilder();

            GattServerService = builder.SetUuid(Constant.GyroscopeServiceGuid)
                                .AddCharacteristics(AngularVelocityCharacteristicWrapper.GattServerCharacteristic)
                                .Build();
        }
コード例 #4
0
        public DeviceInfomationServiceBuilder(IBluetoothManager bluetoothManager)
        {
            BluetoothManager = bluetoothManager;
            var manufacturerNameStringCharacteristic = new ManufacturerNameStringCharacteristicBuilder(BluetoothManager).Build();

            manufacturerNameStringCharacteristic.OnRead  += OnManufacturerNameStringCharacteristicRead;
            manufacturerNameStringCharacteristic.OnWrite += OnManufacturerNameStringCharacteristicWrite;
            _ServiceBuilder = BluetoothManager.NewGattServiceBuilder().SetUuid(SERVICE_DEVICE_INFORMATION)
                              .SetServiceType(GattServiceType.Primary)
                              .AddCharacteristics(manufacturerNameStringCharacteristic);
        }
コード例 #5
0
 public KeyboardServiceWrapper(IBluetoothManager bluetoothManager)
 {
     BluetoothManager = bluetoothManager;
     KeyActionCharacteristicWrapper   = new KeyActionCharacteristicWrapper(this);
     MouseActionCharacteristicWrapper = new MouseActionCharacteristicWrapper(this);
     GattServerService = BluetoothManager.NewGattServiceBuilder()
                         .SetUuid(Guid)
                         .AddCharacteristics(KeyActionCharacteristicWrapper.GattServerCharacteristic)
                         .AddCharacteristics(MouseActionCharacteristicWrapper.GattServerCharacteristic)
                         .Build();
 }
コード例 #6
0
        public TestServiceWrapper(IBluetoothManager bluetoothManager)
        {
            IGattServiceBuilder builder = bluetoothManager.NewGattServiceBuilder();

            builder.SetUuid(SERVICE_UUID).SetServiceType(GattServiceType.Primary);
            TestCharacteristicWrapper          = new TestCharacteristicWrapper(bluetoothManager);
            KeepNotifyingCharacteristicWrapper = new KeepNotifyingCharacteristicWrapper(bluetoothManager);
            builder.AddCharacteristics(TestCharacteristicWrapper.GattServerCharacteristic);
            builder.AddCharacteristics(KeepNotifyingCharacteristicWrapper.GattServerCharacteristic);
            GattServerService = builder.Build();
        }
コード例 #7
0
        public TcpTranspondServiceWrapper(IBluetoothManager bluetoothManager)
        {
            BluetoothManager = bluetoothManager;
            TranspondCharacteristicWrapper = new TranspondCharacteristicWrapper(bluetoothManager);
            IGattServiceBuilder builder = bluetoothManager.NewGattServiceBuilder();

            GattServerService = builder.SetUuid(Uuid)
                                .AddCharacteristics(TranspondCharacteristicWrapper.GattServerCharacteristic)
                                .Build();
            TranspondCharacteristicWrapper.GattServerCharacteristic.OnRead  += GattServerCharacteristic_OnRead;
            TranspondCharacteristicWrapper.GattServerCharacteristic.OnWrite += GattServerCharacteristic_OnWrite;
            State     = TcpConnState.Created;
            TcpClient = new TcpClient();
        }
コード例 #8
0
        public TestGattServiceWrapper(IBluetoothManager bluetoothManager, Int32 shortUuid)
        {
            Name = "No Name M**********r";
            GattRequestViewModels     = new ObservableCollection <GattRequestViewModel>();
            BluetoothManager          = bluetoothManager;
            TestCharacteristicWrapper = new TestCharacteristicWrapper(bluetoothManager);

            IGattServiceBuilder builder = bluetoothManager.NewGattServiceBuilder();

            GattServerService = builder.SetUuid(BluetoothUtils.ShortValueUuid(shortUuid))
                                .AddCharacteristics(TestCharacteristicWrapper.GattServerCharacteristic)
                                .Build();

            TestCharacteristicWrapper.GattServerCharacteristic.OnWrite += _OnCharacteristicWrite;
            TestCharacteristicWrapper.GattServerCharacteristic.OnRead  += _OnCharacteristicRead;
            value = BitConverter.GetBytes(232);
        }