public override Task WriteValueAsyncInternal(byte[] aValue, ButtplugDeviceWriteOptions aOptions, CancellationToken aToken = default(CancellationToken)) { LastWritten.Add(new WriteData() { Value = (byte[])aValue.Clone(), Endpoint = aOptions.Endpoint, WriteWithResponse = aOptions.WriteWithResponse, }); ValueWritten?.Invoke(this, new EventArgs()); try { var valueStr = Encoding.UTF8.GetString(aValue, 0, aValue.Length); if (ExpectedNotify.ContainsKey(valueStr)) { InvokeDataReceived(new ButtplugDeviceDataEventArgs("tx", ExpectedNotify[valueStr])); } } catch { // noop. } return(Task.CompletedTask); }
public Task <ButtplugMessage> WriteValueAsync(uint aMsgId, uint aCharacteristic, byte[] aValue, bool aWriteWithResponse, CancellationToken aToken) { LastWritten.Add(new WriteData() { Value = (byte[])aValue.Clone(), MsgId = aMsgId, Characteristic = aCharacteristic, WriteWithResponse = aWriteWithResponse, }); ValueWritten?.Invoke(this, new EventArgs()); return(Task.FromResult <ButtplugMessage>(new Ok(aMsgId))); }
public override Task WriteValueAsyncInternal(byte[] aValue, ButtplugDeviceWriteOptions aOptions, CancellationToken aToken = default(CancellationToken)) { LastWritten.Add(new WriteData() { Value = (byte[])aValue.Clone(), Endpoint = aOptions.Endpoint, WriteWithResponse = aOptions.WriteWithResponse, }); ValueWritten?.Invoke(this, new EventArgs()); return(Task.CompletedTask); }
public void Write(bool advanceCursor = true, params T[] vals) { if (vals.Length == 0) { return; } var curX = CursorX.Value; var curY = CursorY.Value; _raisePosChanged = false; foreach (var ele in vals) { _buffer[CurrentPos()] = ele; MoveRight(); } ValueWritten?.Invoke(this, vals); if (!advanceCursor) { CursorX.Value = curX; CursorY.Value = curY; } RaisePosChanged(); _raisePosChanged = true; }
private void RaiseValueWritten() => ValueWritten?.Invoke(this, EventArgs.Empty);