public static IObservable <IBleFlow> Create(IPeripheral peripheral, string serviceUuid, string txCharacteristicUuid, string rxCharacteristicUuid, byte endOfMessage) => Observable.FromAsync <IBleFlow>(async ct => { var chs = await peripheral.GetFlowCharacteristics(serviceUuid, txCharacteristicUuid, rxCharacteristicUuid); await chs.Rx.EnableNotifications(true); return(new NotifyBleFlow(chs.Tx, chs.Rx, endOfMessage)); });
public static IObservable <IBleFlow> Create(IPeripheral peripheral, string serviceUuid, string txCharacteristicUuid, string rxCharacteristicUuid, byte endOfMessage) => peripheral .GetFlowCharacteristics(serviceUuid, txCharacteristicUuid, rxCharacteristicUuid) .Select(chs => new ReadBleFlow(chs.Tx, chs.Rx, endOfMessage)) .Take(1);