void RubySupportPart::slotRun ()
{
    // if we can't save all parts, then the user canceled
    if ( partController()->saveAllFiles() == false )
        return;
    QFileInfo program(mainProgram());
    if (mainProgram().endsWith("script/server")) {
         QString cmd;
         QFileInfo server(project()->projectDirectory() + "/script/server");

        // Starting WEBrick for a Rails app. Translate a SIGTERM signal sent by KDevelop
        // to a SIGINT expected by WEBrick (ie control&c) to terminate it.
        cmd += "script/server& \n trap \"kill -s SIGINT $!\" TERM \n wait \n exit 0";
        if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend"))
            appFrontend->startAppCommand(project()->projectDirectory(), cmd, false);
    } else {
        QString cmd = QString("%1 -K%2 -C\"%3\" -I\"%4\" \"%5\" %6")
                          .arg(interpreter())
                          .arg(characterCoding())
                          .arg(runDirectory())
                          .arg(program.dirPath())
                          .arg(program.fileName())
                          .arg(programArgs());
        startApplication(cmd);
    }
}
void RubySupportPart::slotRunTestUnderCursor()
{
    // if we can't save all parts, then the user canceled
    if ( partController()->saveAllFiles() == false )
        return;

    KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(partController()->activePart());
    QString prog;
    if (ro_part != 0) {
        prog = ro_part->url().path();
    } else
        return;

    KTextEditor::ViewCursorInterface* activeViewCursor = dynamic_cast<KTextEditor::ViewCursorInterface*>( ro_part->widget() );
    if (!activeViewCursor) return;

    unsigned int line, column;
    activeViewCursor->cursorPositionReal(&line, &column);
    CodeModelUtils::CodeModelHelper hlp(codeModel(), codeModel()->fileByName(prog));
    FunctionDom fun = hlp.functionAt(line, column);
    if (fun == 0) return;

    QFileInfo program(prog);
    QString cmd = QString("%1 -K%2 -C\"%3\" -I\"%4\" \"%5\" %6")
                          .arg(interpreter())
                          .arg(characterCoding())
                          .arg(runDirectory())
                          .arg(program.dirPath())
                          .arg(program.fileName())
                          .arg(" -n " + fun->name());
    startApplication(cmd);
}
Example #3
0
v8::Handle<v8::Value> startApplication(const v8::Arguments& args)
{
  v8::HandleScope scope;

  startApplication();

  return scope.Close(v8::String::New("N/A"));
}
void BashSupportPart::slotRun ()
{
	QString file;
	KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(partController()->activePart());
	if(ro_part)
		file = ro_part->url().path();

	QString cmd = interpreter() + " " + file;
	startApplication(cmd);
}
Example #5
0
void PythonSupportPart::slotExecuteString()
{
    bool ok;
    QString cmd = KInputDialog::getText(i18n("String to Execute"), i18n("String to execute:"), QString::null, &ok, 0);
    if (ok) {
        cmd.prepend("'");
        cmd.append("'");
        startApplication(cmd);
    }
}
Example #6
0
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
	if( msg.message == "start-pressed" ){
		startApplication();
	}
	else if( msg.message == "stop-pressed" ){
		stopApplication();
	}
	else if( msg.message.substr(0,5) == "load:" ){
		fileToLoad = msg.message.substr(5);
	}
}
Example #7
0
//--------------------------------------------------------------
void ofApp::setup(){
	showInfo = false;
	dropped = 0;
	changed = false;
	clearFbos = false;
	lastMouseMoved = 0;
	exporting = 0;
	
	applicationRunning = false; 
	ofSetVerticalSync(true);
	ofBackground(0);
	ofSetBackgroundAuto(false);
	
	// shaderLoader handles this for us
//	shader.setGeometryInputType(GL_LINES);
//	shader.setGeometryOutputType(GL_QUADS);
//	shader.setGeometryOutputCount(4);
	shaderLoader.setup(&shader, "shaders/osci");
	
	vector<RtAudio::DeviceInfo> devices = listRtSoundDevices();
	ofSetFrameRate(60);
	
	root = new mui::Root();
	
	globals.loadFromFile();
	globals.player.loadSound( "konichiwa.wav" );
	globals.player.setLoop(true);
	globals.player.stop(); 
	
	configView = new ConfigView();
	configView->fromGlobals();
	if( globals.autoDetect ){
		configView->autoDetect();
	}

	root->add( configView );
	
	osciView = new OsciView();
	osciView->visible = false;
	root->add( osciView );
	
	left.loop = false;
	right.loop = false;

	
	if( globals.autoDetect ){
		startApplication();
	}


	windowResized(ofGetWidth(), ofGetHeight());
}
Example #8
0
void KSMServer::restoreLegacySessionInternal( TDEConfig* config, char sep )
{
    int count = config->readNumEntry( "count" );
    for ( int i = 1; i <= count; i++ ) {
        TQString n = TQString::number(i);
        TQStringList wmCommand = config->readListEntry( TQString("command")+n, sep );
        if( wmCommand.isEmpty())
            continue;
        if( isWM( wmCommand.first()))
            continue;
        startApplication( wmCommand,
                          config->readEntry( TQString("clientMachine")+n ),
                          config->readEntry( TQString("userId")+n ));
    }
}
Example #9
0
int main(void)
{
	int iChoice = 0;

	// size console window to 100x40
	if(!initConsole())
	{
		// show error box
		showError("Error", "Console Window could not be initialized.\nExiting program.");
		
		return EXIT_FAILURE;
	}	

	// LogIn / Register Menu
	showStartScreen();

	do
	{
		// choose between LogIn and Register
		getUserInput("%i", &iChoice, "\tChoose: ", "\n\tYour input is invalid. Please choose again.\n");
	}
	while(iChoice != 1 && iChoice != 2);
	
	// LogIn / Register
	if(iChoice == 1)
	{
		// loop until valid login
		while(!showLogin());
	}
	else
	{
		// loop until valid registration
		while(!showRegister());
	}

	// loop until user quits manually
	while(startApplication());

	return EXIT_SUCCESS;
}
Example #10
0
/**
  * @brief  Display the Main Menu on HyperTerminal
  * @param  None
  * @retval None
  */
