Ejemplo n.º 1
0
/*
 * Method:    OnChildError()
 * Purpose:   called when a child window is reporting an error to the user
 * Comments:  none
 */
void CMainWindow::OnChildError(const wchar_t* aMessage,tPvErr aErr)
{
    // append a custom event
    CErrorEvent lEvent(aMessage,aErr);
    lEvent.SetEventObject(this);
    GetEventHandler()->AddPendingEvent(lEvent);
}
Ejemplo n.º 2
0
    void Reactor::TheadCallback() {

        while (mbRunning && mpEpollObject && mpEpollEvents) {
            try {
                //Wait
                int nfds = mpEpollObject->Wait(&mpEpollEvents[0], mnMaxNumOfSocket);
                //accept this client one by one
                for (int i = 0; i < nfds; i++) {
                    Event lEvent(mpEpollEvents[i], nullptr,this);
                    mpThreadPool->AddItem(lEvent);
                }

            } catch (EpollExceptionWaitFailed& e) {

                //If it is system call interrupt then continue
                if (e.GetErrorNo() == EINTR)
                    continue;

                //Else Exit this thread,
                //Log the reason to exit the thread
                mbRunning = false;
                break;
            } catch (std::exception& e) {
                //Log the reason
                //Continue
            }
        }
    }
Ejemplo n.º 3
0
/*
 * Method:    CMainWindow()
 * Purpose:   constructor
 * Comments:  none
 */
CMainWindow::CMainWindow()
    : wxFrame(NULL,dMAINWINDOW,gMainWindowTitle,wxDefaultPosition,wxSize(250,350),
              wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
{
    // Give it an icon
    SetIcon(wxIcon(SampleViewer));

    iSeeking = NULL;

    iMenuBar = new wxMenuBar;
    if(iMenuBar)
    {
        #ifndef __WXMAC__
        wxMenu* lMenu = new wxMenu;
        if(lMenu)
        {
            lMenu->Append(ID_ABOUT,L"&About ...");
            lMenu->AppendSeparator();
            lMenu->Append(ID_QUIT,L"E&xit");
           
            iMenuBar->Append(lMenu,L"&File");
        }

        iMenuWin = new wxMenu;
        if(iMenuWin)
        {
            iMenuWin->Append(ID_RAISE,L"&Show all");
            iMenuWin->Append(ID_CLOSE,L"&Close all");
            iMenuWin->AppendSeparator();
            iMenuBar->Append(iMenuWin,L"&Windows");

            iMenuWin->Enable(ID_RAISE,false);
            iMenuWin->Enable(ID_CLOSE,false);
        }
        #endif

        SetMenuBar(iMenuBar);
        CreateStatusBar();

        // create the tool barCTreeItemData
        iToolBar = CreateToolBar();
        if(iToolBar)
        {
            // fill the toolbar
            iToolBar->AddTool(ID_INFO,_T("info"),wxBitmap(bitmap1),_T("Information"));
            iToolBar->AddTool(ID_CTRL,_T("ctrl"),wxBitmap(bitmap2),_T("Controls"));
            iToolBar->AddTool(ID_LIVE,_T("live"),wxBitmap(bitmap3),_T("Live view"));
            iToolBar->AddTool(ID_SEEK,_T("seek"),wxBitmap(bitmap7),_T("Seek a camera"));
            iToolBar->AddTool(ID_EXPO,_T("expo"),wxBitmap(bitmap8),_T("Export camera's setup"));
            iToolBar->AddTool(ID_EVNT,_T("evnt"),wxBitmap(bitmap9),_T("Events view"));
            iToolBar->AddTool(ID_SRIO,_T("evnt"),wxBitmap(bitmap10),_T("Serial IO shell"));
            iToolBar->Realize();
            
        }

        // creat the cameras tree
        iTree = new wxTreeCtrl(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTR_HAS_BUTTONS | wxTR_SINGLE);
        if(iTree)
            iRoot = iTree->AddRoot(_T("Host"));

        // append a custom event to simuate a post-on-screen event
        wxCommandEvent lEvent(dOPENING,GetId());
        lEvent.SetEventObject(this);
        GetEventHandler()->AddPendingEvent(lEvent);
    }
}