SerialCommand flashDownloadData(unsigned int sequence, QByteArray flashData)
{
    QByteArray data;
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(flashData.length()));
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(sequence));
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(0));  // Mystery value
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(0));  // Mystery value
    data.append(flashData);

    QByteArray command = buildCommand(Opcode_FlashDownloadData, data, calculateChecksum(flashData));

    QByteArray expectedResponse;
    expectedResponse.append(0x01);
    expectedResponse.append(Opcode_FlashDownloadData);
    expectedResponse.append(ByteArrayHelpers::uint16ToByteArrayLittle(2));
    expectedResponse.append((char)0x07);
    expectedResponse.append((char)0x07);
    expectedResponse.append((char)0x12);
    expectedResponse.append((char)0x20);
    expectedResponse.append((char)0x00);
    expectedResponse.append((char)0x00);

    return SerialCommand("flashDownloadData",
                         slipEncode(command),
                         slipEncode(expectedResponse));
}
Exemple #2
0
Int_t IRODS::cd(const Char_t* directory)
{
   // change directory

   buildCommand("icd", directory);
   return execCommand();
}
Exemple #3
0
bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const
{
    PuppetBuildProgressDialog progressDialog;

    m_compileLog.clear();

    QTemporaryDir buildDirectory;

    bool buildSucceeded = false;

    if (qtIsSupported()) {
        if (buildDirectory.isValid()) {
            QStringList qmakeArguments;
            qmakeArguments.append(QStringLiteral("-r"));
            qmakeArguments.append(QStringLiteral("-after"));
            qmakeArguments.append(QStringLiteral("DESTDIR=") + qmlpuppetDirectory(UserSpacePuppet));
#ifndef QT_DEBUG
            qmakeArguments.append(QStringLiteral("CONFIG+=release"));
#endif
            qmakeArguments.append(qmlPuppetProjectFilePath);
            buildSucceeded = startBuildProcess(buildDirectory.path(), qmakeCommand(), qmakeArguments);
            if (buildSucceeded) {
                progressDialog.show();
                buildSucceeded = startBuildProcess(buildDirectory.path(), buildCommand(), QStringList(), &progressDialog);
                progressDialog.hide();
            }
        } else {
            buildSucceeded = true;
        }
    }

    m_useOnlyFallbackPuppet = !buildSucceeded;  // fall back to creator puppet and don't compile again

    return buildSucceeded;
}
Exemple #4
0
TString IRODS::info(const Char_t* file, Option_t* opt)
{
   // returns meta-infos on given file.

   buildCommand("imeta", file, opt);
   return pipeCommand();
}
Exemple #5
0
Int_t IRODS::mkdir(const Char_t* path, Option_t* opt)
{
   // Create new directory in IRODS space

   buildCommand("imkdir", path, opt);
   return execCommand();
}
Exemple #6
0
/**
 * Generates a string that is used as a command to run the necessary test.
 * @param MCGPU The path to MCGPU's root.
 * @param configFile The name of the config file to use for the test.
 * @param outputName The name of the simulation, or the file to pipe cerr to
 *   (if expecting an error).
 * @param series true if the simulation is to be run in series, false otherwise
 * @param neighborlist true if the simulation is to be run with a neighborlist,
 *   false otherwise.
 * @param errorExpected true if passing behavior for the test throws an error.
 */
