예제 #1
0
  public void savePreference() {
    // create editor
    MyEditor editor = edit();

    // source
    editor.putString("source_type", "" + sourceType.ordinal());
    editor.putInt("source_samplerate", sourceSamplerate);

    // file
    editor.putString("filesource_format", "" + filesourceFileFormat);
    editor.putBoolean("filesource_repeat", filesourceRepeat);
    editor.putInt("filesource_samplerate", fileSourceSampleRate);
    editor.putLong("filesource_frequency", fileSourceFrequency);

    // Hack RF
    editor.putBoolean("hackrf_amplify", hackrfAmplify);
    editor.putBoolean("hackrf_antenna_power", hackrfAntennaPower);
    editor.putInt("hackrf_frequency_shift", hackrfFrequencyShift);
    editor.putInt("hackrf_vga_rx_gain", vgaRxGain);
    editor.putInt("hackrf_lna_gain", lnaGain);

    // RTL
    editor.putString("rtlsdr_ip", rtlsdrIP);
    editor.putInt("rtlsdr_port", rtlsdrPort);
    editor.putBoolean("rtlsdr_external_server", rtlsrdExternalServer);
    editor.putInt("rtlsdr_frequency_correction", rtlsdrFrequencyCorrection);
    editor.putInt("rtlsdr_frequency_shift", rtlsdrFrequencyShift);
    editor.putBoolean("rtlsdr_manual_gain", rtlsdrManualGain);
    editor.putInt("rtlsdr_gain", rtlsdrGain);
    editor.putInt("rtlsdr_if_gain", rtlsdrIfGain);

    // FFT
    editor.putString("fft_size", "" + fftSize);
    editor.putString("fft_averaging", "" + fftAveraging);

    // Recording
    editor.putBoolean("recording_stop_after", recordingStopAfter);
    editor.putInt("recording_stop_after_value", recordingStopAfterValue);
    editor.putInt("recording_stop_after_unit", recordingStoppAfterUnit);

    // misc
    editor.putBoolean("autostart", autostart);
    editor.putInt("demodulation", demodulation.ordinal());
    editor.putBoolean("logging", logging);
    editor.putString("logfile", logfile);
    editor.putBoolean("show_log", showLog);
    editor.putBoolean("show_debug_information", showDebugInformation);
    Log.d(LOGTAG, "Preferences saved: " + editor.commit());
  }
예제 #2
0
  /** Will check if any preference conflicts with the current state of the app and fix it */
  public void loadPreference() {

    // source
    sourceType = SourceType.values()[getInt("source_type", 2)];
    sourceSamplerate = getInt("source_samplerate", 2000000);

    // file source
    filesourceFileFormat = getInt("filesource_format", 0);
    filesourceRepeat = getBoolean("filesource_repeat", true);
    fileSourceSampleRate = getInt("filesource_samplerate", 0);
    fileSourceFrequency = getLong("filesource_frequency", 0);

    // Hack RF
    hackrfAmplify = getBoolean("hackrf_amplify", false);
    hackrfAntennaPower = getBoolean("hackrf_antenna_power", false);
    hackrfFrequencyShift = getInt("hackrf_frequency_shift", 0);
    vgaRxGain = getInt("hackrf_vga_rx_gain", HackrfSource.MAX_VGA_RX_GAIN / 2);
    lnaGain = getInt("hackrf_lna_gain", HackrfSource.MAX_LNA_GAIN / 2);

    // RTL
    rtlsdrIP = getString("rtlsdr_ip", "");
    rtlsdrPort = getInt("rtlsdr_port", 1234);
    rtlsrdExternalServer = getBoolean("rtlsdr_external_server", false);
    rtlsdrFrequencyCorrection = getInt("rtlsdr_frequency_correction", 0);
    rtlsdrFrequencyShift = getInt("rtlsdr_frequency_shift", 0);
    rtlsdrManualGain = getBoolean("rtlsdr_manual_gain", false);
    rtlsdrGain = getInt("rtlsdr_gain", 0);
    rtlsdrIfGain = getInt("rtlsdr_if_gain", 0);

    // FFT
    fftAveraging = getInt("fft_averaging", 1);
    fftSize = getInt("fft_size", 1024);

    // Recording
    recordingStopAfter = getBoolean("recording_stop_after", false);
    recordingStopAfterValue = getInt("recording_stop_after_value", 10);
    recordingStoppAfterUnit = getInt("recording_stop_after_unit", 0);

    // misc
    autostart = getBoolean("autostart", false);
    demodulation = DemoType.values()[getInt("demodulation", 0)];
    showDebugInformation = getBoolean("show_debug_information", false);
    logging = getBoolean("logging", false);
    logfile = getString("logfile", "");
    showLog = getBoolean("show_log", false);
  }