void Main_Menu(void)
{
  char cmdbuf [CMD_STRING_SIZE] = {0}, cmdname[15] = {0};     /* command input buffer        */
  int i, j;                                       /* index for command buffer    */
  int targetFlash;
  char startAddressStr[10], endAddressStr[10];
  int32_t startAddress, endAddress;
  bool inputFlashArea = false;

  while (1)  {                                    /* loop forever                */
    printf ("\n\rWiFiMCU> ");
    getline (&cmdbuf[0], sizeof (cmdbuf));        /* input command line          */

    for (i = 0; cmdbuf[i] == ' '; i++);           /* skip blanks on head         */
    for (; cmdbuf[i] != 0; i++)  {                /* convert to upper characters */
      cmdbuf[i] = toupper(cmdbuf[i]);
    }

    for (i = 0; cmdbuf[i] == ' '; i++);        /* skip blanks on head         */
    for(j=0; cmdbuf[i] != ' '&&cmdbuf[i] != 0; i++,j++)  {         /* find command name       */
      cmdname[j] = cmdbuf[i];
    }
    cmdname[j] = '\0';

    /***************** Command "0" or "BOOTUPDATE": Update the application  *************************/
    if(strcmp(cmdname, "BOOTUPDATE") == 0 || strcmp(cmdname, "0") == 0) {
      if (findCommandPara(cmdbuf, "r", NULL, 0) != -1){
        printf ("\n\rRead Bootloader only...\n\r");
        MicoFlashInitialize(MICO_FLASH_FOR_BOOT);
        SerialUpload(MICO_FLASH_FOR_BOOT, BOOT_START_ADDRESS, "BootLoaderImage.bin", BOOT_FLASH_SIZE);
        MicoFlashFinalize(MICO_FLASH_FOR_BOOT);
        continue;
      }
      printf ("\n\rUpdating Bootloader...\n\r");
      SerialDownload(MICO_FLASH_FOR_BOOT, BOOT_START_ADDRESS, BOOT_FLASH_SIZE);
    }

    /***************** Command "1" or "FWUPDATE": Update the MICO application  *************************/
    else if(strcmp(cmdname, "FWUPDATE") == 0 || strcmp(cmdname, "1") == 0)	{
      if (findCommandPara(cmdbuf, "r", NULL, 0) != -1){
        printf ("\n\rRead MICO application only...\n\r");
        MicoFlashInitialize(MICO_FLASH_FOR_APPLICATION);
        SerialUpload(MICO_FLASH_FOR_APPLICATION, APPLICATION_START_ADDRESS, "ApplicationImage.bin", APPLICATION_FLASH_SIZE);
        MicoFlashFinalize(MICO_FLASH_FOR_APPLICATION);
        continue;
      }
      printf ("\n\rUpdating MICO application...\n\r");
      SerialDownload(MICO_FLASH_FOR_APPLICATION, APPLICATION_START_ADDRESS, APPLICATION_FLASH_SIZE); 							   	
    }

    /***************** Command "2" or "DRIVERUPDATE": Update the RF driver  *************************/

    else if(strcmp(cmdname, "DRIVERUPDATE") == 0 || strcmp(cmdname, "2") == 0) {
#ifdef MICO_FLASH_FOR_DRIVER
      if (findCommandPara(cmdbuf, "r", NULL, 0) != -1){
        printf ("\n\rRead RF driver only...\n\r");
        MicoFlashInitialize(MICO_FLASH_FOR_DRIVER);
        SerialUpload(MICO_FLASH_FOR_DRIVER, DRIVER_START_ADDRESS, "DriverImage.bin", DRIVER_FLASH_SIZE);
        MicoFlashFinalize(MICO_FLASH_FOR_DRIVER);
        continue;
      }
      printf ("\n\rUpdating RF driver...\n\r");
      SerialDownload(MICO_FLASH_FOR_DRIVER, DRIVER_START_ADDRESS, DRIVER_FLASH_SIZE);  
#else
      printf ("\n\rNo independ flash memory for RF driver, exiting...\n\r");
#endif
    }

    /***************** Command "3" or "PARAUPDATE": Update the application  *************************/
    else if(strcmp(cmdname, "PARAUPDATE") == 0 || strcmp(cmdname, "3") == 0)  {
      if (findCommandPara(cmdbuf, "e", NULL, 0) != -1){
        printf ("\n\rErasing MICO settings only...\n\r");
        MicoFlashInitialize(MICO_FLASH_FOR_PARA);
        MicoFlashErase(MICO_FLASH_FOR_PARA, PARA_START_ADDRESS, PARA_END_ADDRESS);
        MicoFlashFinalize(MICO_FLASH_FOR_PARA);
        continue;
      }
      if (findCommandPara(cmdbuf, "r", NULL, 0) != -1){
        printf ("\n\rRead MICO settings only...\n\r");
        MicoFlashInitialize(MICO_FLASH_FOR_PARA);
        SerialUpload(MICO_FLASH_FOR_PARA, PARA_START_ADDRESS, "DriverImage.bin", PARA_FLASH_SIZE);
        MicoFlashFinalize(MICO_FLASH_FOR_PARA);
        continue;
      }
      printf ("\n\rUpdating MICO settings...\n\r");
      SerialDownload(MICO_FLASH_FOR_PARA, PARA_START_ADDRESS, PARA_FLASH_SIZE);                        
    }

    /***************** Command "4" or "FLASHUPDATE": : Update the Flash  *************************/
    else if(strcmp(cmdname, "FLASHUPDATE") == 0 || strcmp(cmdname, "4") == 0) {
      if (findCommandPara(cmdbuf, "i", NULL, 0) != -1){
        targetFlash = MICO_INTERNAL_FLASH;
      }else if(findCommandPara(cmdbuf, "s", NULL, 200) != -1){
        targetFlash = MICO_SPI_FLASH;
      }else{
        printf ("\n\rUnkown target type! Exiting...\n\r");
        continue;
      }

      inputFlashArea = false;
      if (findCommandPara(cmdbuf, "start", startAddressStr, 10) != -1){
        if(Str2Int((uint8_t *)startAddressStr, &startAddress)==0){ //Found Flash start address
          printf ("\n\rIllegal start address.\n\r");
          continue;
        }else{
          if (findCommandPara(cmdbuf, "end", endAddressStr, 10) != -1){ //Found Flash end address
            if(Str2Int((uint8_t *)endAddressStr, &endAddress)==0){
              printf ("\n\rIllegal end address.\n\r");
              continue;
            }else{
              inputFlashArea = true;
            }
          }else{
            printf ("\n\rFlash end address not found.\n\r");
            continue;
          }
        }
      }

      if(endAddress<startAddress && inputFlashArea == true) {
        printf ("\n\rIllegal flash address.\n\r");
        continue;
      }

      if(inputFlashArea != true){
        if(targetFlash == MICO_INTERNAL_FLASH){
          startAddress = platform_flash_peripherals[MICO_INTERNAL_FLASH].flash_start_addr ;
          endAddress = platform_flash_peripherals[MICO_INTERNAL_FLASH].flash_start_addr 
                     + platform_flash_peripherals[MICO_INTERNAL_FLASH].flash_length - 1;
        }else{
#ifdef USE_MICO_SPI_FLASH        
          startAddress = platform_flash_peripherals[MICO_SPI_FLASH].flash_start_addr ;
          endAddress = platform_flash_peripherals[MICO_SPI_FLASH].flash_start_addr 
                     + platform_flash_peripherals[MICO_SPI_FLASH].flash_length - 1;
#else
          printf ("\n\rSPI Flash not exist\n\r");
          continue;
#endif
        }
      }

      if (findCommandPara(cmdbuf, "e", NULL, 0) != -1){
        printf ("\n\rErasing flash content From 0x%x to 0x%x\n\r", startAddress, endAddress);
        MicoFlashInitialize((mico_flash_t)targetFlash);
        MicoFlashErase((mico_flash_t)targetFlash, startAddress, endAddress);
        MicoFlashFinalize((mico_flash_t)targetFlash);
        continue;
      }

      if (findCommandPara(cmdbuf, "r", NULL, 0) != -1){
        printf ("\n\rRead flash content From 0x%x to 0x%x\n\r", startAddress, endAddress);
        MicoFlashInitialize((mico_flash_t)targetFlash);
        SerialUpload((mico_flash_t)targetFlash, startAddress, "FlashImage.bin", endAddress-startAddress+1);
        MicoFlashFinalize((mico_flash_t)targetFlash);
        continue;
      }

      printf ("\n\rUpdating flash content From 0x%x to 0x%x\n\r", startAddress, endAddress);
      SerialDownload((mico_flash_t)targetFlash, startAddress, endAddress-startAddress+1);                           
    }

    /***************** Command: Reboot *************************/
    else if(strcmp(cmdname, "MEMORYMAP") == 0 || strcmp(cmdname, "5") == 0)  {
#if defined MICO_FLASH_FOR_UPDATE && defined MICO_FLASH_FOR_DRIVER
      printf(MEMMAP, flash_name[MICO_FLASH_FOR_BOOT],BOOT_START_ADDRESS,BOOT_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_PARA], PARA_START_ADDRESS, PARA_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_APPLICATION], APPLICATION_START_ADDRESS, APPLICATION_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_UPDATE], UPDATE_START_ADDRESS, UPDATE_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_DRIVER], DRIVER_START_ADDRESS, DRIVER_END_ADDRESS);
