Remove previous feature, needs another approach

master
sh123 2024-02-19 21:45:20 +02:00
rodzic ad6e79044b
commit fb809eb47f
5 zmienionych plików z 5 dodań i 39 usunięć

Wyświetl plik

@ -11,8 +11,8 @@ android {
applicationId "com.radio.codec2talkie"
minSdkVersion 23
targetSdkVersion 30
versionCode 169
versionName "1.69"
versionCode 170
versionName "1.70"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Wyświetl plik

@ -40,7 +40,7 @@ public class TransportFactory {
switch (transportType) {
case USB:
return new UsbSerial(UsbPortHandler.getPort(), UsbPortHandler.getName(), context);
return new UsbSerial(UsbPortHandler.getPort(), UsbPortHandler.getName());
case BLUETOOTH:
return new Bluetooth(BluetoothSocketHandler.getSocket(), BluetoothSocketHandler.getName());
case TCP_IP:

Wyświetl plik

@ -21,18 +21,9 @@ public class UsbSerial implements Transport {
private final UsbSerialPort _usbPort;
private final String _name;
private final boolean _isPrefixEnabled;
private final byte[] _bytePrefix;
protected SharedPreferences _sharedPreferences;
public UsbSerial(UsbSerialPort usbPort, String name, Context context) {
public UsbSerial(UsbSerialPort usbPort, String name) {
_usbPort = usbPort;
_name = name;
_sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
_isPrefixEnabled = _sharedPreferences.getBoolean(PreferenceKeys.PORTS_USB_IS_PREFIX_ENABLED, false);
String prefix = _sharedPreferences.getString(PreferenceKeys.PORTS_USB_PREFIX, "");
_bytePrefix = TextTools.hexStringToByteArray(prefix);
}
@Override
@ -48,15 +39,7 @@ public class UsbSerial implements Transport {
@Override
public int write(byte[] data) throws IOException {
try {
if (_isPrefixEnabled) {
byte[] pkt = ByteBuffer.allocate(_bytePrefix.length + data.length)
.put(_bytePrefix)
.put(data)
.array();
_usbPort.write(pkt, TX_TIMEOUT);
} else {
_usbPort.write(data, TX_TIMEOUT);
}
_usbPort.write(data, TX_TIMEOUT);
return data.length;
} catch (SerialTimeoutException e) {
e.printStackTrace();

Wyświetl plik

@ -194,8 +194,6 @@
<string name="usb_serial_summary">Set USB serial settings, such as speed, bits, parity, etc.</string>
<string name="usb_is_prefix_enabled_title">Enable USB packet prefix</string>
<string name="usb_is_prefix_enabled_summary">Prefix USB data with the HEX string for LoRA UART modems</string>
<string name="usb_prefix_title">USB packet prefix value as HEX string</string>
<string name="usb_prefix_summary">Prefix sent content with a hex string (so called transmission target in UART modems), e.g. C0FFEE</string>
<string name="app_audio_output_speaker_title">Play audio through the speaker</string>
<string name="app_audio_output_speaker_summary">Output incoming audio through the speaker</string>

Wyświetl plik

@ -55,20 +55,5 @@
app:defaultValue="false">
</CheckBoxPreference>
<CheckBoxPreference
app:key="ports_usb_is_prefix_enabled"
app:title="@string/usb_is_prefix_enabled_title"
app:summary="@string/usb_is_prefix_enabled_summary"
app:defaultValue="false">
</CheckBoxPreference>
</PreferenceCategory>
<EditTextPreference
app:key="ports_usb_prefix"
app:title="@string/usb_prefix_title"
app:summary = "@string/usb_prefix_summary"
app:dependency="ports_usb_is_prefix_enabled"
app:defaultValue="C0FFEE">
</EditTextPreference>
</PreferenceScreen>