Exemplo n.º 1
0
SyntroZigbeeGateway::SyntroZigbeeGateway(QSettings *settings, QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags), m_settings(settings)
{
	ui.setupUi(this);
	initStatusBar();
	initStatTable();

	loadNodeIDList();

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(ui.actionConnect, SIGNAL(triggered()), this, SLOT(onConnect()));
	connect(ui.actionDisconnect, SIGNAL(triggered()), this, SLOT(onDisconnect()));
	connect(ui.actionConfigure, SIGNAL(triggered()), this, SLOT(onConfigure()));

	ui.actionDisconnect->setEnabled(false);

	m_controller = NULL;
	m_refreshTimer = 0;

	m_client = new ZigbeeGWClient(this, settings);
	m_client->resumeThread();

	m_syntroStatusTimer = startTimer(3000);

	restoreWindowState();
}
Exemplo n.º 2
0
void Acceptor::block() throw ( ConfigError, RuntimeError )
{
  m_stop = false;
  onConfigure( m_settings );
  onInitialize( m_settings );

  startThread(this);
}
Exemplo n.º 3
0
void HttpServer::start() throw ( ConfigError, RuntimeError )
{
  m_stop = false;
  onConfigure( m_settings );
  onInitialize( m_settings );

  if( !thread_spawn( &startThread, this, m_threadid ) )
    throw RuntimeError("Unable to spawn thread");
}
Exemplo n.º 4
0
void Acceptor::block() throw ( ConfigError, RuntimeError )
{   QF_STACK_PUSH( Acceptor::start )

    m_stop = false;
    onConfigure( m_settings );
    onInitialize( m_settings );

    startThread(this);

    QF_STACK_POP
}
Exemplo n.º 5
0
bool Acceptor::poll( double timeout ) throw ( ConfigError, RuntimeError )
{
  if( m_firstPoll )
  {
    m_stop = false;
    onConfigure( m_settings );
    onInitialize( m_settings );
    m_firstPoll = false;
  }

  return onPoll( timeout );
}
Exemplo n.º 6
0
void
processEvents() {
	while (XPending(x_dpy)) {
		XEvent ev;
		XNextEvent(x_dpy, &ev);
		switch (ev.type) {
		case KeyPress:
		case KeyRelease:
			onKey(ev.xkey.window, ev.xkey.state, ev.xkey.keycode, ev.type == KeyPress ? 1 : 2);
			break;
		case ButtonPress:
		case ButtonRelease:
			onMouse(ev.xbutton.window, ev.xbutton.x, ev.xbutton.y, ev.xbutton.state, ev.xbutton.button,
				ev.type == ButtonPress ? 1 : 2);
			break;
		case MotionNotify:
			onMouse(ev.xmotion.window, ev.xmotion.x, ev.xmotion.y, ev.xmotion.state, 0, 0);
			break;
		case FocusIn:
		case FocusOut:
			onFocus(ev.xmotion.window, ev.type == FocusIn);
			break;
		case Expose:
			// A non-zero Count means that there are more expose events coming. For
			// example, a non-rectangular exposure (e.g. from a partially overlapped
			// window) will result in multiple expose events whose dirty rectangles
			// combine to define the dirty region. Go's paint events do not provide
			// dirty regions, so we only pass on the final X11 expose event.
			if (ev.xexpose.count == 0) {
				onExpose(ev.xexpose.window);
			}
			break;
		case ConfigureNotify:
			onConfigure(ev.xconfigure.window, ev.xconfigure.x, ev.xconfigure.y,
				ev.xconfigure.width, ev.xconfigure.height,
				DisplayWidth(x_dpy, DefaultScreen(x_dpy)),
				DisplayWidthMM(x_dpy, DefaultScreen(x_dpy)));
			break;
		case ClientMessage:
			if ((ev.xclient.message_type != wm_protocols) || (ev.xclient.format != 32)) {
				break;
			}
			Atom a = ev.xclient.data.l[0];
			if (a == wm_delete_window) {
				onDeleteWindow(ev.xclient.window);
			} else if (a == wm_take_focus) {
				XSetInputFocus(x_dpy, ev.xclient.window, RevertToParent, ev.xclient.data.l[1]);
			}
			break;
		}
	}
}
Exemplo n.º 7
0
void Acceptor::start() throw ( ConfigError, RuntimeError )
{   QF_STACK_PUSH( Acceptor::start )

    m_stop = false;
    onConfigure( m_settings );
    onInitialize( m_settings );

    HttpServer::startGlobal( m_settings );

    if( !thread_spawn( &startThread, this, m_threadid ) )
        throw RuntimeError("Unable to spawn thread");

    QF_STACK_POP
}
bool OSGDrawingArea::on_configure_event (GdkEventConfigure* pEvent)
{
#ifdef DEBUG
    //??std::cout <<"bool OSGDrawingArea::on_configure_event (GdkEventConfigure* pEvent)<<"<< std::endl;
#endif

    bool lRetVal = Gtk::DrawingArea::on_configure_event (pEvent);

    if (!beginGL ())
        return lRetVal;

    onConfigure (pEvent);

    endGL ();

#ifdef DEBUG
    //??std::cout <<"bool OSGDrawingArea::on_configure_event (GdkEventConfigure* pEvent)>>"<< std::endl;
#endif
    return lRetVal;
}