#endif
#if !defined MICO_FLASH_FOR_UPDATE && defined MICO_FLASH_FOR_DRIVER
      printf(MEMMAP, flash_name[MICO_FLASH_FOR_BOOT],BOOT_START_ADDRESS,BOOT_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_PARA], PARA_START_ADDRESS, PARA_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_APPLICATION], APPLICATION_START_ADDRESS, APPLICATION_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_DRIVER], DRIVER_START_ADDRESS, DRIVER_END_ADDRESS);
#endif
#if defined MICO_FLASH_FOR_UPDATE && !defined MICO_FLASH_FOR_DRIVER
      printf(MEMMAP, flash_name[MICO_FLASH_FOR_BOOT],BOOT_START_ADDRESS,BOOT_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_PARA], PARA_START_ADDRESS, PARA_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_APPLICATION], APPLICATION_START_ADDRESS, APPLICATION_END_ADDRESS);
#endif
#if !defined MICO_FLASH_FOR_UPDATE && !defined MICO_FLASH_FOR_DRIVER
      printf(MEMMAP, flash_name[MICO_FLASH_FOR_BOOT],BOOT_START_ADDRESS,BOOT_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_PARA], PARA_START_ADDRESS, PARA_END_ADDRESS,\
                     flash_name[MICO_FLASH_FOR_APPLICATION], APPLICATION_START_ADDRESS, APPLICATION_END_ADDRESS);
