");
out.newLine();
out.write("Frequency | Event Date/Time/Zone | S/N |
");
out.newLine();
htmlCorrection = htmlCorrection.replaceAll("CH1:","" + intoKHZ1 + " kHz | ");
htmlCorrection = htmlCorrection.replaceAll("CH2:"," |
" + intoKHZ2 + " kHz | ");
htmlCorrection = htmlCorrection.replaceAll("CH3:"," |
" + intoKHZ3 + " kHz | ");
htmlCorrection = htmlCorrection.replaceAll("CH4:"," |
" + intoKHZ4 + " kHz | ");
htmlCorrection = htmlCorrection.replaceAll("CH5:"," |
" + intoKHZ5 + " kHz | ");
htmlCorrection = htmlCorrection.replaceAll("CH6:"," |
" + intoKHZ6 + " kHz | ");
htmlCorrection = htmlCorrection.replaceAll(",", " | ");
htmlCorrection = htmlCorrection.replaceAll(";", " dB |
"); //; is replaced with "dB"
out.write(htmlCorrection );
out.newLine();
out.write("
");
out.newLine();
out.write(" ");
out.newLine();
out.write("");
out.close();
}
catch (IOException e)
{
JOptionPane.showMessageDialog(null,"HTML file creation failed");
}
return ;
}
public static void itemsPropagationList() { //calculates the # of entries without the count of SD
//eventsTrackerPane2.setText("");
int numberOfLines = 0;
String htmlCorrection = "";
String[] hext_Str = new String [numberOfLines]; //reverse order of display - newest first
String arryToHTML = eventsTrackerPane2.getText(); //turn list into HTML
arryToHTML = arryToHTML.replaceAll("dB",";dB"); //dB is the delimiter and is removed ; stays
hext_Str = (arryToHTML.split("dB")); //split into arry using dB as delimiter
numberOfEntries.setText(Integer.toString(hext_Str.length -1));
//System.out.println("Lenght of array:" + hext_Str.length);
int i;
for (i =(hext_Str.length -1); i >= 0; i--) {
htmlCorrection = htmlCorrection + hext_Str[i]; //assembling the text piece by piece backwards
}
}
public static void saveUserParameters() {
try {
BufferedWriter out = new BufferedWriter(new FileWriter((System.getProperty("user.home"))+ "/MDSR_SA/SA_User.cfg"));
out.write (callSign.getText());
out.newLine();
out.write (gridSquare.getText());
out.newLine();
out.write (antenna.getText());
out.newLine();
out.write (elevation.getText());
out.newLine();
out.write (ftpServer.getText());
out.newLine();
out.write (ftpDirectory.getText());
out.newLine();
out.write (ftpUserName.getText());
out.newLine();
out.write (ftpPassWord.getText());
out.close();
}
catch (IOException e)
{
JOptionPane.showMessageDialog(null,"Can not find the user setup file.");
}
return ;
}
public static void loadUserParameters() {
try {
// checking for file size to prevent half images - part one Get size of current image
File file = new File(System.getProperty("user.home") + "/MDSR_SA/SA_User.cfg");
double bytesPre = file.length();
if (file.length() == 0) // checking if file is empty
{
JOptionPane.showMessageDialog(null,"User file empty or corrupt! "
+ "Restore from Backup! "
+ ""
+ System.getProperty("user.home") + "/MDSR_SA");
loadUserParametersBU();
}
else
{
FileReader fr = new FileReader (System.getProperty("user.home")+ "/MDSR_SA/SA_User.cfg");
BufferedReader textReader = new BufferedReader(fr);
int numberOfLines = 9;
String[] textData = new String [numberOfLines];
int i;
for (i=0; i < numberOfLines; i++) {
if (i == 1)
{
callSign.setText(textReader.readLine());
}
if (i == 2)
{
gridSquare.setText(textReader.readLine());
}
if (i == 3)
{
antenna.setText(textReader.readLine());
}
if (i == 4)
{
elevation.setText(textReader.readLine());
}
if (i == 5)
{
ftpServer.setText(textReader.readLine());
}
if (i == 6)
{
ftpDirectory.setText(textReader.readLine());
}
if (i == 7)
{
ftpUserName.setText(textReader.readLine());
}
if (i == 8)
{
ftpPassWord.setText(textReader.readLine());
}
}
} //end else
}
catch (IOException e)
{
JOptionPane.showMessageDialog(null,"No user file found! "
+ "Restore from Backup! "
+ ""
+ System.getProperty("user.home") + "/MDSR_SA");
loadUserParametersBU();
return ;
}
}
public static void loadUserParametersBU() {
try {
FileReader fr = new FileReader (System.getProperty("user.home")+ "/MDSR_SA/upLoad/SA_User.cfg");
BufferedReader textReader = new BufferedReader(fr);
int numberOfLines = 9;
String[] textData = new String [numberOfLines];
int i;
for (i=0; i < numberOfLines; i++) {
if (i == 1)
{
callSign.setText(textReader.readLine());
}
if (i == 2)
{
gridSquare.setText(textReader.readLine());
}
if (i == 3)
{
antenna.setText(textReader.readLine());
}
if (i == 4)
{
elevation.setText(textReader.readLine());
}
if (i == 5)
{
ftpServer.setText(textReader.readLine());
}
if (i == 6)
{
ftpDirectory.setText(textReader.readLine());
}
if (i == 7)
{
ftpUserName.setText(textReader.readLine());
}
if (i == 8)
{
ftpPassWord.setText(textReader.readLine());
}
}
}
catch (IOException e)
{
JOptionPane.showMessageDialog(null,"No user file found! "
+ "The MDSR SA will start with default setting! "
+ ""
+ System.getProperty("user.home") + "/MDSR_SA");
File dir = new File(System.getProperty("user.home") + "/MDSR_SA");
dir.mkdir();
return ;
}
}
public static void connectFldigiRead() {
preCAT_Frequency = CAT_Frequency;
preMDSR_status = MDSR_status;
// create configuration
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
try {
//Set the URL to point to the XmlRpcWebservice portal component
config.setServerURL(
new URL("http://localhost:12345"));
config.setEnabledForExtensions(true);
config.setConnectionTimeout(60 * 1000);
config.setReplyTimeout(60 * 1000);
} catch (MalformedURLException ex) {
Logger.getLogger(SA_Display.class.getName()).log(Level.SEVERE, null, ex);
}
XmlRpcClient client = new XmlRpcClient();
// use Commons HttpClient as transport
client.setTransportFactory(new XmlRpcCommonsTransportFactory(client));
// set configuration
client.setConfig(config);
// make the a regular call
Object[] params = new Object[3] ;
//Here the my_handler is the name of the handler that we registered in class XmlRpcWebservice and getQuoteofTheDay is the method from MyQuotes class.
String result;
try {
//result = (String)client.execute("rig.set_ptt" ,params); //updates the rig frequency
//System.out.println(result2);
result = ((client.execute("rig.get_info" ,params)).toString()); //queries multiple param
//result = (String)client.execute("rig.get_info", params); //queries multiple param
result = result.replaceAll("(\\r\\n|\\n|\\r)", ","); //make string csv delimided
flrigInfo = ( result.split(",")); //remove "retn" and split
String rigCurrentVFO = "";
if (flrigInfo[2].startsWith ("FB"))
rigCurrentVFO = ("VFO B");
else
rigCurrentVFO = ("VFO A");
flrigConnected.setText(flrigInfo[0] +" - "+ rigCurrentVFO);
//setTitle("Linux Spectrum Analyzer V 1.7 ("+ flrigInfo[0] +") - "+rigCurrentVFO+" by VE7DXW"); // update heading to rig
String flrigTX = flrigInfo[1]; //move data from array to varable
flrigTX = flrigTX.substring(2, flrigTX.length()); //clean up data
RigState.setText(flrigTX); //Display in GUI
String flrigFrequency = flrigInfo[2]; //move data from array to varable
flrigFrequency = flrigFrequency.substring(3, flrigFrequency.length()); //clean up data
CAT_Frequency = Integer.parseInt(flrigFrequency);
//ading a comma to make kHz
flrigFrequency = flrigFrequency.substring(0, flrigFrequency.length() - 3) + "." + flrigFrequency.substring((flrigFrequency.length() -3), flrigFrequency.length() );
RigFrequency.setText(flrigFrequency); //Display in GUI
String flrigMode = flrigInfo[3]; //move data from array to varable
flrigMode = flrigMode.substring(2, flrigMode.length()); //clean up data
RigMode.setText(flrigMode); //Display in GUI
String flrigLowpass = flrigInfo[4]; //move data from array to varable
flrigLowpass = flrigLowpass.substring(2, flrigLowpass.length()); //clean up data
filterpassLow.setText(flrigLowpass); //Display in GUI
String flrigHighpass = flrigInfo[5]; //move data from array to varable
flrigHighpass = flrigHighpass.substring(2, flrigHighpass.length()); //clean up data
filterpassHigh.setText(flrigHighpass); //Display in GUI
FFT_binLowpass = (int) (FFT_binBFO + (Integer.parseInt(filterpassLow.getText())) / FFT_step); //set low and highpass
FFT_binHighpass = (int) (FFT_binBFO + (Integer.parseInt(filterpassHigh.getText())) / FFT_step);//on spectral display
updateScrollingFrequency();
//RigFrequency.setText(Integer.toString(CAT_Frequency));
//System.out.println(flrigInfo[1]);
} catch (XmlRpcException ex) {
Logger.getLogger(SA_Display.class.getName()).log(Level.SEVERE, null, ex);
startFLRig();
}
}
public static void connectFldigiWrite() {
preCAT_Frequency = CAT_Frequency;
preMDSR_status = MDSR_status;
//System.out.println("test");
// create configuration
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
try {
//Set the URL to point to the XmlRpcWebservice portal component
config.setServerURL(new URL("http://localhost:12345"));
config.setEnabledForExceptions(true);
config.setEnabledForExtensions(true);
config.setConnectionTimeout(60 * 1000);
config.setReplyTimeout(60 * 1000);
} catch (MalformedURLException ex) {
System.out.println("URL does not exist");
}
XmlRpcClient client = new XmlRpcClient();
// use Commons HttpClient as transport
client.setTransportFactory(new XmlRpcCommonsTransportFactory(client));
// set configuration
client.setConfig(config);
// make the a regular call
Object[] paramsSet = new Object[] { (flrigSetFrequency)};
//String[] paramsSet = new String[7];
//paramsSet[0] = "1";
//Vector paramsSet = new Vector(8);
//paramsSet.addElement(new Integer(0)); // Data String for set requests
//ArrayList