Exemplo n.º 1
0
Void appTaskFxn(UArg arg0, UArg arg1)
{
	char* args[8];
	//arg[0] is 2 chars for dev type
	args[0] = Memory_alloc(NULL, 2 * sizeof(char), 0, NULL);
	//arg[1] is 3 chars for channel num
	args[1] = Memory_alloc(NULL, 3 * sizeof(char), 0, NULL);

	//init the RPC queue
	rpcInitMq();

	//init the application thread to register the callbacks
	appInit();

	consolePrint(
	        "Enter device type c: Coordinator, r: Router, e: End Device:\n");
	consoleGetLine(args[0], 8);

	consolePrint("Enter channel 11-26:\n");
	consoleGetLine(args[1], 8);

	while (1)
	{
		appProcess(args);
		Task_sleep(10);
	}

	Memory_free(NULL, args[0], 2 * sizeof(char));
	Memory_free(NULL, args[1], 3 * sizeof(char));
}
Exemplo n.º 2
0
	void Executer::executeCurrentAction()
	{
		//Skip disabled actions
		if(mCurrentActionIndex >= 0)
		{
			while(mCurrentActionIndex < mScript->actionCount() && canExecuteAction(mCurrentActionIndex) != CanExecute)
				++mCurrentActionIndex;
		}

		if(mCurrentActionIndex < 0 || mCurrentActionIndex >= mScript->actionCount())
		{
			stopExecution();
			return;
		}

        int nextLine = mCurrentActionIndex + 2;
		if(nextLine > mScript->actionCount())
			nextLine = -1;

		QScriptValue script = mScriptEngine->globalObject().property("Script");
		script.setProperty("nextLine", mScriptEngine->newVariant(QVariant(nextLine)));
        script.setProperty("line", mCurrentActionIndex + 1, QScriptValue::ReadOnly);

		ActionTools::ActionInstance *actionInstance = currentActionInstance();

        const ActionTools::ExceptionActionInstancesHash &exceptionActionInstancesHash = actionInstance->exceptionActionInstances();
        const ActionTools::ActionException::ExceptionActionInstance &exceptionAction = exceptionActionInstancesHash.value(ActionTools::ActionException::CodeErrorException);
        mShowDebuggerOnCodeError = (exceptionAction.action() == ActionTools::ActionException::StopExecutionExceptionAction);

		mExecutionWindow->setCurrentActionName(actionInstance->definition()->name());
		mExecutionWindow->setCurrentActionColor(actionInstance->color());

		connect(actionInstance, SIGNAL(executionEnded()), this, SLOT(actionExecutionEnded()));
		connect(actionInstance, SIGNAL(executionException(int,QString)), this, SLOT(executionException(int,QString)));
		connect(actionInstance, SIGNAL(disableAction(bool)), this, SLOT(disableAction(bool)));
		connect(actionInstance, SIGNAL(showProgressDialog(QString,int)), this, SLOT(showProgressDialog(QString,int)));
		connect(actionInstance, SIGNAL(updateProgressDialog(int)), this, SLOT(updateProgressDialog(int)));
		connect(actionInstance, SIGNAL(updateProgressDialog(QString)), this, SLOT(updateProgressDialog(QString)));
		connect(actionInstance, SIGNAL(hideProgressDialog()), this, SLOT(hideProgressDialog()));
		connect(actionInstance, SIGNAL(consolePrint(QString)), this, SLOT(consolePrint(QString)));
		connect(actionInstance, SIGNAL(consolePrintWarning(QString)), this, SLOT(consolePrintWarning(QString)));
		connect(actionInstance, SIGNAL(consolePrintError(QString)), this, SLOT(consolePrintError(QString)));
		
		mExecutionStatus = PrePause;

		mExecutionTimer.start();
		mExecutionTime.start();
		if(currentActionInstance()->pauseBefore() + mPauseBefore > 0)
		{
			mExecutionWindow->setProgressEnabled(true);
			mExecutionWindow->setProgressMinimum(0);
			mExecutionWindow->setProgressMaximum(currentActionInstance()->pauseBefore() + mPauseBefore);
			mExecutionWindow->setProgressValue(0);
		}
		else
			mExecutionWindow->setProgressEnabled(false);

		mExecutionEnded = true;
	}
