internal static void ExecuteShutterCommand(byte shutterAddr, ProtocolCommands cmd) { Switch.bus = new BusInterface(); bus.CreateHeader(DeviceCategories.DEV_CAT_MASTER, 0, DeviceCategories.DEV_CAT_SHUTTER, shutterAddr); bus.AppendPayload((byte)cmd); bus.SendPacket(); }
/// <summary> /// Sets a switch to the specified state /// If the switch cannot be set then throws a MethodNotImplementedException. /// A multi-value switch must throw a not implemented exception /// setting it to false will set it to its minimum value. /// </summary> /// <param name="id"></param> /// <param name="state"></param> public void SetSwitch(short id, bool state) { Switch.bus = new BusInterface(); Validate("SetSwitch", id); if (!CanWrite(id)) { var str = string.Format("SetSwitch({0}) - Cannot Write", id); tl.LogMessage("SetSwitch", str); throw new MethodNotImplementedException(str); } if (state == true) { if (id == 0) { //Commands to Open/Close the shutter OpenShutter(); _switches[1] = false; _switches[0] = true; } else if (id == 1) { CloseShutter(); _switches[0] = false; _switches[1] = true; } } //bus.PacketReceivedEvent += bus_PacketReceivedEvent; tl.LogMessage("SetSwitch", string.Format("SetSwitch({0}) = {1}", id, state)); //throw new MethodNotImplementedException("SetSwitch"); }