mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-03-30 04:31:04 +02:00
changed way of db init
This commit is contained in:
@@ -620,7 +620,7 @@ public class ChatController {
|
|||||||
*/
|
*/
|
||||||
// Timer ASQueryTimer;
|
// Timer ASQueryTimer;
|
||||||
ASQueryTimer = new Timer();
|
ASQueryTimer = new Timer();
|
||||||
ASQueryTimer.schedule(new AirScoutPeriodicalAPReflectionInquirerTask(this), 10000, 5000);
|
ASQueryTimer.schedule(new AirScoutPeriodicalAPReflectionInquirerTask(this), 10000, 12000);
|
||||||
// 60000 * intervalInMinutes = IntervalInMillis
|
// 60000 * intervalInMinutes = IntervalInMillis
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import kst4contest.model.ClusterMessage;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This thread is responsible for processing rx and tx messages, synchronize tx
|
* This thread is responsible for processing received messages.
|
||||||
* and rx and saving the whole chat content in a textfile and write the text to
|
* It checks all messages from server for their functional contest, such as commands to build or change the userlist
|
||||||
* the stdio.
|
* or their settings, get clustermessages and sure the content of all chatmessages, which are delivered.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MessageBusManagementThread extends Thread {
|
public class MessageBusManagementThread extends Thread {
|
||||||
@@ -196,6 +196,7 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
* Builds UserList and gets meta informations out of the chat, as far as it is
|
* 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
|
* 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
|
* @param messageToProcess
|
||||||
*/
|
*/
|
||||||
private void processRXMessage23000(ChatMessage messageToProcess) {
|
private void processRXMessage23000(ChatMessage messageToProcess) {
|
||||||
@@ -362,7 +363,11 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
|
|
||||||
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember); //TODO: map -> List
|
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember); //TODO: map -> List
|
||||||
|
|
||||||
|
//the own call will not be in the list
|
||||||
|
if (!client.getChatPreferences().getLoginCallSign().equals(newMember.getCallSign())) {
|
||||||
this.client.getLst_chatMemberList().add(newMember);
|
this.client.getLst_chatMemberList().add(newMember);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.client.getDbHandler().storeChatMember(newMember);
|
this.client.getDbHandler().storeChatMember(newMember);
|
||||||
|
|
||||||
@@ -380,6 +385,12 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
if (splittedMessageLine[0].contains(USERENTEREDCHAT) || splittedMessageLine[0].contains(USERENTEREDCHAT2)) {
|
if (splittedMessageLine[0].contains(USERENTEREDCHAT) || splittedMessageLine[0].contains(USERENTEREDCHAT2)) {
|
||||||
// System.out.println("MSGBUS: User detected");
|
// System.out.println("MSGBUS: User detected");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The own callsign will not be hold in the userlist any more
|
||||||
|
*/
|
||||||
|
if (!client.getChatPreferences().getLoginCallSign().equals(splittedMessageLine[2])) {
|
||||||
|
|
||||||
|
|
||||||
ChatMember newMember = new ChatMember();
|
ChatMember newMember = new ChatMember();
|
||||||
|
|
||||||
newMember.setAirPlaneReflectInfo(new AirPlaneReflectionInfo());
|
newMember.setAirPlaneReflectInfo(new AirPlaneReflectionInfo());
|
||||||
@@ -392,8 +403,9 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
newMember = this.client.getDbHandler().fetchChatMemberWkdDataForOnlyOneCallsignFromDB(newMember);
|
newMember = this.client.getDbHandler().fetchChatMemberWkdDataForOnlyOneCallsignFromDB(newMember);
|
||||||
|
|
||||||
this.client.getLst_chatMemberList().add(newMember);
|
this.client.getLst_chatMemberList().add(newMember);
|
||||||
|
|
||||||
this.client.getDbHandler().storeChatMember(newMember);
|
this.client.getDbHandler().storeChatMember(newMember);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember);
|
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember);
|
||||||
|
|
||||||
@@ -459,25 +471,27 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
dummy.setCallSign("SERVER");
|
dummy.setCallSign("SERVER");
|
||||||
dummy.setName("Sysop");
|
dummy.setName("Sysop");
|
||||||
newMessage.setSender(dummy);
|
newMessage.setSender(dummy);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ChatMember temp = new ChatMember();
|
ChatMember sender = new ChatMember();
|
||||||
temp.setCallSign(splittedMessageLine[3]);
|
sender.setCallSign(splittedMessageLine[3]);
|
||||||
|
|
||||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), temp);
|
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), sender);
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
//user found in the chatmember list
|
||||||
newMessage.setSender(this.client.getLst_chatMemberList().get(index)); // set sender to member of
|
newMessage.setSender(this.client.getLst_chatMemberList().get(index)); // set sender to member of
|
||||||
// b4 init list
|
// b4 init list
|
||||||
} else {
|
} else {
|
||||||
|
//user not found in chatmember list
|
||||||
if (!temp.getCallSign().equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
if (!sender.getCallSign().equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||||
temp.setCallSign("[n/a]" + temp.getCallSign());
|
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 {
|
||||||
|
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]));
|
// newMessage.setSender(this.client.getChatMemberTable().get(splittedMessageLine[3]));
|
||||||
@@ -487,7 +501,7 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
newMessage.setMessageText(splittedMessageLine[6]);
|
newMessage.setMessageText(splittedMessageLine[6]);
|
||||||
|
|
||||||
if (splittedMessageLine[7].equals("0")) {
|
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();
|
ChatMember dummy = new ChatMember();
|
||||||
dummy.setCallSign("ALL");
|
dummy.setCallSign("ALL");
|
||||||
newMessage.setReceiver(dummy);
|
newMessage.setReceiver(dummy);
|
||||||
@@ -496,20 +510,35 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ChatMember temp2 = new ChatMember();
|
ChatMember receiver = new ChatMember();
|
||||||
temp2.setCallSign(splittedMessageLine[7]);
|
receiver.setCallSign(splittedMessageLine[7]);
|
||||||
|
|
||||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), temp2);
|
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), receiver);
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
newMessage.setReceiver(this.client.getLst_chatMemberList().get(index));// -1: Member left Chat
|
newMessage.setReceiver(this.client.getLst_chatMemberList().get(index));// -1: Member left Chat
|
||||||
// before...
|
// before...
|
||||||
} else {
|
} else {
|
||||||
temp2.setCallSign(temp2.getCallSign() + "(left)");
|
|
||||||
newMessage.setReceiver(temp2);
|
|
||||||
|
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()
|
if (newMessage.getReceiver().getCallSign()
|
||||||
.equals(this.client.getChatPreferences().getLoginCallSign())) {
|
.equals(this.client.getChatPreferences().getLoginCallSign())) {
|
||||||
@@ -518,8 +547,8 @@ public class MessageBusManagementThread extends Thread {
|
|||||||
|
|
||||||
System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + ".");
|
System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + ".");
|
||||||
|
|
||||||
} else if (newMessage.getSender().getCallSign().toUpperCase() // if you sent the message, it will be sorted in to
|
} else if (newMessage.getSender().getCallSign().toUpperCase() // if you sent the message to another station, it will be sorted in to
|
||||||
// the "to you message list"
|
// the "to me message list" with modified messagetext, added rxers callsign
|
||||||
.equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
.equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||||
String originalMessage = newMessage.getMessageText();
|
String originalMessage = newMessage.getMessageText();
|
||||||
newMessage
|
newMessage
|
||||||
|
|||||||
@@ -106,8 +106,9 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
|||||||
|
|
||||||
if (received.contains("ASSETPATH") || received.contains("ASWATCHLIST")) {
|
if (received.contains("ASSETPATH") || received.contains("ASWATCHLIST")) {
|
||||||
// do nothing, that is your own message
|
// do nothing, that is your own message
|
||||||
} else if (received.contains("ASNEAREST:")) {
|
} else if (received.contains("ASNEAREST:")) { //answer by airscout
|
||||||
processASUDPMessage(received);
|
processASUDPMessage(received);
|
||||||
|
|
||||||
// System.out.println("[ReadUSPASTh, info:] received AS String " + received);
|
// System.out.println("[ReadUSPASTh, info:] received AS String " + received);
|
||||||
|
|
||||||
AirPlaneReflectionInfo apReflectInfoForChatMember;
|
AirPlaneReflectionInfo apReflectInfoForChatMember;
|
||||||
|
|||||||
@@ -156,11 +156,11 @@ public class Kst4ContestApplication extends Application {
|
|||||||
SimpleStringProperty airPlaneInfo = new SimpleStringProperty();
|
SimpleStringProperty airPlaneInfo = new SimpleStringProperty();
|
||||||
|
|
||||||
if (cellDataFeatures.getValue().getAirPlaneReflectInfo().getRisingAirplanes() == null) {
|
if (cellDataFeatures.getValue().getAirPlaneReflectInfo().getRisingAirplanes() == null) {
|
||||||
airPlaneInfo.setValue(" ");
|
airPlaneInfo.setValue("nil");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cellDataFeatures.getValue().getAirPlaneReflectInfo().getRisingAirplanes().size() <= 0) {
|
else if (cellDataFeatures.getValue().getAirPlaneReflectInfo().getRisingAirplanes().size() <= 0) {
|
||||||
airPlaneInfo.setValue(" ");
|
airPlaneInfo.setValue("nil");
|
||||||
} else {
|
} else {
|
||||||
String apInfoText = ""
|
String apInfoText = ""
|
||||||
+ cellDataFeatures.getValue().getAirPlaneReflectInfo().getRisingAirplanes().get(0)
|
+ cellDataFeatures.getValue().getAirPlaneReflectInfo().getRisingAirplanes().get(0)
|
||||||
@@ -427,7 +427,7 @@ public class Kst4ContestApplication extends Application {
|
|||||||
* timer_chatMemberTableSortTimer -->
|
* timer_chatMemberTableSortTimer -->
|
||||||
* This part fixes a javafx bug. The update of the Chatmember fields is (for any
|
* This part fixes a javafx bug. The update of the Chatmember fields is (for any
|
||||||
* reason) not visible in the ui. Its neccessarry to sort the table in intervals
|
* reason) not visible in the ui. Its neccessarry to sort the table in intervals
|
||||||
* to keep the table up to date. Otherwise
|
* to keep the table up to date.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
timer_chatMemberTableSortTimer = new Timer();
|
timer_chatMemberTableSortTimer = new Timer();
|
||||||
@@ -834,58 +834,35 @@ public class Kst4ContestApplication extends Application {
|
|||||||
public ObservableValue<String> call(CellDataFeatures<ChatMessage, String> cellDataFeatures) {
|
public ObservableValue<String> call(CellDataFeatures<ChatMessage, String> cellDataFeatures) {
|
||||||
SimpleStringProperty airPlaneInfo = new SimpleStringProperty();
|
SimpleStringProperty airPlaneInfo = new SimpleStringProperty();
|
||||||
|
|
||||||
try {
|
if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes() == null) {
|
||||||
cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes();
|
airPlaneInfo.setValue("nil");
|
||||||
} catch (NullPointerException e) {
|
|
||||||
airPlaneInfo.setValue(" ");
|
|
||||||
isnull = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes() == null) {
|
else if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().size() <= 0) {
|
||||||
// airPlaneInfo.setValue(" ");
|
airPlaneInfo.setValue("nil");
|
||||||
// }
|
} else {
|
||||||
|
|
||||||
// else
|
|
||||||
try {
|
|
||||||
if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes()
|
|
||||||
.size() <= 0) {
|
|
||||||
airPlaneInfo.setValue(" ");}
|
|
||||||
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
airPlaneInfo.setValue(" ");
|
|
||||||
isnull = true;
|
|
||||||
}
|
|
||||||
// if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes()
|
|
||||||
// .size() <= 0) {
|
|
||||||
// airPlaneInfo.setValue(" ");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// else
|
|
||||||
if (!isnull) {
|
|
||||||
String apInfoText = ""
|
String apInfoText = ""
|
||||||
+ cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes()
|
+ cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(0)
|
||||||
.get(0).getArrivingDurationMinutes()
|
.getArrivingDurationMinutes()
|
||||||
+ " (" + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo()
|
+ " (" + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(0)
|
||||||
.getRisingAirplanes().get(0).getPotential()
|
.getPotential()
|
||||||
+ "%)";
|
+ "%)";
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes()
|
if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().size() > 1) {
|
||||||
.size() > 1) {
|
|
||||||
apInfoText += " / "
|
apInfoText += " / "
|
||||||
+ cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes()
|
+ cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(1)
|
||||||
.get(1).getArrivingDurationMinutes()
|
.getArrivingDurationMinutes()
|
||||||
+ " (" + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo()
|
+ " (" + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes()
|
||||||
.getRisingAirplanes().get(1).getPotential()
|
.get(1).getPotential()
|
||||||
+ "%)";
|
+ "%)";
|
||||||
}
|
}
|
||||||
|
|
||||||
airPlaneInfo.setValue(apInfoText);
|
airPlaneInfo.setValue(apInfoText);
|
||||||
} else {
|
|
||||||
airPlaneInfo.setValue(" "); //no planes rising
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return airPlaneInfo;
|
return airPlaneInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
@@ -1143,23 +1120,23 @@ public class Kst4ContestApplication extends Application {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
TableColumn<ChatMessage, String> nameCol = new TableColumn<ChatMessage, String>("Name");
|
// TableColumn<ChatMessage, String> nameCol = new TableColumn<ChatMessage, String>("Name");
|
||||||
nameCol.setCellValueFactory(new Callback<CellDataFeatures<ChatMessage, String>, ObservableValue<String>>() {
|
// nameCol.setCellValueFactory(new Callback<CellDataFeatures<ChatMessage, String>, ObservableValue<String>>() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public ObservableValue<String> call(CellDataFeatures<ChatMessage, String> cellDataFeatures) {
|
// public ObservableValue<String> call(CellDataFeatures<ChatMessage, String> cellDataFeatures) {
|
||||||
SimpleStringProperty name = new SimpleStringProperty();
|
// SimpleStringProperty name = new SimpleStringProperty();
|
||||||
|
//
|
||||||
if (cellDataFeatures.getValue().getSender() != null) {
|
// if (cellDataFeatures.getValue().getSender() != null) {
|
||||||
|
//
|
||||||
name.setValue(cellDataFeatures.getValue().getSender().getName());
|
// name.setValue(cellDataFeatures.getValue().getSender().getName());
|
||||||
} else {
|
// } else {
|
||||||
|
//
|
||||||
name.setValue("");// TODO: Prevents a bug of not setting all values as a default
|
// name.setValue("");// TODO: Prevents a bug of not setting all values as a default
|
||||||
}
|
// }
|
||||||
return name;
|
// return name;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
TableColumn<ChatMessage, String> qrgTXerCol = new TableColumn<ChatMessage, String>("Last QRG TX");
|
TableColumn<ChatMessage, String> qrgTXerCol = new TableColumn<ChatMessage, String>("Last QRG TX");
|
||||||
qrgTXerCol.setCellValueFactory(new Callback<CellDataFeatures<ChatMessage, String>, ObservableValue<String>>() {
|
qrgTXerCol.setCellValueFactory(new Callback<CellDataFeatures<ChatMessage, String>, ObservableValue<String>>() {
|
||||||
@@ -1254,7 +1231,7 @@ public class Kst4ContestApplication extends Application {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tbl_toOtherMSGTable.getColumns().addAll(timeCol, callSignTRCVCol, qrgTXerCol, workedTXCol, callSignRCVRCol,
|
tbl_toOtherMSGTable.getColumns().addAll(timeCol, callSignTRCVCol, qrgTXerCol, workedTXCol, callSignRCVRCol,
|
||||||
qrgRXerCol, workedRXCol, nameCol, msgCol);
|
qrgRXerCol, workedRXCol, msgCol);
|
||||||
|
|
||||||
ObservableList<ChatMessage> toOtherMSGList = chatcontroller.getLst_toOtherMessageList();
|
ObservableList<ChatMessage> toOtherMSGList = chatcontroller.getLst_toOtherMessageList();
|
||||||
tbl_toOtherMSGTable.setItems(toOtherMSGList);
|
tbl_toOtherMSGTable.setItems(toOtherMSGList);
|
||||||
|
|||||||
3
udpReaderBackup.txt
Normal file
3
udpReaderBackup.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
9A5R;Zeljko;JN95MM;StringProperty [value: null];true;true;false;false;false;false;false;false
|
||||||
|
DM5M;Marc;JN49FL;StringProperty [value: 144.243 ];true;true;false;false;false;false;false;false
|
||||||
Reference in New Issue
Block a user