mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-04-03 14:35:40 +02:00
Compare commits
18 Commits
CreateMave
...
featureMes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1663b0fd7f | ||
|
|
3e8783d7cd | ||
|
|
8bea4111f0 | ||
|
|
136cf08f08 | ||
|
|
eb04ad3f33 | ||
|
|
51712a1f85 | ||
|
|
4a605f54ba | ||
|
|
037dc8a05b | ||
|
|
476b4a7dd1 | ||
|
|
bd687dc50f | ||
|
|
7bce7be2ba | ||
|
|
3286a34a08 | ||
|
|
c2086a73b0 | ||
|
|
d57880d945 | ||
|
|
d79886d4c9 | ||
|
|
499b58965c | ||
|
|
7d9adeba1a | ||
|
|
fcc46b3c3b |
@@ -1 +1,4 @@
|
||||
do5sa
|
||||
do5sa
|
||||
##12390780900ß9'++++2e0NEY#####
|
||||
on8tt
|
||||
dl2rmc
|
||||
3
jdk.cmd
Normal file
3
jdk.cmd
Normal file
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
SET JAVA_HOME=C:\Program Files\Java\jdk-17
|
||||
SET PATH=%JAVA_HOME%\bin,%PATH%
|
||||
@@ -5,4 +5,19 @@ public class ApplicationConstants {
|
||||
* Name of the Application.
|
||||
*/
|
||||
public static final String APPLICATION_NAME = "praktiKST";
|
||||
|
||||
/**
|
||||
* Name of file to store preferences in.
|
||||
*/
|
||||
public static final double APPLICATION_CURRENTVERSIONNUMBER = 1.17;
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ public class AirScoutPeriodicalAPReflectionInquirerTask extends TimerTask {
|
||||
String asWatchListStringSuffix = asWatchListString;
|
||||
|
||||
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
|
||||
InetAddress address;
|
||||
|
||||
@@ -13,13 +13,14 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import kst4contest.model.ChatCategory;
|
||||
import kst4contest.model.ChatMember;
|
||||
import kst4contest.model.ChatMessage;
|
||||
import kst4contest.model.ChatPreferences;
|
||||
import kst4contest.model.ClusterMessage;
|
||||
import javafx.collections.transformation.FilteredList;
|
||||
import javafx.collections.transformation.SortedList;
|
||||
import kst4contest.ApplicationConstants;
|
||||
import kst4contest.model.*;
|
||||
import kst4contest.utils.PlayAudioUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -41,6 +42,7 @@ public class ChatController {
|
||||
*/
|
||||
// private int category = ChatCategory.VUHF;
|
||||
|
||||
private UpdateInformation updateInformation;
|
||||
private ChatPreferences chatPreferences;
|
||||
|
||||
private ChatCategory category;
|
||||
@@ -57,6 +59,14 @@ public class ChatController {
|
||||
this.disconnectionPerformedByUser = disconnectionPerformedByUser;
|
||||
}
|
||||
|
||||
public UpdateInformation getUpdateInformation() {
|
||||
return updateInformation;
|
||||
}
|
||||
|
||||
public void setUpdateInformation(UpdateInformation updateInformation) {
|
||||
this.updateInformation = updateInformation;
|
||||
}
|
||||
|
||||
public String getChatState() {
|
||||
return chatState;
|
||||
}
|
||||
@@ -89,9 +99,58 @@ public class ChatController {
|
||||
this.disconnected = disconnected;
|
||||
}
|
||||
|
||||
public void airScout_SendAsShowPathPacket(ChatMember remoteChatMember) {
|
||||
|
||||
DatagramSocket dsocket;
|
||||
|
||||
String prefix_asSetpath ="ASSHOWPATH: \"KST\" \"AS\" ";
|
||||
String bandString = "1440000";
|
||||
String myCallAndMyLocString = chatPreferences.getLoginCallSign() + "," + chatPreferences.getLoginLocator();
|
||||
String remoteCallAndLocString = remoteChatMember.getCallSign() +"," + remoteChatMember.getQra();
|
||||
|
||||
String host = "255.255.255.255";
|
||||
// int port = 9872;
|
||||
int port = chatPreferences.getAirScout_asCommunicationPort();
|
||||
// System.out.println("<<<<<<<<<<<<<<<<<<<<ASPERI: " + port);
|
||||
|
||||
// byte[] message = "ASSETPATH: \"KST\" \"AS\" 1440000,DO5AMF,JN49GL,OK1MZM,JN89IW ".getBytes(); Original, ging
|
||||
InetAddress address;
|
||||
|
||||
String queryStringToAirScout = "";
|
||||
|
||||
queryStringToAirScout += prefix_asSetpath + bandString + "," + myCallAndMyLocString + "," + remoteCallAndLocString;
|
||||
|
||||
byte[] queryStringToAirScoutMSG = queryStringToAirScout.getBytes();
|
||||
|
||||
try {
|
||||
address = InetAddress.getByName("255.255.255.255");
|
||||
DatagramPacket packet = new DatagramPacket(queryStringToAirScoutMSG, queryStringToAirScoutMSG.length, address, port);
|
||||
dsocket = new DatagramSocket();
|
||||
dsocket.setBroadcast(true);
|
||||
dsocket.send(packet);
|
||||
dsocket.close();
|
||||
} catch (UnknownHostException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
} catch (NoRouteToHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SocketException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* (Settings Window closed), Disconnect on Disconnect-Button
|
||||
@@ -101,7 +160,56 @@ public class ChatController {
|
||||
|
||||
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.setConnectedAndLoggedIn(false);
|
||||
this.setConnectedAndNOTLoggedIn(false);
|
||||
@@ -119,9 +227,8 @@ public class ChatController {
|
||||
messageRXBus.add(killThreadPoisonPillMsg); //kills messageprocessor
|
||||
messageTXBus.add(killThreadPoisonPillMsg); //kills writethread
|
||||
|
||||
writeThread.interrupt();
|
||||
|
||||
readThread.interrupt();
|
||||
// writeThread.interrupt();
|
||||
// readThread.interrupt();
|
||||
|
||||
beaconTimer.purge();
|
||||
beaconTimer.cancel();
|
||||
@@ -159,27 +266,30 @@ public class ChatController {
|
||||
// TODO Auto-generated catch block
|
||||
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.setConnectedAndLoggedIn(false);
|
||||
this.setConnectedAndNOTLoggedIn(true);
|
||||
this.setConnectedAndNOTLoggedIn(false);
|
||||
// disconnect telnet and kill all sockets and connections
|
||||
|
||||
|
||||
keepAliveTimer.cancel();
|
||||
keepAliveTimer.purge();
|
||||
|
||||
|
||||
ChatMessage killThreadPoisonPillMsg = new ChatMessage();
|
||||
killThreadPoisonPillMsg.setMessageText("POISONPILL_KILLTHREAD");
|
||||
killThreadPoisonPillMsg.setMessageSenderName("POISONPILL_KILLTHREAD");
|
||||
|
||||
|
||||
messageRXBus.clear();
|
||||
messageTXBus.clear();
|
||||
messageRXBus.add(killThreadPoisonPillMsg); //kills messageprocessor
|
||||
messageTXBus.add(killThreadPoisonPillMsg); //kills writethread
|
||||
|
||||
writeThread.interrupt();
|
||||
|
||||
readThread.interrupt();
|
||||
|
||||
beaconTimer.purge();
|
||||
@@ -192,24 +302,34 @@ public class ChatController {
|
||||
userActualizationtimer.purge();
|
||||
userActualizationtimer.cancel();
|
||||
|
||||
userActualizationtimer.purge();
|
||||
userActualizationtimer.cancel();
|
||||
|
||||
// consoleReader.interrupt();
|
||||
messageProcessor.interrupt();
|
||||
|
||||
readUDPbyUCXThread.interrupt();
|
||||
|
||||
airScoutUDPReaderThread.interrupt();
|
||||
|
||||
dbHandler.closeDBConnection();
|
||||
// messageProcessor.interrupt();
|
||||
|
||||
readUDPbyUCXThread.interrupt(); //need poisonpill?
|
||||
airScoutUDPReaderThread.interrupt(); //need poisonpill?
|
||||
|
||||
// dbHandler.closeDBConnection();
|
||||
// this.dbHandler = null;
|
||||
|
||||
|
||||
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 password;
|
||||
private String showedName;
|
||||
@@ -218,8 +338,7 @@ public class ChatController {
|
||||
private String chatState;
|
||||
|
||||
private String hostname = "109.90.0.130";
|
||||
private String praktiKSTVersion = "wtKST 3.1.4.6";
|
||||
// private String praktiKSTVersion = "praktiKST 1.0";
|
||||
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 int port = 23001; // kst4contest.test 4 23001
|
||||
@@ -232,6 +351,12 @@ public class ChatController {
|
||||
private MessageBusManagementThread messageProcessor;
|
||||
private ReadUDPbyAirScoutMessageThread airScoutUDPReaderThread;
|
||||
|
||||
private PlayAudioUtils playAudioUtils = new PlayAudioUtils();
|
||||
|
||||
public PlayAudioUtils getPlayAudioUtils() {
|
||||
return playAudioUtils;
|
||||
}
|
||||
|
||||
private TimerTask userActualizationTask;
|
||||
|
||||
private TimerTask keepAliveMessageSenderTask;
|
||||
@@ -258,25 +383,30 @@ public class ChatController {
|
||||
|
||||
// ******All abstract types below here are used by the messageprocessor!
|
||||
// ***************
|
||||
// private Hashtable<String, ChatMember> chatMemberTable = new Hashtable<String, ChatMember>();
|
||||
// private HashMap<String, ChatMember> chatMemberTable = new HashMap<String, ChatMember>();
|
||||
// private Hashtable<String, ChatMember> dXClusterMemberTable = new Hashtable<String, ChatMember>();
|
||||
|
||||
private ObservableList<ChatMessage> lst_toAllMessageList = FXCollections.observableArrayList(); // directed to all
|
||||
private ObservableList<ChatMessage> lst_globalChatMessageList = FXCollections.observableArrayList(); //All chatmessages will be put in there, later create filtered message lists
|
||||
// private ObservableList<ChatMessage> lst_toAllMessageList = FXCollections.observableArrayList(); // directed to all
|
||||
// (beacon)
|
||||
private ObservableList<ChatMessage> lst_toMeMessageList = FXCollections.observableArrayList(); // directed to my
|
||||
private FilteredList<ChatMessage> lst_toAllMessageList = new FilteredList<>(lst_globalChatMessageList); // directed to all
|
||||
|
||||
// private ObservableList<ChatMessage> lst_toMeMessageList = FXCollections.observableArrayList(); // directed to my
|
||||
// call
|
||||
private ObservableList<ChatMessage> lst_toOtherMessageList = FXCollections.observableArrayList(); // directed to a
|
||||
private FilteredList<ChatMessage> lst_toMeMessageList = new FilteredList<>(lst_globalChatMessageList);
|
||||
|
||||
private FilteredList<ChatMessage> lst_selectedCallSignInfofilteredMessageList = new FilteredList<>(lst_globalChatMessageList); // directed to all
|
||||
|
||||
// private ObservableList<ChatMessage> lst_toOtherMessageList = FXCollections.observableArrayList(); // directed to a
|
||||
// call but not
|
||||
// mine
|
||||
private FilteredList<ChatMessage> lst_toOtherMessageList = new FilteredList<>(lst_globalChatMessageList);
|
||||
|
||||
private ObservableList<ChatMember> chatMemberList = FXCollections.observableArrayList(); // List of active stations
|
||||
// in chat
|
||||
private ObservableList<ChatMember> lst_chatMemberList = FXCollections.synchronizedObservableList(chatMemberList); // List
|
||||
// of
|
||||
// active
|
||||
// stations
|
||||
// in
|
||||
// chat
|
||||
// of active stn in chat
|
||||
private FilteredList<ChatMember> lst_chatMemberListFiltered = new FilteredList<ChatMember>(chatMemberList);
|
||||
private SortedList<ChatMember> lst_chatMemberSortedFilteredList = new SortedList<ChatMember>(lst_chatMemberListFiltered);
|
||||
private ObservableList<Predicate<ChatMember>> lst_chatMemberListFilterPredicates = FXCollections.observableArrayList();
|
||||
private ObservableList<ClusterMessage> lst_clusterMemberList = FXCollections.observableArrayList();
|
||||
|
||||
private ObservableList<ChatMember> lst_DBBasedWkdCallSignList = FXCollections.observableArrayList();
|
||||
@@ -329,6 +459,22 @@ public class ChatController {
|
||||
|
||||
}
|
||||
|
||||
public FilteredList<ChatMessage> getLst_selectedCallSignInfofilteredMessageList() {
|
||||
return lst_selectedCallSignInfofilteredMessageList;
|
||||
}
|
||||
|
||||
public void setLst_selectedCallSignInfofilteredMessageList(FilteredList<ChatMessage> lst_selectedCallSignInfofilteredMessageList) {
|
||||
this.lst_selectedCallSignInfofilteredMessageList = lst_selectedCallSignInfofilteredMessageList;
|
||||
}
|
||||
|
||||
public ObservableList<ChatMessage> getLst_globalChatMessageList() {
|
||||
return lst_globalChatMessageList;
|
||||
}
|
||||
|
||||
public void setLst_globalChatMessageList(ObservableList<ChatMessage> lst_globalChatMessageList) {
|
||||
this.lst_globalChatMessageList = lst_globalChatMessageList;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
@@ -397,6 +543,22 @@ public class ChatController {
|
||||
this.lst_chatMemberList = lst_chatMemberList;
|
||||
}
|
||||
|
||||
public FilteredList<ChatMember> getLst_chatMemberListFiltered() {
|
||||
return lst_chatMemberListFiltered;
|
||||
}
|
||||
|
||||
public SortedList<ChatMember> getLst_chatMemberSortedFilteredList() {
|
||||
return lst_chatMemberSortedFilteredList;
|
||||
}
|
||||
|
||||
public ObservableList<Predicate<ChatMember>> getLst_chatMemberListFilterPredicates() {
|
||||
return lst_chatMemberListFilterPredicates;
|
||||
}
|
||||
|
||||
public void setLst_chatMemberListFilterPredicates(ObservableList<Predicate<ChatMember>> lst_chatMemberListFilterPredicates) {
|
||||
this.lst_chatMemberListFilterPredicates = lst_chatMemberListFilterPredicates;
|
||||
}
|
||||
|
||||
public ObservableList<ClusterMessage> getLst_clusterMemberList() {
|
||||
return lst_clusterMemberList;
|
||||
}
|
||||
@@ -409,15 +571,21 @@ public class ChatController {
|
||||
return lst_toAllMessageList;
|
||||
}
|
||||
|
||||
public void setLst_toAllMessageList(ObservableList<ChatMessage> lst_toAllMessageList) {
|
||||
this.lst_toAllMessageList = lst_toAllMessageList;
|
||||
// public void setLst_toAllMessageList(ObservableList<ChatMessage> lst_toAllMessageList) {
|
||||
// this.lst_toAllMessageList = lst_toAllMessageList;
|
||||
// }
|
||||
public void setLst_toAllMessageList(FilteredList<ChatMessage> lst_toAllMessageList) {
|
||||
this.lst_toAllMessageList = lst_toAllMessageList;
|
||||
}
|
||||
|
||||
public ObservableList<ChatMessage> getLst_toMeMessageList() {
|
||||
return lst_toMeMessageList;
|
||||
}
|
||||
|
||||
public void setLst_toMeMessageList(ObservableList<ChatMessage> lst_toMeMessageList) {
|
||||
// public void setLst_toMeMessageList(ObservableList<ChatMessage> lst_toMeMessageList) {
|
||||
// this.lst_toMeMessageList = lst_toMeMessageList;
|
||||
// }
|
||||
public void setLst_toMeMessageList(FilteredList<ChatMessage> lst_toMeMessageList) {
|
||||
this.lst_toMeMessageList = lst_toMeMessageList;
|
||||
}
|
||||
|
||||
@@ -425,7 +593,11 @@ public class ChatController {
|
||||
return lst_toOtherMessageList;
|
||||
}
|
||||
|
||||
public void setLst_toOtherMessageList(ObservableList<ChatMessage> lst_toOtherMessageList) {
|
||||
// public void setLst_toOtherMessageList(ObservableList<ChatMessage> lst_toOtherMessageList) {
|
||||
// this.lst_toOtherMessageList = lst_toOtherMessageList;
|
||||
// }
|
||||
|
||||
public void setLst_toOtherMessageList(FilteredList<ChatMessage> lst_toOtherMessageList) {
|
||||
this.lst_toOtherMessageList = lst_toOtherMessageList;
|
||||
}
|
||||
|
||||
@@ -434,9 +606,9 @@ public class ChatController {
|
||||
}
|
||||
|
||||
public ChatController() {
|
||||
super();
|
||||
|
||||
category = new ChatCategory(2);
|
||||
super();
|
||||
category = new ChatCategory(2);
|
||||
ownChatMemberObject = new ChatMember();
|
||||
ownChatMemberObject.setCallSign(userName);
|
||||
ownChatMemberObject.setName(showedName);
|
||||
@@ -444,7 +616,6 @@ public class ChatController {
|
||||
|
||||
// this.category = ChatCategory.VUHF;
|
||||
this.userName = ownChatMemberObject.getName();
|
||||
// this.password = "uxskezcj";
|
||||
this.hostname = "www.on4kst.info";
|
||||
this.port = port;
|
||||
}
|
||||
@@ -452,12 +623,88 @@ public class ChatController {
|
||||
/**
|
||||
* This constructor is used by the Main()-Class of the praktiKST javaFX-gui.
|
||||
*
|
||||
* @param setCategory
|
||||
*
|
||||
* @param setOwnChatMemberObject
|
||||
*/
|
||||
public ChatController(ChatMember setOwnChatMemberObject) {
|
||||
super();
|
||||
|
||||
UpdateChecker checkForUpdates = new UpdateChecker(this);
|
||||
|
||||
if (checkForUpdates.downloadLatestVersionInfoXML()) {
|
||||
updateInformation = checkForUpdates.parseUpdateXMLFile();
|
||||
};
|
||||
|
||||
lst_toMeMessageList.setPredicate(new Predicate<ChatMessage>() {
|
||||
@Override
|
||||
public boolean test(ChatMessage chatMessage) {
|
||||
|
||||
try {
|
||||
|
||||
if (chatMessage.getReceiver().getCallSign().equals(getChatPreferences().getLoginCallSign())) {
|
||||
return true; //messages addressed to you
|
||||
}
|
||||
if ((chatMessage.getSender().getCallSign().equals(getChatPreferences().getLoginCallSign())) && (!chatMessage.getReceiver().getCallSign().equals("ALL"))){
|
||||
return true; //your own echo except texts to all (CQ)
|
||||
}
|
||||
|
||||
String ignoreCaseString = chatMessage.getMessageText();
|
||||
|
||||
if ((chatMessage.getMessageText().contains(chatPreferences.getLoginCallSign().toLowerCase()) || (chatMessage.getMessageText().contains(chatPreferences.getLoginCallSign().toUpperCase())))
|
||||
&& (!chatMessage.getSender().getCallSign().equals(getChatPreferences().getLoginCallSign()))) {
|
||||
return true; //if someone writes about you, you will get the mail, too, except you are the sender...!
|
||||
}
|
||||
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception nullPointerExc) {
|
||||
nullPointerExc.printStackTrace();
|
||||
System.out.println("ChatController, <<<catched ERROR>>>: maybe the receiver was null, message received b4 user entered chatmessage...!" + nullPointerExc.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
lst_toAllMessageList.setPredicate(new Predicate<ChatMessage>() {
|
||||
@Override
|
||||
public boolean test(ChatMessage chatMessage) {
|
||||
|
||||
try {
|
||||
if (chatMessage.getReceiver().getCallSign().equals("ALL")) { //TODO: ALL have to be an application-constant
|
||||
return true;
|
||||
} else return false;
|
||||
|
||||
}
|
||||
catch (Exception nullPointerExc) {
|
||||
nullPointerExc.printStackTrace();
|
||||
System.out.println("ChatController, ERROR: maybe the receiver was null, mostly like a cq message!");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
lst_toOtherMessageList.setPredicate(new Predicate<ChatMessage>() {
|
||||
@Override
|
||||
public boolean test(ChatMessage chatMessage) {
|
||||
try {
|
||||
if ((!chatMessage.getSender().getCallSign().equals(getChatPreferences().getLoginCallSign())) &&
|
||||
(!chatMessage.getReceiver().getCallSign().equals(getChatPreferences().getLoginCallSign()))) {
|
||||
return true;
|
||||
} else return false;
|
||||
|
||||
} catch (Exception nullPointerExc) {
|
||||
nullPointerExc.printStackTrace();
|
||||
System.out.println("ChatController, <<<catched ERROR>>>: maybe the receiver was null!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dbHandler = new DBController();
|
||||
|
||||
chatPreferences = new ChatPreferences();
|
||||
chatPreferences.readPreferencesFromXmlFile(); // set the praktikst Prefs by file or default if file is corrupted
|
||||
|
||||
@@ -540,6 +787,12 @@ public class ChatController {
|
||||
|
||||
public void execute() throws InterruptedException, IOException {
|
||||
|
||||
// messageBus = new SimpleStringProperty("_____est connection");
|
||||
|
||||
// ObservableStringValue test = new SimpleStringProperty("test");
|
||||
|
||||
// eventBus = test;
|
||||
|
||||
chatController = this;
|
||||
|
||||
// This block constructs a sample message
|
||||
@@ -553,7 +806,9 @@ public class ChatController {
|
||||
// getLst_toAllMessageList().add(Test);
|
||||
|
||||
try {
|
||||
dbHandler = new DBController();
|
||||
setDisconnectionPerformedByUser(false);
|
||||
|
||||
// dbHandler = new DBController(); //TODO: old place to instantiuate the dbcontroller
|
||||
|
||||
messageRXBus = new LinkedBlockingQueue<ChatMessage>();
|
||||
messageTXBus = new LinkedBlockingQueue<ChatMessage>();
|
||||
@@ -573,7 +828,7 @@ public class ChatController {
|
||||
writeThread.setName("Writethread-telnetwriter");
|
||||
writeThread.start();
|
||||
|
||||
readUDPbyUCXThread = new ReadUDPbyUCXMessageThread(12060, this);
|
||||
readUDPbyUCXThread = new ReadUDPbyUCXMessageThread(chatPreferences.getLogsynch_ucxUDPWkdCallListenerPort(), this);
|
||||
readUDPbyUCXThread.setName("readUDPbyUCXThread");
|
||||
readUDPbyUCXThread.start();
|
||||
|
||||
@@ -581,7 +836,7 @@ public class ChatController {
|
||||
messageProcessor.setName("messagebusManagementThread");
|
||||
messageProcessor.start();
|
||||
|
||||
airScoutUDPReaderThread = new ReadUDPbyAirScoutMessageThread(9872, this, "AS", "KST");
|
||||
airScoutUDPReaderThread = new ReadUDPbyAirScoutMessageThread(chatPreferences.getAirScout_asCommunicationPort(), this, "AS", "KST");
|
||||
airScoutUDPReaderThread.setName("airscoutudpreaderThread");
|
||||
airScoutUDPReaderThread.start();
|
||||
|
||||
@@ -620,7 +875,7 @@ public class ChatController {
|
||||
*/
|
||||
// Timer ASQueryTimer;
|
||||
ASQueryTimer = new Timer();
|
||||
ASQueryTimer.schedule(new AirScoutPeriodicalAPReflectionInquirerTask(this), 10000, 5000);
|
||||
ASQueryTimer.schedule(new AirScoutPeriodicalAPReflectionInquirerTask(this), 10000, 12000);
|
||||
// 60000 * intervalInMinutes = IntervalInMillis
|
||||
|
||||
/**
|
||||
@@ -632,7 +887,7 @@ public class ChatController {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// System.out.println("[Chatcontroller, info: ] periodical socketcheck");
|
||||
System.out.println("[Chatcontroller, info: ] periodical socketcheck");
|
||||
|
||||
Thread.currentThread().setName("SocketcheckTimer");
|
||||
|
||||
@@ -645,13 +900,6 @@ public class ChatController {
|
||||
chatController.setConnectedAndLoggedIn(false);
|
||||
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");
|
||||
|
||||
ChatMessage killThreadPoisonPillMsg = new ChatMessage();
|
||||
@@ -873,14 +1121,32 @@ public class ChatController {
|
||||
chatMember.setWorked5600(getWorkedDataFromDb.get(chatMember.getCallSign()).isWorked5600());
|
||||
;
|
||||
chatMember.setWorked10G(getWorkedDataFromDb.get(chatMember.getCallSign()).isWorked10G());
|
||||
/**
|
||||
* v1.2 since here
|
||||
* TODO: Change that, this ins not generative
|
||||
*/
|
||||
|
||||
chatMember.setQrv144(getWorkedDataFromDb.get(chatMember.getCallSign()).isQrv144());
|
||||
;
|
||||
chatMember.setQrv432(getWorkedDataFromDb.get(chatMember.getCallSign()).isQrv432());
|
||||
;
|
||||
chatMember.setQrv1240(getWorkedDataFromDb.get(chatMember.getCallSign()).isQrv1240());
|
||||
;
|
||||
chatMember.setQrv2300(getWorkedDataFromDb.get(chatMember.getCallSign()).isQrv2300());
|
||||
;
|
||||
chatMember.setQrv3400(getWorkedDataFromDb.get(chatMember.getCallSign()).isQrv3400());
|
||||
;
|
||||
chatMember.setQrv5600(getWorkedDataFromDb.get(chatMember.getCallSign()).isQrv5600());
|
||||
;
|
||||
chatMember.setQrv10G(getWorkedDataFromDb.get(chatMember.getCallSign()).isQrv10G());
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* This creates the list of the worked stations which had to be displayed in the
|
||||
* settings menu. TODO: May make this List editable
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
getWorkedDataFromDb.forEach((key, value) -> {
|
||||
@@ -898,7 +1164,7 @@ public class ChatController {
|
||||
/* Try the not exceptional way to iterate */
|
||||
// for (ChatMember chatMemberAvl : new ArrayList<ChatMember>(getLst_chatMemberList())) {
|
||||
// if (getWorkedDataFromDb.containsKey(chatMemberAvl.getCallSign())) {
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -922,6 +1188,13 @@ public class ChatController {
|
||||
chatMember -> chatMember.resetWorkedInformationAtAllBands());
|
||||
|
||||
}
|
||||
|
||||
public void resetQRVInfoInGuiLists() {
|
||||
|
||||
this.chatController.getLst_chatMemberList().forEach(
|
||||
chatMember -> chatMember.resetQRVInformationAtAllBands());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the initial parameters at the chat
|
||||
|
||||
@@ -27,8 +27,7 @@ public class DBController {
|
||||
private static final DBController dbcontroller = new DBController();
|
||||
private static Connection connection;
|
||||
// private static final String DB_PATH = System.getProperty("praktiKST.db");
|
||||
private static final String DB_PATH = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, DATABASE_FILE);
|
||||
|
||||
private static String DB_PATH = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, DATABASE_FILE);
|
||||
|
||||
/*
|
||||
static {
|
||||
@@ -62,6 +61,9 @@ public class DBController {
|
||||
}
|
||||
|
||||
private void initDBConnection() {
|
||||
|
||||
System.out.println("DBH: initiate new db connection");
|
||||
|
||||
try {
|
||||
ApplicationFileUtils.copyResourceIfRequired(
|
||||
ApplicationConstants.APPLICATION_NAME,
|
||||
@@ -71,7 +73,17 @@ public class DBController {
|
||||
if (connection != null)
|
||||
return;
|
||||
System.out.println("Creating Connection to Database...");
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
||||
|
||||
DB_PATH = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, DATABASE_FILE);
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
||||
|
||||
//connection = DriverManager.getConnection("jdbc:sqlite:" + "C:\\Users\\prakt\\.praktiKST\\praktiKST.db");
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("[DBH, Info]: Path = " + DB_PATH);
|
||||
|
||||
if (!connection.isClosed())
|
||||
System.out.println("...Connection established");
|
||||
} catch (SQLException e) {
|
||||
@@ -91,8 +103,77 @@ public class DBController {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
versionUpdateOfDBCheckAndChangeV11ToV12(); //TODO: newer version DB update should be called here
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* While the first version of this software has other needs to the db tables than the 1.2 and following versions
|
||||
* this method will check if the database file of the user is compatible and make it compatible if it´s not.
|
||||
* <br/>
|
||||
* v1.1 -> v1.2: Chatmember entities will get additional fields for not-QRV-band-info
|
||||
* <br/>
|
||||
* I check only the first field "notqrv144", if it does not exist, I creating all fields neccessarry for v1.2
|
||||
*/
|
||||
public void versionUpdateOfDBCheckAndChangeV11ToV12() {
|
||||
|
||||
try {
|
||||
Statement stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(
|
||||
"SELECT * FROM ChatMember where notQRV144 != 0;");
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
|
||||
System.out.println("DBH, Info: updating DB fields for version change v1.1 -> v1.2");
|
||||
|
||||
try {
|
||||
|
||||
PreparedStatement ps = connection.prepareStatement(
|
||||
"ALTER TABLE ChatMember ADD notQRV144 BOOLEAN DEFAULT 0" + ";");
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement(
|
||||
"ALTER TABLE ChatMember ADD notQRV432 BOOLEAN DEFAULT 0" + ";");
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement(
|
||||
"ALTER TABLE ChatMember ADD notQRV1240 BOOLEAN DEFAULT 0" + ";");
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement(
|
||||
"ALTER TABLE ChatMember ADD notQRV2300 BOOLEAN DEFAULT 0" + ";");
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement(
|
||||
"ALTER TABLE ChatMember ADD notQRV3400 BOOLEAN DEFAULT 0" + ";");
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement(
|
||||
"ALTER TABLE ChatMember ADD notQRV5600 BOOLEAN DEFAULT 0" + ";");
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement(
|
||||
"ALTER TABLE ChatMember ADD notQRV10G BOOLEAN DEFAULT 0" + ";");
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
connection.setAutoCommit(false);
|
||||
connection.setAutoCommit(true);
|
||||
} catch (SQLException e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// private void handleDB() {
|
||||
// try {
|
||||
// Statement stmt = connection.createStatement();
|
||||
@@ -158,6 +239,7 @@ public class DBController {
|
||||
* "worked3400" BOOLEAN,<br/>
|
||||
* "worked5600" BOOLEAN,<br/>
|
||||
* "worked10G" BOOLEAN,<br/>
|
||||
* <br/><b>!!! since v1.2 there is a not-qrv info for each band, too !!!</b>
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
@@ -170,7 +252,7 @@ public class DBController {
|
||||
// if (!rs.next()) {
|
||||
|
||||
PreparedStatement ps = connection.prepareStatement(
|
||||
"INSERT OR IGNORE INTO ChatMember VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(callsign) DO UPDATE SET qra = '"
|
||||
"INSERT OR IGNORE INTO ChatMember VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(callsign) DO UPDATE SET qra = '"
|
||||
+ chatMemberToStore.getQra() + "', name = '" + chatMemberToStore.getName()
|
||||
+ "', lastActivityDateTime = '" + chatMemberToStore.getLastActivity()
|
||||
+ "' where callsign = '" + chatMemberToStore.getCallSign() + "';");
|
||||
@@ -187,6 +269,16 @@ public class DBController {
|
||||
ps.setInt(10, helper_booleanIntConverter(chatMemberToStore.isWorked3400()));
|
||||
ps.setInt(11, helper_booleanIntConverter(chatMemberToStore.isWorked5600()));
|
||||
ps.setInt(12, helper_booleanIntConverter(chatMemberToStore.isWorked10G()));
|
||||
/**
|
||||
* Here starts v1.2
|
||||
*/
|
||||
ps.setInt(13, helper_booleanIntConverter(!chatMemberToStore.isQrv144()));
|
||||
ps.setInt(14, helper_booleanIntConverter(!chatMemberToStore.isQrv432()));
|
||||
ps.setInt(15, helper_booleanIntConverter(!chatMemberToStore.isQrv1240()));
|
||||
ps.setInt(16, helper_booleanIntConverter(!chatMemberToStore.isQrv2300()));
|
||||
ps.setInt(17, helper_booleanIntConverter(!chatMemberToStore.isQrv3400()));
|
||||
ps.setInt(18, helper_booleanIntConverter(!chatMemberToStore.isQrv5600()));
|
||||
ps.setInt(19, helper_booleanIntConverter(!chatMemberToStore.isQrv10G()));
|
||||
|
||||
ps.addBatch();
|
||||
|
||||
@@ -206,7 +298,7 @@ public class DBController {
|
||||
} catch (SQLException e) {
|
||||
System.err.println("[DBH, ERROR:] Chatmember could not been stored.");
|
||||
e.printStackTrace();
|
||||
connection.close();
|
||||
// connection.close(); //Todo commented out due to errors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,6 +351,18 @@ public class DBController {
|
||||
updateWkdData.setWorked5600(helper_IntToBooleanConverter(rs.getInt("worked5600")));
|
||||
updateWkdData.setWorked10G(helper_IntToBooleanConverter(rs.getInt("worked10G")));
|
||||
|
||||
/**
|
||||
* v1.2 since here
|
||||
*/
|
||||
|
||||
updateWkdData.setQrv144(!helper_IntToBooleanConverter(rs.getInt("notQRV144")));
|
||||
updateWkdData.setQrv432(!helper_IntToBooleanConverter(rs.getInt("notQRV432")));
|
||||
updateWkdData.setQrv1240(!helper_IntToBooleanConverter(rs.getInt("notQRV1240")));
|
||||
updateWkdData.setQrv2300(!helper_IntToBooleanConverter(rs.getInt("notQRV2300")));
|
||||
updateWkdData.setQrv3400(!helper_IntToBooleanConverter(rs.getInt("notQRV3400")));
|
||||
updateWkdData.setQrv5600(!helper_IntToBooleanConverter(rs.getInt("notQRV5600")));
|
||||
updateWkdData.setQrv10G(!helper_IntToBooleanConverter(rs.getInt("notQRV10G")));
|
||||
|
||||
fetchedWorkeddata.put(updateWkdData.getCallSign(), updateWkdData);
|
||||
|
||||
// System.out.println(
|
||||
@@ -319,6 +423,18 @@ public class DBController {
|
||||
checkForThis.setWorked5600(helper_IntToBooleanConverter(rs.getInt("worked5600")));
|
||||
checkForThis.setWorked10G(helper_IntToBooleanConverter(rs.getInt("worked10G")));
|
||||
|
||||
/**
|
||||
* v1.2 since here
|
||||
*/
|
||||
|
||||
checkForThis.setWorked144(helper_IntToBooleanConverter(rs.getInt("notQRV144")));
|
||||
checkForThis.setWorked432(helper_IntToBooleanConverter(rs.getInt("notQRV432")));
|
||||
checkForThis.setWorked1240(helper_IntToBooleanConverter(rs.getInt("notQRV1240")));
|
||||
checkForThis.setWorked2300(helper_IntToBooleanConverter(rs.getInt("notQRV2300")));
|
||||
checkForThis.setWorked3400(helper_IntToBooleanConverter(rs.getInt("notQRV3400")));
|
||||
checkForThis.setWorked5600(helper_IntToBooleanConverter(rs.getInt("notQRV5600")));
|
||||
checkForThis.setWorked10G(helper_IntToBooleanConverter(rs.getInt("notQRV10G")));
|
||||
|
||||
System.out.println(
|
||||
"[DBH, Info:] providing callsign wkd info, wkd, 144, 432, ... for UA5 new chatmember : "
|
||||
+ checkForThis.toString());
|
||||
@@ -353,7 +469,9 @@ public class DBController {
|
||||
* <b>Usage: User triggered after User clicked the reset-wkd button, may in each
|
||||
* new contest period</b> <br/>
|
||||
* <br/>
|
||||
*
|
||||
*
|
||||
* modified for work with v1.2
|
||||
*
|
||||
* @return true if reset was successful
|
||||
*
|
||||
* @throws SQLException
|
||||
@@ -363,7 +481,8 @@ public class DBController {
|
||||
try {
|
||||
Statement stmt = connection.createStatement();
|
||||
|
||||
int affected = stmt.executeUpdate("update ChatMember set worked = 0, worked144 = 0, worked432 = 0, worked1240 = 0, worked2300 = 0, worked3400 = 0, worked5600 = 0, worked10G = 0;");
|
||||
int affected = stmt.executeUpdate("update ChatMember set worked = 0, worked144 = 0, worked432 = 0, worked1240 = 0, worked2300 = 0, worked3400 = 0, worked5600 = 0, worked10G = 0" +
|
||||
", notQrv144 = 0, notQrv432 = 0, notQrv1240 = 0, notQrv2300 = 0, notQrv3400 = 0, notQrv5600 = 0, notQrv10G = 0;");
|
||||
|
||||
stmt.close();
|
||||
|
||||
@@ -503,6 +622,77 @@ public class DBController {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean updateNotQRVInfoOnChatMember(ChatMember chatMemberToStore) throws SQLException {
|
||||
try {
|
||||
Statement stmt = connection.createStatement();
|
||||
|
||||
/**
|
||||
* at first, mark the station as worked, always
|
||||
*/
|
||||
PreparedStatement ps = connection.prepareStatement("UPDATE ChatMember set notQrv144 = ? WHERE CallSign = ?");
|
||||
|
||||
ps.setInt(1, helper_booleanIntConverter(!chatMemberToStore.isQrv144()));
|
||||
ps.setString(2, chatMemberToStore.getCallSign());
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement("UPDATE ChatMember set notQrv432 = ? WHERE CallSign = ?");
|
||||
|
||||
ps.setInt(1, helper_booleanIntConverter(!chatMemberToStore.isQrv432()));
|
||||
ps.setString(2, chatMemberToStore.getCallSign());
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement("UPDATE ChatMember set notQrv1240 = ? WHERE CallSign = ?");
|
||||
|
||||
ps.setInt(1, helper_booleanIntConverter(!chatMemberToStore.isQrv1240()));
|
||||
ps.setString(2, chatMemberToStore.getCallSign());
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement("UPDATE ChatMember set notQrv2300 = ? WHERE CallSign = ?");
|
||||
|
||||
ps.setInt(1, helper_booleanIntConverter(!chatMemberToStore.isQrv2300()));
|
||||
ps.setString(2, chatMemberToStore.getCallSign());
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement("UPDATE ChatMember set notQrv3400 = ? WHERE CallSign = ?");
|
||||
|
||||
ps.setInt(1, helper_booleanIntConverter(!chatMemberToStore.isQrv3400()));
|
||||
ps.setString(2, chatMemberToStore.getCallSign());
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement("UPDATE ChatMember set notQrv5600 = ? WHERE CallSign = ?");
|
||||
|
||||
ps.setInt(1, helper_booleanIntConverter(!chatMemberToStore.isQrv5600()));
|
||||
ps.setString(2, chatMemberToStore.getCallSign());
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
ps = connection.prepareStatement("UPDATE ChatMember set notQrv10G = ? WHERE CallSign = ?");
|
||||
|
||||
ps.setInt(1, helper_booleanIntConverter(!chatMemberToStore.isQrv10G()));
|
||||
ps.setString(2, chatMemberToStore.getCallSign());
|
||||
ps.addBatch();
|
||||
ps.executeBatch();
|
||||
|
||||
connection.setAutoCommit(false);
|
||||
connection.setAutoCommit(true);
|
||||
|
||||
|
||||
stmt.close();
|
||||
|
||||
} catch (SQLException e) {
|
||||
System.err.println("[DBH, ERROR:] Couldn't handle DB-Query");
|
||||
e.printStackTrace();
|
||||
connection.close();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int helper_booleanIntConverter(boolean convertToInt) {
|
||||
|
||||
if (convertToInt) {
|
||||
@@ -531,11 +721,15 @@ public class DBController {
|
||||
dummy.setName("Team Test");
|
||||
dummy.setLastActivity(new Utils4KST().time_generateActualTimeInDateFormat());
|
||||
dummy.setWorked5600(true);
|
||||
|
||||
// dbc.versionUpdateOfDBCheckAndChangeV11ToV12();
|
||||
// dbc.fetchChatMemberNOTQRVBandInfoForOnlyOneCallsignFromDB();
|
||||
// dbc.updateNOTQRVBandInfoOnChatMember();
|
||||
// dummy.setWorked432(true);
|
||||
|
||||
// dbc.storeChatMember(dummy);
|
||||
|
||||
dbc.updateWkdInfoOnChatMember(dummy);
|
||||
// dbc.updateWkdInfoOnChatMember(dummy);
|
||||
|
||||
// dbc.handleDB();
|
||||
}
|
||||
|
||||
@@ -11,16 +11,21 @@ import java.util.regex.Pattern;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.collections.ObservableList;
|
||||
import kst4contest.ApplicationConstants;
|
||||
import kst4contest.locatorUtils.DirectionUtils;
|
||||
import kst4contest.locatorUtils.Location;
|
||||
import kst4contest.model.AirPlaneReflectionInfo;
|
||||
import kst4contest.model.ChatMember;
|
||||
import kst4contest.model.ChatMessage;
|
||||
import kst4contest.model.ClusterMessage;
|
||||
import kst4contest.utils.PlayAudioUtils;
|
||||
import kst4contest.view.Kst4ContestApplication;
|
||||
|
||||
/**
|
||||
*
|
||||
* This thread is responsible for processing rx and tx messages, synchronize tx
|
||||
* and rx and saving the whole chat content in a textfile and write the text to
|
||||
* the stdio.
|
||||
* This thread is responsible for processing received messages.
|
||||
* It checks all messages from server for their functional contest, such as commands to build or change the userlist
|
||||
* or their settings, get clustermessages and sure the content of all chatmessages, which are delivered.
|
||||
*
|
||||
*/
|
||||
public class MessageBusManagementThread extends Thread {
|
||||
@@ -195,7 +200,8 @@ public class MessageBusManagementThread extends Thread {
|
||||
/**
|
||||
* Builds UserList and gets meta informations out of the chat, as far as it is
|
||||
* possible. \n This is the only place where the Chatmember-List will be written
|
||||
*
|
||||
*
|
||||
* Old Method for port 23000, raw text interface without any comfort, no longer used
|
||||
* @param messageToProcess
|
||||
*/
|
||||
private void processRXMessage23000(ChatMessage messageToProcess) {
|
||||
@@ -358,11 +364,19 @@ public class MessageBusManagementThread extends Thread {
|
||||
newMember.setName(splittedMessageLine[3]);
|
||||
newMember.setQra(splittedMessageLine[4]);
|
||||
newMember.setState(Integer.parseInt(splittedMessageLine[5]));
|
||||
newMember.setLastActivity(new Utils4KST().time_generateActualTimeInDateFormat());
|
||||
// newMember.setQTFdirection(LocatorUtils);
|
||||
newMember.setQrb(new Location().getDistanceKmByTwoLocatorStrings(client.getChatPreferences().getLoginLocator(), newMember.getQra()));
|
||||
newMember.setQTFdirection(new Location(client.getChatPreferences().getLoginLocator()).getBearing(new Location(newMember.getQra())));
|
||||
newMember.setLastActivity(new Utils4KST().time_generateActualTimeInDateFormat());//TODO evt obsolete!
|
||||
newMember.setActivityTimeLastInEpoch(new Utils4KST().time_generateCurrentEpochTime());
|
||||
|
||||
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember); //TODO: map -> List
|
||||
|
||||
this.client.getLst_chatMemberList().add(newMember);
|
||||
//the own call will not be in the list
|
||||
if (!client.getChatPreferences().getLoginCallSign().equals(newMember.getCallSign())) {
|
||||
this.client.getLst_chatMemberList().add(newMember);
|
||||
}
|
||||
|
||||
|
||||
this.client.getDbHandler().storeChatMember(newMember);
|
||||
|
||||
@@ -380,22 +394,32 @@ public class MessageBusManagementThread extends Thread {
|
||||
if (splittedMessageLine[0].contains(USERENTEREDCHAT) || splittedMessageLine[0].contains(USERENTEREDCHAT2)) {
|
||||
// System.out.println("MSGBUS: User detected");
|
||||
|
||||
ChatMember newMember = new ChatMember();
|
||||
/**
|
||||
* The own callsign will not be hold in the userlist any more
|
||||
*/
|
||||
if (!client.getChatPreferences().getLoginCallSign().equals(splittedMessageLine[2])) {
|
||||
|
||||
newMember.setAirPlaneReflectInfo(new AirPlaneReflectionInfo());
|
||||
newMember.setCallSign(splittedMessageLine[2]);
|
||||
newMember.setName(splittedMessageLine[3]);
|
||||
newMember.setQra(splittedMessageLine[4]);
|
||||
newMember.setState(Integer.parseInt(splittedMessageLine[5]));
|
||||
newMember.setLastActivity(new Utils4KST().time_generateActualTimeInDateFormat());
|
||||
|
||||
newMember = this.client.getDbHandler().fetchChatMemberWkdDataForOnlyOneCallsignFromDB(newMember);
|
||||
ChatMember newMember = new ChatMember();
|
||||
|
||||
this.client.getLst_chatMemberList().add(newMember);
|
||||
newMember.setAirPlaneReflectInfo(new AirPlaneReflectionInfo());
|
||||
newMember.setCallSign(splittedMessageLine[2]);
|
||||
newMember.setName(splittedMessageLine[3]);
|
||||
newMember.setQra(splittedMessageLine[4]);
|
||||
newMember.setState(Integer.parseInt(splittedMessageLine[5]));
|
||||
newMember.setLastActivity(new Utils4KST().time_generateActualTimeInDateFormat());
|
||||
newMember.setActivityTimeLastInEpoch(new Utils4KST().time_generateCurrentEpochTime());
|
||||
newMember.setQrb(new Location().getDistanceKmByTwoLocatorStrings(client.getChatPreferences().getLoginLocator(), newMember.getQra()));
|
||||
newMember.setQTFdirection(new Location(client.getChatPreferences().getLoginLocator()).getBearing(new Location(newMember.getQra())));
|
||||
|
||||
this.client.getDbHandler().storeChatMember(newMember);
|
||||
newMember = this.client.getDbHandler().fetchChatMemberWkdDataForOnlyOneCallsignFromDB(newMember);
|
||||
|
||||
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember);
|
||||
this.client.getLst_chatMemberList().add(newMember);
|
||||
this.client.getDbHandler().storeChatMember(newMember);
|
||||
}
|
||||
|
||||
|
||||
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember);
|
||||
|
||||
// System.out.println("[MSGBUSMGT:] New entered User detected and added to list ["
|
||||
// + this.client.getChatMemberTable().size() + "] :" + newMember.getCallSign());
|
||||
@@ -452,32 +476,53 @@ public class MessageBusManagementThread extends Thread {
|
||||
|
||||
ChatMessage newMessage = new ChatMessage();
|
||||
newMessage.setChatCategory(this.client.getCategory());
|
||||
newMessage.setMessageGeneratedTime(splittedMessageLine[2]); // TODO: insert readable time?
|
||||
newMessage.setMessageGeneratedTime(splittedMessageLine[2]);
|
||||
|
||||
if (splittedMessageLine[3].equals("SERVER")) {
|
||||
ChatMember dummy = new ChatMember();
|
||||
dummy.setCallSign("SERVER");
|
||||
dummy.setName("Sysop");
|
||||
newMessage.setSender(dummy);
|
||||
|
||||
} else {
|
||||
|
||||
ChatMember temp = new ChatMember();
|
||||
temp.setCallSign(splittedMessageLine[3]);
|
||||
ChatMember sender = new ChatMember();
|
||||
sender.setCallSign(splittedMessageLine[3]);
|
||||
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), temp);
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), sender);
|
||||
|
||||
//if the user had been found in the active users list
|
||||
if (index != -1) {
|
||||
|
||||
newMessage.setSender(this.client.getLst_chatMemberList().get(index)); // set sender to member of
|
||||
//user found in the chatmember list
|
||||
try {
|
||||
newMessage.setSender(this.client.getLst_chatMemberList().get(index)); // set sender to member of
|
||||
this.client.getLst_chatMemberList().get(index).setActivityTimeLastInEpoch(new Utils4KST().time_generateCurrentEpochTime());
|
||||
} catch (Exception exc) {
|
||||
ChatMember aSenderDummy = new ChatMember();
|
||||
aSenderDummy.setCallSign(splittedMessageLine[3] + "[n/a]");
|
||||
aSenderDummy.setAirPlaneReflectInfo(new AirPlaneReflectionInfo());
|
||||
newMessage.setSender(aSenderDummy);
|
||||
System.out.println("MsgBusmgtT: Catched Error! " + exc.getMessage() + " // " + splittedMessageLine[3] + " is not in the list! Faking sender!");
|
||||
exc.printStackTrace();
|
||||
}
|
||||
// b4 init list
|
||||
} else {
|
||||
|
||||
if (!temp.getCallSign().equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||
temp.setCallSign("[n/a]" + temp.getCallSign());
|
||||
//user not found in chatmember list, mark it, sender can not be set
|
||||
if (!sender.getCallSign().equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||
sender.setCallSign("[n/a]" + sender.getCallSign());
|
||||
// if someone sent a message without being in the userlist (cause
|
||||
// on4kst missed implementing....), callsign will be marked
|
||||
} else {
|
||||
//that means, message was by own station, broadcasted to all other
|
||||
ChatMember dummy = new ChatMember();
|
||||
dummy.setCallSign("ALL");
|
||||
newMessage.setReceiver(dummy);
|
||||
|
||||
AirPlaneReflectionInfo preventNullpointerExc = new AirPlaneReflectionInfo();
|
||||
preventNullpointerExc.setAirPlanesReachableCntr(0);
|
||||
sender.setAirPlaneReflectInfo(preventNullpointerExc);
|
||||
newMessage.setSender(sender); //my own call is the sender
|
||||
}
|
||||
|
||||
newMessage.setSender(temp); // if someone sent a message without being in the userlist (cause
|
||||
// on4kst missed implementing....)
|
||||
}
|
||||
|
||||
// newMessage.setSender(this.client.getChatMemberTable().get(splittedMessageLine[3]));
|
||||
@@ -487,49 +532,124 @@ public class MessageBusManagementThread extends Thread {
|
||||
newMessage.setMessageText(splittedMessageLine[6]);
|
||||
|
||||
if (splittedMessageLine[7].equals("0")) {
|
||||
// message is not directed to anyone
|
||||
// message is not directed to anyone, move it to the cq messages!
|
||||
ChatMember dummy = new ChatMember();
|
||||
dummy.setCallSign("ALL");
|
||||
newMessage.setReceiver(dummy);
|
||||
|
||||
this.client.getLst_toAllMessageList().add(0, newMessage); // sdtout to all message-List
|
||||
// this.client.getLst_toAllMessageList().add(0, newMessage); // sdtout to all message-List //TODO: change, moved to globalmessagelist - original
|
||||
this.client.getLst_globalChatMessageList().add(0, newMessage); // sdtout to all message-List //TODO: change, moved to globalmessagelist
|
||||
|
||||
} else {
|
||||
//message is directed to another chatmember, process as such!
|
||||
|
||||
ChatMember temp2 = new ChatMember();
|
||||
temp2.setCallSign(splittedMessageLine[7]);
|
||||
ChatMember receiver = new ChatMember();
|
||||
receiver.setCallSign(splittedMessageLine[7]);
|
||||
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), temp2);
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), receiver);
|
||||
|
||||
if (index != -1) {
|
||||
newMessage.setReceiver(this.client.getLst_chatMemberList().get(index));// -1: Member left Chat
|
||||
// before...
|
||||
} else {
|
||||
temp2.setCallSign(temp2.getCallSign() + "(left)");
|
||||
newMessage.setReceiver(temp2);
|
||||
} else { //found in active member list
|
||||
|
||||
|
||||
if (receiver.getCallSign().equals(client.getChatPreferences().getLoginCallSign())) {
|
||||
/**
|
||||
* If mycallsign sent a message to the server, server will publish that message and
|
||||
* send it to all chatmember including me.
|
||||
* As mycall is not in the userlist, the message would not been displayed if I handle
|
||||
* it in the next case (marking left user, just for information). But I want an echo.
|
||||
*/
|
||||
|
||||
receiver.setCallSign(client.getChatPreferences().getLoginCallSign());
|
||||
newMessage.setReceiver(receiver);
|
||||
} else {
|
||||
//this are user which left chat but had been adressed by this message
|
||||
receiver.setCallSign(receiver.getCallSign() + "(left)");
|
||||
newMessage.setReceiver(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
if (newMessage.getReceiver().getCallSign()
|
||||
.equals(this.client.getChatPreferences().getLoginCallSign())) {
|
||||
try {
|
||||
/**
|
||||
* message is directed to me, will be put in the "to me" messagelist
|
||||
*/
|
||||
if (newMessage.getReceiver().getCallSign()
|
||||
.equals(this.client.getChatPreferences().getLoginCallSign())) {
|
||||
|
||||
this.client.getLst_toMeMessageList().add(0, newMessage);
|
||||
// this.client.getLst_toMeMessageList().add(0, newMessage); //TODO: change, moved to globalmessagelist, original
|
||||
this.client.getLst_globalChatMessageList().add(0, newMessage); //TODO: change, moved to globalmessagelist, original
|
||||
|
||||
System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + ".");
|
||||
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());
|
||||
}
|
||||
|
||||
} else if (newMessage.getSender().getCallSign().toUpperCase() // if you sent the message, it will be sorted in to
|
||||
// the "to you message list"
|
||||
.equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||
String originalMessage = newMessage.getMessageText();
|
||||
newMessage
|
||||
.setMessageText("(>" + newMessage.getReceiver().getCallSign() + ")" + originalMessage);
|
||||
this.client.getLst_toMeMessageList().add(0, newMessage); // TODO:check
|
||||
if (this.client.getChatPreferences().isNotify_playSimpleSounds()) {
|
||||
if (newMessage.getMessageText().toUpperCase().contains("//BELL")) {
|
||||
this.client.getPlayAudioUtils().playVoiceLauncher("!");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
this.client.getLst_toOtherMessageList().add(0, newMessage);
|
||||
|
||||
System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + ".");
|
||||
|
||||
} else if (newMessage.getSender().getCallSign().toUpperCase()
|
||||
.equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||
/**
|
||||
* message sent by me!
|
||||
* message from me will appear in the PM window, too, with (>CALLSIGN) before
|
||||
*/
|
||||
String originalMessage = newMessage.getMessageText();
|
||||
newMessage
|
||||
.setMessageText("(>" + newMessage.getReceiver().getCallSign() + ")" + originalMessage);
|
||||
// this.client.getLst_toMeMessageList().add(0, newMessage); //TODO: change, moved to globalmessagelist, original
|
||||
this.client.getLst_globalChatMessageList().add(0,newMessage);//TODO: change, moved to globalmessagelist
|
||||
|
||||
// if you sent the message to another station, it will be sorted in to
|
||||
// the "to me message list" with modified messagetext, added rxers callsign
|
||||
|
||||
} else {
|
||||
//message sent to other user
|
||||
// this.client.getLst_toOtherMessageList().add(0, newMessage); //TODO: change, moved to globalmessagelist, original
|
||||
if (DirectionUtils.isInAngleAndRange(client.getChatPreferences().getLoginLocator(),
|
||||
newMessage.getSender().getQra(),
|
||||
newMessage.getReceiver().getQra(),
|
||||
client.getChatPreferences().getStn_maxQRBDefault(),
|
||||
client.getChatPreferences().getStn_antennaBeamWidthDeg())) {
|
||||
|
||||
if (this.client.getChatPreferences().isNotify_playSimpleSounds()) {
|
||||
//play only tick sound if the sender was not set directedtome before
|
||||
if (!newMessage.getSender().isInAngleAndRange()) {
|
||||
this.client.getPlayAudioUtils().playNoiseLauncher('-');
|
||||
}
|
||||
}
|
||||
newMessage.getSender().setInAngleAndRange(true);
|
||||
System.out.println(">>>>>>>>>> Anglewarning <<<<<<<<<< " + newMessage.getSender().getCallSign() + ", " + newMessage.getSender().getQra() + " -> " + newMessage.getReceiver().getCallSign() + ", " + newMessage.getReceiver().getQra() + " = " +
|
||||
new Location(newMessage.getSender().getQra()).getBearing(new Location(newMessage.getReceiver().getQra())) +
|
||||
" / sender bearing to me: " + new Location(newMessage.getSender().getQra()).getBearing(new Location(client.getChatPreferences().getLoginLocator())));
|
||||
|
||||
} else {
|
||||
System.out.println("-notinangle- " + newMessage.getSender().getCallSign() + ", " + newMessage.getSender().getQra() + " -> " + newMessage.getReceiver().getCallSign() + ", " + newMessage.getReceiver().getQra() + " = " +
|
||||
new Location(newMessage.getSender().getQra()).getBearing(new Location(newMessage.getReceiver().getQra())) +
|
||||
" ; sender bearing to me: " + new Location(newMessage.getSender().getQra()).getBearing(new Location(client.getChatPreferences().getLoginLocator())));
|
||||
newMessage.getSender().setInAngleAndRange(false);
|
||||
}
|
||||
|
||||
this.client.getLst_globalChatMessageList().add(0, newMessage);
|
||||
// System.out.println("MSGBS bgfx: tx call = " + newMessage.getSender().getCallSign() + " / rx call = " + newMessage.getReceiver().getCallSign());
|
||||
}
|
||||
} catch (NullPointerException referenceDeletedByUserLeftChatDuringMessageprocessing) {
|
||||
System.out.println("MSGBS bgfx, <<<catched error>>>: referenced user left the chat during messageprocessing or message got before user entered chat message: " + referenceDeletedByUserLeftChatDuringMessageprocessing.getStackTrace());
|
||||
// referenceDeletedByUserLeftChatDuringMessageprocessing.printStackTrace();
|
||||
}
|
||||
|
||||
// sdtout to me message-List
|
||||
@@ -571,9 +691,10 @@ public class MessageBusManagementThread extends Thread {
|
||||
/**
|
||||
* CH|2|1664663240|IK7LMX|Gilberto QRO|0|pse ant to jn80|YT5W| Caused this line
|
||||
*/
|
||||
System.out.println("[MSGBUSMGT:] ERROR, Frequency for " + splittedMessageLine[3]
|
||||
System.out.println("[MSGBUSMGT <<<catched ERROR>>>]:, Frequency for " + splittedMessageLine[3]
|
||||
+ " is not settable, Callsign is not in the Member-list!");
|
||||
|
||||
//create dummy user to display the message but it wont be hit the user object
|
||||
ChatMember newMember = new ChatMember();
|
||||
newMember.setCallSign(splittedMessageLine[3]);
|
||||
newMember.setName(splittedMessageLine[4]);
|
||||
@@ -584,24 +705,13 @@ public class MessageBusManagementThread extends Thread {
|
||||
} else {
|
||||
/**
|
||||
* User is in the list...
|
||||
*
|
||||
*/
|
||||
this.client.getLst_chatMemberList().get(index).setFrequency(qrg);
|
||||
System.out.println("[MSGBUSMGT:] Frequency for " + splittedMessageLine[3] + " setted: "
|
||||
+ locatedFrequencies);
|
||||
|
||||
// this.client.getLst_chatMemberList().
|
||||
|
||||
// ChatMember dummy = new ChatMember();
|
||||
//
|
||||
// dummy.setAirPlaneReflectInfo(new AirPlaneReflectionInfo()); //TODO: check if this is neccessary
|
||||
// this.client.getLst_chatMemberList().add(dummy); // TODO: Bugfix for UI actualization, maybe we dont need that any more
|
||||
// this.client.getLst_chatMemberList().remove(dummy);
|
||||
// this.client.getLst_chatMemberList().sorted();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: Next: get frequency infos out of name?
|
||||
@@ -628,6 +738,9 @@ public class MessageBusManagementThread extends Thread {
|
||||
+ splittedMessageLine[3]));
|
||||
|
||||
this.client.getLst_chatMemberList().get(index).setQra(splittedMessageLine[3]);
|
||||
this.client.getLst_chatMemberList().get(index).setQrb(new Location().getDistanceKmByTwoLocatorStrings(client.getChatPreferences().getLoginLocator(), splittedMessageLine[3]));
|
||||
this.client.getLst_chatMemberList().get(index).setQTFdirection(new Location(client.getChatPreferences().getLoginLocator()).getBearing(new Location(splittedMessageLine[3])));
|
||||
|
||||
|
||||
} else {
|
||||
System.out.println("[MSGBUSMGT:] ERROR! Locator Change of ["
|
||||
@@ -784,6 +897,8 @@ public class MessageBusManagementThread extends Thread {
|
||||
stateChangeMember.setQra(splittedMessageLine[4]);
|
||||
stateChangeMember.setState(Integer.parseInt(splittedMessageLine[5]));
|
||||
stateChangeMember.setLastActivity(new Utils4KST().time_generateActualTimeInDateFormat());
|
||||
stateChangeMember.setQrb(new Location().getDistanceKmByTwoLocatorStrings(client.getChatPreferences().getLoginLocator(), stateChangeMember.getQra()));
|
||||
stateChangeMember.setQTFdirection(new Location(client.getChatPreferences().getLoginLocator()).getBearing(new Location(stateChangeMember.getQra())));
|
||||
|
||||
this.client.getDbHandler().storeChatMember(stateChangeMember); // TODO: not clean, it should be an
|
||||
// upodate
|
||||
@@ -793,9 +908,13 @@ public class MessageBusManagementThread extends Thread {
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(),
|
||||
stateChangeMember);
|
||||
|
||||
this.client.getLst_chatMemberList().get(index).setName(stateChangeMember.getName());
|
||||
this.client.getLst_chatMemberList().get(index).setQra(stateChangeMember.getQra());
|
||||
this.client.getLst_chatMemberList().get(index).setState(stateChangeMember.getState());
|
||||
//-1 could be the case if mycall is processed
|
||||
if (index != -1) {
|
||||
this.client.getLst_chatMemberList().get(index).setName(stateChangeMember.getName());
|
||||
this.client.getLst_chatMemberList().get(index).setQra(stateChangeMember.getQra());
|
||||
this.client.getLst_chatMemberList().get(index).setState(stateChangeMember.getState());
|
||||
}
|
||||
|
||||
|
||||
// this.client.getChatMemberTable().get(stateChangeMember.getCallSign())
|
||||
// .setName(stateChangeMember.getName());
|
||||
@@ -828,7 +947,7 @@ public class MessageBusManagementThread extends Thread {
|
||||
System.out.println("Passwort falsch!");
|
||||
|
||||
if (splittedMessageLine[2].contains("password")) {
|
||||
splittedMessageLine[2] += "pse disc- and reconnect";
|
||||
splittedMessageLine[2] += " pse disc- and reconnect";
|
||||
}
|
||||
|
||||
ChatMember server = new ChatMember();
|
||||
@@ -840,11 +959,24 @@ public class MessageBusManagementThread extends Thread {
|
||||
pwErrorMsg.setMessageGeneratedTime(client.getCurrentEpochTime()+"");
|
||||
pwErrorMsg.setSender(server);
|
||||
pwErrorMsg.setMessageText(splittedMessageLine[2]);
|
||||
|
||||
ChatMember receiverDummy = new ChatMember();
|
||||
receiverDummy.setCallSign(client.getChatPreferences().getLoginCallSign());
|
||||
receiverDummy.setQrb(0.);
|
||||
receiverDummy.setQTFdirection(0.);
|
||||
pwErrorMsg.setReceiver(receiverDummy);
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
client.getLst_toMeMessageList().add(pwErrorMsg);
|
||||
client.getLst_toAllMessageList().add(pwErrorMsg);
|
||||
client.getLst_globalChatMessageList().add(pwErrorMsg);
|
||||
// client.getLst_toMeMessageList().add(pwErrorMsg);
|
||||
// client.getLst_toAllMessageList().add(pwErrorMsg);
|
||||
}
|
||||
|
||||
// Kst4ContestApplication.alertWindowEvent("Password was wrong. Pse check!");
|
||||
|
||||
client.disconnect(ApplicationConstants.DISCSTRING_DISCONNECTONLY);
|
||||
|
||||
// this.client.disconnect();
|
||||
}
|
||||
@@ -937,9 +1069,7 @@ public class MessageBusManagementThread extends Thread {
|
||||
String messageLine;
|
||||
|
||||
while (true) {
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
messageTextRaw = client.getMessageRXBus().take();
|
||||
|
||||
|
||||
@@ -91,48 +91,7 @@ public class ReadThread extends Thread {
|
||||
// TODO Auto-generated catch block
|
||||
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();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Comparator;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import kst4contest.ApplicationConstants;
|
||||
import kst4contest.model.AirPlane;
|
||||
import kst4contest.model.AirPlaneReflectionInfo;
|
||||
import kst4contest.model.ChatMember;
|
||||
@@ -30,6 +31,8 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
|
||||
public ReadUDPbyAirScoutMessageThread(int localPort, ChatController client, String ASIdentificator,
|
||||
String ChatClientIdentificator) {
|
||||
|
||||
|
||||
this.localPort = localPort;
|
||||
this.client = client;
|
||||
this.ASIdentificator = ASIdentificator;
|
||||
@@ -38,6 +41,7 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
|
||||
@Override
|
||||
public void interrupt() {
|
||||
System.out.println("ReadUDP");
|
||||
super.interrupt();
|
||||
try {
|
||||
if (this.socket != null) {
|
||||
@@ -89,6 +93,12 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
}
|
||||
|
||||
socket.receive(packet);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (SocketTimeoutException e2) {
|
||||
// this will catch the repeating Sockettimeoutexception...nothing to do
|
||||
// e2.printStackTrace();
|
||||
@@ -104,10 +114,22 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
String received = new String(packet.getData(), packet.getOffset(), packet.getLength());
|
||||
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")) {
|
||||
// do nothing, that is your own message
|
||||
} else if (received.contains("ASNEAREST:")) {
|
||||
} else if (received.contains("ASNEAREST:")) { //answer by airscout
|
||||
processASUDPMessage(received);
|
||||
|
||||
// System.out.println("[ReadUSPASTh, info:] received AS String " + received);
|
||||
|
||||
AirPlaneReflectionInfo apReflectInfoForChatMember;
|
||||
@@ -260,9 +282,13 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
return apInfo;
|
||||
}
|
||||
|
||||
public boolean terminateConnection() throws IOException {
|
||||
public boolean terminateConnection() {
|
||||
|
||||
this.socket.close();
|
||||
try {
|
||||
this.socket.close();
|
||||
} catch (Exception e) {
|
||||
System.out.println("udpbyas: catched " + e.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import kst4contest.ApplicationConstants;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
@@ -43,17 +44,19 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
super.interrupt();
|
||||
try {
|
||||
if (this.socket != null) {
|
||||
|
||||
this.socket.close();
|
||||
System.out.println(">>>>>>>>>>>>>>ReadUdpbyUCS: closing socket");
|
||||
terminateConnection();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
System.out.println("UCXUDPRDR: catched error " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
|
||||
|
||||
Thread.currentThread().setName("ReadUDPByUCXLogThread");
|
||||
|
||||
DatagramSocket socket = null;
|
||||
@@ -63,7 +66,7 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
|
||||
try {
|
||||
socket = new DatagramSocket(12060);
|
||||
socket.setSoTimeout(11000); //TODO try for end properly
|
||||
socket.setSoTimeout(2000); //TODO try for end properly
|
||||
}
|
||||
|
||||
catch (SocketException e) {
|
||||
@@ -75,22 +78,47 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
|
||||
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)
|
||||
// DatagramPacket packet = new DatagramPacket(SRPDefinitions.BYTE_BUFFER_MAX_LENGTH); //TODO: Changed that due to memory leak, check if all works (seems like that)
|
||||
try {
|
||||
socket.receive(packet);
|
||||
|
||||
} catch (SocketTimeoutException e2) {
|
||||
|
||||
|
||||
timeOutIndicator = true;
|
||||
// this will catch the repeating Sockettimeoutexception...nothing to do
|
||||
// e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
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();
|
||||
@@ -99,9 +127,20 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
String received = new String(packet.getData(), packet.getOffset(), packet.getLength());
|
||||
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) {
|
||||
processUCXUDPMessage(received);
|
||||
} else {
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
*/
|
||||
package kst4contest.controller;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableStringValue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@@ -19,7 +22,9 @@ public class StartChat {
|
||||
public static void main(String[] args) throws InterruptedException, IOException {
|
||||
|
||||
System.out.println("[Startchat:] Starting new Chat instance");
|
||||
|
||||
|
||||
// ObservableStringValue messageBus = new SimpleStringProperty("");
|
||||
|
||||
ChatController client = new ChatController();
|
||||
client.execute();
|
||||
|
||||
|
||||
237
src/main/java/kst4contest/controller/UpdateChecker.java
Normal file
237
src/main/java/kst4contest/controller/UpdateChecker.java
Normal file
@@ -0,0 +1,237 @@
|
||||
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;
|
||||
import java.util.ArrayList;
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Section changeLog
|
||||
*/
|
||||
|
||||
list = doc.getElementsByTagName("changeLog");
|
||||
ArrayList<String[]> changeLogArrayList = new ArrayList<String[]>();
|
||||
|
||||
if (list.getLength() != 0) {
|
||||
|
||||
for (int temp = 0; temp < list.getLength(); temp++) {
|
||||
|
||||
Node node = list.item(temp);
|
||||
|
||||
Element element = (Element) node;
|
||||
int childNodeCounter = 0; //need an extra counter due to childnodes are counted...no idea, how
|
||||
String[] aChangeLogEntry = new String[7];
|
||||
aChangeLogEntry[0] = "";
|
||||
aChangeLogEntry[1] = "Date: ";
|
||||
aChangeLogEntry[2] = "Desc: ";
|
||||
aChangeLogEntry[3] = "Added: ";
|
||||
aChangeLogEntry[4] = "Changed: ";
|
||||
aChangeLogEntry[5] = "Fixed: ";
|
||||
aChangeLogEntry[6] = "Removed: ";
|
||||
|
||||
for (int i = 0; i < element.getChildNodes().getLength(); i++) {
|
||||
|
||||
if (element.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
|
||||
// System.out.println(element.getChildNodes().item(i).getTextContent() + " <<<<<<<<<<<<<<<<<< " + i + " / " + childNodeCounter);
|
||||
// System.out.println(element.getChildNodes().item(i).getNodeName());
|
||||
aChangeLogEntry[childNodeCounter] = aChangeLogEntry[childNodeCounter] + element.getChildNodes().item(i).getTextContent();
|
||||
childNodeCounter++;
|
||||
}
|
||||
}
|
||||
changeLogArrayList.add(aChangeLogEntry);
|
||||
}
|
||||
updateInfos.setChangeLog(changeLogArrayList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Section Buglist
|
||||
*/
|
||||
|
||||
list = doc.getElementsByTagName("bug");
|
||||
ArrayList<String[]> bugFixArrayList = new ArrayList<String[]>();
|
||||
|
||||
if (list.getLength() != 0) {
|
||||
|
||||
for (int temp = 0; temp < list.getLength(); temp++) {
|
||||
|
||||
Node node = list.item(temp);
|
||||
|
||||
Element element = (Element) node;
|
||||
int childNodeCounter = 0; //need an extra counter due to childnodes are counted...no idea, how
|
||||
String[] aChangeLogEntry = new String[3];
|
||||
aChangeLogEntry[0] = "";
|
||||
aChangeLogEntry[1] = "State: ";
|
||||
|
||||
|
||||
for (int i = 0; i < element.getChildNodes().getLength(); i++) {
|
||||
|
||||
if (element.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
|
||||
System.out.println(element.getChildNodes().item(i).getTextContent() + " <<<<<<<<<<<<<<<<<< " + i + " / " + childNodeCounter);
|
||||
// System.out.println(element.getChildNodes().item(i).getNodeName());
|
||||
aChangeLogEntry[childNodeCounter] = aChangeLogEntry[childNodeCounter] + element.getChildNodes().item(i).getTextContent();
|
||||
childNodeCounter++;
|
||||
}
|
||||
}
|
||||
bugFixArrayList.add(aChangeLogEntry);
|
||||
}
|
||||
updateInfos.setBugList(bugFixArrayList);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String[] testEntry = new String[7];
|
||||
testEntry[0] = "0.99";
|
||||
testEntry[1] = "2022-09";
|
||||
testEntry[2] = "researched the Chatprotocol";
|
||||
testEntry[3] = "addednothing";
|
||||
testEntry[4] = "changedsome";
|
||||
testEntry[5] = "fixedxed";
|
||||
testEntry[6] = "removedYourMom";
|
||||
|
||||
String[] testEntry2 = new String[7];
|
||||
testEntry2[0] = "0.29";
|
||||
testEntry2[1] = "2033-09";
|
||||
testEntry2[2] = "tested";
|
||||
testEntry2[3] = "addednotashing";
|
||||
testEntry2[4] = "changeasdsome";
|
||||
testEntry2[5] = "fixedxeds";
|
||||
testEntry2[6] = "removedYosssurMom";
|
||||
|
||||
// changeLogArrayList.add(testEntry);
|
||||
// changeLogArrayList.add(testEntry2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return updateInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String toString = "";
|
||||
|
||||
// toString += this.currentVersion;
|
||||
|
||||
return toString;
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,21 @@ public class Utils4KST {
|
||||
return formatted;
|
||||
|
||||
}
|
||||
|
||||
public static long time_getSecondsBetweenEpochAndNow(String epoch1) {
|
||||
|
||||
long epoch1Long = Long.parseLong(epoch1);
|
||||
long epoch2Long = new Utils4KST().time_generateCurrentEpochTime();
|
||||
// Instant instant = Instant.ofEpochSecond(epoch);
|
||||
|
||||
Date date = new Date(epoch1Long * 1000L);
|
||||
Date date2 = new Date(epoch2Long * 1000L);
|
||||
|
||||
long seconds = Math.abs(date.getTime()-date2.getTime())/1000;
|
||||
|
||||
return seconds;
|
||||
|
||||
}
|
||||
|
||||
public Date time_generateActualTimeInDateFormat() {
|
||||
Date date = new Date(time_generateCurrentEpochTime() * 1000L);
|
||||
|
||||
110
src/main/java/kst4contest/locatorUtils/DirectionUtils.java
Normal file
110
src/main/java/kst4contest/locatorUtils/DirectionUtils.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package kst4contest.locatorUtils;
|
||||
|
||||
public class DirectionUtils {
|
||||
|
||||
/**
|
||||
* Checks wheter a sked-sender writes to a sked-receiver and is in my direction due he beams to this receiver
|
||||
*
|
||||
* @param myLocator
|
||||
* @param locatorOfSkedSender
|
||||
* @param locatorOfSekdReceiver
|
||||
* @param maxRangeKm
|
||||
* @param hisAntennaBeamWidth
|
||||
* @return
|
||||
*/
|
||||
public static boolean isInAngleAndRange(String myLocator, String locatorOfSkedSender, String locatorOfSekdReceiver, double maxRangeKm, double hisAntennaBeamWidth) {
|
||||
|
||||
Location myLocation = new Location(myLocator);
|
||||
Location skedSenderLocation = new Location(locatorOfSkedSender);
|
||||
Location skedReceiverLocation = new Location(locatorOfSekdReceiver);
|
||||
|
||||
double distanceFromMeToLocSender = new Location(myLocator).getDistanceKm(new Location(locatorOfSkedSender));
|
||||
|
||||
// Check if distance exceeds my setted maximum range
|
||||
if (distanceFromMeToLocSender > maxRangeKm) {
|
||||
System.out.println("too far, " + distanceFromMeToLocSender + " km");
|
||||
return false;
|
||||
}
|
||||
|
||||
//check bearing of sender to receiver
|
||||
|
||||
double bearingOfSekdSenderToSkedReceiver = skedSenderLocation.getBearing(skedReceiverLocation);
|
||||
// System.out.println("skedTX -> skedTX deg: " + bearingOfSekdSenderToSkedReceiver);
|
||||
|
||||
double bearingOfSekdSenderToMe = skedSenderLocation.getBearing(myLocation);
|
||||
// System.out.println("skedTX -> me deg: " + bearingOfSekdSenderToMe);
|
||||
|
||||
/**
|
||||
* simple mech works
|
||||
*/
|
||||
// if (bearingOfSekdSenderToMe >= bearingOfSekdSenderToSkedReceiver) {
|
||||
// if (bearingOfSekdSenderToMe-bearingOfSekdSenderToSkedReceiver <= hisAntennaBeamWidth/2){
|
||||
// System.out.println(bearingOfSekdSenderToMe-bearingOfSekdSenderToSkedReceiver + " <= " + hisAntennaBeamWidth);
|
||||
// return true;
|
||||
// }
|
||||
// } else if ((bearingOfSekdSenderToMe <= bearingOfSekdSenderToSkedReceiver)) {
|
||||
// if (bearingOfSekdSenderToSkedReceiver-bearingOfSekdSenderToMe <= hisAntennaBeamWidth/2){
|
||||
// return true;
|
||||
// }
|
||||
// } else return false;
|
||||
/**
|
||||
* simple mech end
|
||||
*/
|
||||
|
||||
if (DirectionUtils.isAngleInRange(bearingOfSekdSenderToSkedReceiver, bearingOfSekdSenderToMe, hisAntennaBeamWidth)) {
|
||||
//I may should get "/2" because of 50% of the 3dB opening angle if txer is directed to sender exactly
|
||||
// System.out.println("------------> isinangleandrange!");
|
||||
return true;
|
||||
} else {
|
||||
// System.out.println("not in angle and reach");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests, if the angle (from me to) other station is in the range of the
|
||||
* angle (qtf) in degrees where my antenna points to.
|
||||
*
|
||||
* @param toForeignAngle [degrees]
|
||||
* @param mySelectedQTFAngle [degrees]
|
||||
* @param antennaBeamwidth [degrees]
|
||||
* @return
|
||||
*/
|
||||
public static boolean isAngleInRange(double toForeignAngle,
|
||||
double mySelectedQTFAngle, double antennaBeamwidth) {
|
||||
|
||||
double beamwidth = antennaBeamwidth / 2; // half left, half right
|
||||
|
||||
double startAngle = mySelectedQTFAngle - beamwidth;
|
||||
double endAngle = mySelectedQTFAngle + beamwidth;
|
||||
|
||||
// Normalize angles to be between 0 and 360 degrees
|
||||
toForeignAngle = normalizeAngle(toForeignAngle);
|
||||
startAngle = normalizeAngle(startAngle);
|
||||
endAngle = normalizeAngle(endAngle);
|
||||
|
||||
// Check if the range wraps around 360 degrees
|
||||
if (startAngle <= endAngle) {
|
||||
return toForeignAngle >= startAngle && toForeignAngle <= endAngle;
|
||||
} else {
|
||||
// Range wraps around 360 degrees, so check if angle is within the
|
||||
// range or outside the range
|
||||
return toForeignAngle >= startAngle || toForeignAngle <= endAngle;
|
||||
}
|
||||
}
|
||||
|
||||
private static double normalizeAngle(double angle) {
|
||||
if (angle < 0) {
|
||||
angle += 360;
|
||||
}
|
||||
if (angle >= 360) {
|
||||
angle -= 360;
|
||||
}
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
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
|
||||
* locator (grid squares) based off of
|
||||
@@ -203,6 +208,27 @@ public class Location {
|
||||
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 Double.parseDouble(format);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loc2
|
||||
* second location
|
||||
@@ -278,6 +304,19 @@ public class Location {
|
||||
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
|
||||
* source location
|
||||
@@ -300,6 +339,21 @@ public class Location {
|
||||
- Math.sin(loc1.getLatitude().getRadians())
|
||||
* Math.cos(loc2.getLatitude().getRadians())
|
||||
* Math.cos(dLon);
|
||||
return (Angle.radiansToDegrees(Math.atan2(y, x)) + 360) % 360;
|
||||
|
||||
double bearing = (Angle.radiansToDegrees(Math.atan2(y, x)) + 360) % 360;
|
||||
|
||||
// return bearing;
|
||||
|
||||
|
||||
Locale locale = new Locale("en", "UK");
|
||||
String pattern = "###.##";
|
||||
|
||||
DecimalFormat decimalFormat = (DecimalFormat)
|
||||
NumberFormat.getNumberInstance(locale);
|
||||
decimalFormat.applyPattern(pattern);
|
||||
|
||||
String format = decimalFormat.format(bearing);
|
||||
|
||||
return Double.parseDouble(format);
|
||||
}
|
||||
}
|
||||
|
||||
43
src/main/java/kst4contest/locatorUtils/TestLocatorUtils.java
Normal file
43
src/main/java/kst4contest/locatorUtils/TestLocatorUtils.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package kst4contest.locatorUtils;
|
||||
|
||||
public class TestLocatorUtils {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
// isInAngle(myLocation, location1, location2);
|
||||
System.out.println(isInAngleAndRange("JN49FL", "jo43xm", "jo30sa", 900, 50));
|
||||
System.out.println(isInAngleAndRange("JN49FL", "jo51ij", "jn39oc", 900, 50));
|
||||
System.out.println(isInAngleAndRange("JN49FL", "jn39oc", "jo51ij", 1100, 50));
|
||||
}
|
||||
|
||||
public static boolean isInAngleAndRange(String myLocator, String locatorOfSkedSender, String locatorOfSekdReceiver, double maxRangeKm, double hisAntennaBeamWidth) {
|
||||
|
||||
Location myLocation = new Location(myLocator);
|
||||
Location skedSenderLocation = new Location(locatorOfSkedSender);
|
||||
Location skedReceiverLocation = new Location(locatorOfSekdReceiver);
|
||||
|
||||
double distanceFromMeToLocSender = new Location(myLocator).getDistanceKm(new Location(locatorOfSkedSender));
|
||||
|
||||
// Check if distance exceeds my setted maximum range
|
||||
if (distanceFromMeToLocSender > maxRangeKm) {
|
||||
System.out.println("too far, " + distanceFromMeToLocSender + " km");
|
||||
return false;
|
||||
}
|
||||
|
||||
//check bearing of sender to receiver
|
||||
|
||||
double bearingOfSekdSenderToSkedReceiver = skedSenderLocation.getBearing(skedReceiverLocation);
|
||||
System.out.println("skedTX -> skedRX deg: " + bearingOfSekdSenderToSkedReceiver);
|
||||
|
||||
double bearingOfSekdSenderToMe = skedSenderLocation.getBearing(myLocation);
|
||||
System.out.println("skedTX -> me deg: " + bearingOfSekdSenderToMe);
|
||||
|
||||
if (DirectionUtils.isAngleInRange(bearingOfSekdSenderToSkedReceiver, bearingOfSekdSenderToMe, hisAntennaBeamWidth)) {
|
||||
//may I should get "/2" because of 50% of the 3dB opening angle if txer is directed to sender exactly
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,25 @@ package kst4contest.model;
|
||||
public class AirPlane {
|
||||
|
||||
String apCallSign, apSizeCategory;
|
||||
String potencialDescriptionAsWord;
|
||||
|
||||
public String getPotencialDescriptionAsWord() {
|
||||
if (this.getPotential() <=50) {
|
||||
return "small AP";
|
||||
} else if (this.getPotential() <=75 && this.getPotential() > 50) {
|
||||
return "big AP";
|
||||
} else if (this.getPotential() > 75) {
|
||||
return "very big AP";
|
||||
}
|
||||
|
||||
|
||||
return potencialDescriptionAsWord;
|
||||
}
|
||||
|
||||
public void setPotencialDescriptionAsWord(String potencialDescriptionAsWord) {
|
||||
this.potencialDescriptionAsWord = potencialDescriptionAsWord;
|
||||
}
|
||||
|
||||
int distanceKm, potential, arrivingDurationMinutes;
|
||||
public String getApCallSign() {
|
||||
return apCallSign;
|
||||
|
||||
@@ -11,6 +11,9 @@ public class ChatMember {
|
||||
String callSign;
|
||||
String qra;
|
||||
String name;
|
||||
|
||||
boolean isInAngleAndRange; //if he tries a sked in my dir, he is in range, will process that in the messages
|
||||
|
||||
// String frequency; // last known qrg of the station
|
||||
|
||||
StringProperty frequency = new SimpleStringProperty();
|
||||
@@ -19,13 +22,13 @@ public class ChatMember {
|
||||
ChatCategory chatCategory; // only used by own instance of the chatmember instance to login to the chat
|
||||
// ChatCategory chatCategory;//only used by own instance of the chatmember instance to login to the chat
|
||||
|
||||
long activityCounter; // time of last activity in epochtimesec
|
||||
long activityTimeLastInEpoch; // time of last activity in epochtimesec
|
||||
Date lastActivity; // time of last activity in epochtimesec
|
||||
Date lastActualizationTimeOfThisMember; // time of last state change if that member
|
||||
int qrb;
|
||||
Double qrb;
|
||||
int state;
|
||||
|
||||
int QTFdirection; // antenna direction in deg
|
||||
Double QTFdirection; // antenna direction in deg
|
||||
int[] workedCategories; // Chatcategory where the station is in the log, see kst4contest.model.ChatCategory
|
||||
|
||||
boolean worked; // true if the callsign is logged already - for temporary worked processing
|
||||
@@ -37,6 +40,28 @@ public class ChatMember {
|
||||
boolean worked5600;
|
||||
boolean worked10G;
|
||||
|
||||
/**
|
||||
* Chatmember is qrv at all band except we initialize anything other, depending to user entry
|
||||
*/
|
||||
boolean qrv144 = true;
|
||||
boolean qrv432 = true;
|
||||
boolean qrv1240 = true;
|
||||
boolean qrv2300 = true;
|
||||
boolean qrv3400 = true;
|
||||
boolean qrv5600 = true;
|
||||
boolean qrv10G = true;
|
||||
boolean qrvAny = true;
|
||||
|
||||
|
||||
|
||||
public boolean isInAngleAndRange() {
|
||||
return isInAngleAndRange;
|
||||
}
|
||||
|
||||
public void setInAngleAndRange(boolean inAngleAndRange) {
|
||||
isInAngleAndRange = inAngleAndRange;
|
||||
}
|
||||
|
||||
public AirPlaneReflectionInfo getAirPlaneReflectInfo() {
|
||||
return airPlaneReflectInfo;
|
||||
}
|
||||
@@ -117,6 +142,70 @@ public class ChatMember {
|
||||
worked10G = worked10g;
|
||||
}
|
||||
|
||||
public boolean isQrv144() {
|
||||
return qrv144;
|
||||
}
|
||||
|
||||
public void setQrv144(boolean qrv144) {
|
||||
this.qrv144 = qrv144;
|
||||
}
|
||||
|
||||
public boolean isQrv432() {
|
||||
return qrv432;
|
||||
}
|
||||
|
||||
public void setQrv432(boolean qrv432) {
|
||||
this.qrv432 = qrv432;
|
||||
}
|
||||
|
||||
public boolean isQrv1240() {
|
||||
return qrv1240;
|
||||
}
|
||||
|
||||
public void setQrv1240(boolean qrv1240) {
|
||||
this.qrv1240 = qrv1240;
|
||||
}
|
||||
|
||||
public boolean isQrv2300() {
|
||||
return qrv2300;
|
||||
}
|
||||
|
||||
public void setQrv2300(boolean qrv2300) {
|
||||
this.qrv2300 = qrv2300;
|
||||
}
|
||||
|
||||
public boolean isQrv3400() {
|
||||
return qrv3400;
|
||||
}
|
||||
|
||||
public void setQrv3400(boolean qrv3400) {
|
||||
this.qrv3400 = qrv3400;
|
||||
}
|
||||
|
||||
public boolean isQrv5600() {
|
||||
return qrv5600;
|
||||
}
|
||||
|
||||
public void setQrv5600(boolean qrv5600) {
|
||||
this.qrv5600 = qrv5600;
|
||||
}
|
||||
|
||||
public boolean isQrv10G() {
|
||||
return qrv10G;
|
||||
}
|
||||
|
||||
public void setQrv10G(boolean qrv10G) {
|
||||
this.qrv10G = qrv10G;
|
||||
}
|
||||
|
||||
public boolean isQrvAny() {
|
||||
return qrvAny;
|
||||
}
|
||||
|
||||
public void setQrvAny(boolean qrvAny) {
|
||||
this.qrvAny = qrvAny;
|
||||
}
|
||||
|
||||
public int[] getWorkedCategories() {
|
||||
return workedCategories;
|
||||
}
|
||||
@@ -125,8 +214,8 @@ public class ChatMember {
|
||||
this.workedCategories = workedCategories;
|
||||
}
|
||||
|
||||
public void setActivityCounter(long activityCounter) {
|
||||
this.activityCounter = activityCounter;
|
||||
public void setActivityTimeLastInEpoch(long activityTimeLastInEpoch) {
|
||||
this.activityTimeLastInEpoch = activityTimeLastInEpoch;
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
@@ -153,28 +242,22 @@ public class ChatMember {
|
||||
this.lastActualizationTimeOfThisMember = lastActualizationTimeOfThisMember;
|
||||
}
|
||||
|
||||
public int getQrb() {
|
||||
public Double getQrb() {
|
||||
return qrb;
|
||||
}
|
||||
|
||||
public void setQrb(int qrb) {
|
||||
public void setQrb(Double qrb) {
|
||||
this.qrb = qrb;
|
||||
}
|
||||
|
||||
public int getQTFdirection() {
|
||||
public Double getQTFdirection() {
|
||||
return QTFdirection;
|
||||
}
|
||||
|
||||
public void setQTFdirection(int qTFdirection) {
|
||||
public void setQTFdirection(Double qTFdirection) {
|
||||
QTFdirection = qTFdirection;
|
||||
}
|
||||
|
||||
// public int getWorkedCategory() {
|
||||
// return workedCategory;
|
||||
// }
|
||||
// public void setWorkedCategory(int workedCategory) {
|
||||
// this.workedCategory = workedCategory;
|
||||
// }
|
||||
public String getCallSign() {
|
||||
return callSign;
|
||||
}
|
||||
@@ -210,12 +293,12 @@ public class ChatMember {
|
||||
this.frequency = frequency;
|
||||
}
|
||||
|
||||
public long getActivityCounter() {
|
||||
return activityCounter;
|
||||
public long getActivityTimeLastInEpoch() {
|
||||
return activityTimeLastInEpoch;
|
||||
}
|
||||
|
||||
public void setActivityCounter(int activityCounter) {
|
||||
this.activityCounter = activityCounter;
|
||||
this.activityTimeLastInEpoch = activityCounter;
|
||||
}
|
||||
|
||||
public boolean isWorked() {
|
||||
@@ -242,6 +325,22 @@ public class ChatMember {
|
||||
this.setWorked10G(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all worked information of this object to false. Scope: GUI, Reset Button
|
||||
* for worked info, called by appcontroller
|
||||
*/
|
||||
public void resetQRVInformationAtAllBands() {
|
||||
|
||||
this.setQrvAny(true);
|
||||
this.setQrv144(true);
|
||||
this.setQrv432(true);
|
||||
this.setQrv1240(true);
|
||||
this.setQrv2300(true);
|
||||
this.setQrv3400(true);
|
||||
this.setQrv5600(true);
|
||||
this.setQrv10G(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String chatMemberSerialization = "";
|
||||
|
||||
@@ -46,6 +46,8 @@ public class ChatPreferences {
|
||||
*/
|
||||
public static final String PREFERENCE_RESOURCE = "/praktiKSTpreferences.xml";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor will set the default values (also for predefined texts
|
||||
* and shorts) automatically at initialization
|
||||
@@ -130,13 +132,29 @@ public class ChatPreferences {
|
||||
* Station preferences
|
||||
*/
|
||||
|
||||
boolean loginAFKState = false; //always start as here
|
||||
String loginCallSign = "do5amf";
|
||||
String loginPassword = "";
|
||||
String loginName = "Marc";
|
||||
String loginLocator = "jn49fk";
|
||||
|
||||
double stn_antennaBeamWidthDeg = 50;
|
||||
double stn_maxQRBDefault = 900;
|
||||
double stn_qtfDefault = 135;
|
||||
|
||||
ChatCategory loginChatCategory = new ChatCategory(2);
|
||||
IntegerProperty actualQTF = new SimpleIntegerProperty(360); // will be updated by user at runtime!
|
||||
|
||||
boolean stn_bandActive144;
|
||||
boolean stn_bandActive432;
|
||||
boolean stn_bandActive1240;
|
||||
boolean stn_bandActive2300;
|
||||
boolean stn_bandActive3400;
|
||||
boolean stn_bandActive5600;
|
||||
boolean stn_bandActive10G;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Log Synch preferences
|
||||
*/
|
||||
@@ -164,6 +182,13 @@ public class ChatPreferences {
|
||||
* Notification prefs
|
||||
*/
|
||||
|
||||
//Audio section
|
||||
boolean notify_playSimpleSounds = true;
|
||||
boolean notify_playCWCallsignsOnRxedPMs = true;
|
||||
boolean notify_playVoiceCallsignsOnRxedPMs = true;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Shortcuts and Textsnippets prefs
|
||||
*/
|
||||
@@ -189,14 +214,127 @@ public class ChatPreferences {
|
||||
String unwkd_unworkedStnRequesterBeaconsText;
|
||||
String unwkd_beaconUnworkedstationsPrefix;
|
||||
|
||||
// public String getMYQRG() {
|
||||
// return MYQRG;
|
||||
// }
|
||||
//
|
||||
// public void setMYQRG(String mYQRG) {
|
||||
//
|
||||
// MYQRG = mYQRG;
|
||||
// }
|
||||
/*********************************************************************************
|
||||
*
|
||||
* GUI SETTING VARIABLES WILL BE BUFFERED HERE, DEFAULTS TOO
|
||||
*
|
||||
*********************************************************************************/
|
||||
|
||||
private double[] GUIscn_ChatwindowMainSceneSizeHW = new double[] {768, 1234};
|
||||
private double[] GUIclusterAndQSOMonStage_SceneSizeHW = new double[] {700, 500};
|
||||
private double[] GUIstage_updateStage_SceneSizeHW = new double[] {640, 480};
|
||||
private double[] GUIsettingsStageSceneSizeHW = new double[] {720, 768};
|
||||
|
||||
private double[] GUIselectedCallSignSplitPane_dividerposition = {0.55};
|
||||
private double[] GUImainWindowLeftSplitPane_dividerposition = {0.51};
|
||||
private double[] GUImessageSectionSplitpane_dividerposition = {0.62, 0.7, 0.75}; //3 deviders now //TODO: more should be possible?
|
||||
private double[] GUImainWindowRightSplitPane_dividerposition = {0.72};
|
||||
private double[] GUIpnl_directedMSGWin_dividerpositionDefault = {0.8};
|
||||
|
||||
|
||||
public double[] getGUIscn_ChatwindowMainSceneSizeHW() {
|
||||
return GUIscn_ChatwindowMainSceneSizeHW;
|
||||
}
|
||||
|
||||
public void setGUIscn_ChatwindowMainSceneSizeHW(double[] GUIscn_ChatwindowMainSceneSizeHW) {
|
||||
this.GUIscn_ChatwindowMainSceneSizeHW = GUIscn_ChatwindowMainSceneSizeHW;
|
||||
}
|
||||
|
||||
public double[] getGUIclusterAndQSOMonStage_SceneSizeHW() {
|
||||
return GUIclusterAndQSOMonStage_SceneSizeHW;
|
||||
}
|
||||
|
||||
public void setGUIclusterAndQSOMonStage_SceneSizeHW(double[] GUIclusterAndQSOMonStage_SceneSizeHW) {
|
||||
this.GUIclusterAndQSOMonStage_SceneSizeHW = GUIclusterAndQSOMonStage_SceneSizeHW;
|
||||
}
|
||||
|
||||
public double[] getGUIstage_updateStage_SceneSizeHW() {
|
||||
return GUIstage_updateStage_SceneSizeHW;
|
||||
}
|
||||
|
||||
public void setGUIstage_updateStage_SceneSizeHW(double[] GUIstage_updateStage_SceneSizeHW) {
|
||||
this.GUIstage_updateStage_SceneSizeHW = GUIstage_updateStage_SceneSizeHW;
|
||||
}
|
||||
|
||||
public double[] getGUIsettingsStageSceneSizeHW() {
|
||||
return GUIsettingsStageSceneSizeHW;
|
||||
}
|
||||
|
||||
public void setGUIsettingsStageSceneSizeHW(double[] GUIsettingsStageSceneSizeHW) {
|
||||
this.GUIsettingsStageSceneSizeHW = GUIsettingsStageSceneSizeHW;
|
||||
}
|
||||
|
||||
public double[] getGUIselectedCallSignSplitPane_dividerposition() {
|
||||
return GUIselectedCallSignSplitPane_dividerposition;
|
||||
}
|
||||
|
||||
public void setGUIselectedCallSignSplitPane_dividerposition(double[] GUIselectedCallSignSplitPane_dividerposition) {
|
||||
this.GUIselectedCallSignSplitPane_dividerposition = GUIselectedCallSignSplitPane_dividerposition;
|
||||
}
|
||||
|
||||
public double[] getGUImainWindowLeftSplitPane_dividerposition() {
|
||||
return GUImainWindowLeftSplitPane_dividerposition;
|
||||
}
|
||||
|
||||
public void setGUImainWindowLeftSplitPane_dividerposition(double[] GUImainWindowLeftSplitPane_dividerposition) {
|
||||
this.GUImainWindowLeftSplitPane_dividerposition = GUImainWindowLeftSplitPane_dividerposition;
|
||||
}
|
||||
|
||||
public double[] getGUImessageSectionSplitpane_dividerposition() {
|
||||
return GUImessageSectionSplitpane_dividerposition;
|
||||
}
|
||||
|
||||
public void setGUImessageSectionSplitpane_dividerposition(double[] GUImessageSectionSplitpane_dividerposition) {
|
||||
this.GUImessageSectionSplitpane_dividerposition = GUImessageSectionSplitpane_dividerposition;
|
||||
}
|
||||
|
||||
public double[] getGUImainWindowRightSplitPane_dividerposition() {
|
||||
return GUImainWindowRightSplitPane_dividerposition;
|
||||
}
|
||||
|
||||
public void setGUImainWindowRightSplitPane_dividerposition(double[] GUImainWindowRightSplitPane_dividerposition) {
|
||||
this.GUImainWindowRightSplitPane_dividerposition = GUImainWindowRightSplitPane_dividerposition;
|
||||
}
|
||||
|
||||
public double[] getGUIpnl_directedMSGWin_dividerpositionDefault() {
|
||||
return GUIpnl_directedMSGWin_dividerpositionDefault;
|
||||
}
|
||||
|
||||
public void setGUIpnl_directedMSGWin_dividerpositionDefault(double[] GUIpnl_directedMSGWin_dividerpositionDefault) {
|
||||
this.GUIpnl_directedMSGWin_dividerpositionDefault = GUIpnl_directedMSGWin_dividerpositionDefault;
|
||||
}
|
||||
|
||||
public double getStn_antennaBeamWidthDeg() {
|
||||
return stn_antennaBeamWidthDeg;
|
||||
}
|
||||
|
||||
public void setStn_antennaBeamWidthDeg(double stn_antennaBeamWidthDeg) {
|
||||
this.stn_antennaBeamWidthDeg = stn_antennaBeamWidthDeg;
|
||||
}
|
||||
|
||||
public double getStn_maxQRBDefault() {
|
||||
return stn_maxQRBDefault;
|
||||
}
|
||||
|
||||
public void setStn_maxQRBDefault(double stn_maxQRBDefault) {
|
||||
this.stn_maxQRBDefault = stn_maxQRBDefault;
|
||||
}
|
||||
|
||||
public double getStn_qtfDefault() {
|
||||
return stn_qtfDefault;
|
||||
}
|
||||
|
||||
public void setStn_qtfDefault(double stn_qtfDefault) {
|
||||
this.stn_qtfDefault = stn_qtfDefault;
|
||||
}
|
||||
|
||||
public boolean isLoginAFKState() {
|
||||
return loginAFKState;
|
||||
}
|
||||
|
||||
public void setLoginAFKState(boolean loginAFKState) {
|
||||
this.loginAFKState = loginAFKState;
|
||||
}
|
||||
|
||||
public String getLoginCallSign() {
|
||||
return loginCallSign;
|
||||
@@ -267,10 +405,33 @@ public class ChatPreferences {
|
||||
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
|
||||
*
|
||||
* @param actualQTF, int, QTF in degrees
|
||||
*
|
||||
*/
|
||||
|
||||
public StringProperty getMYQRG() {
|
||||
@@ -514,6 +675,46 @@ public class ChatPreferences {
|
||||
ChatCategory.setTextContent(this.getLoginChatCategory().getCategoryNumber()+"");
|
||||
station.appendChild(ChatCategory);
|
||||
|
||||
Element stn_antennaBeamWidthDeg = doc.createElement("stn_antennaBeamWidthDeg");
|
||||
stn_antennaBeamWidthDeg.setTextContent(this.stn_antennaBeamWidthDeg+"");
|
||||
station.appendChild(stn_antennaBeamWidthDeg);
|
||||
|
||||
Element stn_maxQRBDefault = doc.createElement("stn_maxQRBDefault");
|
||||
stn_maxQRBDefault.setTextContent(this.stn_maxQRBDefault+"");
|
||||
station.appendChild(stn_maxQRBDefault);
|
||||
|
||||
Element stn_qtfDefault = doc.createElement("stn_qtfDefault");
|
||||
stn_qtfDefault.setTextContent(this.stn_qtfDefault+"");
|
||||
station.appendChild(stn_qtfDefault);
|
||||
|
||||
Element stn_bandActive144 = doc.createElement("stn_bandActive144");
|
||||
stn_bandActive144.setTextContent(this.stn_bandActive144+"");
|
||||
station.appendChild(stn_bandActive144);
|
||||
|
||||
Element stn_bandActive432 = doc.createElement("stn_bandActive432");
|
||||
stn_bandActive432.setTextContent(this.stn_bandActive432+"");
|
||||
station.appendChild(stn_bandActive432);
|
||||
|
||||
Element stn_bandActive1240 = doc.createElement("stn_bandActive1240");
|
||||
stn_bandActive1240.setTextContent(this.stn_bandActive1240+"");
|
||||
station.appendChild(stn_bandActive1240);
|
||||
|
||||
Element stn_bandActive2300 = doc.createElement("stn_bandActive2300");
|
||||
stn_bandActive2300.setTextContent(this.stn_bandActive2300+"");
|
||||
station.appendChild(stn_bandActive2300);
|
||||
|
||||
Element stn_bandActive3400 = doc.createElement("stn_bandActive3400");
|
||||
stn_bandActive3400.setTextContent(this.stn_bandActive3400+"");
|
||||
station.appendChild(stn_bandActive3400);
|
||||
|
||||
Element stn_bandActive5600 = doc.createElement("stn_bandActive5600");
|
||||
stn_bandActive5600.setTextContent(this.stn_bandActive5600+"");
|
||||
station.appendChild(stn_bandActive5600);
|
||||
|
||||
Element stn_bandActive10G = doc.createElement("stn_bandActive10G");
|
||||
stn_bandActive10G.setTextContent(this.stn_bandActive10G+"");
|
||||
station.appendChild(stn_bandActive10G);
|
||||
|
||||
// Element salary = doc.createElement("salary");
|
||||
// salary.setAttribute("currency", "USD");
|
||||
// salary.setTextContent("5000");
|
||||
@@ -603,6 +804,27 @@ public class ChatPreferences {
|
||||
asQry_airScoutBandValue.setTextContent(this.getAirScout_asBandString());
|
||||
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
|
||||
*/
|
||||
@@ -660,8 +882,7 @@ public class ChatPreferences {
|
||||
|
||||
Element beaconUnworkedstations = doc.createElement("beaconUnworkedstations");
|
||||
rootElement.appendChild(beaconUnworkedstations);
|
||||
|
||||
|
||||
|
||||
Element beaconUnworkedstationsText = doc.createElement("beaconUnworkedstationsText");
|
||||
beaconUnworkedstationsText.setTextContent(this.getUnwkd_unworkedStnRequesterBeaconsText());
|
||||
beaconUnworkedstations.appendChild(beaconUnworkedstationsText);
|
||||
@@ -677,10 +898,62 @@ public class ChatPreferences {
|
||||
Element beaconUnworkedstationsPrefix = doc.createElement("beaconUnworkedstationsPrefix");
|
||||
beaconUnworkedstationsPrefix.setTextContent(this.getUnwkd_beaconUnworkedstationsPrefix());
|
||||
beaconUnworkedstations.appendChild(beaconUnworkedstationsPrefix);
|
||||
|
||||
|
||||
|
||||
writeXml(doc, System.out);
|
||||
/****************************
|
||||
* GUI BEHAVIOUR
|
||||
***************************/
|
||||
|
||||
/**
|
||||
* window sizes
|
||||
*/
|
||||
Element guiOptions = doc.createElement("guiOptions");
|
||||
rootElement.appendChild(guiOptions);
|
||||
|
||||
Element GUIscn_ChatwindowMainSceneSizeHW = doc.createElement("GUIscn_ChatwindowMainSceneSizeHW");
|
||||
GUIscn_ChatwindowMainSceneSizeHW.setTextContent(this.getGUIscn_ChatwindowMainSceneSizeHW()[0]+";"+this.getGUIscn_ChatwindowMainSceneSizeHW()[1]);
|
||||
guiOptions.appendChild(GUIscn_ChatwindowMainSceneSizeHW);
|
||||
|
||||
Element GUIclusterAndQSOMonStage_SceneSizeHW = doc.createElement("GUIclusterAndQSOMonStage_SceneSizeHW");
|
||||
GUIclusterAndQSOMonStage_SceneSizeHW.setTextContent(this.getGUIclusterAndQSOMonStage_SceneSizeHW()[0]+";"+this.getGUIclusterAndQSOMonStage_SceneSizeHW()[1]);
|
||||
guiOptions.appendChild(GUIclusterAndQSOMonStage_SceneSizeHW);
|
||||
|
||||
Element GUIstage_updateStage_SceneSizeHW = doc.createElement("GUIstage_updateStage_SceneSizeHW");
|
||||
GUIstage_updateStage_SceneSizeHW.setTextContent(this.getGUIstage_updateStage_SceneSizeHW()[0]+";"+this.getGUIstage_updateStage_SceneSizeHW()[1]);
|
||||
guiOptions.appendChild(GUIstage_updateStage_SceneSizeHW);
|
||||
|
||||
Element GUIsettingsStageSceneSizeHW = doc.createElement("GUIsettingsStageSceneSizeHW");
|
||||
GUIsettingsStageSceneSizeHW.setTextContent(this.getGUIsettingsStageSceneSizeHW()[0]+";"+this.getGUIsettingsStageSceneSizeHW()[1]);
|
||||
guiOptions.appendChild(GUIsettingsStageSceneSizeHW);
|
||||
|
||||
/************************************
|
||||
* save splitpanel divider positions
|
||||
************************************/
|
||||
|
||||
Element GUIselectedCallSignSplitPane_dividerposition = doc.createElement("GUIselectedCallSignSplitPane_dividerposition");
|
||||
GUIselectedCallSignSplitPane_dividerposition.setTextContent(doubleArrayToCSVString(getGUIselectedCallSignSplitPane_dividerposition()));
|
||||
guiOptions.appendChild(GUIselectedCallSignSplitPane_dividerposition);
|
||||
|
||||
Element GUImainWindowLeftSplitPane_dividerposition = doc.createElement("GUImainWindowLeftSplitPane_dividerposition");
|
||||
GUImainWindowLeftSplitPane_dividerposition.setTextContent(doubleArrayToCSVString(getGUImainWindowLeftSplitPane_dividerposition()));
|
||||
guiOptions.appendChild(GUImainWindowLeftSplitPane_dividerposition);
|
||||
|
||||
Element GUImessageSectionSplitpane_dividerposition = doc.createElement("GUImessageSectionSplitpane_dividerposition");
|
||||
GUImessageSectionSplitpane_dividerposition.setTextContent(doubleArrayToCSVString(getGUImessageSectionSplitpane_dividerposition()));
|
||||
guiOptions.appendChild(GUImessageSectionSplitpane_dividerposition);
|
||||
|
||||
Element GUImainWindowRightSplitPane_dividerposition = doc.createElement("GUImainWindowRightSplitPane_dividerposition");
|
||||
GUImainWindowRightSplitPane_dividerposition.setTextContent(doubleArrayToCSVString(getGUImainWindowRightSplitPane_dividerposition()));
|
||||
guiOptions.appendChild(GUImainWindowRightSplitPane_dividerposition);
|
||||
|
||||
Element GUIpnl_directedMSGWin_dividerpositionDefault = doc.createElement("GUIpnl_directedMSGWin_dividerpositionDefault");
|
||||
GUIpnl_directedMSGWin_dividerpositionDefault.setTextContent(doubleArrayToCSVString(getGUIpnl_directedMSGWin_dividerpositionDefault()));
|
||||
guiOptions.appendChild(GUIpnl_directedMSGWin_dividerpositionDefault);
|
||||
|
||||
/****************************************************************************************
|
||||
****************************** now write this XML! *************************************
|
||||
****************************************************************************************/
|
||||
|
||||
writeXml(doc, System.out);
|
||||
|
||||
// write dom document to a file
|
||||
try (FileOutputStream output =
|
||||
@@ -745,6 +1018,7 @@ public class ChatPreferences {
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
Document doc = db.parse(xmlConfigFile);
|
||||
|
||||
|
||||
/**
|
||||
* case station settings
|
||||
*
|
||||
@@ -784,9 +1058,111 @@ public class ChatPreferences {
|
||||
loginChatCategory = new ChatCategory(2); // TODO: Set this default at another place
|
||||
}
|
||||
|
||||
double antennaBeamWidthDeg = Double.parseDouble(element.getElementsByTagName("stn_antennaBeamWidthDeg").item(0).getTextContent());
|
||||
stn_antennaBeamWidthDeg = antennaBeamWidthDeg;
|
||||
double maxQRBDefault = Double.parseDouble(element.getElementsByTagName("stn_maxQRBDefault").item(0).getTextContent());
|
||||
stn_maxQRBDefault = maxQRBDefault;
|
||||
double qtfDefault = Double.parseDouble(element.getElementsByTagName("stn_qtfDefault").item(0).getTextContent());
|
||||
stn_qtfDefault = qtfDefault;
|
||||
|
||||
try {
|
||||
|
||||
String stnUses144 = element
|
||||
.getElementsByTagName("stn_bandActive144").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (stnUses144.equals("true")) {
|
||||
|
||||
stn_bandActive144 = true;
|
||||
} else {
|
||||
stn_bandActive144 = false;
|
||||
}
|
||||
|
||||
String stnUses432 = element
|
||||
.getElementsByTagName("stn_bandActive432").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (stnUses432.equals("true")) {
|
||||
|
||||
stn_bandActive432 = true;
|
||||
} else {
|
||||
stn_bandActive432 = false;
|
||||
}
|
||||
|
||||
String stnUses1240 = element
|
||||
.getElementsByTagName("stn_bandActive1240").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (stnUses1240.equals("true")) {
|
||||
|
||||
stn_bandActive1240 = true;
|
||||
} else {
|
||||
stn_bandActive1240 = false;
|
||||
}
|
||||
|
||||
String stnUses2300 = element
|
||||
.getElementsByTagName("stn_bandActive2300").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (stnUses2300.equals("true")) {
|
||||
|
||||
stn_bandActive2300 = true;
|
||||
} else {
|
||||
stn_bandActive2300 = false;
|
||||
}
|
||||
|
||||
String stnUses3400 = element
|
||||
.getElementsByTagName("stn_bandActive3400").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (stnUses3400.equals("true")) {
|
||||
|
||||
stn_bandActive3400 = true;
|
||||
} else {
|
||||
stn_bandActive3400 = false;
|
||||
}
|
||||
|
||||
String stnUses5600 = element
|
||||
.getElementsByTagName("stn_bandActive5600").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (stnUses5600.equals("true")) {
|
||||
|
||||
stn_bandActive5600 = true;
|
||||
} else {
|
||||
stn_bandActive5600 = false;
|
||||
}
|
||||
|
||||
String stnUses10G = element
|
||||
.getElementsByTagName("stn_bandActive10G").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (stnUses10G.equals("true")) {
|
||||
|
||||
stn_bandActive10G = true;
|
||||
} else {
|
||||
stn_bandActive10G = false;
|
||||
}
|
||||
|
||||
} catch (NullPointerException tooOldConfigFileOrFormatError) {
|
||||
/**
|
||||
* In program version 1 there had not been these settings in the xml and not founding em
|
||||
* would cause an exception and dumb values for the preferences. So we have to initialize
|
||||
* these variables and later write a proper configfile which can be used correctly then.
|
||||
*/
|
||||
stn_bandActive144 = true;
|
||||
stn_bandActive432 = true;
|
||||
stn_bandActive1240 = true;
|
||||
stn_bandActive2300 = true;
|
||||
stn_bandActive3400 = true;
|
||||
stn_bandActive5600 = true;
|
||||
stn_bandActive10G = true;
|
||||
}
|
||||
|
||||
|
||||
System.out.println("[ChatPreferences, info]: Current Element: " + node.getNodeName()
|
||||
+ " --> call: " + call + " / " + password + " / " + loginDisplayedName + " / " + qra
|
||||
+ " / " + category);
|
||||
+ " / " + category + " / " + antennaBeamWidthDeg + " / " + maxQRBDefault + " / " + qtfDefault + " qrv144: " + stn_bandActive144);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -905,6 +1281,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
|
||||
*/
|
||||
@@ -1123,6 +1549,105 @@ public class ChatPreferences {
|
||||
+ unwkd_unworkedStnRequesterBeaconsText);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************
|
||||
*
|
||||
* case read GUI options
|
||||
*
|
||||
***********************************************/
|
||||
list = doc.getElementsByTagName("guiOptions");
|
||||
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;
|
||||
|
||||
try{
|
||||
|
||||
String GUIscn_ChatwindowMainSceneSizeHW = element.getElementsByTagName("GUIscn_ChatwindowMainSceneSizeHW").item(0)
|
||||
.getTextContent();
|
||||
|
||||
for (int i = 0; i < (GUIscn_ChatwindowMainSceneSizeHW.split(";").length); i++) {
|
||||
this.getGUIscn_ChatwindowMainSceneSizeHW()[i] =
|
||||
Double.parseDouble(GUIscn_ChatwindowMainSceneSizeHW.split(";")[i]);
|
||||
}
|
||||
|
||||
System.out.println(
|
||||
"[ChatPreferences, info]: Set the GUIscn_ChatwindowMainSceneSizeHW size to " + GUIclusterAndQSOMonStage_SceneSizeHW);
|
||||
|
||||
|
||||
String GUIclusterAndQSOMonStage_SceneSizeHW = element.getElementsByTagName("GUIclusterAndQSOMonStage_SceneSizeHW").item(0)
|
||||
.getTextContent();
|
||||
|
||||
for (int i = 0; i < (GUIclusterAndQSOMonStage_SceneSizeHW.split(";").length); i++) {
|
||||
this.getGUIclusterAndQSOMonStage_SceneSizeHW()[i] =
|
||||
Double.parseDouble(GUIclusterAndQSOMonStage_SceneSizeHW.split(";")[i]);
|
||||
}
|
||||
|
||||
String GUIselectedCallSignSplitPane_dividerposition = element.getElementsByTagName("GUIselectedCallSignSplitPane_dividerposition").item(0)
|
||||
.getTextContent();
|
||||
this.setGUIselectedCallSignSplitPane_dividerposition(csvStringToDoubleArray(GUIselectedCallSignSplitPane_dividerposition));
|
||||
|
||||
String GUImainWindowLeftSplitPane_dividerposition = element.getElementsByTagName("GUImainWindowLeftSplitPane_dividerposition").item(0)
|
||||
.getTextContent();
|
||||
this.setGUImainWindowLeftSplitPane_dividerposition(csvStringToDoubleArray(GUImainWindowLeftSplitPane_dividerposition));
|
||||
|
||||
String GUImessageSectionSplitpane_dividerposition = element.getElementsByTagName("GUImessageSectionSplitpane_dividerposition").item(0)
|
||||
.getTextContent();
|
||||
this.setGUImessageSectionSplitpane_dividerposition(csvStringToDoubleArray(GUImessageSectionSplitpane_dividerposition));
|
||||
|
||||
String GUImainWindowRightSplitPane_dividerposition = element.getElementsByTagName("GUImainWindowRightSplitPane_dividerposition").item(0)
|
||||
.getTextContent();
|
||||
this.setGUImainWindowRightSplitPane_dividerposition(csvStringToDoubleArray(GUImainWindowRightSplitPane_dividerposition));
|
||||
|
||||
String GUIpnl_directedMSGWin_dividerpositionDefault = element.getElementsByTagName("GUIpnl_directedMSGWin_dividerpositionDefault").item(0)
|
||||
.getTextContent();
|
||||
this.setGUIpnl_directedMSGWin_dividerpositionDefault(csvStringToDoubleArray(GUIpnl_directedMSGWin_dividerpositionDefault));
|
||||
|
||||
|
||||
|
||||
|
||||
// System.out.println(
|
||||
// "[ChatPreferences, info]: Set the GUIclusterAndQSOMonStage_SceneSizeHW size to " + GUIclusterAndQSOMonStage_SceneSizeHW);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
catch (NullPointerException tooOldConfigFileOrFormatError) {
|
||||
/**
|
||||
* In program version 1.2 there had not been these settings in the xml and not founding em
|
||||
* would cause an exception and dumb values for the preferences. So we have to initialize
|
||||
* these variables and later write a proper configfile which can be used correctly then.
|
||||
*
|
||||
* So THESE ARE DEFULTS
|
||||
*/
|
||||
|
||||
tooOldConfigFileOrFormatError.printStackTrace();
|
||||
GUIscn_ChatwindowMainSceneSizeHW = new double[] {768, 1234};
|
||||
GUIclusterAndQSOMonStage_SceneSizeHW = new double[] {700, 500};
|
||||
GUIstage_updateStage_SceneSizeHW = new double[] {640, 480};
|
||||
GUIsettingsStageSceneSizeHW = new double[] {720, 768};
|
||||
|
||||
GUIselectedCallSignSplitPane_dividerposition = new double[]{0.9};
|
||||
setGUImainWindowLeftSplitPane_dividerposition(new double[]{0.7});
|
||||
GUImessageSectionSplitpane_dividerposition = new double[]{0.5};
|
||||
GUImainWindowRightSplitPane_dividerposition = new double[]{0.8};
|
||||
GUIpnl_directedMSGWin_dividerpositionDefault = new double[]{0.8};
|
||||
// GUImainWindowLeftSplitPane_dividerposition
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.getCause());
|
||||
@@ -1133,6 +1658,96 @@ public class ChatPreferences {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return double array with separated values for each doublevalue, seperated by ";", empty array if none
|
||||
*/
|
||||
private double [] csvStringToDoubleArray(String csvStringWithDoubles){
|
||||
|
||||
String separator = ";";
|
||||
double[] result = new double[csvStringWithDoubles.split(separator).length];
|
||||
|
||||
for (int i = 0; i < (csvStringWithDoubles.split(separator).length); i++) {
|
||||
result[i] =
|
||||
Double.parseDouble(csvStringWithDoubles.split(separator)[i]);
|
||||
// System.out.println("EXTRACTED " + result[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private String doubleArrayToCSVString(double[] doubleArrayToCSVConvert){
|
||||
|
||||
String separator = ";";
|
||||
String result = "";
|
||||
|
||||
for (int i = 0; i < (doubleArrayToCSVConvert.length); i++) {
|
||||
result += doubleArrayToCSVConvert[i];
|
||||
|
||||
if (i+1<doubleArrayToCSVConvert.length) {
|
||||
result += separator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean isStn_bandActive144() {
|
||||
return stn_bandActive144;
|
||||
}
|
||||
|
||||
public void setStn_bandActive144(boolean stn_bandActive144) {
|
||||
this.stn_bandActive144 = stn_bandActive144;
|
||||
}
|
||||
|
||||
public boolean isStn_bandActive432() {
|
||||
return stn_bandActive432;
|
||||
}
|
||||
|
||||
public void setStn_bandActive432(boolean stn_bandActive432) {
|
||||
this.stn_bandActive432 = stn_bandActive432;
|
||||
}
|
||||
|
||||
public boolean isStn_bandActive1240() {
|
||||
return stn_bandActive1240;
|
||||
}
|
||||
|
||||
public void setStn_bandActive1240(boolean stn_bandActive1240) {
|
||||
this.stn_bandActive1240 = stn_bandActive1240;
|
||||
}
|
||||
|
||||
public boolean isStn_bandActive2300() {
|
||||
return stn_bandActive2300;
|
||||
}
|
||||
|
||||
public void setStn_bandActive2300(boolean stn_bandActive2300) {
|
||||
this.stn_bandActive2300 = stn_bandActive2300;
|
||||
}
|
||||
|
||||
public boolean isStn_bandActive3400() {
|
||||
return stn_bandActive3400;
|
||||
}
|
||||
|
||||
public void setStn_bandActive3400(boolean stn_bandActive3400) {
|
||||
this.stn_bandActive3400 = stn_bandActive3400;
|
||||
}
|
||||
|
||||
public boolean isStn_bandActive5600() {
|
||||
return stn_bandActive5600;
|
||||
}
|
||||
|
||||
public void setStn_bandActive5600(boolean stn_bandActive5600) {
|
||||
this.stn_bandActive5600 = stn_bandActive5600;
|
||||
}
|
||||
|
||||
public boolean isStn_bandActive10G() {
|
||||
return stn_bandActive10G;
|
||||
}
|
||||
|
||||
public void setStn_bandActive10G(boolean stn_bandActive10G) {
|
||||
this.stn_bandActive10G = stn_bandActive10G;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
87
src/main/java/kst4contest/model/UpdateInformation.java
Normal file
87
src/main/java/kst4contest/model/UpdateInformation.java
Normal file
@@ -0,0 +1,87 @@
|
||||
package kst4contest.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class UpdateInformation {
|
||||
double latestVersionNumberOnServer = 100; //dummy value to prevent nullpointerexc
|
||||
String adminMessage ="";
|
||||
String majorChanges ="";
|
||||
String latestVersionPathOnWebserver="";
|
||||
ArrayList<String> needUpdateResourcesSinceLastVersion = new ArrayList<String>();
|
||||
ArrayList<String[]> featureRequest = new ArrayList<String[]>();
|
||||
ArrayList<String[]> bugRequests = new ArrayList<String[]>();
|
||||
ArrayList<String[]> changeLog = new ArrayList<String[]>();
|
||||
ArrayList<String[]> bugList = new ArrayList<String[]>();
|
||||
|
||||
public ArrayList<String[]> getBugList() {
|
||||
return bugList;
|
||||
}
|
||||
|
||||
public void setBugList(ArrayList<String[]> bugList) {
|
||||
this.bugList = bugList;
|
||||
}
|
||||
|
||||
public ArrayList<String[]> getChangeLog() {
|
||||
return changeLog;
|
||||
}
|
||||
|
||||
public void setChangeLog(ArrayList<String[]> changeLog) {
|
||||
this.changeLog = changeLog;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
484
src/main/java/kst4contest/utils/PlayAudioUtils.java
Normal file
484
src/main/java/kst4contest/utils/PlayAudioUtils.java
Normal file
@@ -0,0 +1,484 @@
|
||||
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, "/tick.mp3", "tick.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 '-': tick<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, "/tick.mp3")).toURI().toString()));
|
||||
break;
|
||||
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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
19
src/main/java/kst4contest/utils/TestAudioPlayerUtils.java
Normal file
19
src/main/java/kst4contest/utils/TestAudioPlayerUtils.java
Normal 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
10
src/main/java/module-info.java
Normal file
10
src/main/java/module-info.java
Normal 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;
|
||||
}
|
||||
BIN
src/main/resources/LTTR0.mp3
Normal file
BIN
src/main/resources/LTTR0.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR1.mp3
Normal file
BIN
src/main/resources/LTTR1.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR2.mp3
Normal file
BIN
src/main/resources/LTTR2.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR3.mp3
Normal file
BIN
src/main/resources/LTTR3.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR4.mp3
Normal file
BIN
src/main/resources/LTTR4.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR5.mp3
Normal file
BIN
src/main/resources/LTTR5.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR6.mp3
Normal file
BIN
src/main/resources/LTTR6.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR7.mp3
Normal file
BIN
src/main/resources/LTTR7.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR8.mp3
Normal file
BIN
src/main/resources/LTTR8.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR9.mp3
Normal file
BIN
src/main/resources/LTTR9.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRA.mp3
Normal file
BIN
src/main/resources/LTTRA.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRB.mp3
Normal file
BIN
src/main/resources/LTTRB.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRC.mp3
Normal file
BIN
src/main/resources/LTTRC.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRD.mp3
Normal file
BIN
src/main/resources/LTTRD.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRE.mp3
Normal file
BIN
src/main/resources/LTTRE.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRF.mp3
Normal file
BIN
src/main/resources/LTTRF.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRG.mp3
Normal file
BIN
src/main/resources/LTTRG.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRH.mp3
Normal file
BIN
src/main/resources/LTTRH.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRI.mp3
Normal file
BIN
src/main/resources/LTTRI.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRJ.mp3
Normal file
BIN
src/main/resources/LTTRJ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRK.mp3
Normal file
BIN
src/main/resources/LTTRK.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRL.mp3
Normal file
BIN
src/main/resources/LTTRL.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRM.mp3
Normal file
BIN
src/main/resources/LTTRM.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRMINUS.mp3
Normal file
BIN
src/main/resources/LTTRMINUS.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRN.mp3
Normal file
BIN
src/main/resources/LTTRN.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRO.mp3
Normal file
BIN
src/main/resources/LTTRO.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRP.mp3
Normal file
BIN
src/main/resources/LTTRP.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRPOINT.mp3
Normal file
BIN
src/main/resources/LTTRPOINT.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRQ.mp3
Normal file
BIN
src/main/resources/LTTRQ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRQUESTMARK.mp3
Normal file
BIN
src/main/resources/LTTRQUESTMARK.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRR.mp3
Normal file
BIN
src/main/resources/LTTRR.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRS.mp3
Normal file
BIN
src/main/resources/LTTRS.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRSPACE.mp3
Normal file
BIN
src/main/resources/LTTRSPACE.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRSTROKE.mp3
Normal file
BIN
src/main/resources/LTTRSTROKE.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRT.mp3
Normal file
BIN
src/main/resources/LTTRT.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRU.mp3
Normal file
BIN
src/main/resources/LTTRU.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRV.mp3
Normal file
BIN
src/main/resources/LTTRV.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRW.mp3
Normal file
BIN
src/main/resources/LTTRW.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRX.mp3
Normal file
BIN
src/main/resources/LTTRX.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRY.mp3
Normal file
BIN
src/main/resources/LTTRY.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRZ.mp3
Normal file
BIN
src/main/resources/LTTRZ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISECQWINDOW.mp3
Normal file
BIN
src/main/resources/NOISECQWINDOW.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISEERROR.mp3
Normal file
BIN
src/main/resources/NOISEERROR.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISENOTIFY.mp3
Normal file
BIN
src/main/resources/NOISENOTIFY.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISEPMWINDOW.mp3
Normal file
BIN
src/main/resources/NOISEPMWINDOW.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISESTARTUP.mp3
Normal file
BIN
src/main/resources/NOISESTARTUP.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE0.mp3
Normal file
BIN
src/main/resources/VOICE0.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE1.mp3
Normal file
BIN
src/main/resources/VOICE1.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE2.mp3
Normal file
BIN
src/main/resources/VOICE2.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE3.mp3
Normal file
BIN
src/main/resources/VOICE3.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE4.mp3
Normal file
BIN
src/main/resources/VOICE4.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE5.mp3
Normal file
BIN
src/main/resources/VOICE5.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE6.mp3
Normal file
BIN
src/main/resources/VOICE6.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE7.mp3
Normal file
BIN
src/main/resources/VOICE7.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE73.mp3
Normal file
BIN
src/main/resources/VOICE73.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE8.mp3
Normal file
BIN
src/main/resources/VOICE8.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE9.mp3
Normal file
BIN
src/main/resources/VOICE9.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEA.mp3
Normal file
BIN
src/main/resources/VOICEA.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEB.mp3
Normal file
BIN
src/main/resources/VOICEB.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEBELL.mp3
Normal file
BIN
src/main/resources/VOICEBELL.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEC.mp3
Normal file
BIN
src/main/resources/VOICEC.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICED.mp3
Normal file
BIN
src/main/resources/VOICED.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEE.mp3
Normal file
BIN
src/main/resources/VOICEE.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEF.mp3
Normal file
BIN
src/main/resources/VOICEF.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEG.mp3
Normal file
BIN
src/main/resources/VOICEG.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEH.mp3
Normal file
BIN
src/main/resources/VOICEH.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEHELLO.mp3
Normal file
BIN
src/main/resources/VOICEHELLO.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEI.mp3
Normal file
BIN
src/main/resources/VOICEI.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEJ.mp3
Normal file
BIN
src/main/resources/VOICEJ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEK.mp3
Normal file
BIN
src/main/resources/VOICEK.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEL.mp3
Normal file
BIN
src/main/resources/VOICEL.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEM.mp3
Normal file
BIN
src/main/resources/VOICEM.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEMEEPMEEP.mp3
Normal file
BIN
src/main/resources/VOICEMEEPMEEP.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEN.mp3
Normal file
BIN
src/main/resources/VOICEN.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEO.mp3
Normal file
BIN
src/main/resources/VOICEO.mp3
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user