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); }
public void Notify(string text) { TestCharacteristicWrapper.GattServerCharacteristic.Value = Encoding.UTF8.GetBytes(text); TestCharacteristicWrapper.NotifyAll(); }