Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Headless #1144

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repositories {
maven { url "https://jitpack.io" }
}

version = '0.5.0-alpha7'
version = '0.5.0-alpha8'
sourceCompatibility = '17'

javafx {
Expand Down Expand Up @@ -88,6 +88,8 @@ dependencies {
implementation 'javax.usb:usb-api:1.0.2'
implementation 'net.coderazzi:tablefilter-swing:5.4.0'
implementation 'org.apache.commons:commons-compress:1.20'
implementation 'commons-cli:commons-cli:1.4'
implementation 'commons-io:commons-io:2.7'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.apache.commons:commons-csv:1.9.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public BroadcastifyCallBroadcaster(BroadcastifyCallConfiguration config, AliasMo
@Override
public void start()
{
System.out.println("Started audio recording thread.");
setBroadcastState(BroadcastState.CONNECTING);
String response = testConnection(getBroadcastConfiguration());
mLastConnectionAttempt = System.currentTimeMillis();
Expand Down Expand Up @@ -211,6 +212,7 @@ private void processRecordingQueue()

if(isValid(audioRecording) && audioRecording.getRecordingLength() > 0)
{
System.out.println("Processing recording.");
float durationSeconds = (float)(audioRecording.getRecordingLength() / 1E3f);
long timestampSeconds = (int)(audioRecording.getStartTime() / 1E3);
String talkgroup = getTo(audioRecording);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
package io.github.dsheirer.channel.metadata;

import com.google.common.eventbus.Subscribe;
import io.github.dsheirer.gui.SDRTrunk;

import io.github.dsheirer.alias.Alias;
import io.github.dsheirer.controller.channel.Channel;
import io.github.dsheirer.eventbus.MyEventBus;
Expand Down Expand Up @@ -74,13 +76,16 @@ public void preferenceUpdated(PreferenceType preferenceType)
{
if(preferenceType == PreferenceType.TALKGROUP_FORMAT)
{
EventQueue.invokeLater(() -> {
for(int row = 0; row < mChannelMetadata.size(); row++)
{
fireTableCellUpdated(row, COLUMN_USER_FROM);
fireTableCellUpdated(row, COLUMN_USER_TO);
}
});
if (!SDRTrunk.mHeadlessMode) {

EventQueue.invokeLater(() -> {
for(int row = 0; row < mChannelMetadata.size(); row++)
{
fireTableCellUpdated(row, COLUMN_USER_FROM);
fireTableCellUpdated(row, COLUMN_USER_TO);
}
});
}
}
}

Expand Down Expand Up @@ -114,21 +119,24 @@ public void setChannelAddListener(Listener<ChannelAndMetadata> listener)
public void add(ChannelAndMetadata channelAndMetadata)
{
//Execute on the swing thread to avoid threading issues
EventQueue.invokeLater(() -> {
for(ChannelMetadata channelMetadata: channelAndMetadata.getChannelMetadata())
{
mChannelMetadata.add(channelMetadata);
mMetadataChannelMap.put(channelMetadata, channelAndMetadata.getChannel());
int index = mChannelMetadata.indexOf(channelMetadata);
fireTableRowsInserted(index, index);
channelMetadata.setUpdateEventListener(ChannelMetadataModel.this);
}
if (!SDRTrunk.mHeadlessMode) {

if(mChannelAddListener != null)
{
mChannelAddListener.receive(channelAndMetadata);
}
});
EventQueue.invokeLater(() -> {
for(ChannelMetadata channelMetadata: channelAndMetadata.getChannelMetadata())
{
mChannelMetadata.add(channelMetadata);
mMetadataChannelMap.put(channelMetadata, channelAndMetadata.getChannel());
int index = mChannelMetadata.indexOf(channelMetadata);
fireTableRowsInserted(index, index);
channelMetadata.setUpdateEventListener(ChannelMetadataModel.this);
}

if(mChannelAddListener != null)
{
mChannelAddListener.receive(channelAndMetadata);
}
});
}
}

/**
Expand All @@ -147,17 +155,20 @@ public void updateChannelMetadataToChannelMap(Collection<ChannelMetadata> channe
public void remove(ChannelMetadata channelMetadata)
{
//Execute on the swing thread to avoid threading issues
EventQueue.invokeLater(() -> {
channelMetadata.removeUpdateEventListener();
int index = mChannelMetadata.indexOf(channelMetadata);
mChannelMetadata.remove(channelMetadata);
mMetadataChannelMap.remove(channelMetadata);
if (!SDRTrunk.mHeadlessMode) {

if(index >= 0)
{
fireTableRowsDeleted(index, index);
}
});
EventQueue.invokeLater(() -> {
channelMetadata.removeUpdateEventListener();
int index = mChannelMetadata.indexOf(channelMetadata);
mChannelMetadata.remove(channelMetadata);
mMetadataChannelMap.remove(channelMetadata);

if(index >= 0)
{
fireTableRowsDeleted(index, index);
}
});
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import io.github.dsheirer.source.SourceManager;
import io.github.dsheirer.source.config.SourceConfigTuner;
import io.github.dsheirer.source.config.SourceConfigTunerMultipleFrequency;
import io.github.dsheirer.gui.SDRTrunk;
import io.github.dsheirer.util.ThreadPool;
import javafx.application.Platform;
import org.slf4j.Logger;
Expand Down Expand Up @@ -311,7 +312,11 @@ private void startProcessing(ChannelStartProcessingRequest request) throws Chann
if(source == null)
{
//This has to be done on the FX event thread when the playlist editor is constructed
Platform.runLater(() -> channel.setProcessing(false));
if (!SDRTrunk.mHeadlessMode) {
Platform.runLater(() -> channel.setProcessing(false));
} else {
channel.setProcessing(false);
}

mChannelEventBroadcaster.broadcast(new ChannelEvent(channel,
ChannelEvent.Event.NOTIFICATION_PROCESSING_START_REJECTED, TUNER_UNAVAILABLE_DESCRIPTION));
Expand Down Expand Up @@ -466,7 +471,11 @@ else if(request.hasChildDecodeEventHistory())
processingChain.start();

//This has to be done on the FX event thread when the playlist editor is constructed
Platform.runLater(() -> channel.setProcessing(true));
if (!SDRTrunk.mHeadlessMode) {
Platform.runLater(() -> channel.setProcessing(true));
} else {
channel.setProcessing(true);
}

getChannelMetadataModel().add(new ChannelAndMetadata(channel, processingChain.getChannelState().getChannelMetadata()));

Expand All @@ -481,7 +490,9 @@ else if(request.hasChildDecodeEventHistory())
private void stopProcessing(Channel channel) throws ChannelException
{
//This has to be done on the FX event thread when the playlist editor is constructed
Platform.runLater(() -> channel.setProcessing(false));
if (!SDRTrunk.mHeadlessMode) {
Platform.runLater(() -> channel.setProcessing(false));
}

if(mProcessingChains.containsKey(channel))
{
Expand Down
Loading