#endif 
    }
    /***************** Command: Excute the application *************************/
    else if(strcmp(cmdname, "BOOT") == 0 || strcmp(cmdname, "6") == 0)	{
      printf ("\n\rBooting.......\n\r");
      startApplication();
    }

   /***************** Command: Reboot *************************/
    else if(strcmp(cmdname, "REBOOT") == 0 || strcmp(cmdname, "7") == 0)  {
      printf ("\n\rReBooting.......\n\r");
      MicoSystemReboot();
    break;                              
  }

	else if(strcmp(cmdname, "HELP") == 0 || strcmp(cmdname, "?") == 0)	{
    printf ( menu, MODEL, Bootloader_REVISION );                       /* display command menu        */
		break;
	}

	else if(strcmp(cmdname, "") == 0 )	{                         
		break;
	}
	else{
	    printf (ERROR_STR, "UNKNOWN COMMAND");
		break;
	}
  }
}
Example #11
0
/*
WEAK bool MicoShouldEnterMFGMode( void )
{
  return false;
}

WEAK bool MicoShouldEnterATEMode( void )
{
  return false;
}
*/
void bootloader_start_app( uint32_t app_addr )
{
  enable_protection( );
  startApplication( app_addr );
}
Example #12
0
void PythonSupportPart::slotStartInterpreter()
{
    startApplication(interpreter());
}
Example #13
0
void PythonSupportPart::slotExecute()
{
    QString program = project()->mainProgram();
    QString cmd = interpreter() + " " + program;
    startApplication(cmd);
}
Example #14
0
MainWindow::MainWindow(QWidget* parent)
: QMainWindow(parent)
, m_editor(0)
, m_hooqPlayInjector(new PlatformInjector(this))
, m_hooqRecordInjector(new PlatformInjector(this))
, m_hooqLogger(0)
, m_hooqPlayer(0)
, m_interpreter(new Interpreter(this))
, m_server(new QTcpServer(this))
, m_testModel(new TestModel(this))
, m_testRunning(false)
, m_testResultsWindow(new TestResultsDialog(this))
, m_xmlDump(0)
{
	if(!m_interpreter->haveRequiredQtScriptExtensions())
	{
		QMessageBox::critical(0, tr("Couldn't load required QtScript extensions"), tr("Please install qtscriptgenerator for the version of Qt you are currently using. While recording in Hooq may work, playback will not be possible."));
	}

	if(!m_server->listen(QHostAddress::LocalHost, Hooq::Communication::serverPort()))
	{
		QMessageBox::critical(0, tr("Couldn't listen for applications"), tr("Hooq couldn't start listening for applications; you're probably running two copies of Hooq. Hooq will not work."));
	}

	m_editor = new ScriptEditor(m_interpreter->engine());
	setupUi(this);
	setStatusBar(0);

	populateTestSets();

	m_testList->setModel(m_testModel);
	PushButtonDelegate* delegate = new PushButtonDelegate(m_testList, this);
	delegate->addButton(1, QApplication::style()->standardIcon(QStyle::SP_MediaPlay));
	delegate->addButton(2, QApplication::style()->standardIcon(QStyle::SP_FileIcon));
	m_testList->setItemDelegate(delegate);

	m_testList->header()->setResizeMode(0, QHeaderView::Stretch);
	m_testList->header()->setResizeMode(1, QHeaderView::Fixed);
	m_testList->header()->setResizeMode(2, QHeaderView::Fixed);
	m_testList->header()->setStretchLastSection(false);

	m_contextMenu = new QMenu(this);
	m_contextMenu->addAction(tr("Run"), this, SLOT(runCurrentTest()));
	m_contextMenu->addAction(tr("Edit"), this, SLOT(editCurrentTest()));
	m_contextMenu->addSeparator();
	m_contextMenu->addAction(tr("Delete"), this, SLOT(deleteCurrentTest()));

	setTestSet(m_testSetEdit->currentText());

	m_testList->setContextMenuPolicy(Qt::CustomContextMenu);

	QObject* deleteObserver = new ModelIndexKeyEventObserver(QKeySequence::Delete, m_testList);

	connect(
		deleteObserver,
		SIGNAL(released(QModelIndex)),
		SLOT(deleteCurrentTest())
	);

	connect(
		m_testList,
		SIGNAL(customContextMenuRequested(QPoint)),
		SLOT(showTestContextMenu(QPoint))
	);

	connect(
		m_testSetEdit,
		SIGNAL(activated(QString)),
		SLOT(setTestSet(QString))
	);

	connect(
		m_runAllButton,
		SIGNAL(clicked()),
		SLOT(runAllTests())
	);

	connect(
		m_addTestButton,
		SIGNAL(clicked()),
		SLOT(startRecording())
	);

	connect(
		m_hooqRecordInjector,
		SIGNAL(finished(int)),
		SLOT(finishRecording())
	);

	connect(
		m_testNameEdit,
		SIGNAL(textChanged(QString)),
		SLOT(updateActionStates())
	);

	connect(
		m_addTestSetButton,
		SIGNAL(clicked()),
		SLOT(addTestSet())
	);

	connect(
		m_newTestSet,
		SIGNAL(triggered()),
		SLOT(addTestSet())
	);
	connect(
		m_editTestSet,
		SIGNAL(triggered()),
		SLOT(editTestSet())
	);
	connect(
		m_removeTestSet,
		SIGNAL(triggered()),
		SLOT(removeTestSet())
	);
	connect(
		m_exportSet,
		SIGNAL(triggered()),
		SLOT(exportCurrentSet())
	);
	connect(
		m_importSet,
		SIGNAL(triggered()),
		SLOT(importTestSet())
	);
	connect(
		m_editor,
		SIGNAL(pickRequested()),
		m_interpreter,
		SLOT(pickObject())
	);
	connect(
		m_editor,
		SIGNAL(startRequested()),
		SLOT(runEditorTest())
	);

	connect(
		m_editor,
		SIGNAL(exceptionThrown(QString, QStringList)),
		SLOT(logException(QString, QStringList))
	);

	connect(
		m_interpreter,
		SIGNAL(objectPicked(ObjectInformation)),
		m_editor,
		SLOT(objectPicked(ObjectInformation))
	);
	connect(
		m_interpreter,
		SIGNAL(objectNotFound(QString)),
		m_editor,
		SLOT(objectNotFound(QString))
	);
	connect(
		m_interpreter,
		SIGNAL(executionFailed(int)),
		m_editor,
		SLOT(handleApplicationExit(int))
	);

	connect(
		m_interpreter,
		SIGNAL(finished()),
		SLOT(testFinished())
	);
	connect(
		m_interpreter,
		SIGNAL(startApplicationAndAttach()),
		SLOT(startApplication())
	);

	connect(
		m_quit,
		SIGNAL(triggered()),
		qApp,
		SLOT(quit())
	);

	connect(
		m_aboutQt,
		SIGNAL(triggered()),
		qApp,
		SLOT(aboutQt())
	);

	connect(
		m_about,
		SIGNAL(triggered()),
		SLOT(about())
	);

	ColumnClickMapper* mapper = new ColumnClickMapper(m_testList);
	mapper->addMapping(1, this, SLOT(runTestScript(QModelIndex)));
	mapper->addMapping(2, this, SLOT(editTestScript(QModelIndex)));

	updateActionStates();
}
Example #15
0
void ApplicationManager::onWindowCreated()
{
    startApplication("unity8-dash");
    focusApplication("unity8-dash");
}
Example #16
0
ApplicationInfo* ApplicationManager::startApplication(const QString &appId,
                                              const QStringList &arguments)
{
    return startApplication(appId, NoFlag, arguments);
}
ERROR_CODE Controller::executeApplication()
{
	return startApplication( &myStatusBlock );
}
Example #18
0
//
// main function
//
int main(void) {

    char c;
    uint16_t loop = 0;
    uint8_t bootloaderEnableFlag = FALSE;


    // relocate interrupt vector table to bottom of flash
    // in case the bootloader will not be started
    myIVSELREG = _BV(IVCE);
    myIVSELREG = 0;        

    // init USART
    myUBRRH = (F_CPU/(BAUDRATE*16L)-1) >> 8;             // calculate baudrate and set high byte
    myUBRRL = (uint8_t)(F_CPU/(BAUDRATE*16L)-1);         // and low byte
    myUCSRB = _BV(myTXEN) | _BV(myRXEN) | _BV(myRXCIE);  // enable transmitter and receiver and receiver interrupt
    myUCSRC = myURSEL | _BV(myUCSZ1) | _BV(myUCSZ0);     // 8 bit character size, 1 stop bit, no parity

    // the bootloader may be activated either if
    // the character 'i' (interactive mode) was received from USART
    // or the flash is (still) empty

    // poll USART receive complete flag 64k times to catch the 'i' reliably
    do {
	if(bit_is_set(myUCSRA, myRXC))
	    if(myUDR == 'i')
		bootloaderEnableFlag = TRUE;
    } while(--loop);

    // test if flash is empty (i.e. flash content is 0xff)
    if(pgm_read_byte_near(0x0000) == 0xFF) {
	bootloaderEnableFlag = TRUE;  // set enable flag
    }

    // check enable flag and start application if FALSE
    if(bootloaderEnableFlag == FALSE) {
        myUCSRB = 0;  // clear USART register to reset default
        startApplication();  // start application code
    }


    //
    // now the bootloader code begins
    //


    // welcome message and prompt
    uartPutChar('\r');
    uartPutChar('>');

    // loop until a valid character is received
    do {

	c = uartGetChar();  // read a character

	if(c == 'f') {  // 'f' selects flash programming
	    uartPutChar('f');           // echo the 'f'
	    programThisMemory = FLASH;  // set flag
	}

#ifdef EEPROM_CODE
	if(c == 'e') {  // 'e' selects eeprom programming
	    uartPutChar('e');            // echo the 'e'
	    programThisMemory = EEPROM;  // set flag
	}
#endif

	if(c == 'g') {  // 'g' starts the application
	    uartPutChar('g');    // echo the 'g'
	    startApplication();  // and jump to 0x0000
	}

    } while(!programThisMemory);  // exit loop when a valid key was pressed


    // move interrupt vector table to boot loader area
    myIVSELREG = _BV(IVCE);
    myIVSELREG = _BV(IVSEL);
 
    uartPutChar('\r');  // set cursor to next line

    receiveBufferFull = FALSE;  // reset full flag
    receiveBufferPointer = (char *)receiveBuffer;  // reset buffer pointer to start of buffer

    // enable interrupts
    sei();

    // endless loop
    while(1) {

	// if buffer is full, parse the buffer and write to flash
	if(receiveBufferFull) {

	    cli();  // disable interrupts

	    // if parsing produced an error, restart bootloader
	    if(!parseSrecBuffer(receiveBuffer)) {
		uartPutChar('\r');  // set cursor to next line
		startBootloader();  // restart the bootloader
	    }

	    // was an end-of-file s-record found?
	    if(srecEndOfFile) {
		uartPutChar('O');  // 'OK' indicates successful programming
		uartPutChar('K');
		loop_until_bit_is_set(myUCSRA, myUDRE);  // wait until character is transmitted
		startBootloader();       // restart the bootloader
	    }

	    receiveBufferFull = FALSE;  // reset full flag
	    receiveBufferPointer = (char *)receiveBuffer;  // reset buffer pointer to start of buffer

	    sei();  // enable interrupts
	}
    }
}