Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
wxViscaControlPanel.cpp
1 #include "wxViscaControlPanel.h"
2 #include <Gui/StringConv.hh>
3 #include <wx/msgdlg.h>
4 
5 using namespace std;
6 using namespace BIAS;
7 
8 wxViscaControlPanel::wxViscaControlPanel( wxWindow* parent )
9 :
11 {
12  #ifdef WIN32
13  m_textCtrlDevice->SetValue(AsciiToWx("COM0"));
14  #endif
15  m_scrolledWindow1->Enable(false);
16 }
17 
18 void wxViscaControlPanel::OnScrollZoom( wxScrollEvent& event )
19 {
20  int step = viscaControl_.GetMaxZoom()/m_sliderZoom->GetMax();
21  cout<<"Setting zoom step:"<<step<<endl;
22  viscaControl_.ZoomDirect(short(m_sliderZoom->GetValue()*step));
23 }
24 
25 void wxViscaControlPanel::OnScrollPan( wxScrollEvent& event )
26 {
28  viscaControl_.MoveAbsolute((short)m_sliderPan->GetValue(),(short)m_sliderTilt->GetValue());
29 }
30 
31 void wxViscaControlPanel::OnScrollTilt( wxScrollEvent& event )
32 {
34  viscaControl_.MoveAbsolute((short)m_sliderPan->GetValue(),(short)m_sliderTilt->GetValue());
35 }
36 
37 void wxViscaControlPanel::OnButtonReset( wxCommandEvent& event )
38 {
40 }
41 
42 void wxViscaControlPanel::OnButtonTele( wxCommandEvent& event )
43 {
45 }
46 void wxViscaControlPanel::OnButtonWide( wxCommandEvent& event )
47 {
49 }
50 void wxViscaControlPanel::OnButtonStop( wxCommandEvent& event )
51 {
53 }
54 
55 
56 void wxViscaControlPanel::OnConnect( wxCommandEvent& event )
57 {
58  bool ret = false;
59 
61  wxString dev = m_textCtrlDevice->GetValue();
62  ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev));
63  if (!ret) {
64  wxMessageDialog messageDialog(this,
65  wxT("Initialising Visca pan-tilt unit failed!"),
66  wxT("Visca Controller"), wxICON_ERROR | wxOK);
67  messageDialog.ShowModal();
68  return;
69  }
70  }
71  else{
73  if (!ret) {
74  wxMessageDialog messageDialog(this,
75  wxT("Closing Visca pan-tilt unit failed!"),
76  wxT("Visca Controller"), wxICON_ERROR | wxOK);
77  messageDialog.ShowModal();
78  return;
79  }
80  }
81 
83  m_buttonConnect->SetLabel(AsciiToWx("Disconnect"));
84  m_scrolledWindow1->Enable(true);
85  wxString text= wxT("Connected!");
86  }
87  else{
88  m_buttonConnect->SetLabel(AsciiToWx("Connect"));
89  m_scrolledWindow1->Enable(false);
90  wxString text= wxT("Disonnected!");
91  }
92 }
93 
94 void wxViscaControlPanel::OnClose( wxCommandEvent& event )
95 {
96  Show(false);
97 }
98 
99 void wxViscaControlPanel::OnCloseCam( wxCommandEvent& event ){
101  viscaControl_.CamPower(false);
102  }
103 }
104 
105 void wxViscaControlPanel::OnOpenCam( wxCommandEvent& event ){
107  viscaControl_.CamPower(true);
108  }
109 }
110 
111 void wxViscaControlPanel::OnProgressive( wxCommandEvent& event ){
113  int sel = event.GetInt();
114  if(sel == 0){//interlaced
116  }
117  else if(sel == 1){ //progressive
119  }
120 
122  cout<<"CCD Scanning:"<<ret<<endl;
123 
124  }
125 }
void OnScrollPan(wxScrollEvent &event)
ViscaControl::VISCA_CONSTANT GetCCDScanningMode()
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
Definition: StringConv.hh:32
void ZoomDirect(short zoom)
void OnButtonReset(wxCommandEvent &event)
void MoveAbsolute(short panPos, short tiltPos)
void OnProgressive(wxCommandEvent &event)
void OnScrollTilt(wxScrollEvent &event)
void OnClose(wxCommandEvent &event)
void OnButtonTele(wxCommandEvent &event)
void OnConnect(wxCommandEvent &event)
void OnScrollZoom(wxScrollEvent &event)
void OnButtonStop(wxCommandEvent &event)
void OnButtonWide(wxCommandEvent &event)
void OnOpenCam(wxCommandEvent &event)
BIAS::ViscaControl viscaControl_
void CamPower(bool mode)
bool SetCCDScanningMode(VISCA_CONSTANT mode)
Class wxViscaControlPanelInterface.
void OnCloseCam(wxCommandEvent &event)
bool InitPanTiltUnit(std::string port)