std::string buildT3pDimCommand(std::string MCGPU, std::string configFile,
                               std::string outputName, bool series,
                               bool neighborlist, bool errorExpected) {
  return buildCommand(MCGPU, configFile, outputName, series, neighborlist,
                      errorExpected,
                      "test/unittests/MultipleSolvents/t3pdimTests");
}
SerialCommand flashDownloadStart(unsigned int totalSize,
                                 unsigned int numberOfBlocks,
                                 unsigned int blockSize,
                                 unsigned int offset)
{
    QByteArray data;
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(totalSize));
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(numberOfBlocks));
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(blockSize));
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(offset));

    QByteArray command = buildCommand(Opcode_FlashDownloadStart, data, calculateChecksum(data));

    QByteArray expectedResponse;
    expectedResponse.append(0x01);
    expectedResponse.append(Opcode_FlashDownloadStart);
    expectedResponse.append(ByteArrayHelpers::uint16ToByteArrayLittle(2));
    expectedResponse.append((char)0x07);
    expectedResponse.append((char)0x07);
    expectedResponse.append((char)0x12);
    expectedResponse.append((char)0x20);
    expectedResponse.append((char)0x00);
    expectedResponse.append((char)0x00);

    return SerialCommand("flashDownloadStart",
                         slipEncode(command),
                         slipEncode(expectedResponse));
}
Exemple #8
0
TString IRODS::list(const Char_t* directory)
{
   // returns simple listing of current directory (default) or given directory.
   // returns empty string if directory is unknown.

   buildCommand("ils", directory);
   return pipeCommand();
}
Exemple #9
0
void kommuHandler(void){
	int i;
	while(buildCommand(input_buf,command)){
		switch(command[0]){
		case 'a':
			if(kommuConnected){
				sendCommand("a",1);
				kommuNoPing = 0;
			}
			break;
		case 'b':
			sendCommand("c",1);
			kommuConnected = 1;
			kommuNoPing = 0;
			HAL_GPIO_WritePin(GPIOD,GPIO_PIN_12,GPIO_PIN_SET);
			break;
		case 's':
			stopRecording(command[1]);
			break;
		case 'r':
			if(kommuConnected){
				startRecording(command[1]);
			}
			break;
		case 'q':
			stopRecordingAll();
			break;
		case 'x':
			if(kommuConnected){
				changeValue(command+1);
			}
			break;
		}		
	}
	if(kommuConnected){
		for(i = 0; i < sendingCodesCurrent; i++){
			sendCode(sendingCodes[i],buffer);
		}
	}
	if(kommuNoPing > maxPingsMissed){ //Max ping loss?
		kommuConnected = 0;
		HAL_GPIO_WritePin(GPIOD,GPIO_PIN_12,GPIO_PIN_RESET);
	}else{
		kommuNoPing++;
	}

	if((output_currentPos>0) && !ptrUSART->GetStatus().tx_busy){
		ptrUSART->Send(output_currentBuffer,output_currentPos);
		if(output_currentBufferNr == 1){
			output_currentBuffer = output_buffer2;
			output_currentBufferNr = 2;
		}else{
			output_currentBuffer = output_buffer1;
			output_currentBufferNr = 1;
		}
		output_currentPos = 0;
	}
}
Exemple #10
0
Int_t IRODS::forcedelete(const Char_t* path)
{
   // Delete a file.
   // WARNING: THIS WILL DELETE THE PHYSICAL FILE,
   // not just the catalogue entry!!!

   buildCommand("irm", path, "-f");
   return execCommand();
}
Exemple #11
0
Int_t IRODS::get(const Char_t* source, const Char_t* target)
{
   // copy a file from IRODS space.

   TString args;
   args.Form("-P %s %s", source, target);
   buildCommand("iget", args.Data());
   return execCommand();
}
Exemple #12
0
Int_t IRODS::put(const Char_t* source, const Char_t* target)
{
   // put a new file into IRODS space.

   TString args;
   args.Form("%s %s", source, target);
   buildCommand("iput", args.Data(), "-N0");
   return execCommand();
}
void SerialCommands::receive()
{
    int bCommandReady = false;
    
    while(Serial.available() > 0)
        bCommandReady = buildCommand( (char)Serial.read() );
    
    if (bCommandReady == true)
        processCommand();
}
Exemple #14
0
TString IRODS::longlist(const Char_t* directory)
{
   // returns long-format listing of current directory (default) or given directory.
   // returns empty string if directory is unknown.
#ifdef CCIN2P3_BUILD
   buildCommand("ils", directory, "-l");
   return pipeCommand();
#else
   return list(directory);//outside of CCIN2P3, only short-format list works
#endif
}
Exemple #15
0
/**
 * Runs the lash program. The given parameters allow the user to specify the
 * limits the program should operate within.
 *
 * @param command      The maximum amount of commands to allow
 * @param args         The maximum number of arguments within each command
 * @param arglength    The maximum length of each argument
 * @param promptlength The maximum length of the prompt on the command line
 */
