void RemoteSoarCommunicator::receiveStatusMessage(IntBuffer& buffer, uint& offset){
	//cout << "--> Soar Receive Status" << endl;
  pthread_mutex_lock(&mutex);

	uint numAcks = buffer[offset++];
	for(uint i = 0; i < numAcks; i++){
		uint ack = buffer[offset++];
		CommandMapIt it = waitingCommands.find(ack);
		if(it != waitingCommands.end()){
			waitingCommands.erase(it);
		}
		IdentifierMap::iterator jt = waitingIdentifiers.find(ack);
		if(jt != waitingIdentifiers.end()){
			//cout << "Added "<< ack << " to finished ids " << jt->second->GetValueAsString() << endl;
			finishedIdentifiers.insert(jt->second);
			waitingIdentifiers.erase(jt);
		}
	}

	StatusList statuses;
	uint numStatuses = buffer[offset++];
	for(uint i = 0; i < numStatuses; i++){
		statuses.push_back(Ev3Status(buffer, offset));
	}
	soarManager->readStatus(statuses);

	//cout << "<-- Soar Receive Status" << endl;
  pthread_mutex_unlock(&mutex);
}
Exemplo n.º 2
0
void SoarLcmCommunicator::receiveStatusMessage(IntBuffer& buffer, uint& offset){
	//cout << "--> Soar Receive Status" << endl;
	StatusList statuses;
	uint numStatuses = buffer[offset++];
	for(uint i = 0; i < numStatuses; i++){
		statuses.push_back(Ev3Status(buffer, offset));
	}
	soarManager->readStatus(statuses);
	//cout << "<-- Soar Receive Status" << endl;
}
Exemplo n.º 3
0
/* Start commit of files of a single repository by displaying
 * template and files in a submit editor. On closing, the real
 * commit will start. */
void SubversionPlugin::startCommit(const QString &workingDir, const QStringList &files)
{
    if (raiseSubmitEditor())
        return;
    if (isCommitEditorOpen()) {
        VcsOutputWindow::appendWarning(tr("Another commit is currently being executed."));
        return;
    }

    QStringList args(QLatin1String("status"));
    args << SubversionClient::addAuthenticationOptions(settings());
    args += files;

    const SubversionResponse response =
            runSvn(workingDir, args, m_settings.timeOutMs(), 0);
    if (response.error)
        return;

    // Get list of added/modified/deleted files
    const StatusList statusOutput = parseStatusOutput(response.stdOut);
    if (statusOutput.empty()) {
        VcsOutputWindow::appendWarning(tr("There are no modified files."));
        return;
    }
    m_commitRepository = workingDir;
    // Create a new submit change file containing the submit template
    TempFileSaver saver;
    saver.setAutoRemove(false);
    // TODO: Retrieve submit template from
    const QString submitTemplate;
    // Create a submit
    saver.write(submitTemplate.toUtf8());
    if (!saver.finalize()) {
        VcsOutputWindow::appendError(saver.errorString());
        return;
    }
    m_commitMessageFileName = saver.fileName();
    // Create a submit editor and set file list
    SubversionSubmitEditor *editor = openSubversionSubmitEditor(m_commitMessageFileName);
    QTC_ASSERT(editor, return);
    editor->setStatusList(statusOutput);
}
Exemplo n.º 4
0
void Ev3LcmCommunicator::sendStatusMessage(){
	pthread_mutex_lock(&mutex);
	//cout << "--> Ev3 Send Status" << endl;
	IntBuffer buffer;
	buffer.push_back(STATUS_MESSAGE);

	StatusList statuses;
	ev3Manager->writeStatus(statuses);
	buffer.push_back(statuses.size());
	for(uint i = 0; i < statuses.size(); i++){
		statuses[i].packStatus(buffer);
	}

	// Create + send outgoing buffer
	uchar* outBuffer;
	uint buf_size;
	packBuffer(buffer, outBuffer, buf_size);

	wrapper.publish(outChannel, (void*)outBuffer, buf_size);
	delete [] outBuffer;
	//cout << "<-- Ev3 Send Status" << endl;
	pthread_mutex_unlock(&mutex);
}
void SoarManager::readStatus(StatusList& statuses){
	for(unsigned int i = 0; i < statuses.size(); i++){
		Ev3Status& status = statuses[i];
		uint offset = 0;
		//cout << "STATUS FOR: " << status.dev << endl;
		if(status.dev == BRICK_DEV){
			brick->readStatus(status.info, offset);
		} else if(status.dev == OUTPUT_MAN_DEV){
			readMotorsStatus(status.info);
		} else if(status.dev == INPUT_MAN_DEV){
			readSensorsStatus(status.info);
		} else if(status.dev == MANAGER_DEV){

		} else {
			cout << "UNKNOWN DEVICE " << status.dev << endl;
		}
	}
}