From 76f8f4a77717597a1a90d326d45559873ce14aab Mon Sep 17 00:00:00 2001 From: Filip Strajnar Date: Wed, 25 Sep 2024 19:30:10 +0200 Subject: [PATCH] Created PinValueModel. --- Proculite.GpioRest/Models/PinValueModel.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Proculite.GpioRest/Models/PinValueModel.cs diff --git a/Proculite.GpioRest/Models/PinValueModel.cs b/Proculite.GpioRest/Models/PinValueModel.cs new file mode 100644 index 0000000..1767b67 --- /dev/null +++ b/Proculite.GpioRest/Models/PinValueModel.cs @@ -0,0 +1,14 @@ +using System.Device.Gpio; +using System.Text.Json.Serialization; + +namespace Proculite.GpioRest.Models +{ + public class PinValueModel(int pinNumber, PinValue pinValue) + { + public int PinNumber { get; set; } = pinNumber; + + [JsonIgnore] + public PinValue PinValue { get; set; } = pinValue; + public int Value => PinValue == PinValue.High ? 1 : 0; + } +}