6 Commits

Author SHA1 Message Date
Marc Froehlich
037dc8a05b Update information service mechanic implemented 2024-02-08 23:52:08 +01:00
Marc Froehlich
476b4a7dd1 Some bugfixes to make the client robust against crashes after deconnects 2024-02-06 23:56:04 +01:00
Marc Froehlich
bd687dc50f Chat is now disconnectable and reconnectable without closing. Made some changes in the thread management to make that possible 2024-02-01 22:35:06 +01:00
Marc Froehlich
7bce7be2ba added contextmenu to cq-message-table 2024-01-26 22:42:45 +01:00
Marc Froehlich
3286a34a08 added audio support 2024-01-26 11:09:15 +01:00
Marc Froehlich
c2086a73b0 added audio support 2024-01-16 22:51:30 +01:00
111 changed files with 1918 additions and 205 deletions

View File

@@ -1 +1,2 @@
do5sa do5sa
##12390780900ß9'++++2e0NEY#####

3
jdk.cmd Normal file
View File

@@ -0,0 +1,3 @@
@echo off
SET JAVA_HOME=C:\Program Files\Java\jdk-17
SET PATH=%JAVA_HOME%\bin,%PATH%

View File

@@ -5,4 +5,19 @@ public class ApplicationConstants {
* Name of the Application. * Name of the Application.
*/ */
public static final String APPLICATION_NAME = "praktiKST"; public static final String APPLICATION_NAME = "praktiKST";
/**
* Name of file to store preferences in.
*/
public static final double APPLICATION_CURRENTVERSIONNUMBER = 0.9;
public static final String VERSIONINFOURLFORUPDATES_KST4CONTEST = "https://do5amf.funkerportal.de/kst4ContestVersionInfo.xml";
public static final String VERSIONINFDOWNLOADEDLOCALFILE = "kst4ContestVersionInfo.xml";
public static final String DISCSTRING_DISCONNECT_AND_CLOSE = "CLOSEALL";
public static final String DISCSTRING_DISCONNECT_DUE_PAWWORDERROR = "JUSTDSICCAUSEPWWRONG";
public static final String DISCSTRING_DISCONNECTONLY = "ONLYDISCONNECT";
public static final String DISCONNECT_RDR_POISONPILL = "POISONPILL_KILLTHREAD"; //whereever a (blocking) udp or tcp reader in an infinite loop gets this message, it will break this loop
} }

View File

