예제 #1
0
    void PathDisplay::setColor(const Ogre::ColourValue& color)
    {
        color_ = color;

        processMessage(current_message_);
        causeRender();
    }
예제 #2
0
void Server::processMessageGroup(QString message_gr, quint32 ipaddr)
{
    QStringList message_list = message_gr.split("\r\n", QString::KeepEmptyParts);
    for(int i=0; i<message_list.size(); i++) {
        processMessage(message_list.at(i), ipaddr);
    }
}
예제 #3
0
void Socket::processingLoop() {
    while (connected) {
        std::unique_lock<std::mutex> lock(processingMutex);
        while (connected && processingQueue.empty()) processingCondition.wait(lock);

        if (connected) {
            char *buffer = processingQueue.back();
            processingQueue.pop_back();
            lock.unlock();

            std::unique_lock<std::mutex> handlerLock(handlerSwapMutex);
            while (handlerSwapping) handlerSwapProcessingCondition.wait(handlerLock);
            handlerLock.unlock();

            activeProcessingCount++;

            processMessage(buffer);
            free(buffer);

            activeProcessingCount--;
            handlerSwapCondition.notify_all();
        } else {
            lock.unlock();
        }
    }
}
예제 #4
0
// =====================================================================
//                          QWebSocket
// =====================================================================
void CWebSocketServer::onNewConnection()
{
    qDebug() << "CWebSocketServer : New Connection";
    QWebSocket *pSocket = m_pWebSocketServer->nextPendingConnection();
    if (!pSocket) return;

    m_clients.insert(pSocket, m_client_count);
    m_clients_rev.insert(m_client_count, pSocket);

    connect(pSocket, SIGNAL(textMessageReceived(QString)), this, SLOT(processMessage(QString)));
    connect(pSocket, SIGNAL(binaryMessageReceived(QByteArray)), this, SLOT(processMessage(QByteArray)));
    connect(pSocket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));

    emit connected(m_client_count);
    m_client_count++;
}
예제 #5
0
void AVReceiver::dataGet(std::string msg)
{
    if (msg.find('\n') == std::string::npos &&
        msg.find('\r') == std::string::npos)
    {
        //We have not a complete paquet yet, buffurize it.
        recv_buffer += msg;

        cDebugDom("output") << "Bufferize data.";

        return;
    }

    if (!recv_buffer.empty())
    {
        //Put last data in buffer
        recv_buffer += msg;
        msg = recv_buffer;
        recv_buffer.clear();
    }

    replace_str(msg, "\r\n", "\n");
    replace_str(msg, "\r", "\n");

    std::vector<std::string> tokens;
    Utils::split(msg, tokens, "\n");

    cDebugDom("output") << "Got " << tokens.size() << " messages.";

    for(uint i = 0; i < tokens.size(); i++)
        processMessage(tokens[i]);
}
void RenderWindow::repaint() {
    D("Entering\n");
    RenderWindowMessage msg;
    msg.cmd = CMD_REPAINT;
    (void) processMessage(msg);
    D("Exiting\n");
}
예제 #7
0
    void GridCellsDisplay::setColor(const Ogre::ColourValue& color)
    {
        this->color = color;

        processMessage(current_message_);
        causeRender();
    }
