public override void DeactivateOutput(string deviceId) { if (new Guid(deviceId) == Constants.Output1) { string url = this.Container.ConnectionManager.Uri.AbsoluteUri; // ex http://localhost:5000 string switchId = this.Container.SettingsManager.GetSetting(new DeviceSetting(Constants.Switch1, deviceId, null)).Value; string state = this.Container.SettingsManager.GetSetting(new DeviceSetting(Constants.Switch1Deactivated, deviceId, null)).Value; DeviceProxy proxy = new DeviceProxy(); Console.WriteLine("sending Dectivate..."); proxy.Send(url, switchId, state); Console.WriteLine("Dectivate sent."); Container.EventManager.NewEvent(deviceId, EventId.OutputDeactivated); return; } throw new MIPDriverException("E5 - Device does not support Output commands"); }
static void Main(string[] args) { string stateInput = "off"; string content = "{'state' : '" + stateInput + " '}"; content = content.Replace('\'', '"'); Console.WriteLine(content); var kvs = content.Split(new char[] { '{', '\'', '"', ' ', ':', '}' }, StringSplitOptions.RemoveEmptyEntries); string state = kvs[1]; Console.WriteLine(state); DeviceProxy proxy = new DeviceProxy(); Console.WriteLine("sending..."); proxy.Send("http://localhost:5000/", "Door2", "blue"); Console.WriteLine("sent."); string got = proxy.Get("http://localhost:5000/", "Door2"); Console.WriteLine(got); }