@@ -42,7 +42,9 @@ public class AirScoutPeriodicalAPReflectionInquirerTask extends TimerTask {
String asWatchListStringSuffix = asWatchListString; String asWatchListStringSuffix = asWatchListString;
String host = "255.255.255.255"; String host = "255.255.255.255";
int port = 9872; // int port = 9872;
int port = client.getChatPreferences().getAirScout_asCommunicationPort();
// System.out.println("<<<<<<<<<<<<<<<<<<<<ASPERI: " + port);
// byte[] message = "ASSETPATH: \"KST\" \"AS\" 1440000,DO5AMF,JN49GL,OK1MZM,JN89IW ".getBytes(); Original, ging // byte[] message = "ASSETPATH: \"KST\" \"AS\" 1440000,DO5AMF,JN49GL,OK1MZM,JN89IW ".getBytes(); Original, ging
InetAddress address; InetAddress address;

View File

@@ -11,13 +11,13 @@ import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableStringValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import kst4contest.model.ChatCategory; import kst4contest.ApplicationConstants;
import kst4contest.model.ChatMember; import kst4contest.model.*;
import kst4contest.model.ChatMessage; import kst4contest.utils.PlayAudioUtils;
import kst4contest.model.ChatPreferences;
import kst4contest.model.ClusterMessage;
import java.io.*; import java.io.*;
@@ -41,6 +41,7 @@ public class ChatController {
*/ */
// private int category = ChatCategory.VUHF; // private int category = ChatCategory.VUHF;
private UpdateInformation updateInformation;
private ChatPreferences chatPreferences; private ChatPreferences chatPreferences;
private ChatCategory category; private ChatCategory category;
@@ -57,6 +58,14 @@ public class ChatController {
this.disconnectionPerformedByUser = disconnectionPerformedByUser; this.disconnectionPerformedByUser = disconnectionPerformedByUser;
} }
public UpdateInformation getUpdateInformation() {
return updateInformation;
}
public void setUpdateInformation(UpdateInformation updateInformation) {
this.updateInformation = updateInformation;
}
public String getChatState() { public String getChatState() {
return chatState; return chatState;
} }
@@ -91,7 +100,8 @@ public class ChatController {
/** /**
* Handles the disconnect of either the chat (Case DISCONNECTONLY) or the * Handles the disconnect of either the chat (Case DISCONNECTONLY) or the
* complete application life including all threads (case CLOSEALL) * complete application life including all threads (case CLOSEALL)<br/><br/>
* Look in ApplicationConstants for the DISCSTRINGS
* *
* @param action: "CLOSEALL" or "DISCONNECTONLYCHAT", on application close event * @param action: "CLOSEALL" or "DISCONNECTONLYCHAT", on application close event
* (Settings Window closed), Disconnect on Disconnect-Button * (Settings Window closed), Disconnect on Disconnect-Button
@@ -101,7 +111,56 @@ public class ChatController {
this.setDisconnectionPerformedByUser(true); this.setDisconnectionPerformedByUser(true);
if (action.equals("CLOSEALL")) { try {
/**
* Kill UCX packetreader by sending poison pill to the reader thread
*/
DatagramSocket dsocket;
String host = "255.255.255.255";
int port = chatPreferences.getLogsynch_ucxUDPWkdCallListenerPort();
InetAddress address;
address = InetAddress.getByName("255.255.255.255");
DatagramPacket packet = new DatagramPacket(ApplicationConstants.DISCONNECT_RDR_POISONPILL.getBytes(), ApplicationConstants.DISCONNECT_RDR_POISONPILL.length(), address, port);
dsocket = new DatagramSocket();
dsocket.setBroadcast(true);
dsocket.send(packet);
// dsocket.send(packet);
dsocket.close();
readUDPbyUCXThread.interrupt();
} catch (Exception error) {
System.out.println("Chatcrontroller, ERROR: unable to send poison pill to ucxThread");
}
try {
/**
* Kill AS packetreader by sending poison pill to the reader thread
*/
DatagramSocket dsocket;
String host = "255.255.255.255";
int port = chatPreferences.getAirScout_asCommunicationPort();
InetAddress address;
address = InetAddress.getByName("255.255.255.255");
DatagramPacket packet = new DatagramPacket(ApplicationConstants.DISCONNECT_RDR_POISONPILL.getBytes(), ApplicationConstants.DISCONNECT_RDR_POISONPILL.length(), address, port);
dsocket = new DatagramSocket();
dsocket.setBroadcast(true);
dsocket.send(packet);
dsocket.close();
} catch (Exception error) {
System.out.println("Chatcrontroller, ERROR: unable to send poison pill to ucxThread");
}
if (action.equals(ApplicationConstants.DISCSTRING_DISCONNECT_AND_CLOSE)) {
this.lst_chatMemberList.clear();;
this.lst_clusterMemberList.clear();
this.setDisconnected(true); this.setDisconnected(true);
this.setConnectedAndLoggedIn(false); this.setConnectedAndLoggedIn(false);
this.setConnectedAndNOTLoggedIn(false); this.setConnectedAndNOTLoggedIn(false);
@@ -119,9 +178,8 @@ public class ChatController {
messageRXBus.add(killThreadPoisonPillMsg); //kills messageprocessor messageRXBus.add(killThreadPoisonPillMsg); //kills messageprocessor
messageTXBus.add(killThreadPoisonPillMsg); //kills writethread messageTXBus.add(killThreadPoisonPillMsg); //kills writethread
writeThread.interrupt(); // writeThread.interrupt();
// readThread.interrupt();
readThread.interrupt();
beaconTimer.purge(); beaconTimer.purge();
beaconTimer.cancel(); beaconTimer.cancel();
@@ -159,11 +217,15 @@ public class ChatController {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e2.printStackTrace(); e2.printStackTrace();
} }
} else if (action.equals("JUSTDSICCAUSEPWWRONG")){ } else if (action.equals(ApplicationConstants.DISCSTRING_DISCONNECTONLY)){
this.lst_chatMemberList.clear();;
this.lst_clusterMemberList.clear();
this.setDisconnected(true); this.setDisconnected(true);
this.setConnectedAndLoggedIn(false); this.setConnectedAndLoggedIn(false);
this.setConnectedAndNOTLoggedIn(true); this.setConnectedAndNOTLoggedIn(false);
// disconnect telnet and kill all sockets and connections // disconnect telnet and kill all sockets and connections
keepAliveTimer.cancel(); keepAliveTimer.cancel();
@@ -179,7 +241,6 @@ public class ChatController {
messageTXBus.add(killThreadPoisonPillMsg); //kills writethread messageTXBus.add(killThreadPoisonPillMsg); //kills writethread
writeThread.interrupt(); writeThread.interrupt();
readThread.interrupt(); readThread.interrupt();
beaconTimer.purge(); beaconTimer.purge();
@@ -192,24 +253,34 @@ public class ChatController {
userActualizationtimer.purge(); userActualizationtimer.purge();
userActualizationtimer.cancel(); userActualizationtimer.cancel();
userActualizationtimer.purge();
userActualizationtimer.cancel();
// consoleReader.interrupt(); // consoleReader.interrupt();
messageProcessor.interrupt(); // messageProcessor.interrupt();
readUDPbyUCXThread.interrupt(); readUDPbyUCXThread.interrupt(); //need poisonpill?
airScoutUDPReaderThread.interrupt(); //need poisonpill?
airScoutUDPReaderThread.interrupt(); // dbHandler.closeDBConnection();
// this.dbHandler = null;
dbHandler.closeDBConnection();
try {
if (socket != null) {
socket.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
} }
} }
// private String userName = "DO5AMF";
// private String password = "uxskezcj";
private String userName; private String userName;
private String password; private String password;
private String showedName; private String showedName;
@@ -218,8 +289,7 @@ public class ChatController {
private String chatState; private String chatState;
private String hostname = "109.90.0.130"; private String hostname = "109.90.0.130";
private String praktiKSTVersion = "wtKST 3.1.4.6"; private String praktiKSTVersion = "praktiKST 0.9b";
// private String praktiKSTVersion = "praktiKST 1.0";
private String praktiKSTVersionInfo = "2022-10 - 2022-12\ndeveloped by DO5AMF, Marc\nContact: praktimarc@gmail.com\nDonations via paypal are welcome"; private String praktiKSTVersionInfo = "2022-10 - 2022-12\ndeveloped by DO5AMF, Marc\nContact: praktimarc@gmail.com\nDonations via paypal are welcome";
private int port = 23001; // kst4contest.test 4 23001 private int port = 23001; // kst4contest.test 4 23001
@@ -232,6 +302,12 @@ public class ChatController {
private MessageBusManagementThread messageProcessor; private MessageBusManagementThread messageProcessor;
private ReadUDPbyAirScoutMessageThread airScoutUDPReaderThread; private ReadUDPbyAirScoutMessageThread airScoutUDPReaderThread;
private PlayAudioUtils playAudioUtils = new PlayAudioUtils();
public PlayAudioUtils getPlayAudioUtils() {
return playAudioUtils;
}
private TimerTask userActualizationTask; private TimerTask userActualizationTask;
private TimerTask keepAliveMessageSenderTask; private TimerTask keepAliveMessageSenderTask;
@@ -434,9 +510,9 @@ public class ChatController {
} }
public ChatController() { public ChatController() {
super();
category = new ChatCategory(2); super();
category = new ChatCategory(2);
ownChatMemberObject = new ChatMember(); ownChatMemberObject = new ChatMember();
ownChatMemberObject.setCallSign(userName); ownChatMemberObject.setCallSign(userName);
ownChatMemberObject.setName(showedName); ownChatMemberObject.setName(showedName);
@@ -444,7 +520,6 @@ public class ChatController {
// this.category = ChatCategory.VUHF; // this.category = ChatCategory.VUHF;
this.userName = ownChatMemberObject.getName(); this.userName = ownChatMemberObject.getName();
// this.password = "uxskezcj";
this.hostname = "www.on4kst.info"; this.hostname = "www.on4kst.info";
this.port = port; this.port = port;
} }
@@ -452,12 +527,20 @@ public class ChatController {
/** /**
* This constructor is used by the Main()-Class of the praktiKST javaFX-gui. * This constructor is used by the Main()-Class of the praktiKST javaFX-gui.
* *
* @param setCategory *
* @param setOwnChatMemberObject * @param setOwnChatMemberObject
*/ */
public ChatController(ChatMember setOwnChatMemberObject) { public ChatController(ChatMember setOwnChatMemberObject) {
super(); super();
UpdateChecker checkForUpdates = new UpdateChecker(this);
if (checkForUpdates.downloadLatestVersionInfoXML()) {
updateInformation = checkForUpdates.parseUpdateXMLFile();
};
dbHandler = new DBController();
chatPreferences = new ChatPreferences(); chatPreferences = new ChatPreferences();
chatPreferences.readPreferencesFromXmlFile(); // set the praktikst Prefs by file or default if file is corrupted chatPreferences.readPreferencesFromXmlFile(); // set the praktikst Prefs by file or default if file is corrupted
@@ -540,6 +623,12 @@ public class ChatController {
public void execute() throws InterruptedException, IOException { public void execute() throws InterruptedException, IOException {
// messageBus = new SimpleStringProperty("_____est connection");
// ObservableStringValue test = new SimpleStringProperty("test");
// eventBus = test;
chatController = this; chatController = this;
// This block constructs a sample message // This block constructs a sample message
@@ -553,7 +642,9 @@ public class ChatController {
// getLst_toAllMessageList().add(Test); // getLst_toAllMessageList().add(Test);
try { try {
dbHandler = new DBController(); setDisconnectionPerformedByUser(false);
// dbHandler = new DBController(); //TODO: old place to instantiuate the dbcontroller
messageRXBus = new LinkedBlockingQueue<ChatMessage>(); messageRXBus = new LinkedBlockingQueue<ChatMessage>();
messageTXBus = new LinkedBlockingQueue<ChatMessage>(); messageTXBus = new LinkedBlockingQueue<ChatMessage>();
@@ -573,7 +664,7 @@ public class ChatController {
writeThread.setName("Writethread-telnetwriter"); writeThread.setName("Writethread-telnetwriter");
writeThread.start(); writeThread.start();
readUDPbyUCXThread = new ReadUDPbyUCXMessageThread(12060, this); readUDPbyUCXThread = new ReadUDPbyUCXMessageThread(chatPreferences.getLogsynch_ucxUDPWkdCallListenerPort(), this);
readUDPbyUCXThread.setName("readUDPbyUCXThread"); readUDPbyUCXThread.setName("readUDPbyUCXThread");
readUDPbyUCXThread.start(); readUDPbyUCXThread.start();
@@ -581,7 +672,7 @@ public class ChatController {
messageProcessor.setName("messagebusManagementThread"); messageProcessor.setName("messagebusManagementThread");
messageProcessor.start(); messageProcessor.start();
airScoutUDPReaderThread = new ReadUDPbyAirScoutMessageThread(9872, this, "AS", "KST"); airScoutUDPReaderThread = new ReadUDPbyAirScoutMessageThread(chatPreferences.getAirScout_asCommunicationPort(), this, "AS", "KST");
airScoutUDPReaderThread.setName("airscoutudpreaderThread"); airScoutUDPReaderThread.setName("airscoutudpreaderThread");
airScoutUDPReaderThread.start(); airScoutUDPReaderThread.start();
@@ -632,7 +723,7 @@ public class ChatController {
@Override @Override
public void run() { public void run() {
// System.out.println("[Chatcontroller, info: ] periodical socketcheck"); System.out.println("[Chatcontroller, info: ] periodical socketcheck");
Thread.currentThread().setName("SocketcheckTimer"); Thread.currentThread().setName("SocketcheckTimer");
@@ -645,13 +736,6 @@ public class ChatController {
chatController.setConnectedAndLoggedIn(false); chatController.setConnectedAndLoggedIn(false);
chatController.getLst_chatMemberList().clear(); chatController.getLst_chatMemberList().clear();
// messageProcessor.interrupt();
// chatController.getReadThread().interrupt();
// chatController.getWriteThread().interrupt();
// keepAliveTimer.wait();
// chatController.getstat
System.out.println("[Chatcontroller, Warning: ] Socket closed or disconnected"); System.out.println("[Chatcontroller, Warning: ] Socket closed or disconnected");
ChatMessage killThreadPoisonPillMsg = new ChatMessage(); ChatMessage killThreadPoisonPillMsg = new ChatMessage();

View File

@@ -29,8 +29,6 @@ public class DBController {
// private static final String DB_PATH = System.getProperty("praktiKST.db"); // private static final String DB_PATH = System.getProperty("praktiKST.db");
private static String DB_PATH = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, DATABASE_FILE); private static String DB_PATH = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, DATABASE_FILE);
/* /*
static { static {
try { try {
@@ -63,6 +61,9 @@ public class DBController {
} }
private void initDBConnection() { private void initDBConnection() {
System.out.println("DBH: initiate new db connection");
try { try {
ApplicationFileUtils.copyResourceIfRequired( ApplicationFileUtils.copyResourceIfRequired(
ApplicationConstants.APPLICATION_NAME, ApplicationConstants.APPLICATION_NAME,

View File

@@ -11,10 +11,13 @@ import java.util.regex.Pattern;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import kst4contest.ApplicationConstants;
import kst4contest.model.AirPlaneReflectionInfo; import kst4contest.model.AirPlaneReflectionInfo;
import kst4contest.model.ChatMember; import kst4contest.model.ChatMember;
import kst4contest.model.ChatMessage; import kst4contest.model.ChatMessage;
import kst4contest.model.ClusterMessage; import kst4contest.model.ClusterMessage;
import kst4contest.utils.PlayAudioUtils;
import kst4contest.view.Kst4ContestApplication;
/** /**
* *
@@ -544,14 +547,37 @@ public class MessageBusManagementThread extends Thread {
// System.out.println("message directed to: " + newMessage.getReceiver().getCallSign() + ". EQ?: " + this.client.getownChatMemberObject().getCallSign() + " sent by: " + newMessage.getSender().getCallSign().toUpperCase() + " -> EQ?: "+ this.client.getChatPreferences().getLoginCallSign().toUpperCase()); // System.out.println("message directed to: " + newMessage.getReceiver().getCallSign() + ". EQ?: " + this.client.getownChatMemberObject().getCallSign() + " sent by: " + newMessage.getSender().getCallSign().toUpperCase() + " -> EQ?: "+ this.client.getChatPreferences().getLoginCallSign().toUpperCase());
try { try {
/**
* message is directed to me, will be put in the "to me" messagelist
*/
if (newMessage.getReceiver().getCallSign() if (newMessage.getReceiver().getCallSign()
.equals(this.client.getChatPreferences().getLoginCallSign())) { .equals(this.client.getChatPreferences().getLoginCallSign())) {
this.client.getLst_toMeMessageList().add(0, newMessage); this.client.getLst_toMeMessageList().add(0, newMessage);
if (this.client.getChatPreferences().isNotify_playSimpleSounds()) {
this.client.getPlayAudioUtils().playNoiseLauncher('P');
}
if (this.client.getChatPreferences().isNotify_playCWCallsignsOnRxedPMs()) {
this.client.getPlayAudioUtils().playCWLauncher(" " + " " + newMessage.getSender().getCallSign().toUpperCase());
}
if (this.client.getChatPreferences().isNotify_playVoiceCallsignsOnRxedPMs()) {
this.client.getPlayAudioUtils().playVoiceLauncher( "?" + newMessage.getSender().getCallSign().toUpperCase());
}
if (this.client.getChatPreferences().isNotify_playSimpleSounds()) {
if (newMessage.getMessageText().toUpperCase().contains("//BELL")) {
this.client.getPlayAudioUtils().playVoiceLauncher("!");
}
}
System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + "."); System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + ".");
} else if (newMessage.getSender().getCallSign().toUpperCase() } else if (newMessage.getSender().getCallSign().toUpperCase()
/**
* message from me will appear in the PM window, too, with (>CALLSIGN) before
*/
.equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) { .equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
String originalMessage = newMessage.getMessageText(); String originalMessage = newMessage.getMessageText();
newMessage newMessage
@@ -566,7 +592,7 @@ public class MessageBusManagementThread extends Thread {
// System.out.println("MSGBS bgfx: tx call = " + newMessage.getSender().getCallSign() + " / rx call = " + newMessage.getReceiver().getCallSign()); // System.out.println("MSGBS bgfx: tx call = " + newMessage.getSender().getCallSign() + " / rx call = " + newMessage.getReceiver().getCallSign());
} }
} catch (NullPointerException referenceDeletedByUserLeftChatDuringMessageprocessing) { } catch (NullPointerException referenceDeletedByUserLeftChatDuringMessageprocessing) {
System.out.println("MSGBS bgfx, catched error: referenced user left the chat during messageprocessing: "); System.out.println("MSGBS bgfx, <<<catched error>>>: referenced user left the chat during messageprocessing: ");
referenceDeletedByUserLeftChatDuringMessageprocessing.printStackTrace(); referenceDeletedByUserLeftChatDuringMessageprocessing.printStackTrace();
} }
@@ -877,6 +903,10 @@ public class MessageBusManagementThread extends Thread {
client.getLst_toAllMessageList().add(pwErrorMsg); client.getLst_toAllMessageList().add(pwErrorMsg);
} }
// Kst4ContestApplication.alertWindowEvent("Password was wrong. Pse check!");
client.disconnect(ApplicationConstants.DISCSTRING_DISCONNECTONLY);
// this.client.disconnect(); // this.client.disconnect();
} }
@@ -969,8 +999,6 @@ public class MessageBusManagementThread extends Thread {
while (true) { while (true) {
try { try {
messageTextRaw = client.getMessageRXBus().take(); messageTextRaw = client.getMessageRXBus().take();

View File

@@ -92,47 +92,6 @@ public class ReadThread extends Thread {
e.printStackTrace(); e.printStackTrace();
} }
// try {
// sleep(3000);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// try {
// System.out.println("RDTH: try new socket");
// this.client.getSocket().close();
// this.client.getSocket().close();
// this.client.setSocket(new Socket(this.client.getHostname(), this.client.getPort()));
// socket.connect(new InetSocketAddress(this.client.getHostname(), this.client.getPort()));
// System.out.println("[Readthread, Warning:] new socket connected? -> " + socket.isConnected());
// input = socket.getInputStream();
// reader = new BufferedReader(new InputStreamReader(input));
//
// this.sleep(5000);
// } catch (IOException | InterruptedException e2) {
// // TODO Auto-generated catch block
// System.out.println("fucktah");
// e2.printStackTrace();
// }
// try {
// sleep(2000);
// } catch (InterruptedException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
// try {
// this.client.getSocket().close();
// this.client.setSocket(new Socket(this.client.getHostname(), this.client.getPort()));
// } catch (UnknownHostException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
} }
} }

View File

@@ -6,6 +6,7 @@ import java.util.Comparator;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import kst4contest.ApplicationConstants;
import kst4contest.model.AirPlane; import kst4contest.model.AirPlane;
import kst4contest.model.AirPlaneReflectionInfo; import kst4contest.model.AirPlaneReflectionInfo;
import kst4contest.model.ChatMember; import kst4contest.model.ChatMember;
@@ -30,6 +31,8 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
public ReadUDPbyAirScoutMessageThread(int localPort, ChatController client, String ASIdentificator, public ReadUDPbyAirScoutMessageThread(int localPort, ChatController client, String ASIdentificator,
String ChatClientIdentificator) { String ChatClientIdentificator) {
this.localPort = localPort; this.localPort = localPort;
this.client = client; this.client = client;
this.ASIdentificator = ASIdentificator; this.ASIdentificator = ASIdentificator;
@@ -38,6 +41,7 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
@Override @Override
public void interrupt() { public void interrupt() {
System.out.println("ReadUDP");
super.interrupt(); super.interrupt();
try { try {
if (this.socket != null) { if (this.socket != null) {
@@ -89,6 +93,12 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
} }
socket.receive(packet); socket.receive(packet);
} catch (SocketTimeoutException e2) { } catch (SocketTimeoutException e2) {
// this will catch the repeating Sockettimeoutexception...nothing to do // this will catch the repeating Sockettimeoutexception...nothing to do
// e2.printStackTrace(); // e2.printStackTrace();
@@ -104,6 +114,17 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
String received = new String(packet.getData(), packet.getOffset(), packet.getLength()); String received = new String(packet.getData(), packet.getOffset(), packet.getLength());
received = received.trim(); received = received.trim();
if (received.contains(ApplicationConstants.DISCONNECT_RDR_POISONPILL)) {
System.out.println("ReadUdpByASMsgTh, Info: got poison, now dieing....");
try {
terminateConnection();
} catch (Exception e) {
System.out.println("ASUDPRDR: catched error " + e.getMessage());
}
break;
}
if (received.contains("ASSETPATH") || received.contains("ASWATCHLIST")) { if (received.contains("ASSETPATH") || received.contains("ASWATCHLIST")) {
// do nothing, that is your own message // do nothing, that is your own message
} else if (received.contains("ASNEAREST:")) { //answer by airscout } else if (received.contains("ASNEAREST:")) { //answer by airscout
@@ -261,9 +282,13 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
return apInfo; return apInfo;
} }
public boolean terminateConnection() throws IOException { public boolean terminateConnection() {
try {
this.socket.close(); this.socket.close();
} catch (Exception e) {
System.out.println("udpbyas: catched " + e.getMessage());
}
return true; return true;
} }

View File

@@ -9,6 +9,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import kst4contest.ApplicationConstants;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@@ -43,17 +44,19 @@ public class ReadUDPbyUCXMessageThread extends Thread {
super.interrupt(); super.interrupt();
try { try {
if (this.socket != null) { if (this.socket != null) {
System.out.println(">>>>>>>>>>>>>>ReadUdpbyUCS: closing socket");
this.socket.close(); terminateConnection();
} }
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); System.out.println("UCXUDPRDR: catched error " + e.getMessage());
} }
} }
public void run() { public void run() {
Thread.currentThread().setName("ReadUDPByUCXLogThread"); Thread.currentThread().setName("ReadUDPByUCXLogThread");
DatagramSocket socket = null; DatagramSocket socket = null;
@@ -63,7 +66,7 @@ public class ReadUDPbyUCXMessageThread extends Thread {
try { try {
socket = new DatagramSocket(12060); socket = new DatagramSocket(12060);
socket.setSoTimeout(11000); //TODO try for end properly socket.setSoTimeout(2000); //TODO try for end properly
} }
catch (SocketException e) { catch (SocketException e) {
@@ -75,13 +78,11 @@ public class ReadUDPbyUCXMessageThread extends Thread {
boolean timeOutIndicator = false; boolean timeOutIndicator = false;
if (this.client.isDisconnectionPerformedByUser()) {
break;//TODO: what if it´s not the finally closage but a band channel change?
}
// packet = new DatagramPacket(buf, buf.length); //TODO: Changed that due to memory leak, check if all works (seems like that) // packet = new DatagramPacket(buf, buf.length); //TODO: Changed that due to memory leak, check if all works (seems like that)
// DatagramPacket packet = new DatagramPacket(SRPDefinitions.BYTE_BUFFER_MAX_LENGTH); //TODO: Changed that due to memory leak, check if all works (seems like that) // DatagramPacket packet = new DatagramPacket(SRPDefinitions.BYTE_BUFFER_MAX_LENGTH); //TODO: Changed that due to memory leak, check if all works (seems like that)
try { try {
socket.receive(packet); socket.receive(packet);
} catch (SocketTimeoutException e2) { } catch (SocketTimeoutException e2) {
timeOutIndicator = true; timeOutIndicator = true;
@@ -91,6 +92,33 @@ public class ReadUDPbyUCXMessageThread extends Thread {
catch (IOException e) { catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} catch (NullPointerException nE) {
// TODO Auto-generated catch block
nE.printStackTrace();
System.out.println("ReadUdpByUCXTH: Socket not ready");
try {
socket = new DatagramSocket(client.getChatPreferences().getLogsynch_ucxUDPWkdCallListenerPort());
socket.setSoTimeout(2000);
} catch (SocketException e) {
System.out.println("[ReadUDPByUCSMsgTH, Error]: socket in use or something:");
e.printStackTrace();
try {
socket = new DatagramSocket(null);
socket.setReuseAddress(true);
socket.bind(new InetSocketAddress(client.getChatPreferences().getLogsynch_ucxUDPWkdCallListenerPort()));
socket.receive(packet);
socket.setSoTimeout(3000);
} catch (Exception ex) {
System.out.println("ReadUDPByUCXMsgTh: Could not solve that. Program Restart needed.");
throw new RuntimeException(ex);
}
}
} }
InetAddress address = packet.getAddress(); InetAddress address = packet.getAddress();
@@ -99,8 +127,19 @@ public class ReadUDPbyUCXMessageThread extends Thread {
String received = new String(packet.getData(), packet.getOffset(), packet.getLength()); String received = new String(packet.getData(), packet.getOffset(), packet.getLength());
received = received.trim(); received = received.trim();
// System.out.println("recvudpucx");
// System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<recv " + received);
if (received.contains(ApplicationConstants.DISCONNECT_RDR_POISONPILL)) {
System.out.println("ReadUdpByUCX, Info: got poison, now dieing....");
socket.close();
timeOutIndicator = true;
break;
}
if (this.client.isDisconnectionPerformedByUser()) {
break;//TODO: what if it´s not the finally closage but a band channel change?
}
if (!timeOutIndicator) { if (!timeOutIndicator) {
processUCXUDPMessage(received); processUCXUDPMessage(received);

View File

@@ -3,6 +3,9 @@
*/ */
package kst4contest.controller; package kst4contest.controller;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableStringValue;
import java.io.IOException; import java.io.IOException;
/** /**
@@ -20,6 +23,8 @@ public class StartChat {
System.out.println("[Startchat:] Starting new Chat instance"); System.out.println("[Startchat:] Starting new Chat instance");
// ObservableStringValue messageBus = new SimpleStringProperty("");
ChatController client = new ChatController(); ChatController client = new ChatController();
client.execute(); client.execute();

View File

@@ -0,0 +1,133 @@
package kst4contest.controller;
import java.io.InputStream;
import kst4contest.ApplicationConstants;
import kst4contest.model.UpdateInformation;
import kst4contest.utils.ApplicationFileUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
public class UpdateChecker {
public static void main(String[] args) {
// new UpdateChecker(null).parseUpdateXMLFile();
if (new UpdateChecker(null).downloadLatestVersionInfoXML()) {
// ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
}
new UpdateChecker(null).parseUpdateXMLFile();
}
public UpdateChecker(ChatController chatController) {
System.out.println("[Updatechecker: checking for updates...]");
double currentVersionNumber = ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER;
}
String versionInfoDownloadedFromServerFileName = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
String versionInfoXMLURLAtServer = ApplicationConstants.VERSIONINFOURLFORUPDATES_KST4CONTEST;
double currentVersion = ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER;
//DOWNLOAD from URL, then parse, then do anything with it...
/**
* Downloads the versioninfo-xml-file from a webserver to local. Returns true if download was successful, else false
*
* @return true if successful
*/
public boolean downloadLatestVersionInfoXML() {
try {
InputStream in = new URL(versionInfoXMLURLAtServer).openStream();
Files.copy(in, Paths.get(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE)), StandardCopyOption.REPLACE_EXISTING);
in.close();
// System.out.println(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE));
// ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,ApplicationFileUtils.get,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
} catch (Exception e) {
System.out.println("ERROR DOWNLOADING!" + e);
return false;
}
return true;
}
public UpdateInformation parseUpdateXMLFile() {
UpdateInformation updateInfos = new UpdateInformation();
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,"/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
// System.out.println("[Updatecker, Info]: restoring prefs from file " + versionInfoDownloadedFromServerFileName);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
} catch (ParserConfigurationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
File xmlConfigFile = new File(versionInfoDownloadedFromServerFileName);
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(xmlConfigFile);
/**
* latestVersion on server
*/
NodeList list = doc.getElementsByTagName("latestVersion");
if (list.getLength() != 0) {
for (int temp = 0; temp < list.getLength(); temp++) {
Node node = list.item(temp);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
updateInfos.setLatestVersionNumberOnServer(Double.parseDouble(element.getElementsByTagName("versionNumber").item(0).getTextContent()));
updateInfos.setAdminMessage(element.getElementsByTagName("adminMessage").item(0).getTextContent());
updateInfos.setMajorChanges(element.getElementsByTagName("majorChanges").item(0)
.getTextContent());
updateInfos.setLatestVersionPathOnWebserver(element.getElementsByTagName("latestVersionPathOnWebserver").item(0).getTextContent());
// System.out.println(updateInfos.toString());
}
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
return updateInfos;
}
@Override
public String toString() {
String toString = "";
toString += this.currentVersion;
return toString;
}
}

View File

@@ -1,5 +1,10 @@
package kst4contest.locatorUtils; package kst4contest.locatorUtils;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
/** /**
* Location class with methods allowing conversion to and from Maidenhead * Location class with methods allowing conversion to and from Maidenhead
* locator (grid squares) based off of * locator (grid squares) based off of
@@ -203,6 +208,28 @@ public class Location {
return getDistanceKm(this, loc2); return getDistanceKm(this, loc2);
} }
/**
* @param locator1 6 letter location string
* @param locator2 6 letter location string
* @return great circle distance in kilometers
*/
public double getDistanceKmByTwoLocatorStrings(String locator1,String locator2 ) {
Location loc1 = new Location(locator1);
Location loc2 = new Location(locator2);
Locale locale = new Locale("en", "UK");
String pattern = "###.##";
DecimalFormat decimalFormat = (DecimalFormat)
NumberFormat.getNumberInstance(locale);
decimalFormat.applyPattern(pattern);
String format = decimalFormat.format(loc1.getDistanceKm(loc2));
// return df.format(number);
return Double.parseDouble(format);
}
/** /**
* @param loc2 * @param loc2
* second location * second location
@@ -278,6 +305,19 @@ public class Location {
return getBearing(this, loc2); return getBearing(this, loc2);
} }
/**
*
* @return bearing in degrees
*/
public double getBearingOfTwoLocatorStrings(String locator1, String locator2) {
Location loc1 = new Location(locator1);
Location loc2 = new Location(locator2);
return getBearing(loc1, loc2);
}
/** /**
* @param loc1 * @param loc1
* source location * source location

View File

@@ -46,6 +46,8 @@ public class ChatPreferences {
*/ */
public static final String PREFERENCE_RESOURCE = "/praktiKSTpreferences.xml"; public static final String PREFERENCE_RESOURCE = "/praktiKSTpreferences.xml";
/** /**
* Default constructor will set the default values (also for predefined texts * Default constructor will set the default values (also for predefined texts
* and shorts) automatically at initialization * and shorts) automatically at initialization
@@ -130,13 +132,16 @@ public class ChatPreferences {
* Station preferences * Station preferences
*/ */
boolean loginAFKState = false; //always start as here
String loginCallSign = "do5amf"; String loginCallSign = "do5amf";
String loginPassword = ""; String loginPassword = "";
String loginName = "Marc"; String loginName = "Marc";
String loginLocator = "jn49fk"; String loginLocator = "jn49fk";
ChatCategory loginChatCategory = new ChatCategory(2); ChatCategory loginChatCategory = new ChatCategory(2);
IntegerProperty actualQTF = new SimpleIntegerProperty(360); // will be updated by user at runtime! IntegerProperty actualQTF = new SimpleIntegerProperty(360); // will be updated by user at runtime!
/** /**
* Log Synch preferences * Log Synch preferences
*/ */
@@ -164,6 +169,13 @@ public class ChatPreferences {
* Notification prefs * Notification prefs
*/ */
//Audio section
boolean notify_playSimpleSounds = true;
boolean notify_playCWCallsignsOnRxedPMs = true;
boolean notify_playVoiceCallsignsOnRxedPMs = true;
/** /**
* Shortcuts and Textsnippets prefs * Shortcuts and Textsnippets prefs
*/ */
@@ -198,6 +210,17 @@ public class ChatPreferences {
// MYQRG = mYQRG; // MYQRG = mYQRG;
// } // }
public boolean isLoginAFKState() {
return loginAFKState;
}
public void setLoginAFKState(boolean loginAFKState) {
this.loginAFKState = loginAFKState;
}
public String getLoginCallSign() { public String getLoginCallSign() {
return loginCallSign; return loginCallSign;
} }
@@ -267,10 +290,33 @@ public class ChatPreferences {
this.logsynch_storeWorkedCallSignsFileNameUDPMessageBackup = logsynch_storeWorkedCallSignsFileNameUDPMessageBackup; this.logsynch_storeWorkedCallSignsFileNameUDPMessageBackup = logsynch_storeWorkedCallSignsFileNameUDPMessageBackup;
} }
public boolean isNotify_playSimpleSounds() {
return notify_playSimpleSounds;
}
public boolean isNotify_playCWCallsignsOnRxedPMs() {
return notify_playCWCallsignsOnRxedPMs;
}
public boolean isNotify_playVoiceCallsignsOnRxedPMs() {
return notify_playVoiceCallsignsOnRxedPMs;
}
public void setNotify_playSimpleSounds(boolean notify_playSimpleSounds) {
this.notify_playSimpleSounds = notify_playSimpleSounds;
}
public void setNotify_playCWCallsignsOnRxedPMs(boolean notify_playCWCallsignsOnRxedPMs) {
this.notify_playCWCallsignsOnRxedPMs = notify_playCWCallsignsOnRxedPMs;
}
public void setNotify_playVoiceCallsignsOnRxedPMs(boolean notify_playVoiceCallsignsOnRxedPMs) {
this.notify_playVoiceCallsignsOnRxedPMs = notify_playVoiceCallsignsOnRxedPMs;
}
/** /**
* actualQTF, int, QTF in degrees * actualQTF, int, QTF in degrees
* *
* @param actualQTF, int, QTF in degrees
*/ */
public StringProperty getMYQRG() { public StringProperty getMYQRG() {
@@ -603,6 +649,27 @@ public class ChatPreferences {
asQry_airScoutBandValue.setTextContent(this.getAirScout_asBandString()); asQry_airScoutBandValue.setTextContent(this.getAirScout_asBandString());
AirScoutQuerier.appendChild(asQry_airScoutBandValue); AirScoutQuerier.appendChild(asQry_airScoutBandValue);
/**
* Notifications
*/
Element notifications = doc.createElement("notifications");
rootElement.appendChild(notifications);
Element notify_SimpleAudioNotificationsEnabled = doc.createElement("notify_SimpleAudioNotificationsEnabled");
notify_SimpleAudioNotificationsEnabled.setTextContent(this.isNotify_playSimpleSounds()+"");
notifications.appendChild(notify_SimpleAudioNotificationsEnabled);
Element notify_CWCallSignAudioNotificationsEnabled = doc.createElement("notify_CWCallsignAudioNotificationsEnabled");
notify_CWCallSignAudioNotificationsEnabled.setTextContent(this.isNotify_playCWCallsignsOnRxedPMs()+"");
notifications.appendChild(notify_CWCallSignAudioNotificationsEnabled);
Element notify_VoiceCallSignAudioNotificationsEnabled = doc.createElement("notify_VoiceCallsignAudioNotificationsEnabled");
notify_VoiceCallSignAudioNotificationsEnabled.setTextContent(this.isNotify_playVoiceCallsignsOnRxedPMs()+"");
notifications.appendChild(notify_VoiceCallSignAudioNotificationsEnabled);
/** /**
* Shortcuts * Shortcuts
*/ */
@@ -905,6 +972,56 @@ public class ChatPreferences {
} }
} }
/**
* Case notifications
*/
list = doc.getElementsByTagName("notifications");
if (list.getLength() != 0) {
for (int temp = 0; temp < list.getLength(); temp++) {
Node node = list.item(temp);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
String notify_simpleAudioNotificationsEnabled = element.getElementsByTagName("notify_SimpleAudioNotificationsEnabled").item(0)
.getTextContent();
if (notify_simpleAudioNotificationsEnabled.equals("true")) {
notify_playSimpleSounds = true;
} else {
notify_playSimpleSounds = false;
}
String notify_cwAudioNotificationsEnabled = element.getElementsByTagName("notify_CWCallsignAudioNotificationsEnabled").item(0)
.getTextContent();
if (notify_cwAudioNotificationsEnabled.equals("true")) {
notify_playCWCallsignsOnRxedPMs = true;
} else {
notify_playCWCallsignsOnRxedPMs = false;
}
String notify_voiceAudioNotificationsEnabled = element.getElementsByTagName("notify_VoiceCallsignAudioNotificationsEnabled").item(0)
.getTextContent();
if (notify_voiceAudioNotificationsEnabled.equals("true")) {
notify_playVoiceCallsignsOnRxedPMs = true;
} else {
notify_playVoiceCallsignsOnRxedPMs = false;
}
System.out.println(
"[ChatPreferences, info]: Set the audionotifications simple: " + notify_playSimpleSounds + ", CW: " + notify_playCWCallsignsOnRxedPMs + ", Voice: " + notify_playVoiceCallsignsOnRxedPMs);
}
}
}
/** /**
* Case AirScout querier * Case AirScout querier
*/ */

View File

@@ -0,0 +1,67 @@
package kst4contest.model;
import java.util.ArrayList;
public class UpdateInformation {
double latestVersionNumberOnServer;
String adminMessage, majorChanges,latestVersionPathOnWebserver;
ArrayList<String> needUpdateResourcesSinceLastVersion;
ArrayList<String[]> featureRequest;
ArrayList<String[]> bugRequests;
public double getLatestVersionNumberOnServer() {
return latestVersionNumberOnServer;
}
public void setLatestVersionNumberOnServer(double latestVersionNumberOnServer) {
this.latestVersionNumberOnServer = latestVersionNumberOnServer;
}
public String getAdminMessage() {
return adminMessage;
}
public void setAdminMessage(String adminMessage) {
this.adminMessage = adminMessage;
}
public String getMajorChanges() {
return majorChanges;
}
public void setMajorChanges(String majorChanges) {
this.majorChanges = majorChanges;
}
public String getLatestVersionPathOnWebserver() {
return latestVersionPathOnWebserver;
}
public void setLatestVersionPathOnWebserver(String latestVersionPathOnWebserver) {
this.latestVersionPathOnWebserver = latestVersionPathOnWebserver;
}
public ArrayList<String> getNeedUpdateResourcesSinceLastVersion() {
return needUpdateResourcesSinceLastVersion;
}
public void setNeedUpdateResourcesSinceLastVersion(ArrayList<String> needUpdateResourcesSinceLastVersion) {
this.needUpdateResourcesSinceLastVersion = needUpdateResourcesSinceLastVersion;
}
public ArrayList<String[]> getFeatureRequest() {
return featureRequest;
}
public void setFeatureRequest(ArrayList<String[]> featureRequest) {
this.featureRequest = featureRequest;
}
public ArrayList<String[]> getBugRequests() {
return bugRequests;
}
public void setBugRequests(ArrayList<String[]> bugRequests) {
this.bugRequests = bugRequests;
}
}

View File

@@ -0,0 +1,478 @@
package kst4contest.utils;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import kst4contest.ApplicationConstants;
import java.io.File;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
/**
* This part of the client drives the sounds. Its a singleton instance. All audio outs are directed to this instance.<br>
* <br>
* */
public class PlayAudioUtils {
/**
* Default constructor initializes the sound files and copies it to the project home folder
*/
public PlayAudioUtils() {
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISESTARTUP.mp3", "NOISESTARTUP.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISECQWINDOW.mp3", "NOISECQWINDOW.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISEPMWINDOW.mp3", "NOISEPMWINDOW.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISEERROR.mp3", "NOISEERROR.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISENOTIFY.mp3", "NOISENOTIFY.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRA.mp3", "LTTRA.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRB.mp3", "LTTRB.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRC.mp3", "LTTRC.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRD.mp3", "LTTRD.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRE.mp3", "LTTRE.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRF.mp3", "LTTRF.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRG.mp3", "LTTRG.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRH.mp3", "LTTRH.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRI.mp3", "LTTRI.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRJ.mp3", "LTTRJ.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRK.mp3", "LTTRK.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRL.mp3", "LTTRL.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRM.mp3", "LTTRM.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRN.mp3", "LTTRN.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRO.mp3", "LTTRO.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRP.mp3", "LTTRP.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRQ.mp3", "LTTRQ.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRR.mp3", "LTTRR.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRS.mp3", "LTTRS.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRT.mp3", "LTTRT.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRU.mp3", "LTTRU.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRV.mp3", "LTTRV.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRW.mp3", "LTTRW.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRX.mp3", "LTTRX.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRY.mp3", "LTTRY.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRZ.mp3", "LTTRZ.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR0.mp3", "LTTR0.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR1.mp3", "LTTR1.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR2.mp3", "LTTR2.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR3.mp3", "LTTR3.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR4.mp3", "LTTR4.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR5.mp3", "LTTR5.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR6.mp3", "LTTR6.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR7.mp3", "LTTR7.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR8.mp3", "LTTR8.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR9.mp3", "LTTR9.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRSTROKE.mp3", "LTTRSTROKE.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRSPACE.mp3", "LTTRSPACE.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEA.mp3", "VOICEA.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEB.mp3", "VOICEB.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEC.mp3", "VOICEC.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICED.mp3", "VOICED.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEE.mp3", "VOICEE.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEF.mp3", "VOICEF.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEG.mp3", "VOICEG.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEH.mp3", "VOICEH.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEI.mp3", "VOICEI.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEJ.mp3", "VOICEJ.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEK.mp3", "VOICEK.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEL.mp3", "VOICEL.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEM.mp3", "VOICEM.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEN.mp3", "VOICEN.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEO.mp3", "VOICEO.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEP.mp3", "VOICEP.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEQ.mp3", "VOICEQ.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICER.mp3", "VOICER.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICES.mp3", "VOICES.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICET.mp3", "VOICET.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEU.mp3", "VOICEU.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEV.mp3", "VOICEV.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEW.mp3", "VOICEW.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEX.mp3", "VOICEX.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEY.mp3", "VOICEY.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEZ.mp3", "VOICEZ.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE0.mp3", "VOICE0.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE1.mp3", "VOICE1.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE2.mp3", "VOICE2.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE3.mp3", "VOICE3.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE4.mp3", "VOICE4.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE5.mp3", "VOICE5.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE6.mp3", "VOICE6.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE7.mp3", "VOICE7.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE8.mp3", "VOICE8.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE9.mp3", "VOICE9.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICESTROKE.mp3", "VOICESTROKE.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEBELL.mp3", "VOICEBELL.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEYOUGOTMAIL.mp3", "VOICEYOUGOTMAIL.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEHELLO.mp3", "VOICEHELLO.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE73.mp3", "VOICE73.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICESTROKEPORTABLE.mp3", "VOICESTROKEPORTABLE.mp3");
}
private Queue<Media> musicList = new LinkedList<Media>();
private MediaPlayer mediaPlayer ;
/**
* Plays notification sounds out of the windws 95 box by given action character<br/>
*<br/>
*
* case '!': Startup<br/>
* case 'C': CQ Window new entry<br/>
* case 'P': PM Window new entry<br/>
* case 'E': Error occured<br/>
* case 'N': other notification sounds<br/>
*
* @param actionChar
*/
public void playNoiseLauncher(char actionChar) {
// ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISESTARTUP.mp3");
switch (actionChar){
case '!':
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISESTARTUP.mp3")).toURI().toString()));
break;
case 'C':
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISECQWINDOW.mp3")).toURI().toString()));
break;
case 'P':
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISEPMWINDOW.mp3")).toURI().toString()));
break;
case 'E':
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISEERROR.mp3")).toURI().toString()));
break;
case 'N':
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISENOTIFY.mp3")).toURI().toString()));
break;
// case 'M':
// musicList.add(new Media(new File ("VOICE.mp3").toURI().toString()));
// break;
default:
System.out.println("[KST4ContestApp, warning, letter not defined!]");
}
playMusic();
// mediaPlayer.dispose();
}
/**
* Plays all chars of a given String-parameter as CW Sound out of the speaker.
* As a workaround for delay problems at the beginning of playing, there are added 2x pause chars to the string.
*
* @param playThisChars
*/
public void playCWLauncher(String playThisChars) {
char[] playThisInCW = playThisChars.toUpperCase().toCharArray();
for (char letterToPlay: playThisInCW){
switch (letterToPlay){
case 'A':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRA.mp3")).toURI().toString()));
break;
case 'B':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRB.mp3")).toURI().toString()));
break;
case 'C':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRC.mp3")).toURI().toString()));
break;
case 'D':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRD.mp3")).toURI().toString()));
break;
case 'E':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRE.mp3")).toURI().toString()));
break;
case 'F':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRF.mp3")).toURI().toString()));
break;
case 'G':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRG.mp3")).toURI().toString()));
break;
case 'H':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRH.mp3")).toURI().toString()));
break;
case 'I':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRI.mp3")).toURI().toString()));
break;
case 'J':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRJ.mp3")).toURI().toString()));
break;
case 'K':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRK.mp3")).toURI().toString()));
break;
case 'L':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRL.mp3")).toURI().toString()));
break;
case 'M':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRM.mp3")).toURI().toString()));
break;
case 'N':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRN.mp3")).toURI().toString()));
break;
case 'O':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRO.mp3")).toURI().toString()));
break;
case 'P':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRP.mp3")).toURI().toString()));
break;
case 'Q':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRQ.mp3")).toURI().toString()));
break;
case 'R':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRR.mp3")).toURI().toString()));
break;
case 'S':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRS.mp3")).toURI().toString()));
break;
case 'T':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRT.mp3")).toURI().toString()));
break;
case 'U':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRU.mp3")).toURI().toString()));
break;
case 'V':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRV.mp3")).toURI().toString()));
break;
case 'W':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRW.mp3")).toURI().toString()));
break;
case 'X':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRX.mp3")).toURI().toString()));
break;
case 'Y':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRY.mp3")).toURI().toString()));
break;
case 'Z':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRZ.mp3")).toURI().toString()));
break;
case '1':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR1.mp3")).toURI().toString()));
break;
case '2':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR2.mp3")).toURI().toString()));
break;
case '3':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR3.mp3")).toURI().toString()));
break;
case '4':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR4.mp3")).toURI().toString()));
break;
case '5':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR5.mp3")).toURI().toString()));
break;
case '6':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR6.mp3")).toURI().toString()));
break;
case '7':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR7.mp3")).toURI().toString()));
break;
case '8':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR8.mp3")).toURI().toString()));
break;
case '9':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR9.mp3")).toURI().toString()));
break;
case '0':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR0.mp3")).toURI().toString()));
break;
case '/':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRSTROKE.mp3")).toURI().toString()));
break;
case ' ':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRSPACE.mp3")).toURI().toString()));
break;
default:
System.out.println("[KST4ContestApp, warning, letter not defined:] cwLetters = " + Arrays.toString(playThisInCW));
}
}
playMusic();
// mediaPlayer.dispose();
}
/**
*
* Plays a voice file for each char in the string (only EN alphabetic and numbers) except some specials: <br/><br/>
* <b>Note that the audio settings (ChatPreferences) must be switched on in order to make the sounds playing.</b><br/><br/>
* case '!': BELL<br/>
* case '?': YOUGOTMAIL<br/>
* case '#': HELLO<br/>
* case '*': 73 bye<br/>
* case '$': STROKEPORTABLE<br/>
* @param playThisChars
*/
public void playVoiceLauncher(String playThisChars) {
char[] spellThisWithVoice = playThisChars.toUpperCase().toCharArray();
for (char letterToPlay: spellThisWithVoice){
switch (letterToPlay){
case '!':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEBELL.mp3")).toURI().toString()));
break;
case '?':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEYOUGOTMAIL.mp3")).toURI().toString()));
break;
case '#':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEHELLO.mp3")).toURI().toString()));
break;
case '*':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE73.mp3")).toURI().toString()));
break;
case '$':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICESTROKEPORTABLE.mp3")).toURI().toString()));
break;
case 'A':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEA.mp3")).toURI().toString()));
break;
case 'B':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEB.mp3")).toURI().toString()));
break;
case 'C':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEC.mp3")).toURI().toString()));
break;
case 'D':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICED.mp3")).toURI().toString()));
break;
case 'E':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEE.mp3")).toURI().toString()));
break;
case 'F':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEF.mp3")).toURI().toString()));
break;
case 'G':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEG.mp3")).toURI().toString()));
break;
case 'H':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEH.mp3")).toURI().toString()));
break;
case 'I':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEI.mp3")).toURI().toString()));
break;
case 'J':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEJ.mp3")).toURI().toString()));
break;
case 'K':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEK.mp3")).toURI().toString()));
break;
case 'L':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEL.mp3")).toURI().toString()));
break;
case 'M':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEM.mp3")).toURI().toString()));
break;
case 'N':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEN.mp3")).toURI().toString()));
break;
case 'O':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEO.mp3")).toURI().toString()));
break;
case 'P':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEP.mp3")).toURI().toString()));
break;
case 'Q':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEQ.mp3")).toURI().toString()));
break;
case 'R':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICER.mp3")).toURI().toString()));
break;
case 'S':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICES.mp3")).toURI().toString()));
break;
case 'T':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICET.mp3")).toURI().toString()));
break;
case 'U':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEU.mp3")).toURI().toString()));
break;
case 'V':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEV.mp3")).toURI().toString()));
break;
case 'W':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEW.mp3")).toURI().toString()));
break;
case 'X':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEX.mp3")).toURI().toString()));
break;
case 'Y':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEY.mp3")).toURI().toString()));
break;
case 'Z':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEZ.mp3")).toURI().toString()));
break;
case '1':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE1.mp3")).toURI().toString()));
break;
case '2':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE2.mp3")).toURI().toString()));
break;
case '3':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE3.mp3")).toURI().toString()));
break;
case '4':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE4.mp3")).toURI().toString()));
break;
case '5':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE5.mp3")).toURI().toString()));
break;
case '6':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE6.mp3")).toURI().toString()));
break;
case '7':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE7.mp3")).toURI().toString()));
break;
case '8':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE8.mp3")).toURI().toString()));
break;
case '9':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE9.mp3")).toURI().toString()));
break;
case '0':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE0.mp3")).toURI().toString()));
break;
case '/':
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICESTROKE.mp3")).toURI().toString()));
break;
// case ' ':
// musicList.add(new Media(new File ("VOICESPACE.mp3").toURI().toString()));
// break;
default:
System.out.println("[KST4ContestApp, warning, letter not defined:] cwLetters = " + Arrays.toString(spellThisWithVoice));
}
}
playMusic();
// mediaPlayer.dispose();
}
private void playMusic() {
// System.out.println("Kst4ContestApplication.playMusic");
if(musicList.peek() == null)
{
return;
}
mediaPlayer = new MediaPlayer(musicList.poll());
mediaPlayer.setRate(1.0);
mediaPlayer.setOnReady(() -> {
mediaPlayer.play();
mediaPlayer.setOnEndOfMedia(() -> {
// mediaPlayer.dispose();
playMusic();
if (musicList.isEmpty()) {
// mediaPlayer.dispose();
}
});
});
}
}

View File

@@ -0,0 +1,19 @@
package kst4contest.utils;
import javafx.application.Application;
import javafx.stage.Stage;
import kst4contest.utils.PlayAudioUtils;
public class TestAudioPlayerUtils extends Application {
public static void main(String[] args) {
}
@Override
public void start(Stage stage) throws Exception {
PlayAudioUtils testAudio = new PlayAudioUtils();
testAudio.playCWLauncher("DO5AMF");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
module praktiKST {
requires javafx.controls;
requires jdk.xml.dom;
requires java.sql;
requires javafx.media;
exports kst4contest.controller;
exports kst4contest.locatorUtils;
exports kst4contest.model;
exports kst4contest.view;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More