mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 02:57:35 -05:00
Check in with Broadcastify Calls to stay online while otherwise idle (#1214)
This commit is contained in:
@@ -68,6 +68,8 @@ public class BroadcastifyCallBroadcaster extends AbstractAudioBroadcaster<Broadc
|
|||||||
private static final String MULTIPART_TYPE = "multipart";
|
private static final String MULTIPART_TYPE = "multipart";
|
||||||
private static final String DEFAULT_SUBTYPE = "form-data";
|
private static final String DEFAULT_SUBTYPE = "form-data";
|
||||||
private static final String MULTIPART_FORM_DATA = MULTIPART_TYPE + "/" + DEFAULT_SUBTYPE;
|
private static final String MULTIPART_FORM_DATA = MULTIPART_TYPE + "/" + DEFAULT_SUBTYPE;
|
||||||
|
private static final long BROADCASTIFY_TEST_INTERVAL = 15l; // minutes
|
||||||
|
private ScheduledFuture<?> mBroadcastifyTestFuture;
|
||||||
private Queue<AudioRecording> mAudioRecordingQueue = new LinkedTransferQueue<>();
|
private Queue<AudioRecording> mAudioRecordingQueue = new LinkedTransferQueue<>();
|
||||||
private ScheduledFuture<?> mAudioRecordingProcessorFuture;
|
private ScheduledFuture<?> mAudioRecordingProcessorFuture;
|
||||||
private HttpClient mHttpClient = HttpClient.newBuilder()
|
private HttpClient mHttpClient = HttpClient.newBuilder()
|
||||||
@@ -102,6 +104,9 @@ public class BroadcastifyCallBroadcaster extends AbstractAudioBroadcaster<Broadc
|
|||||||
if(response != null && response.toLowerCase().startsWith("ok"))
|
if(response != null && response.toLowerCase().startsWith("ok"))
|
||||||
{
|
{
|
||||||
setBroadcastState(BroadcastState.CONNECTED);
|
setBroadcastState(BroadcastState.CONNECTED);
|
||||||
|
|
||||||
|
// Test periodically so we don't get marked offline due to radio inactivity
|
||||||
|
mBroadcastifyTestFuture = ThreadPool.SCHEDULED.scheduleAtFixedRate(new BroadcastifyCallTest(), BROADCASTIFY_TEST_INTERVAL, BROADCASTIFY_TEST_INTERVAL, TimeUnit.MINUTES);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -124,6 +129,8 @@ public class BroadcastifyCallBroadcaster extends AbstractAudioBroadcaster<Broadc
|
|||||||
{
|
{
|
||||||
if(mAudioRecordingProcessorFuture != null)
|
if(mAudioRecordingProcessorFuture != null)
|
||||||
{
|
{
|
||||||
|
mBroadcastifyTestFuture.cancel(true);
|
||||||
|
mBroadcastifyTestFuture = null;
|
||||||
mAudioRecordingProcessorFuture.cancel(true);
|
mAudioRecordingProcessorFuture.cancel(true);
|
||||||
mAudioRecordingProcessorFuture = null;
|
mAudioRecordingProcessorFuture = null;
|
||||||
dispose();
|
dispose();
|
||||||
@@ -131,6 +138,19 @@ public class BroadcastifyCallBroadcaster extends AbstractAudioBroadcaster<Broadc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class BroadcastifyCallTest implements Runnable
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
String response = testConnection(getBroadcastConfiguration());
|
||||||
|
if(response != null && !response.toLowerCase().startsWith("ok"))
|
||||||
|
{
|
||||||
|
mLog.info("Broadcastify Calls test failure");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares for disposal
|
* Prepares for disposal
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user