private DeviceReportNode BuildOutputNodes(string name, BindingCategory bindingCategory, List <IODescriptor> descriptors) { var bindings = new List <BindingReport>(); foreach (var ioDescriptor in descriptors) { bindings.Add(new BindingReport() { Title = ioDescriptor.Name, Category = bindingCategory, Path = $"{name} > {ioDescriptor.Name}", Blockable = false, BindingDescriptor = EspUtility.GetBindingDescriptor(bindingCategory, ioDescriptor.Value) }); } return(new DeviceReportNode() { Title = name, Bindings = bindings }); }
public void WriteOutput(OutputSubscriptionRequest subReq, BindingDescriptor bindingDescriptor, int state) { var subscribedDevice = _subscribedDevices[subReq.DeviceDescriptor.DeviceHandle]; switch (EspUtility.GetBindingCategory(bindingDescriptor)) { case BindingCategory.Momentary: subscribedDevice.DataMessage.SetButton(bindingDescriptor.Index, (short)state); break; case BindingCategory.Event: subscribedDevice.DataMessage.SetEvent(bindingDescriptor.Index, (short)state); break; case BindingCategory.Signed: case BindingCategory.Unsigned: subscribedDevice.DataMessage.SetAxis(bindingDescriptor.Index, (short)state); break; case BindingCategory.Delta: subscribedDevice.DataMessage.SetDelta(bindingDescriptor.Index, (short)state); break; } }