private async Task <ButtplugMessage> HandleLinearCmd(ButtplugDeviceMessage aMsg) { var vis = from x in (aMsg as LinearCmd).Vectors where x.Index == 0 select x; if (!vis.Any()) { return(new Error("Invalid vibrator index!", Error.ErrorClass.ERROR_DEVICE, aMsg.Id)); } foreach (var vi in vis) { _manager.Linear2(this, vi.Duration, vi.Position); } return(new Ok(aMsg.Id)); }
private Task <ButtplugMessage> HandleLinearCmd(ButtplugDeviceMessage aMsg) { var vis = (aMsg as LinearCmd)?.Vectors?.Where(x => x.Index == 0).ToList(); if (!vis?.Any() ?? true) { return(Task.FromResult <ButtplugMessage>(new Error("Invalid vibrator index!", Error.ErrorClass.ERROR_DEVICE, aMsg.Id))); } foreach (var vi in vis) { _manager.Linear2(this, vi.Duration, vi.Position); } return(Task.FromResult <ButtplugMessage>(new Ok(aMsg.Id))); }