Esempio n. 1
0
int main(int argc, char* argv[])
{
  IupOpen(&argc, &argv);

  DialogTest();

  IupMainLoop();

  IupClose();

  return EXIT_SUCCESS;
}
void CContextLocaAppUi::HandleCommandL(TInt aCommand)
{
	CALLSTACKITEM_N(_CL("CContextLocaAppUi"), _CL("HandleCommandL"));

	SetInHandlableEvent(ETrue);
#ifdef __WINS__
	TInt err;
	TBreakItem b(GetContext(), err);
#endif
	if (BaseHandleCommandL(aCommand)) return;

	switch ( aCommand )
	{
	case Econtext_logCmdAppPauseLog:
		Settings().WriteSettingL(SETTING_LOGGING_ENABLE, EFalse);
		break;
	case Econtext_logCmdAppUnPauseLog:
		Settings().WriteSettingL(SETTING_LOGGING_ENABLE, ETrue);
		break;
	case Econtext_logCmdCancelSend:
		// do nothing
		break;
	case Econtext_logCmdAppSettings:
		ActivateLocalViewL(KSettingsViewId);
		break;
	case Econtext_logCmdDumpCommDb:
		{
		CCommDbDump* dump=CCommDbDump::NewL();
		dump->DumpDBtoFileL(_L("c:\\commdb.txt"));
		delete dump;
		}
		break;
	case Econtext_logCmdCreateAp:
		{
		CreateAPL(_L("cingular"),
			_L("WAP.CINGULAR"),
			_L("*****@*****.**"),
			_L("CINGULAR1"));
		}
		break;
	case Econtext_logCmdStartSensors:
		{
			if  (!iSensorRunner)
				iSensorRunner=CSensorRunner::NewL(
					AppContext(), smsh, EFalse, *this);
		}
		break;

	case Econtext_logCmdAppTest:
		{
		//loc->test();
		//recorder->test();
		DialogTest();
		}
		break;
	case Econtext_logCmdAppImsi:
		{
			/*if (loc) status_change(loc->GetImsi());
			else */{
#ifndef __WINS__
				TBuf<20> machineId;
				GetImeiL(machineId);
				status_change(machineId);
#else
				// Return a fake IMEI when working on emulator
				_LIT(KEmulatorImsi, "244050000000000");
				status_change(KEmulatorImsi);
#endif
			}
		}
			
		break;
	default:
		if (aCommand>Econtext_logCmdSendAppUi || aCommand==Econtext_logCmdSendFtp) {
			
			if (aCommand==Econtext_logCmdSendFtp) {
				//iPeriodicTransfer->Transfer(false);
				//iPeriodicTransfer->Transfer(true);
			} else {
				status_change(_L("trying transfer"));

				/*
				cellid_name_file.Close();
				*/
				
				TFileName transfer_cellid_filen, cellid_filen;
				transfer_cellid_filen.Format(_L("%S%S"), &AppDir(), &transfer_cellid_file);
				cellid_filen.Format(_L("%S%S"), &DataDir(), &cellid_file);

				TInt ferr=BaflUtils::CopyFile(Fs(), cellid_filen, transfer_cellid_filen);
				if (ferr!=KErrNone) {
					TBuf<30> errmsg;
					errmsg.Format(_L("copy: %d"), ferr);
					error(errmsg);
					return;
				}
				/*
				ferr=cellid_name_file.Open(Fs(), cellid_filen, 
					EFileShareAny | EFileStreamText | EFileRead | EFileWrite);
				if (ferr!=KErrNone) {
					TBuf<30> errmsg;
					errmsg.Format(_L("reopen: %d, RESTART NOW"), ferr);
					error(errmsg);
					return;
				}
				*/
				iLog->switch_file();

				transferer->transfer_files(aCommand);
			}
			
		}
		break;
	}
}