Add separate events for data and voice

pull/44/head
sh123 2022-07-10 19:22:29 +03:00
rodzic b4cd220dae
commit e749558981
5 zmienionych plików z 36 dodań i 28 usunięć

Wyświetl plik

@ -715,7 +715,7 @@ public class MainActivity extends AppCompatActivity {
_btnPtt.setText(R.string.push_to_talk);
_textStatus.setText("");
break;
case EV_TRANSMITTING:
case EV_TRANSMITTED_VOICE:
if (msg.obj != null) {
_textStatus.setText((String) msg.obj);
}
@ -724,11 +724,17 @@ public class MainActivity extends AppCompatActivity {
case EV_RECEIVING:
_btnPtt.setText(R.string.main_status_rx);
break;
case EV_PLAYING:
case EV_DATA_RECEIVED:
if (msg.obj != null) {
_textStatus.setText((String) msg.obj);
}
_btnPtt.setText(R.string.main_status_play);
_btnPtt.setText(R.string.main_status_data_received);
break;
case EV_VOICE_RECEIVED:
if (msg.obj != null) {
_textStatus.setText((String) msg.obj);
}
_btnPtt.setText(R.string.main_status_voice_received);
break;
case EV_RX_RADIO_LEVEL:
if (msg.arg1 == 0) {

Wyświetl plik

@ -5,23 +5,25 @@ public enum AppMessage {
EV_DISCONNECTED(0),
EV_CONNECTED(1),
EV_LISTENING(2),
EV_TRANSMITTING(3),
EV_RECEIVING(4),
EV_PLAYING(5),
EV_RX_LEVEL(6),
EV_TX_LEVEL(7),
EV_RX_ERROR(8),
EV_TX_ERROR(9),
EV_RX_RADIO_LEVEL(10),
EV_STARTED_TRACKING(11),
EV_STOPPED_TRACKING(12),
EV_TRANSMITTED_VOICE(3),
EV_TRANSMITTED_DATA(4),
EV_RECEIVING(5),
EV_VOICE_RECEIVED(6),
EV_DATA_RECEIVED(7),
EV_RX_LEVEL(8),
EV_TX_LEVEL(9),
EV_RX_ERROR(10),
EV_TX_ERROR(11),
EV_RX_RADIO_LEVEL(12),
EV_STARTED_TRACKING(13),
EV_STOPPED_TRACKING(14),
// commands
CMD_SEND_LOCATION_TO_TNC(13),
CMD_PROCESS(14),
CMD_QUIT(15),
CMD_START_TRACKING(16),
CMD_STOP_TRACKING(17),
CMD_SEND_SINGLE_TRACKING(18);
CMD_SEND_LOCATION_TO_TNC(15),
CMD_PROCESS(16),
CMD_QUIT(17),
CMD_START_TRACKING(18),
CMD_STOP_TRACKING(19),
CMD_SEND_SINGLE_TRACKING(20);
private final int _value;
@ -32,4 +34,4 @@ public enum AppMessage {
public int toInt() {
return _value;
}
};
}

Wyświetl plik

@ -199,8 +199,7 @@ public class AppService extends Service {
_tracker.stopTracking();
showServiceNotification(R.string.app_service_notif_connection_lost, R.drawable.ic_app_action_disconnected);
break;
case EV_PLAYING:
case EV_RECEIVING:
case EV_VOICE_RECEIVED:
showVoiceNotification(R.string.app_notifications_voice_title, R.string.app_notifications_voice_summary);
break;
case EV_LISTENING:

Wyświetl plik

@ -222,7 +222,7 @@ public class AppWorker extends Thread {
@Override
protected void onReceivePcmAudio(String src, String dst, int codec, short[] pcmFrame) {
String note = (src == null ? "UNK" : src) + "→" + (dst == null ? "UNK" : dst);
sendStatusUpdate(AppMessage.EV_PLAYING, note);
sendStatusUpdate(AppMessage.EV_VOICE_RECEIVED, note);
sendRxAudioLevelUpdate(pcmFrame);
_systemAudioPlayer.write(pcmFrame, 0, pcmFrame.length);
}
@ -236,7 +236,7 @@ public class AppWorker extends Thread {
protected void onReceiveData(String src, String dst, byte[] data) {
// TODO, handle incoming messages
String note = (src == null ? "UNK" : src) + "→" + (dst == null ? "UNK" : dst);
sendStatusUpdate(AppMessage.EV_PLAYING, note);
sendStatusUpdate(AppMessage.EV_DATA_RECEIVED, note);
}
@Override
@ -253,7 +253,7 @@ public class AppWorker extends Thread {
@Override
protected void onTransmitPcmAudio(String src, String dst, int codec, short[] frame) {
String note = (src == null ? "UNK" : src) + "→" + (dst == null ? "UNK" : dst);
sendStatusUpdate(AppMessage.EV_TRANSMITTING, note);
sendStatusUpdate(AppMessage.EV_TRANSMITTED_VOICE, note);
sendTxAudioLevelUpdate(frame);
}
@ -265,7 +265,7 @@ public class AppWorker extends Thread {
@Override
protected void onTransmitData(String src, String dst, byte[] data) {
String note = (src == null ? "UNK" : src) + "→" + (dst == null ? "UNK" : dst);
sendStatusUpdate(AppMessage.EV_TRANSMITTING, note);
sendStatusUpdate(AppMessage.EV_TRANSMITTED_VOICE, note);
}
@Override

Wyświetl plik

@ -23,7 +23,7 @@
<string name="main_status_stop">STOPPED</string>
<string name="main_status_tx">TRANSMITTING</string>
<string name="main_status_rx">RECEIVING</string>
<string name="main_status_play">PLAYING</string>
<string name="main_status_voice_received">PLAYING</string>
<string name="main_status_rx_error">RECEIVING\nERROR</string>
<string name="main_status_tx_error">TRANSMITTING\nERROR</string>
@ -254,7 +254,7 @@
<string name="tracking_label">&#127937;</string>
<string name="app_notifications_voice_enable_title">Enable incoming notifications</string>
<string name="app_notifications_voice_enable_summary">Show pop-up notification on incoming transmission when app is invisible</string>
<string name="app_notifications_voice_title">Incoming transmission</string>
<string name="app_notifications_voice_title">Incoming voice transmission</string>
<string name="app_notifications_voice_summary">Click to open and react</string>
<string name="app_no_lock_title">Disable lock screen</string>
<string name="app_no_lock_summary">Run above the lock screen</string>
@ -263,4 +263,5 @@
<string name="aprs_digirepeater_enable_title">Enable digirepeater</string>
<string name="aprs_digirepeater_enable_summary">Incoming APRS packets will received and digirepeated</string>
<string name="digirepeater_label">&#128257;</string>
<string name="main_status_data_received">PROCESSING</string>
</resources>