示例#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();
        }
        public GyroscopeServiceWrapper(IBluetoothManager bluetoothManager)
        {
            BluetoothManager = bluetoothManager;
            AngularVelocityCharacteristicWrapper = new GyroscopeAngularVelocityCharacteristicWrapper(this);
            IGattServiceBuilder builder = bluetoothManager.NewGattServiceBuilder();

            GattServerService = builder.SetUuid(Constant.GyroscopeServiceGuid)
                                .AddCharacteristics(AngularVelocityCharacteristicWrapper.GattServerCharacteristic)
                                .Build();
        }
示例#3
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();
        }
示例#4
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();
        }
        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);
        }