private void SendProjCmd(MonitorConfig mc, ProjectorCommand pc)
 {
     try
     {
         //send the command
         if (mc.m_displayconnectionenabled == false)
         {
             DebugLogger.Instance().LogWarning("Display connection not enabled");
             return;
         }
         //Find the driver
         DeviceDriver driver = UVDLPApp.Instance().m_deviceinterface.FindProjDriverByComName(mc.m_displayconnection.comname);
         if (driver == null)
         {
             DebugLogger.Instance().LogError("Driver not found");
             return;
         }
         if (driver.Connected == true)
         {
             //send the command.
             driver.Write(pc.GetBytes(), pc.GetBytes().Length);
         }
         else
         {
             DebugLogger.Instance().LogError("Driver not connected");
             return;
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex);
     }
 }
Пример #2
0
 public bool SendCommandToDevice(String command)
 {
     UVDLPApp.Instance().m_callbackhandler.Activate("cmdLogGcode", this, command);
     try
     {
         lock (lockobj)
         {
             // this could be the source of the lock
             if (m_driver.Write(command) > 0)
             {
                 if (AlwaysReady) // relys more on timing
                 {
                     m_ready = true;
                 }
                 else
                 {
                     m_ready = false;
                 }
                 return(true);
             }
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #3
0
 public bool SendCommandToDevice(String command)
 {
     try
     {
         lock (lockobj)
         {
             // this could be the source of the lock
             if (m_driver.Write(command) > 0)
             {
                 if (AlwaysReady) // relys more on timing
                 {
                     m_ready = true;
                 }
                 else
                 {
                     m_ready = false;
                 }
                 return(true);
             }
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool SendCommandToDevice(String command)
 {
     try
     {
         if (m_driver.Write(command) > 0)
         {
             //start a timer
             m_timeouttimer.Enabled = true;
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool SendCommandToDevice(String command)
 {
     try
     {
         lock (lockobj)
         {
             // this could be the source of the lock
             if (m_driver.Write(command) > 0)
             {
                 m_ready = false;
                 return(true);
             }
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool SendProjCommand(string displayname, string commandname)
 {
     try
     {
         // get the projector command for 'on'
         // ACER_ON
         ProjectorCommand pcmd = UVDLPApp.Instance().m_proj_cmd_lst.FindByName(commandname);
         if (pcmd != null)
         {
             DeviceDriver dd = DisplayManager.Instance().FindDisplaySerialPortDriverByName(displayname);
             if (dd != null)
             {
                 if (dd.Connected)
                 {
                     byte[] data = pcmd.GetBytes();
                     dd.Write(data, data.Length);
                     return(true);
                 }
                 else
                 {
                     DebugLogger.Instance().LogError("Projector Driver not connected");
                 }
             }
             else
             {
                 DebugLogger.Instance().LogError("Projector Driver not found");
             }
         }
         else
         {
             DebugLogger.Instance().LogError("Projector command not found");
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex);
     }
     return(false);
 }
 private void cmdSendProj_Click(object sender, EventArgs e)
 {
     try
     {
         // get the index from the combo box
         int idx = cmbCommands.SelectedIndex;
         if (idx == -1)
         {
             return;
         }
         ProjectorCommand cmd = UVDLPApp.Instance().m_proj_cmd_lst.m_commands[idx];
         byte[]           dat = cmd.GetBytes();
         if (dat != null)
         {
             int idx2 = cmbDisplays.SelectedIndex;
             if (idx2 == -1)
             {
                 return;
             }
             MonitorConfig mc = UVDLPApp.Instance().m_printerinfo.m_lstMonitorconfigs[idx2];
             //mc.m_displayconnection.
             //get the correct projector driver
             DeviceDriver prjdrv = UVDLPApp.Instance().m_deviceinterface.GetDriver(idx2);
             if (prjdrv.Connected)
             {
                 prjdrv.Write(dat, dat.Length); // write it
             }
             else
             {
                 MessageBox.Show("Projector Driver Not connected");
             }
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
 }