예제 #1
0
void QX::launch_clicked()
{
    int sel = GetClickedId();
    if (sel<0) return;

    DesktopEntry entry = scanner->entries[sel];
    QString appname = entry.file;

    ProfileManager *mngr = new ProfileManager();
    AppProfile prof = mngr->GetAppProfile(appname);
    delete mngr;

#ifdef QTOPIA
    if (prof.antiDim)
    {
        powerConstraint = QtopiaApplication::Disable;
    }
    else if (prof.antiSuspend)
    {
        powerConstraint = QtopiaApplication::DisableSuspend;
    }

    if (prof.gps)
        gpsPower("1");
#endif

    if (prof.init != "")
        system(prof.init.toUtf8().data());

    //if (prof.qvga) { }

    QString cmd = entry.exec;

    if ((prof.wm) || (prof.kbd))
    {
        QString script = "/tmp/.QX_app_launcher.sh";
        QFile f(script);
        if (f.open(QIODevice::WriteOnly))
        {
            f.write("matchbox-window-manager &\n");
            f.write("sleep 5\n");
            if (prof.kbd)
                f.write("matchbox-keyboard &\n");
            f.write(entry.exec.toUtf8());
            f.close();
        }
        cmd = "sh " + script;
    }

    QString applabel = "<b>"+entry.name+"</b><br/>"+entry.exec;
    runApp(cmd, applabel, prof.rotate);
}
예제 #2
0
파일: main.cpp 프로젝트: rmhsilva/vertigo
int main() {
    char state;
    int nlock_count = 0, n;

    setup();
    
    for (;;) {
        wdt.kick();
        ftdi.printf("Entering Loop.\r\n");
        status_led = !status_led;
        
        write_rfm868(0x07, 0x01); // turn tx off - needed for below code
        write_rfm434(0x07, 0x01);

        // If GPS does not have lock for > 8 loops, restart it.
        if (nlock_count>8) {
            gpsPower(0);
            wait(2);
            gpsPower(1);
            nlock_count = 0;
        }
        
        wait(0.1); // wait for tx to turn off

        // Get temp while radio off
        temperature = (int16_t)((temp.read_u16()-9930)/19.9);
        battery_voltage = (int16_t)(battery.read()*BATT_MUL);

        rssi = ((int)read_rfm868(26)*51 - 12400)/100; // returned in dBm
        if (rssi > -50) { // if 868 channel is busy
            enable_868 = 0;
        } else {
            enable_868 = 1;
            write_rfm868(0x07, 0x08); // turn tx on
        }
        
        write_rfm434(0x07, 0x08); // turn tx on

        // Check for GPS lock
        gps_check_lock();
        if (lock==0) {
            state='L';
            nlock_count++;
        } else if (!enable_868) {
            state='O';
        } else {
            nlock_count = 0;
            state='F';
        }

        gps_get_position();
        gps_get_time();
        
        // Process triggers here
        if (config_err == 0) {
            ftdi.printf("Running triggers... ");
            runTrigger(0);
            runTrigger(1);
            runTrigger(2);
            ftdi.printf("Finished. \r\n");
        }
        
        // Cutdown check
        if (cutdown_enabled && (alt>CUTDOWN_ALT)) {
            // Double check the altitude!
            gps_get_position();
            if (alt>CUTDOWN_ALT) {
                ftdi.printf("Cutting wire!!!! \r\n");
                cutdown = 1;    // burn that wire!!!!!.   ..   !
                wait(3);
                cutdown = 0;
                cutdown_enabled = 0;
                state = 'C';
            }
        }

        // Do TX (always true, triggers not quite working)
        //if (send_gps) {
        if (1) {
            n = sprintf (buffer434, "$$VERTIGO,%d,%02d%02d%02d,%ld,%ld,%ld,%d,%c", count434, hour, minute, second, lat, lon, alt, sats, state);
            n = sprintf (buffer434, "%s*%04X\n", buffer434, (CRC16_checksum(buffer434) & 0xFFFF));

            rtty_434_txstring(buffer434);
            save_434id(count434++);
            send_gps = 0;
        }
        
        // And for 868 if enabled
        if(enable_868) {
            ftdi.printf("Doing 868 now \r\n");
            for (int count=0; count<10; count++) {
                ftdi.printf("\t loop %d\r\n", count);
                last_lon = lon;
                last_lat = lat;
                last_alt = alt;
                gps_get_position();
                gps_get_time();
                if ((lat==last_lat)&&(lon==last_lon)&&(alt==last_alt)) {
                    gps_check_lock();
                } else {
                    state = 'F'; // cheat a second here.
                }
                n = sprintf (buffer868, "$$8VERTIGO,%d,%02d%02d%02d,%ld,%ld,%ld,%d,%c,%d,%d,%d", count868, hour, minute, second, lat, lon, alt, sats, state, temperature, battery_voltage, rssi);
                n = sprintf (buffer868, "%s*%04X\n", buffer868, (CRC16_checksum(buffer868) & 0xFFFF));
        
                rtty_868_txstring(buffer868);
                save_868id(count868++);
            }
        }
    }

    return 0;
}