void ReaderManipulatorWidget::sendCommand(const QString &command)
{
    if( ! command.isEmpty()){

        ui->leCommand->clear();

        if(m_connectionType == Settings::KSerial){
            if(SerialCommunication::instance()->sendCommand(
                        command,
                        (SerialCommunication::CommandType) ui->cbInputType->currentData().toInt())
              )
                    writeToOutput(tr("Command sent to device: %1").arg(command));

        }
        else if(m_connectionType == Settings::KNetwork){
            NetworkCommunication::instance()->sendNewCommandToReader(command);
        }
    }
}
// run
// Description: Runs the simulation
void Restaurant::run(void){
	TimeStamp::set(); // Setup timestamp for data writing

	setValues(); // Initialize default values and attempt to read config file

	int groups = 0;

	// Main loop
	while(timeRun <= totalTimeToRun){
		
		if(timeRun > 0 && timeRun % patronGroupArriveInterval == 0){ // If patron groups should arrive at the time interval

			(patronGroupMinArrive == 0) ? // Account for a 0 as the minimum
				groups = rand() % patronGroupMaxArrive :
				groups = rand() % patronGroupMinArrive + patronGroupMaxArrive;

			totalPatronGroups += groups;

			for(int i = 0; i < groups; i++){ // Add number of groups to arrive to line
				line.push_back(PatronFactory::newPatronGroup());
			}
		} // End generating new PatronGroups

		busTables(); // Remove finished PatronGroups
		seatLine(); // Seat PatronGroups from the line if possible

		if(timeRun > 0 && timeRun % updateInterval == 0){ // Check if data should be shown for the current time interval
			showData();
		}

		advanceTime(); // Advance time for all PatronGroups

	} // End main loop

	writeToOutput(); // Write data to output file

} // End run
void ReaderManipulatorWidget::newAnswerFromNetworkComm(const QString answer)
{
    writeToOutput(answer);
}
예제 #4
0
Connector::Connector() : m_username(""), m_passSara(""), m_passvnc(""), m_hours(""), m_minutes(""), m_seconds(""), output(new QTextEdit), process(new QProcess(this)) 
{
    setupOutputBox() ;
    connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(writeToOutput())) ;
}