private void connect_Click(object sender, EventArgs e) { System.Net.IPAddress address = null; if (System.Net.IPAddress.TryParse(ipAddress.Text, out address)) { Status.Text = "Connecting to " + address.ToString(); c = new PJLinkConnection(ipAddress.Text, "JBMIAProjectorLink"); LampStatusCommand l = new LampStatusCommand(); int hours = l.getHoursOfLamp(1); string status = l.getStatusOfLamp(1).ToString(); string power = c.powerQuery().ToString(); ProjectorInfo pi = new ProjectorInfo(); Status.Text = "Connected. \n Projector is now: " + power + "\n" + "\nstatus: " + status + "\nlamphours: " + hours; Status.Text += "\nFan:" + pi.FanStatus; Status.Text += " Lamp:" + pi.LampStatus; Status.Text += " Input:" + pi.Input; Status.Text += "\nCover:" + pi.CoverStatus; Status.Text += " Filter:" + pi.FilterStatus; Status.Text += " NumLamps:" + pi.NumOfLamps; Status.Text += "\nOthers:" + pi.PowerStatus; } else { Status.Text = "Invalid IP Address Entered"; } }
static void Main(string[] args) { AmplifierInfo amplifier = new AmplifierInfo("AmplifierInfo"); TunerInfo tuner = new TunerInfo("TunerInfo"); DVDPlayerInfo dvdPlayer = new DVDPlayerInfo("DVDPlayerInfo"); CDPlayerInfo cdPlayer = new CDPlayerInfo("CDPlayerInfo"); ProjectorInfo projector = new ProjectorInfo("ProjectorInfo"); TheaterLightInfo light = new TheaterLightInfo("TheaterLightInfo"); ScreenInfo screen = new ScreenInfo("ScreenInfo"); PopcornPopperInfo popper = new PopcornPopperInfo("PopcornPopperInfo"); HomeTheaterInfo homeTheater = new HomeTheaterInfo(amplifier, tuner, dvdPlayer, cdPlayer, projector, screen, light, popper); homeTheater.WatchMovie("Move 123"); Console.WriteLine(); homeTheater.EndMovie(); Console.WriteLine(); homeTheater.ListenToCD("CD 123"); Console.WriteLine(); homeTheater.EndCD(); Console.WriteLine(); homeTheater.ListenToRadio(12.34); Console.WriteLine(); homeTheater.EndRadio(); Console.WriteLine(); Console.ReadLine(); }
public ProjectorDeviceInfo(ProjectorInfo projectorInfo, string portName) { ProjectorDeviceType = projectorInfo.ProjectorDeviceType; HeaderName = projectorInfo.ProjectorHeaderName; DeviceNumber = projectorInfo.DeviceNumber; UpdatePortName(portName); InitEditCommand(); InitPowerOnCommand(); InitPowerOffCommand(); InitOpenLogFileCommand(); }
public string printProjectorStatus() { StringBuilder p_objProgress = new StringBuilder(); var l_strFunctionName = "printProjectorStatus()"; try { if (m_objProjectorConnection == null) { connectToProjector(); //Connect now if not connected } p_objProgress.AppendLine("Attempting to Print the Projector Status"); LampStatusCommand l_objLamp = new LampStatusCommand(); string l_strLampStatus = l_objLamp.getStatusOfLamp(1).ToString(); var l_objConnectionStatus = connectToProjector(); string l_strPower = m_objProjectorConnection.powerQuery().ToString(); ProjectorInfo l_objProjectorInfo = new ProjectorInfo(); p_objProgress.AppendLine("Connection Status: Connected"); p_objProgress.AppendLine(""); p_objProgress.AppendLine("Power Status: " + l_strPower); p_objProgress.AppendLine("Fan Status: " + l_objProjectorInfo.FanStatus); p_objProgress.AppendLine("Lamp Status: " + l_objProjectorInfo.LampStatus); p_objProgress.AppendLine("Current Source Input: " + l_objProjectorInfo.Input); p_objProgress.AppendLine("Cover Status: " + l_objProjectorInfo.CoverStatus); p_objProgress.AppendLine("Filter Status: " + l_objProjectorInfo.FilterStatus); p_objProgress.AppendLine("Current Lamp Status: " + l_strLampStatus); p_objProgress.AppendLine(""); } catch (Exception e) { //Writes the error to the DB then throws the error up. throw new Exception(m_objLogger.logToDB(string.Format("{1}: {2}: Error Printing the Projector Status: {2}.", l_strFunctionName, projectorName, e.ToString()), actionStatus.Error, true, p_strFunctionName: "printProjectorStatus()")); } finally { m_objLogger.writePendingToDB(p_strFunctionName: l_strFunctionName); } return(p_objProgress.ToString()); }
static void Main(string[] args) { PJLinkConnection c = new PJLinkConnection("192.168.1.14", "rv"); //shortcuts //c.turnOn(); //System.Console.WriteLine(c.getProjectorInfo()); //detailed command calls //PowerCommand pc1 = new PowerCommand(PowerCommand.Powr.QUERY); //if (c.sendCommand(pc1) == Command.Response.SUCCESS) // Console.WriteLine("Projector is " + pc1.Status.ToString()); //else // Console.WriteLine("Communication Error"); //PowerCommand pc2 = new PowerCommand(PowerCommand.Powr.ON); //if (c.sendCommand(pc2) == Command.Response.SUCCESS) // Console.WriteLine("Switching on successful"); //else // Console.WriteLine("Communication Error"); //PowerCommand pc3 = new PowerCommand(PowerCommand.Powr.QUERY); //if (c.sendCommand(pc3) == Command.Response.SUCCESS) // Console.WriteLine("Projector is " + pc3.Status.ToString()); //else // Console.WriteLine("Communication Error"); //ErrorStatusCommand esc = new ErrorStatusCommand(); //if (c.sendCommand(esc) == Command.Response.SUCCESS) // Console.WriteLine(esc.dumpToString()); //else // Console.WriteLine("Communication Error"); //LampStatusCommand lsc = new LampStatusCommand(); //if (c.sendCommand(lsc) == Command.Response.SUCCESS) // Console.WriteLine(lsc.dumpToString()); //else // Console.WriteLine("Communication Error"); //ProjectorNameCommand pnc = new ProjectorNameCommand(); //if (c.sendCommand(pnc) == Command.Response.SUCCESS) // Console.WriteLine(pnc.dumpToString()); //else // Console.WriteLine("Communication Error"); //ManufacturerNameCommand mnc = new ManufacturerNameCommand(); //if (c.sendCommand(mnc) == Command.Response.SUCCESS) // Console.WriteLine(mnc.dumpToString()); //else // Console.WriteLine("Communication Error"); //ProductNameCommand prnc = new ProductNameCommand(); //if (c.sendCommand(prnc) == Command.Response.SUCCESS) // Console.WriteLine(prnc.dumpToString()); //else // Console.WriteLine("Communication Error"); //OtherInfoCommand oic = new OtherInfoCommand(); //if (c.sendCommand(oic) == Command.Response.SUCCESS) // Console.WriteLine(oic.dumpToString()); //else // Console.WriteLine("Communication Error"); //InputCommand ic1 = new InputCommand(); //if (c.sendCommand(ic1) == Command.Response.SUCCESS) // Console.WriteLine(ic1.dumpToString()); //else // Console.WriteLine("Communication Error"); //InputCommand ic2 = new InputCommand(InputCommand.InputType.RGB, 2); //if (c.sendCommand(ic2) == Command.Response.SUCCESS) // Console.WriteLine(ic2.dumpToString()); //else // Console.WriteLine("Communication Error"); ProjectorInfo pi = ProjectorInfo.create(c); string s = pi.toXmlString(); Console.WriteLine(s); Console.ReadKey(); }
public ProjectorDetailDeviceSettings(ProjectorInfo projectorInfo) { ProjectorDeviceType = projectorInfo.ProjectorDeviceType; HeaderName = projectorInfo.ProjectorHeaderName; DeviceNumber = projectorInfo.DeviceNumber; }
public void AddDetailDevice(ProjectorInfo projectorInfo) { ProjectorDetailDevicesSettings.Add(new ProjectorDetailDeviceSettings(projectorInfo)); }