Exemplo n.º 3
0
static void openConsole(char *str) {
	if ((mode==modeRewriteLast) && consoleLines) {
		mode=modeAppend;
		utilStrListRm(&consoleLines);
		cursorPos=0;
		consolePrint(str);
		mode=modeRewriteLast;
	} else {
		consoleClear();
		consolePrint(str);
	}
	cmdEnd=strlen(consoleLines->str);
	updateCompletions();
	setCursorPos(cmdEnd);
}
Exemplo n.º 4
0
void consolePrintErr(char *str) {
	static char *str2=0;
	utilStrRealloc(&str2, 0, strlen(str)+2);
	*str2=consoleSpecialColorRed;
	strcpy(str2+1, str);
	consolePrint(str2);
}
Exemplo n.º 5
0
std::string __cdecl consolePrintf(const char* fmt ...) {
    va_list argList;
    va_start(argList, fmt);
    std::string s = G3D::vformat(fmt, argList);
    va_end(argList);

    return consolePrint(s);
}
Exemplo n.º 6
0
void consoleEvalExpr(char *expr) {
	char *ret=scriptEvalExpr(expr);
	if (ret && *ret)
		consolePrint(ret);

	char *err=scriptCatchException();
	if (err)
		consolePrintErr(err);

	if (consolePythonExprToStdout) {
		if (err)
			printf("%s # Error: %s\n", expr, err);
		else if (ret && *ret)
			printf("%s # Ret: %s\n", expr, ret);
		else
			printf("%s\n", expr);
	}
}
Exemplo n.º 7
0
void consolePrintLn(long v)
{
  consolePrint(v);
  newline();
}
Exemplo n.º 8
0
void consoleClearAfterCmd(char *msg) {
	mode=modeAppend;
	consolePrint(msg);
	mode=modeRewriteLast;
}
Exemplo n.º 9
0
void consolePrintLn(unsigned long v)
{
  consolePrint(v);
  newline();
}
Exemplo n.º 10
0
void consolePrint(float v)
{
  consolePrint(v, 2);
}
Exemplo n.º 11
0
	void Executer::consolePrintError(const QString &text)
	{
		consolePrint(text, ActionTools::ConsoleWidget::Error);
	}
Exemplo n.º 12
0
void consoleNote(const char *s)
{
  consolePrint("// ");
  consolePrint(s);
}
Exemplo n.º 13
0
int detectFloppyDevices(char **ideDevices, char **ideDeviceNames)
{
    // first, open /proc/devices to locate all block devics that begin with ide
    int deviceNumbers[MAXIMUM_DEVICE_COUNT]={0};
    FILE *fd = fopen(DEVICE_FILE,"r");
    if (fd == NULL)
    {
        return 0;
    }
    
    char buffer[256];
    int deviceCount=0;
    int deviceNumber=0,ideDeviceNumber=0;
    char sstring[3];
    while(fgets(buffer,sizeof(buffer),fd))
    {
        // scan for the ide string
        
        if (sscanf (buffer, "%i %2s", &deviceNumber,sstring)  == 2)
        {
            if (!strcmp(sstring,"fd"))
            {
                
                if (ideDeviceNumber != deviceCount)
                {
                    consolePrint("out of order\n");
                    return 0;
                }
                // record the device number
                deviceNumbers[deviceCount] = deviceCount;
                
                snprintf(ideDeviceNames[deviceCount],MAX_DEVICE_STRING_LENGTH,"fd%i",deviceCount);
                deviceCount++;
            }
        }
    }
    fclose(fd);
    if (deviceCount == 0)
    {
        // no devices
        return 0;
    }

    fd = fopen(DISKSTAT_FILE,"r");
    if (fd == NULL)
    {
        return 0;
    }
    // use the device counter for locating devices
    short deviceCounter=0;
    char deviceCharacter=0,deviceType=0;
    short i=0;
    ideDeviceNumber=0;
    while(fgets(buffer,sizeof(buffer),fd))
    {
        // scan for the %cd%c string, which will be like hdc or sda
        if (sscanf (buffer, "%i %i %2s%i", &deviceNumber,&deviceCounter,&sstring,&ideDeviceNumber)  ==4 )
        {
            if (deviceCounter == 0 && deviceNumber == deviceNumbers[i] && !strcmp(sstring,"fd"))
            {
                // populate the device location string
                snprintf(ideDevices[i],MAX_DEVICE_STRING_LENGTH,"/dev/fd%i",deviceType,ideDeviceNumber);
                
                i++;
            }
        }
    }

    // let's remember to close the file
    fclose(fd);
    if (i != deviceCount)
    {
        deviceCount = i;
    }
    return deviceCount;

}
Exemplo n.º 14
0
void consolePrintLn(uint8_t v)
{
  consolePrint(v);
  newline();
}
Exemplo n.º 15
0
void consolePrintLn(double v)
{
  consolePrint(v);
  newline();
}
Exemplo n.º 16
0
void consolePrintLn(float v, int p)
{
  consolePrint(v, p);
  newline();
}
Exemplo n.º 17
0
void consolePrintLn(float v)
{
  consolePrint(v);
  newline();
}
Exemplo n.º 18
0
void consolePrintLn(const char *s)
{
  consolePrint(s);
  newline();
}
Exemplo n.º 19
0
void newline(void)
{
  consolePrint("\n");
}
Exemplo n.º 20
0
	void Executer::consolePrint(const QString &text)
	{
		consolePrint(text, ActionTools::ConsoleWidget::Information);
	}
Exemplo n.º 21
0
void consoleCmdHistory() {
	consolePrint("--- History of commands ---");
	consolePrintLinesList(consoleGetHistory());
	consoleClearAfterCmdDefaultMsg();
}
Exemplo n.º 22
0
	void Executer::consolePrintWarning(const QString &text)
	{
		consolePrint(text, ActionTools::ConsoleWidget::Warning);
	}
Exemplo n.º 23
0
void consolePrintLn(double v, int p)
{
  consolePrint(v, p);
  newline();
}
Exemplo n.º 24
0
void consolePrint(double v)
{
  consolePrint(v, 2);
}