Пример #1
0
void nrf5UartProcess(void)
{
    while (app_usbd_event_queue_process())
    {
    }

    processConnection();
    processReceive();
    processTransmit();
}
Пример #2
0
//---------------------------------------------dropEvent
void QtIOWidget::dropEvent(QDropEvent* pEvent)
{
  const char* pAcceptDropFormat = getAcceptDropFormat();
  QByteArray aItemData = pEvent->mimeData()->data(pAcceptDropFormat);
  QDataStream aDataStream(&aItemData, QIODevice::ReadOnly);

  QtIOWidget* pIOWidget = NULL;
  aDataStream.readRawData(reinterpret_cast<char*>(&pIOWidget), sizeof(pIOWidget));

  processReceive(pIOWidget);
}
Пример #3
0
	    void SslConnection::handleProxyRead(const error_code &ec, size_t bytesTransferred)
        {
			auto self = shared_from_this();
            if (handleError(ec)) return;

            if (processReceive(bytesTransferred, true)) {
                _socket.async_handshake(ssl::stream_base::client, boost::bind(
                        &SslConnection::handleHandshake, this, pl::error));
            }
            else {
                _socket.next_layer().async_read_some(buffer(), boost::bind(
                        &SslConnection::handleProxyRead, this, pl::error, pl::bytes_transferred));
            }
		}
Пример #4
0
		void SslConnection::dataReceived(const error_code &ec, size_t bytesTransferred)
		{
			auto self = shared_from_this();
			if (ec) {
				/*
				if (ec.category() == asio::error::get_ssl_category() &&
					ec.value() == ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)) {
					_socket.lowest_layer().close();
				}
				*/
                handleError(ec);
				return;
            }

            if (processReceive(bytesTransferred)) return;

            _socket.async_read_some(buffer(), boost::bind(
                    &SslConnection::dataReceived, this, pl::error, pl::bytes_transferred));
		}
Пример #5
0
void pollNet()
{
	if (connectState != ConnectState::Connecting &&
		connectState != ConnectState::Connected) {
		return;
	}

	// wait for the connection to succeed
	ENetEvent evt;
	if (enet_host_service(client, &evt, 0) > 0) {
		switch (evt.type) {
		case ENET_EVENT_TYPE_CONNECT:
			processConnect(evt);
			break;

		case ENET_EVENT_TYPE_DISCONNECT:
			processDisconnect(evt);
			break;

		case ENET_EVENT_TYPE_RECEIVE:
			processReceive(evt);
			break;

		case ENET_EVENT_TYPE_NONE:
			// make the compiler shut up about unhandled enum value
			break;
		}
	}

	if (connectState == ConnectState::Connecting &&
		narf::time::now() >= connectTimeoutEnd) {
		narf::console->println("Connection attempt timed out"); // TODO: use to_string

		enet_peer_reset(server);
		// TODO: is server valid at this point? do we need to destroy it?
		server = nullptr;
		connectState = ConnectState::Unconnected;
	}
}
Пример #6
0
/*! Kliens módban indították el a programot, várja a parancsokat és válaszol
    valamint a billentyűparancsok alapján állítja a nyomás, hőmérséklet és hiba flag-et.
    @param clientAddr az eszköz címe, csak az erre a címre érkezett parancsokra válaszol
    @param fd a soros port kezelője
*/
void clientProcess(char clientAddr, int fd) {
    char key=0;
    clientAddress = clientAddr;
    fileHandle = fd;
    while(1) {  // vegtelen ciklus
        receiveByte(fd);  // soros port olvasas

        if (isReceivePacket()) // van feldolgozásra váró keret?
           processReceive();    // dolgozzuk fel

        refreshClientStatus();  // frissites

        key = get_a_key(); // billentyu leutes ellenorzese

        switch (key) {
            case 0 : continue;
            case ESC : return;  // kilepes
            case 'e' :
            case 'E' : ++clientTerm;  // homerseklet novelese
                continue;
            case 'x' :
            case 'X' : --clientTerm;    // homerseklet csokkentese
                continue;
            case 'r' :
            case 'R' : ++clientPressure; // nyomas novelese
                continue;
            case 'c' :
            case 'C' : -- clientPressure; // nyomas csokkentese
                continue;
            case 'h' :
            case 'H' : toggleErrorFlag(); // hiba flag váltás
                continue;

        }
    } // while
}
Пример #7
0
/**
 * Function documented in platform-cc2650.h
 */
void cc2650UartProcess(void)
{
    processReceive();
    processTransmit();
}
Пример #8
0
void samr21UartProcess(void)
{
    processReceive();
    processTransmit();
}
Пример #9
0
void nrf5UartProcess(void)
{
    processReceive();
    processTransmit();
}