本文整理汇总了C++中SerialPort::GetSerialPortList方法的典型用法代码示例。如果您正苦于以下问题:C++ SerialPort::GetSerialPortList方法的具体用法?C++ SerialPort::GetSerialPortList怎么用?C++ SerialPort::GetSerialPortList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerialPort
的用法示例。
在下文中一共展示了SerialPort::GetSerialPortList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ERROR_INFO
LEWebcamDialog::LEWebcamDialog(wxWindow *parent, CVVidCapture *vc)
: wxDialog(parent, wxID_ANY, _("Serial LE Webcam"))
{
m_pVidCap = vc;
wxBoxSizer *pHSizer = new wxBoxSizer(wxHORIZONTAL);
wxStaticText *pPortLabel = new wxStaticText(this, wxID_ANY, _("LE Port"));
pHSizer->Add(pPortLabel, wxSizerFlags().Border(wxRIGHT | wxLEFT, 10));
try
{
SerialPort *pSerialPort = SerialPort::SerialPortFactory();
if (!pSerialPort)
{
throw ERROR_INFO("LESerialWebcamClass::Connect: serial port is NULL");
}
wxArrayString serialPorts = pSerialPort->GetSerialPortList();
if (serialPorts.IsEmpty())
{
wxMessageBox(_("No serial ports found"),_("Error"), wxOK | wxICON_ERROR);
throw ERROR_INFO("No Serial port found");
}
wxString lastSerialPort = pConfig->Profile.GetString("/camera/serialLEWebcam/serialport", "");
int resp = serialPorts.Index(lastSerialPort);
m_pPortNum = new wxChoice(this, wxID_ANY,wxDefaultPosition,
wxDefaultSize, serialPorts );
m_pPortNum->SetSelection(resp);
pHSizer->Add(m_pPortNum, wxSizerFlags().Border(wxRIGHT | wxLEFT, 10).Expand());
delete pSerialPort;
}
catch (wxString Msg)
{
POSSIBLY_UNUSED(Msg);
}
int signal_config = pConfig->Profile.GetInt("/camera/serialLEWebcam/SignalConfig", LE_DEFAULT);
wxFlexGridSizer *pSignalSizer = new wxFlexGridSizer(6, 3, 5, 15);
pSignalSizer->Add(new wxStaticText(this, wxID_ANY, _("Port pins")));
pSignalSizer->Add(new wxStaticText(this, wxID_ANY, _T("DTR")));
pSignalSizer->Add(new wxStaticText(this, wxID_ANY, _T("CTS")));
pSignalSizer->Add(new wxStaticText(this, wxID_ANY, _T("LE Mask")));
m_pLEMaskDTR = new wxCheckBox(this, wxID_ANY, _T(""));
m_pLEMaskDTR->SetValue(signal_config & LE_MASK_DTR ? true : false);
pSignalSizer->Add(m_pLEMaskDTR, wxSizerFlags().Center());
m_pLEMaskRTS = new wxCheckBox(this, wxID_ANY, _T(""));
m_pLEMaskRTS->SetValue(signal_config & LE_MASK_RTS ? true : false);
pSignalSizer->Add(m_pLEMaskRTS, wxSizerFlags().Center());
//pSignalSizer->Add(new wxStaticText(this, wxID_ANY, _T("LE Init")));
//m_pLEInitDTR = new wxCheckBox(this, wxID_ANY, _T(""));
//m_pLEInitDTR->SetValue(signal_config & LE_INIT_DTR ? true : false);
//pSignalSizer->Add(m_pLEInitDTR, wxSizerFlags().Center());
//m_pLEInitRTS = new wxCheckBox(this, wxID_ANY, _T(""));
//m_pLEInitRTS->SetValue(signal_config & LE_INIT_RTS ? true : false);
//pSignalSizer->Add(m_pLEInitRTS, wxSizerFlags().Center());
pSignalSizer->Add(new wxStaticText(this, wxID_ANY, _T("LE Expo")));
m_pLEExpoDTR = new wxCheckBox(this, wxID_ANY, _T(""));
m_pLEExpoDTR->SetValue(signal_config & LE_EXPO_DTR ? true : false);
pSignalSizer->Add(m_pLEExpoDTR, wxSizerFlags().Center());
m_pLEExpoRTS = new wxCheckBox(this, wxID_ANY, _T(""));
m_pLEExpoRTS->SetValue(signal_config & LE_EXPO_RTS ? true : false);
pSignalSizer->Add(m_pLEExpoRTS, wxSizerFlags().Center());
pSignalSizer->Add(new wxStaticText(this, wxID_ANY, _T("LE Amp")));
m_pLEAmpDTR = new wxCheckBox(this, wxID_ANY, _T(""));
m_pLEAmpDTR->SetValue(signal_config & LE_AMP_DTR ? true : false);
pSignalSizer->Add(m_pLEAmpDTR, wxSizerFlags().Center());
m_pLEAmpRTS = new wxCheckBox(this, wxID_ANY, _T(""));
m_pLEAmpRTS->SetValue(signal_config & LE_AMP_RTS ? true : false);
pSignalSizer->Add(m_pLEAmpRTS, wxSizerFlags().Center());
m_pInvertedLogic = new wxCheckBox(this, wxID_ANY, _("Inverted logic"));
m_pInvertedLogic->SetValue(pConfig->Profile.GetBoolean("/camera/serialLEWebcam/InvertedLogic", true));
m_pUseAmp = new wxCheckBox(this, wxID_ANY, _("Use Amp"));
m_pUseAmp->SetValue(pConfig->Profile.GetBoolean("/camera/serialLEWebcam/UseAmp", false));
wxBoxSizer *pVSizer = new wxBoxSizer(wxVERTICAL);
pVSizer->Add(pHSizer, wxSizerFlags().Border(wxTOP | wxBOTTOM, 10).Expand());
pVSizer->Add(pSignalSizer, wxSizerFlags().Border(wxALL, 10).Expand());
pVSizer->Add(m_pInvertedLogic, wxSizerFlags().Border(wxRIGHT | wxLEFT, 10));
pVSizer->Add(m_pUseAmp, wxSizerFlags().Border(wxTOP | wxRIGHT | wxLEFT, 10));
pHSizer = new wxBoxSizer(wxHORIZONTAL);
wxButton *pBtnDefault = new wxButton(this, wxID_DEFAULT, _("Defaults"));
pHSizer->Add(pBtnDefault);
if (m_pVidCap)
{
wxButton *pBtnVidCap = new wxButton(this, wxID_CONVERT, _("Webcam settings"));
pHSizer ->Add(pBtnVidCap, wxSizerFlags().Border(wxLEFT, 10));
}
pVSizer->Add(pHSizer, wxSizerFlags().Border(wxALL, 10));
//.........这里部分代码省略.........