void MountTray::programInit() { DCheck = new DevCheck(); //initialize class for checking devices qDebug() << "pc-mounttray: starting up"; MTINIT=true; //set the flag that the mount tray is initializing; //getInitialUsername(); //try to detect the non-root user who is running the program with root permissions getFileManager(); loadSavedSettings(); trayIcon = new QSystemTrayIcon(this); trayIconMenu = new QMenu(); //Generate the system menu options (these don't change) sysMenu = new QMenu( tr("More Options") ); sysMenu->setIcon( QIcon(":icons/config.png") ); //Add the additional options sysMenu->addAction( QIcon(":icons/folder.png"), tr("Open Media Directory"), this, SLOT(slotOpenMediaDir()) ); sysMenu->addAction( QIcon(":icons/harddrive.png"), tr("View Disk Usage"),this,SLOT(slotOpenFSDialog()) ); sysMenu->addAction( QIcon(":icons/refresh.png"),tr("Rescan Devices"), this, SLOT(slotRescan()) ); //Add the setting dialog option seperately sysMenu->addSeparator(); sysMenu->addAction( QIcon(":icons/dvd.png"), tr("Load ISO File"), this, SLOT(slotOpenISO()) ); sysMenu->addAction( QIcon(":icons/config.png"), tr("Change Settings"), this, SLOT(slotOpenSettings()) ); //Add the Close button seperately sysMenu->addSeparator(); sysMenu->addAction( QIcon(":icons/application-exit.png"), tr("Close Tray"), this, SLOT(closeTray()) ); // Tie the left-click signal to open the context menu connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason)) ); //Connect the message clicked slot connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotPopupClicked()) ); //Set the default Tray Icon (will change once tray menus are set) trayIcon->setIcon(QIcon(":icons/CDdevices-inactive.png")); trayIcon->show(); //Do an initial scan of the devices with dmesg qDebug() << "-Performing initial device scan"; scanInitialDevices(); //Startup the devd watching process qDebug() << "-Starting up the DEVD watcher"; devdTimer = new QTimer(); devdTimer->setSingleShot(TRUE); connect(devdTimer,SIGNAL(timeout()),this,SLOT(slotDevChanges())); startupDevdProc(); //Start up the filesystem watcher diskWatcher = new FSWatcher(); connect(diskWatcher,SIGNAL(FSWarning(QString,QString)),this,SLOT(slotDisplayWarning(QString,QString))); if(useDiskWatcher){ qDebug() << "-Starting up the disk space alert system"; diskWatcher->start(diskTimerMaxMS); } //Update the tray menu and icons updateMenu(); qDebug() << "-Program now ready for use"; QTimer::singleShot(500, this, SLOT(slotDoneWithInit()) ); //give it 1/2 a second to settle }
int main(void) { cli(); loadSavedSettings(); setupRegisters(); sei(); if (ButtonIsDown) { machineState = throttleMax; } else { machineState = startWipe1; } while (1) { } }
int DsauServer::readFromAddress(int new_s, char addrloc, int *iVal, double *dVal, int *type, DsauServer& settings){ //we'll be simulating reading from the zynq with reading from a txt file. If we are using xml for settings data, we'll need to add code to handle it but it will be much more convient for accessing data. loadSavedSettings("Control_Settings.txt", settings); char *sendf= new char[MAX_LINE]; switch(addrloc) { case 'a': //nsweep *iVal = settings.nSweep; printf("Sweep number is %d \n", *iVal); sprintf( sendf, "%c%d", 'b', *iVal); *type = 1; break; case 'b': //nstep *iVal = settings.nStep; printf("Step Number is %d \n", *iVal); sprintf( sendf, "%c%d", 'b',*iVal); *type = 2; break; case 'c': //nSample *iVal = settings.nSample; printf("Sample Number %d \n", *iVal); sprintf( sendf, "%c%d", 'b',*iVal); *type = 3; break; case 'd': //dsweeep *dVal = settings.dSweep; printf("Sweep Delay is %f \n", *dVal); sprintf( sendf, "%c%f", 'b',*dVal); *type = 4; break; case 'e': //minF *dVal = settings.minF; printf("Min Frequency is %f \n", *dVal); sprintf( sendf, "%c%f", 'b',*dVal); *type = 5; break; case 'f': //maxF *dVal = settings.maxF; printf("Max Frequency is %f \n", *dVal); sprintf( sendf, "%c%f", 'b',*dVal); *type = 6; break; case 'g': //gain *dVal = settings.gain; printf("Gain is %f \n", *dVal); sprintf( sendf, "%c%f", 'b',*dVal); *type = 6; break; default: fprintf(stderr, "%s \n", "Not a valid address"); sprintf( sendf, "%s%s", "eeeee", "Not a valid address"); send( new_s, sendf,strlen( sendf), 0); return 0; } /*** //Server code to send back response? or do something else? ***/ // fprintf(stderr, "%s \n", sendf); send( new_s, sendf, strlen( sendf), 0); sprintf( sendf, "%c", 'f'); // fprintf(stderr, "%s \n", sendf); send( new_s, sendf, strlen( sendf), 0); return 1; }