예제 #8
0
void ClientNetwork::readData()
{
    char msg[1024];
    memset(msg, 0, 1024);
    int len = clientSocket->read(msg, 1024);
    emit processMessage(msg, len);
}
예제 #9
0
파일: network.cpp 프로젝트: ffloyd/ds_simul
void Network::nextTick()
{
	// Перекладываем все сообщения в temp_queue, чтобы не начать обрабатывать сообщения следующего тика
	queue<Message> temp_queue;

	while(!message_queue.empty()) {
	    temp_queue.push(message_queue.front());
	    message_queue.pop();
	}

	applyInstability();

	if (temp_queue.empty())
	{
		idle_ticks++;
	}
	else
	{
		idle_ticks = 0;
		while(!temp_queue.empty()) {
		    processMessage(temp_queue.front());
		    temp_queue.pop();
		}
	}

	runIdleCalls();
}
예제 #10
0
파일: network.cpp 프로젝트: ffloyd/ds_simul
void Network::runIdleCalls()
{
	for (int process_id = 0; process_id < processes.size(); ++process_id)
	{
		processMessage(Message(process_id));
	}
}
예제 #11
0
void Connection::readyReadHandler()
{
    while (true) {
        size_t fileDescriptorsCount = 0;
        size_t bytesToRead = m_readBuffer.size() - m_readBufferSize;
        ssize_t bytesRead = readBytesFromSocket(m_socketDescriptor, m_readBuffer.data() + m_readBufferSize, bytesToRead,
                                                m_fileDescriptors.data() + m_fileDescriptorsSize, &fileDescriptorsCount);

        if (bytesRead < 0) {
            // EINTR was already handled by readBytesFromSocket.
            if (errno == EAGAIN || errno == EWOULDBLOCK)
                return;

            if (m_isConnected) {
                WTFLogAlways("Error receiving IPC message on socket %d in process %d: %s", m_socketDescriptor, getpid(), strerror(errno));
                connectionDidClose();
            }
            return;
        }

        m_readBufferSize += bytesRead;
        m_fileDescriptorsSize += fileDescriptorsCount;

        if (!bytesRead) {
            connectionDidClose();
            return;
        }

        // Process messages from data received.
        while (true) {
            if (!processMessage())
                break;
        }
    }
}
예제 #12
0
파일: C_GetTime.cpp 프로젝트: Raxtion/CT82
void C_GetTime::waitFor( void )
{
  do
  {
    if( _timeSlice == true ) processMessage();
  } while( !timeUp() );
}
예제 #13
0
void MessageProcessor::processSocket()
{
    char* msg = zstr_recv(zmqSocket_);
    if (msg == nullptr) {
        Log::Error("zeromq recv() failed\n");
        return;
    }
    std::string requestString(msg);
    zstr_free(&msg);

    std::string responseString;

    bool error = processMessage(requestString, responseString);

    if (error) {
        responseString = "";
    }

    int rc = zstr_send(zmqSocket_, responseString.c_str());

    if (rc != 0) {
        Log::vError("MessageProcessor: failed to send response\n"
                    "request:\n%s\n\n"
                    "response:\n%s\n\n",
                    requestString.c_str(), responseString.c_str());
    }
}
void RenderWindow::setRotation(float zRot) {
    D("Entering rotation=%f\n", zRot);
    RenderWindowMessage msg;
    msg.cmd = CMD_SET_ROTATION;
    msg.rotation = zRot;
    (void) processMessage(msg);
    D("Exiting\n");
}
void OSCController::update()
{
    while (listener.hasWaitingMessages()) {
		osc::Message msg;
		listener.getNextMessage(&msg);
        processMessage( msg );
    }
}
예제 #16
0
void Client::addSocket(QtWebsocket::QWsSocket *socket)
{
    sockets << socket;

    connect(socket, SIGNAL(frameReceived(QString)), this, SLOT(processMessage(QString)));
    connect(socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
    connect(socket, SIGNAL(pong(quint64)), this, SLOT(processPong(quint64)));
}
예제 #17
0
void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count)
{
    // assuming enabled checked by caller
    QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType,
                           url.toString(), -1, -1, -1, count, -1,
                           0, 0, 0, 0, 0};
    processMessage(rd);
}
void NXTUltrasonicDisplay::setColor( const rviz::Color& color )
{
  color_ = color;

  propertyChanged(color_property_);

  processMessage(current_message_);
  causeRender();
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    _handler(makeHandler())
{
    ui->setupUi(this);
    connect(this,SIGNAL(vMessage(MsgPtr)),
        this,SLOT(processMessage(MsgPtr)));
}
예제 #20
0
void QQmlProfilerService::endRange(RangeType range)
{
    if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
        return;

    QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeEnd, (int)range,
                           QString(), -1, -1, 0, 0, 0};
    processMessage(rd);
}
예제 #21
0
void QQmlProfilerService::rangeLocation(RangeType range, const QUrl &fileName, int line, int column)
{
    if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
        return;

    QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeLocation, (int)range,
                           fileName.toString(), line, column, 0, 0, 0};
    processMessage(rd);
}
예제 #22
0
void QQmlProfilerService::rangeData(RangeType range, const QUrl &rData)
{
    if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
        return;

    QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeData, (int)range,
                           rData.toString(), -1, -1, 0, 0, 0};
    processMessage(rd);
}
예제 #23
0
void QQmlProfilerService::startRange(RangeType range, BindingType bindingType)
{
    if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
        return;

    QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeStart, (int)range,
                           QString(), -1, -1, 0, 0, (int)bindingType};
    processMessage(rd);
}
예제 #24
0
void QQmlProfilerService::addEventImpl(EventType event)
{
    if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
        return;

    QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)event,
                           QString(), -1, -1, 0, 0, 0};
    processMessage(ed);
}
예제 #25
0
void ClientWS::onTextMessage(ConstStrA msg) {
	JSON::Value v;
	try {
		v = jsonFactory->fromString(msg);
	} catch (...) {
		onParseError(msg);
	}
	processMessage(v);
}
예제 #26
0
파일: C_GetTime.cpp 프로젝트: Raxtion/CT82
void C_GetTime::delay( const unsigned tm )
{
  unsigned __int64 temp;
  temp = time();
  do
  {
    if( _timeSlice == true ) processMessage();
  } while( ( time() - temp ) < tm );
}
void NXTUltrasonicDisplay::setAlpha( float alpha )
{
  alpha_ = alpha;

  propertyChanged(alpha_property_);

  processMessage(current_message_);
  causeRender();
}
void DspMessageInputDspOutputObject::processMessages() {
  resetNextMessageCounter();
  
  PdMessage *message;
  int inletIndex;
  while ((message = getNextMessageInTemporalOrder(&inletIndex)) != NULL) {
    processMessage(inletIndex, message);
  }
}
예제 #29
0
void CInputHandler::handleMessage(CMessage &msg, bool respectLock) {
	if (!respectLock || _lockCount <= 0) {
		if (_gameManager->_gameState._mode == GSMODE_INTERACTIVE) {
			processMessage(&msg);
		} else if (!msg.isMouseMsg()) {
			g_vm->_filesManager->loadDrive();
		}
	}
}
예제 #30
0
bool MultiUserChat::messageReadWrite(int AOrder, const Jid &AStreamJid, Message &AMessage, int ADirection)
{
	if (AOrder==MEO_MULTIUSERCHAT && ADirection==IMessageProcessor::DirectionIn && AStreamJid==FStreamJid)
	{
		if (FRoomJid.pBare() == Jid(AMessage.from()).pBare())
			return processMessage(AMessage.stanza());
	}
	return false;
}