kopia lustrzana https://github.com/sh123/codec2_talkie
Do not allow Voax25 in FreeDV
rodzic
60c62a2f82
commit
ef49bde42b
|
@ -33,7 +33,6 @@ import android.os.Looper;
|
|||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
|
@ -479,7 +478,7 @@ public class MainActivity extends AppCompatActivity implements ServiceConnection
|
|||
status += getString(R.string.aprs_label);
|
||||
|
||||
// VoAX25
|
||||
boolean voax25Enabled = _sharedPreferences.getBoolean(PreferenceKeys.AX25_VOAX25_ENABLE, false);
|
||||
boolean voax25Enabled = SettingsWrapper.isVoax25Enabled(_sharedPreferences);
|
||||
if (voax25Enabled) {
|
||||
status += getString(R.string.voax25_label);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.radio.codec2talkie.protocol;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
@ -14,6 +15,7 @@ import com.radio.codec2talkie.protocol.message.TextMessage;
|
|||
import com.radio.codec2talkie.protocol.position.Position;
|
||||
import com.radio.codec2talkie.protocol.ax25.AX25Callsign;
|
||||
import com.radio.codec2talkie.settings.PreferenceKeys;
|
||||
import com.radio.codec2talkie.settings.SettingsWrapper;
|
||||
import com.radio.codec2talkie.transport.Transport;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -49,7 +51,7 @@ public class Aprs implements Protocol {
|
|||
_childProtocol.initialize(transport, context, _protocolCallback);
|
||||
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
_isVoax25Enabled = sharedPreferences.getBoolean(PreferenceKeys.AX25_VOAX25_ENABLE, false);
|
||||
_isVoax25Enabled = SettingsWrapper.isVoax25Enabled(sharedPreferences);
|
||||
|
||||
_srcCallsign = AX25Callsign.formatCallsign(
|
||||
sharedPreferences.getString(PreferenceKeys.AX25_CALLSIGN, "NOCALL").toUpperCase(),
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.radio.codec2talkie.protocol.ax25.AX25Packet;
|
|||
import com.radio.codec2talkie.protocol.message.TextMessage;
|
||||
import com.radio.codec2talkie.protocol.position.Position;
|
||||
import com.radio.codec2talkie.settings.PreferenceKeys;
|
||||
import com.radio.codec2talkie.settings.SettingsWrapper;
|
||||
import com.radio.codec2talkie.transport.Transport;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -42,7 +43,7 @@ public class Ax25 implements Protocol {
|
|||
sharedPreferences.getString(PreferenceKeys.AX25_SSID, "0"));
|
||||
// NOTE, may need to pass through sendData/sendAudio
|
||||
_digipath = sharedPreferences.getString(PreferenceKeys.AX25_DIGIPATH, "").toUpperCase();
|
||||
_isVoax25Enabled = sharedPreferences.getBoolean(PreferenceKeys.AX25_VOAX25_ENABLE, false);
|
||||
_isVoax25Enabled = SettingsWrapper.isVoax25Enabled(sharedPreferences);
|
||||
_isDigiRepeaterEnabled = sharedPreferences.getBoolean(PreferenceKeys.AX25_DIGIREPEATER_ENABLED, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,8 @@ public class Freedv implements Protocol {
|
|||
if (cntRead > 0) {
|
||||
//Log.i(TAG, "receive " + cntRead);
|
||||
_parentProtocolCallback.onReceivePcmAudio(null, null, -1, Arrays.copyOf(_speechRxBuffer, (int) cntRead));
|
||||
float snr = Codec2.freedvGetModemStat(_freedv);
|
||||
_parentProtocolCallback.onReceiveSignalLevel((short) 0, (short)(100 * snr));
|
||||
isRead = true;
|
||||
}
|
||||
nin = Codec2.freedvNin(_freedv);
|
||||
|
@ -151,6 +153,8 @@ public class Freedv implements Protocol {
|
|||
Log.i(TAG, "receive " + cntRead);
|
||||
// TODO, refactor, use onReceiveData
|
||||
_parentProtocolCallback.onReceiveCompressedAudio(null, null, -1, _dataBuffer);
|
||||
float snr = Codec2.freedvGetModemStat(_freedv);
|
||||
_parentProtocolCallback.onReceiveSignalLevel((short) 0, (short)(100 * snr));
|
||||
isRead = true;
|
||||
}
|
||||
ninData = Codec2.freedvNin(_freedvData);
|
||||
|
|
|
@ -87,4 +87,9 @@ public class SettingsWrapper {
|
|||
public static boolean isAprsEnabled(SharedPreferences sharedPreferences) {
|
||||
return sharedPreferences.getBoolean(PreferenceKeys.APRS_ENABLED, false);
|
||||
}
|
||||
|
||||
public static boolean isVoax25Enabled(SharedPreferences sharedPreferences) {
|
||||
return sharedPreferences.getBoolean(PreferenceKeys.AX25_VOAX25_ENABLE, false) &&
|
||||
!isFreeDvSoundModemModulation(sharedPreferences); // no voax25 in freedv
|
||||
}
|
||||
}
|
||||
|
|
|
@ -296,6 +296,13 @@ namespace Java_com_ustadmobile_codec2_Codec2 {
|
|||
return cntSamples;
|
||||
}
|
||||
|
||||
static jfloat freedvGetModemStat(JNIEnv *env, jclass clazz, jlong n) {
|
||||
ContextFreedv *conFreedv = getContextFreedv(n);
|
||||
float snr;
|
||||
freedv_get_modem_stats(conFreedv->freeDv, NULL, &snr);
|
||||
return snr;
|
||||
}
|
||||
|
||||
static jlong decode(JNIEnv *env, jclass clazz, jlong n, jshortArray outputSamples, jbyteArray inputBits) {
|
||||
Context *con = getContext(n);
|
||||
env->GetByteArrayRegion(inputBits, 0, con->nbyte, reinterpret_cast<jbyte*>(con->bits));
|
||||
|
@ -364,6 +371,7 @@ namespace Java_com_ustadmobile_codec2_Codec2 {
|
|||
{"freedvNin", "(J)I", (void *)freedvNin},
|
||||
{"freedvTx", "(J[S[S)J", (void *)freedvTx},
|
||||
{"freedvRx", "(J[S[S)J", (void *)freedvRx},
|
||||
{"freedvGetModemStat", "(J)F", (void *)freedvGetModemStat},
|
||||
// freedv raw data
|
||||
{"freedvRawDataRx", "(J[B[S)J", (void*)freedvRawDataRx},
|
||||
{"freedvRawDataTx", "(J[S[B)J", (void*)freedvRawDataTx},
|
||||
|
|
|
@ -71,6 +71,7 @@ public class Codec2 {
|
|||
public native static int freedvGetNSpeechSamples(long conFreedv);
|
||||
public native static int freedvGetNomModemSamples(long conFreedv);
|
||||
public native static int freedvNin(long conFreedv);
|
||||
public native static float freedvGetModemStat(long conFreedv);
|
||||
|
||||
public native static long freedvTx(long conFreedv, short[] outputModemSamples, short[] inputSpeechSamples);
|
||||
public native static long freedvRx(long conFreedv, short[] outputSpeechSamples, short[] inputModemSamples);
|
||||
|
|
Ładowanie…
Reference in New Issue