public void HandleGetPinsRequest(StreamSocket socket) { string stringResponse = ""; var gpio = new Pi2GpioLocal(); var pins = gpio.GetPinValues(); Pi2Pins restPins = new Pi2Pins() { Pins = new List<Pi2Pin>() }; foreach (var pin in pins.Pins) { restPins.Pins.Add(pin); } stringResponse = JsonConvert.SerializeObject(restPins); string header = Pi2GpioJson.GetOkResponseHeader(stringResponse.Length); // Write response to the socket using (IOutputStream output = socket.OutputStream) { StreamWriter sw = new StreamWriter(output.AsStreamForWrite()); sw.Write(header + stringResponse); sw.Flush(); } }
public void UpdatePinValues(Pi2Pins pins) { foreach (var pin in pins.Pins) { if (comboBoxGpioMap.ContainsKey(pin.Number)) { SetComboBox(pin); } } }