void runLash(int command, int args, int arglength, int promptlength){

	maxcommands     = command;
	maxargs         = args;
	maxarglength    = arglength;
	maxpromptlength = promptlength;

	sprintf(prompt, "%s LaSH %% ", getenv("USER"));

    // ignore all signals that should be passed to jobs
    signal (SIGINT, sighandler);
    signal (SIGQUIT, SIG_IGN);
   	signal (SIGTSTP, SIG_IGN);
   	signal (SIGTTIN, SIG_IGN);
   	signal (SIGTTOU, SIG_IGN);
 //   	signal (SIGCHLD, sighandler);

	stifle_history(100);

	struct LashParser *lash = newLashParser(maxcommands, maxargs, maxarglength);

	// Loop forever. This will be broken if exit is run
	int cont = 1;
	int status;
    while(cont){
		acceptInterrupt = 0;

        char *input = readline(prompt);
		if(strcmp(input, "") != 0){
	        add_history(input);
		}
		status = buildCommand(lash, input);

		if(status == VALID)
			cont = executeCommand(lash);
		else if(status == QUOTE_MISMATCH)
			printf("Error: Quote Mismatch\n");

        free(input);
		clearParser(lash);
    }

	free(lash->commands);
	free(lash);

    exit(0);
}
Exemple #16
0
int main(int argc, char** argv) {
  init();
  std::string line;
  std::getline(std::cin, line);

  while(!std::cin.eof()) {
    run_command(buildCommand(line));
    std::getline(std::cin, line);    
  }

  size_t count = 0;
  for(auto& v : grid) {
    if(v == true)
      ++count;
  }

  std::cout << count << std::endl;
  return 0;
}
Exemple #17
0
bool IosBuildStep::init()
{
    BuildConfiguration *bc = buildConfiguration();
    if (!bc)
        bc = target()->activeBuildConfiguration();
    if (!bc)
        emit addTask(Task::buildConfigurationMissingTask());

    ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
    if (!tc)
        emit addTask(Task::compilerMissingTask());

    if (!bc || !tc) {
        emitFaultyConfigurationMessage();
        return false;
    }

    ProcessParameters *pp = processParameters();
    pp->setMacroExpander(bc->macroExpander());
    pp->setWorkingDirectory(bc->buildDirectory().toString());
    Utils::Environment env = bc->environment();
    // Force output to english for the parsers. Do this here and not in the toolchain's
    // addToEnvironment() to not screw up the users run environment.
    env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
    pp->setEnvironment(env);
    pp->setCommand(buildCommand());
    pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
    pp->resolveAll();

    // If we are cleaning, then build can fail with an error code, but that doesn't mean
    // we should stop the clean queue
    // That is mostly so that rebuild works on an already clean project
    setIgnoreReturnValue(m_clean);

    setOutputParser(new GnuMakeParser());
    IOutputParser *parser = target()->kit()->createOutputParser();
    if (parser)
        appendOutputParser(parser);
    outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());

    return AbstractProcessStep::init();
}
Exemple #18
0
/*--------------------------------------------------------------------------*/
static char *getCommandByFileExtension(char *File,char *FileExtension)
{
    char *command = NULL;

    if (FileExtension)
    {
        if ( (stricmp(FileExtension, BIN_EXTENSION_FILE) == 0) ||
            (stricmp(FileExtension, SAV_EXTENSION_FILE) == 0) ||
            (stricmp(FileExtension, SOD_EXTENSION_FILE) == 0))
        {
            command = buildCommand(FORMAT_BIN_SCE_EXTENSION_FILES, File);
        }
        else
            if ( (stricmp(FileExtension, COS_EXTENSION_FILE) == 0) ||
                (stricmp(FileExtension, COSF_EXTENSION_FILE) == 0) ||
                (stricmp(FileExtension, ZCOS_EXTENSION_FILE) == 0) ||
                (stricmp(FileExtension, XCOS_EXTENSION_FILE) == 0))
            {
                if (with_module("xcos"))
                {
                    command = buildCommand(FORMAT_COS_COSF_XCOS_EXTENSION_FILES, File);
                }
                else
                {
                    command = strdup(XCOS_NOT_INSTALLED);
                }
            }
            else
                if (stricmp(FileExtension,SCI_EXTENSION_FILE) == 0)
                {
                    command = buildCommand(FORMAT_SCI_EXTENSION_FILES, File);
                }
                else
                    if ( (stricmp(FileExtension, SCE_EXTENSION_FILE) == 0) || (stricmp(FileExtension, TST_EXTENSION_FILE) == 0) || (stricmp(FileExtension, DEM_EXTENSION_FILE) == 0) )
                    {
                        command = buildCommand(FORMAT_SCE_TST_EXTENSION_FILES, File);
                    }
                    else
                        if (stricmp(FileExtension, SCG_EXTENSION_FILE) == 0)
                        {
                            command = buildCommand(FORMAT_SCG_EXTENSION_FILES, File);
                        }
                        else
                        {
                            command = buildCommand(FORMAT_UNKNOW_EXTENSION_FILES, File);
                        }
    }
    return command;
}
Exemple #19
0
bool IosBuildStep::init()
{
    BuildConfiguration *bc = buildConfiguration();
    if (!bc)
        bc = target()->activeBuildConfiguration();

    ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
    if (!tc) {
        Task t = Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit preferences."),
                      Utils::FileName(), -1,
                      Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
        emit addTask(t);
        emit addOutput(tr("Configuration is faulty. Check the Issues output pane for details."),
                       BuildStep::MessageOutput);
        return false;
    }
    ProcessParameters *pp = processParameters();
    pp->setMacroExpander(bc->macroExpander());
    pp->setWorkingDirectory(bc->buildDirectory().toString());
    Utils::Environment env = bc->environment();
    // Force output to english for the parsers. Do this here and not in the toolchain's
    // addToEnvironment() to not screw up the users run environment.
    env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
    pp->setEnvironment(env);
    pp->setCommand(buildCommand());
    pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
    pp->resolveAll();

    // If we are cleaning, then build can fail with an error code, but that doesn't mean
    // we should stop the clean queue
    // That is mostly so that rebuild works on an already clean project
    setIgnoreReturnValue(m_clean);

    setOutputParser(new GnuMakeParser());
    IOutputParser *parser = target()->kit()->createOutputParser();
    if (parser)
        appendOutputParser(parser);
    outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());

    return AbstractProcessStep::init();
}
SerialCommand flashDownloadFinish(unsigned int rebootFlag)
{
    QByteArray data;
    data.append(ByteArrayHelpers::uint32ToByteArrayLittle(rebootFlag));

    QByteArray command = buildCommand(Opcode_FlashDownloadFinish, data, calculateChecksum(data));

    QByteArray expectedResponse;
    expectedResponse.append(0x01);
    expectedResponse.append(Opcode_FlashDownloadFinish);
    expectedResponse.append(ByteArrayHelpers::uint16ToByteArrayLittle(2));
    expectedResponse.append((char)0x07);
    expectedResponse.append((char)0x07);
    expectedResponse.append((char)0x12);
    expectedResponse.append((char)0x20);
    expectedResponse.append((char)0x01);  // TODO: Can we count on these?
    expectedResponse.append((char)0x06);  // TODO: Can we count on these?

    return SerialCommand("flashDownloadFinish",
                         slipEncode(command),
                         slipEncode(expectedResponse));
}
SerialCommand SyncFrame()
{
    QByteArray data;
    data.append((char)0x07);
    data.append((char)0x07);
    data.append((char)0x12);
    data.append((char)0x20);
    data.append(QByteArray(32, 0x55));

    QByteArray command = buildCommand(Opcode_SyncFrame, data, calculateChecksum(data));

    QByteArray expectedResponse;
    expectedResponse.append(0x01);
    expectedResponse.append(Opcode_SyncFrame);
    expectedResponse.append(ByteArrayHelpers::uint16ToByteArrayLittle(2));
    expectedResponse.append((char)0x07);
    expectedResponse.append((char)0x07);
    expectedResponse.append((char)0x12);
    expectedResponse.append((char)0x20);
    expectedResponse.append((char)0x00);
    expectedResponse.append((char)0x00);

    command = slipEncode(command);

    // TODO: Unclear why the esp responds with the same message repeated multiple times
    expectedResponse = slipEncode(expectedResponse);
    expectedResponse = expectedResponse
            + expectedResponse
            + expectedResponse
            + expectedResponse
            + expectedResponse
            + expectedResponse
            + expectedResponse
            + expectedResponse;

    return SerialCommand("SyncFrame", command, expectedResponse, 200);
}
Exemple #22
0
Int_t IRODS::exit()
{
   // Call at end of interactive session (i.e. if you previously called iinit())
   buildCommand("iexit");
   return execCommand();
}
Exemple #23
0
Int_t IRODS::init()
{
   // Call in interactive session if you want to use relative pathnames
   buildCommand("iinit");
   return execCommand();
}