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";
            }
        }
Пример #2
0
 public void OpenSendOnClick()
 {
     if (ty_ip.text != "" && ty_port.text == "" && ty_order.text == "")
     {
         PJLinkConnection c  = new PJLinkConnection(ty_ip.text);
         PowerCommand     pc = new PowerCommand(Power.ON);
         c.sendCommandAsync(pc, OpenProjection);
     }
     else if (ty_ip.text != "" && ty_port.text != "" && ty_order.text == "")
     {
         PJLinkConnection c  = new PJLinkConnection(ty_ip.text, int.Parse(ty_port.text));
         PowerCommand     pc = new PowerCommand(Power.ON);
         c.sendCommandAsync(pc, OpenProjection);
     }
     else if (ty_ip.text != "" && ty_port.text == "" && ty_order.text != "")
     {
         PJLinkConnection c  = new PJLinkConnection(ty_ip.text, ty_order.text);
         PowerCommand     pc = new PowerCommand(Power.ON);
         c.sendCommandAsync(pc, OpenProjection);
     }
     else if (ty_ip.text != "" && ty_port.text == "" && ty_order.text == "")
     {
         PJLinkConnection c  = new PJLinkConnection(ty_ip.text, int.Parse(ty_port.text), ty_order.text);
         PowerCommand     pc = new PowerCommand(Power.ON);
         c.sendCommandAsync(pc, OpenProjection);
     }
 }
Пример #3
0
        public Projector(string p_strName, string p_strIP, string p_strLiftAssociation, string p_strCurrentSession, logLevel p_objLogLevel = logLevel.ErrorOnly)
        {
            projectorName            = p_strName;
            projectorIP              = p_strIP;
            projectorLiftAssociation = p_strLiftAssociation;
            m_objProjectorConnection = null;

            myDB        = new AutomationsEntities();
            m_objLogger = new Logger(ref myDB, p_strCurrentSession, p_objLogLevel, "Projector()");
        }
Пример #4
0
        private projectorConnectionStatus connectToProjector()
        {
            projectorConnectionStatus l_objConnectionStatus = projectorConnectionStatus.None;
            var l_strFunctionName = "connectToProjector()";
            var l_objStatus       = actionStatus.None;

            try
            {
                m_objLogger.logToMemory(string.Format("{0}: {1}: Is there already a connection to the projector? ", l_strFunctionName, projectorName), l_objStatus, false);
                if (m_objProjectorConnection == null)
                {
                    m_objLogger.logToMemory("N", l_objStatus);
                    m_objLogger.logToMemory(string.Format("{0}: {1}: Attempting to Connect to the projector", l_strFunctionName, projectorName), l_objStatus);

                    System.Net.IPAddress l_objAddress = null;

                    m_objLogger.logToMemory(string.Format("{0}: {1}: Checking the IP Address of the Projector", l_strFunctionName, projectorName), l_objStatus);
                    if (System.Net.IPAddress.TryParse(projectorIP, out l_objAddress))
                    {
                        m_objLogger.logToMemory(string.Format("{0}: {1}: Attempting to Connect to the projector", l_strFunctionName, projectorName), l_objStatus);

                        m_objProjectorConnection = new PJLinkConnection(projectorIP, "JBMIAProjectorLink");

                        l_objStatus = actionStatus.Success;
                        m_objLogger.logToMemory(string.Format("{0}: {1}: A Connection has been established!", l_strFunctionName, projectorName), l_objStatus);

                        l_objConnectionStatus = projectorConnectionStatus.Connected;
                    }
                    else
                    {
                        throw new Exception("Invalid IP Address Entered");
                    }
                }
                else
                {
                    l_objStatus = actionStatus.Success;
                    m_objLogger.logToMemory("Y", l_objStatus);
                    l_objConnectionStatus = projectorConnectionStatus.Connected;
                }
            }
            catch (Exception e)
            {
                l_objStatus = actionStatus.Error;
                m_objLogger.logToMemory(string.Format("{0}: {1}: Error Connecting to OR getting the status of the projector: {2}", l_strFunctionName, projectorName, e.ToString()), l_objStatus, true, true, l_strFunctionName);
                l_objConnectionStatus = projectorConnectionStatus.Error;
            }
            finally { m_objLogger.writePendingToDB(l_objStatus, p_strFunctionName: l_strFunctionName); }
            return(l_objConnectionStatus);
        }
Пример #5
0
 public void Open()
 {
     while (FacilityControl.Instance.sceneDatas[scene_num].projections.Count == 0)
     {
         scene_num++;
     }
     if ((type == ProjectionType.ONE && current_scene == scene_num) || type == ProjectionType.ALL)
     {
         PJLinkConnection c  = new PJLinkConnection(FacilityControl.Instance.sceneDatas[scene_num].projections[projections_num].ip);
         PowerCommand     pc = new PowerCommand(power);
         c.sendCommandAsync(pc, OpenProjection);
     }
     else
     {
     }
 }
Пример #6
0
        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();
        }
Пример #7
0
 public ProjectorApp()
 {
     link = new PJLinkConnection(host, password);
 }