rcpilot-cvs Mailing List for R/C Pilot Project (Page 2)
Status: Beta
Brought to you by:
mjpawlowsky
You can subscribe to this list here.
2004 |
Jan
|
Feb
(55) |
Mar
(175) |
Apr
(6) |
May
|
Jun
(24) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Michael P. <mjp...@us...> - 2004-04-06 12:47:48
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5395 Modified Files: Agwpe.java Log Message: Added checking for up to 4 repeaters. Trying to get confirmation of MAX REPEATERS from APRS Sig. Index: Agwpe.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/Agwpe.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Agwpe.java 5 Apr 2004 17:33:58 -0000 1.10 --- Agwpe.java 6 Apr 2004 12:34:59 -0000 1.11 *************** *** 326,329 **** --- 326,331 ---- System.out.println ("Rep1: " + frame.repeater_1); System.out.println ("Rep2: " + frame.repeater_2); + System.out.println ("Rep3: " + frame.repeater_3); + System.out.println ("Rep4: " + frame.repeater_4); System.out.println ("Control: " + frame.control); System.out.println ("PID : " + frame.PID); |
From: Michael P. <mjp...@us...> - 2004-04-06 12:47:02
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5241 Modified Files: TelemetryData.java Log Message: Added checking for up to 4 repeaters. Trying to get confirmation of MAX REPEATERS from APRS Sig. Index: TelemetryData.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/TelemetryData.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TelemetryData.java 9 Mar 2004 20:29:57 -0000 1.5 --- TelemetryData.java 6 Apr 2004 12:34:14 -0000 1.6 *************** *** 86,93 **** private double calcBearing(){ ! double lat1 = GPS.secToDeg(Global.homeLat); ! double lon1 = GPS.secToDeg(Global.homeLon); ! double lat2 = GPS.secToDeg(this.gps_latitude); ! double lon2 = GPS.secToDeg(this.gps_longitude); double d = GPS.geoBearing(lat1,lon1 , lat2, lon2); --- 86,93 ---- private double calcBearing(){ ! double lat2 = GPS.secToDeg(Global.homeLat); ! double lon2 = GPS.secToDeg(Global.homeLon); ! double lat1 = GPS.secToDeg(this.gps_latitude); ! double lon1 = GPS.secToDeg(this.gps_longitude); double d = GPS.geoBearing(lat1,lon1 , lat2, lon2); |
From: Michael P. <mjp...@us...> - 2004-04-06 12:46:47
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5133 Modified Files: DataAPRS.java Log Message: Added checking for up to 4 repeaters. Trying to get confirmation of MAX REPEATERS from APRS Sig. Index: DataAPRS.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/DataAPRS.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DataAPRS.java 5 Apr 2004 17:33:58 -0000 1.2 --- DataAPRS.java 6 Apr 2004 12:33:58 -0000 1.3 *************** *** 31,35 **** // Not sure what these bytes are yet. // Need to find out. ! bbinfo.position(22 ); --- 31,39 ---- // Not sure what these bytes are yet. // Need to find out. ! b = bbinfo.get(); ! if ((char)b != '/'){ ! System.err.println ("Unsupported APRS packet"); ! return(-1); ! } |
From: Michael P. <mjp...@us...> - 2004-04-06 12:46:23
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5056 Modified Files: AGWAX25.java Log Message: Added checking for up to 4 repeaters. Trying to get confirmation of MAX REPEATERS from APRS Sig. Index: AGWAX25.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/AGWAX25.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AGWAX25.java 12 Mar 2004 17:11:21 -0000 1.1 --- AGWAX25.java 6 Apr 2004 12:33:35 -0000 1.2 *************** *** 15,18 **** --- 15,20 ---- public String repeater_1; public String repeater_2; + public String repeater_3; + public String repeater_4; public byte control; public byte PID; *************** *** 27,30 **** --- 29,34 ---- public int decodeAX25(byte[] dat){ + int more = 1; + // Let's make sure we have the minimum size required if (dat.length < 17) return(-1); *************** *** 59,66 **** // Get the source field sb = new StringBuffer(); - int more = 0; for (int i = 0; i<6; i++){ b = bdat.get(); - more = (b & 0x01); t = (b & 0xff); t = t >> 1; --- 63,68 ---- *************** *** 68,71 **** --- 70,74 ---- } b = bdat.get(); + more = (b & 0x01); s = makeSSID(b); if (s != 0) { *************** *** 77,85 **** // If we have a repeater_1 ! if (more == 1){ sb = new StringBuffer(); for (int i = 0; i<6; i++){ b = bdat.get(); - more = (b & 0x01); t = (b & 0xff); t = t >> 1; --- 80,87 ---- // If we have a repeater_1 ! if (more == 0){ sb = new StringBuffer(); for (int i = 0; i<6; i++){ b = bdat.get(); t = (b & 0xff); t = t >> 1; *************** *** 87,90 **** --- 89,93 ---- } b = bdat.get(); + more = (b & 0x01); s = makeSSID(b); if (s != 0) { *************** *** 95,104 **** } ! // If we have a repeater_1 ! if (more == 1){ sb = new StringBuffer(); for (int i = 0; i<6; i++){ b = bdat.get(); - more = b & 0x01; t = (b & 0xff); t = t >> 1; --- 98,106 ---- } ! // If we have a repeater_2 ! if (more == 0){ sb = new StringBuffer(); for (int i = 0; i<6; i++){ b = bdat.get(); t = (b & 0xff); t = t >> 1; *************** *** 106,109 **** --- 108,112 ---- } b = bdat.get(); + more = b & 0x01; s = makeSSID(b); if (s != 0) { *************** *** 114,117 **** --- 117,159 ---- } + // If we have a repeater_3 + if (more == 0){ + sb = new StringBuffer(); + for (int i = 0; i<6; i++){ + b = bdat.get(); + t = (b & 0xff); + t = t >> 1; + sb.append((char)t); + } + b = bdat.get(); + more = b & 0x01; + s = makeSSID(b); + if (s != 0) { + sb.append('-'); + sb.append(Integer.toString(s)); + } + this.repeater_3 = sb.toString(); + } + + // If we have a repeater_4 + if (more == 0){ + sb = new StringBuffer(); + for (int i = 0; i<6; i++){ + b = bdat.get(); + t = (b & 0xff); + t = t >> 1; + sb.append((char)t); + } + b = bdat.get(); + more = b & 0x01; + s = makeSSID(b); + if (s != 0) { + sb.append('-'); + sb.append(Integer.toString(s)); + } + this.repeater_4 = sb.toString(); + } + + // Get the control byte |
From: Michael P. <mjp...@us...> - 2004-04-05 17:46:40
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6062 Modified Files: Agwpe.java DataAPRS.java GPS.java Tracker.java Log Message: Adding APRS Support Index: GPS.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/GPS.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GPS.java 10 Mar 2004 00:45:47 -0000 1.4 --- GPS.java 5 Apr 2004 17:33:58 -0000 1.5 *************** *** 160,165 **** i = (int)((deg * 360000) - (min * 6000)); } ! ! // Make sure values are in range if (l == LATITUDE && (i < -32400000 || i > 32400000 )) return(e); --- 160,164 ---- i = (int)((deg * 360000) - (min * 6000)); } ! // Make sure values are in range if (l == LATITUDE && (i < -32400000 || i > 32400000 )) return(e); Index: DataAPRS.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/DataAPRS.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DataAPRS.java 14 Mar 2004 19:51:44 -0000 1.1 --- DataAPRS.java 5 Apr 2004 17:33:58 -0000 1.2 *************** *** 2,12 **** import java.nio.ByteBuffer; ! abstract public class DataAPRS{ ! public static void parseData(byte[] info){ } --- 2,170 ---- import java.nio.ByteBuffer; + import java.text.DateFormat; + import java.text.SimpleDateFormat; + import java.text.ParseException; + import java.util.Date; + import java.lang.Double; ! abstract public class DataAPRS { ! public static int parseData(byte[] info){ ! ! byte b; ! int t; ! int i; ! Date new_date; ! ! // Setup for parsing the date and creating a timestamp out of it. ! DateFormat datePart = new SimpleDateFormat("yyyy-MM-dd"); ! DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); ! Date thisDate = new Date(); ! String date_only = datePart.format(thisDate); ! ! ! ByteBuffer bbinfo = ByteBuffer.wrap(info); ! ! // Skip over first 21 bytes to get to after the "/" ! // Not sure what these bytes are yet. ! // Need to find out. ! bbinfo.position(22 ); ! ! ! // Next 7 bytes are the time ! // Hour(2) Minute(2) Seconds(2) Format(1) ! StringBuffer hrs = new StringBuffer(); ! for (i = 0; i<2; i++){ ! b = bbinfo.get(); ! hrs.append((char)b); ! } ! ! // Minutes ! StringBuffer mins = new StringBuffer(); ! for (i = 0; i<2; i++){ ! b = bbinfo.get(); ! mins.append((char)b); ! } ! ! // Minutes ! StringBuffer secs = new StringBuffer(); ! for (i = 0; i<2; i++){ ! b = bbinfo.get(); ! secs.append((char)b); ! } ! ! String new_date_str = date_only + " " + hrs + ":" + mins + ":" + secs; ! ! try { ! new_date = dateFormat.parse(new_date_str); ! System.out.println ("APRS DATE: " + new_date); ! } catch (ParseException pe){ ! System.err.println ("Unable to parse date field.\n" + pe); ! return(-1); ! } ! ! // Skip the format ! bbinfo.position(bbinfo.position()+1); ! ! ! // GET THE LATITUDE ! StringBuffer lat = new StringBuffer(); ! for (i = 0; i<2; i++){ ! b = bbinfo.get(); ! lat.append((char)b); ! } ! ! lat.append(" "); ! // Get the minutes ! for (i = 0; i<5; i++){ ! b = bbinfo.get(); ! lat.append((char)b); ! } ! ! // stringToGPS expects precision to be to the .001 ! lat.append((char)'0'); ! ! // See if we are + or - (N or S) ! b = bbinfo.get(); ! if ((char)b == 'S'){ ! lat.insert(0, '-'); ! } ! ! int gps_int = GPS.stringToGPS(lat.toString(), GPS.LATITUDE); ! Rcgs.tdata.setGPSLatitude(gps_int); ! ! // Skip the "/" ! bbinfo.position(bbinfo.position()+1); ! ! // GET THE LONGITUDE ! ! StringBuffer lon = new StringBuffer(); ! // Get the degrees ! for (i = 0; i<3; i++){ ! b = bbinfo.get(); ! lon.append((char)b); ! } ! ! lon.append(" "); ! // Get the minutes ! for (i = 0; i<5; i++){ ! b = bbinfo.get(); ! lon.append((char)b); ! } ! ! // stringToGPS expects precision to be to the .001 ! lon.append((char)'0'); ! ! // See if we are + or - (W or E) ! b = bbinfo.get(); ! if ((char)b == 'W'){ ! lon.insert(0, '-'); ! } ! ! gps_int = GPS.stringToGPS(lon.toString(), GPS.LONGITUDE); ! Rcgs.tdata.setGPSLongitude(gps_int); + + // SKIP THE ICON + bbinfo.position(bbinfo.position()+1); + + + // GET THE COURSE + StringBuffer courseStr = new StringBuffer(); + for (i = 0; i<3; i++){ + b = bbinfo.get(); + courseStr.append((char)b); + } + Rcgs.tdata.setCourse(Double.parseDouble(courseStr.toString())); + + // SKIP THE "/" + bbinfo.position(bbinfo.position()+1); + + // GET THE SPEED + StringBuffer speedStr = new StringBuffer(); + for (i = 0; i<3; i++){ + b = bbinfo.get(); + speedStr.append((char)b); + } + Rcgs.tdata.setSpeed(Double.parseDouble(speedStr.toString())); + + // SKIP THE "/" + bbinfo.position(bbinfo.position()+1); + // GET THE ALTITUDE + b = bbinfo.get(); + if ((char)b == 'A'){ + // skip over the "="; + bbinfo.position(bbinfo.position()+1); + StringBuffer altStr = new StringBuffer(); + for (i = 0; i<6; i++){ + b = bbinfo.get(); + altStr.append((char)b); + } + Rcgs.tdata.setAltitude(Double.parseDouble(altStr.toString())); + } + + return(0); } Index: Tracker.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/Tracker.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Tracker.java 9 Mar 2004 20:31:02 -0000 1.7 --- Tracker.java 5 Apr 2004 17:33:58 -0000 1.8 *************** *** 71,75 **** RenderingHints.VALUE_ANTIALIAS_ON); ! // Don't ned this but keeing it around for later. ;-) // AffineTransform oldTrans = g2.getTransform(); // Save this xform --- 71,75 ---- RenderingHints.VALUE_ANTIALIAS_ON); ! // Don't need this but keeing it around for later. ;-) // AffineTransform oldTrans = g2.getTransform(); // Save this xform Index: Agwpe.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/Agwpe.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Agwpe.java 14 Mar 2004 19:49:56 -0000 1.9 --- Agwpe.java 5 Apr 2004 17:33:58 -0000 1.10 *************** *** 318,322 **** DataNMEA.parseData(frame.info); } else if (protocol.equals(UserPreferences.CONST_DATA_PROTOCOL_APRS)){ ! DataAPRS.parseData(frame.info); } --- 318,322 ---- DataNMEA.parseData(frame.info); } else if (protocol.equals(UserPreferences.CONST_DATA_PROTOCOL_APRS)){ ! DataAPRS.parseData(frame.info); } |
From: <ian...@us...> - 2004-03-15 09:05:59
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18030/rcpilot/rcgs Modified Files: UserPreferencesDialog.java UserPreferences.java TelemetryTable.java Log Message: TelemtryTable: * Refactored to allow us to specify which fields are displayed and in what order UserPreferences: * Added fields for Distance Alarm and Altitude Alarm * Added a Font Size selector Index: UserPreferencesDialog.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/UserPreferencesDialog.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** UserPreferencesDialog.java 14 Mar 2004 14:15:54 -0000 1.6 --- UserPreferencesDialog.java 15 Mar 2004 08:56:52 -0000 1.7 *************** *** 7,12 **** import javax.swing.*; import java.awt.Color; - import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; --- 7,14 ---- import javax.swing.*; + import javax.swing.event.ChangeEvent; + import javax.swing.event.ChangeListener; + import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; *************** *** 14,17 **** --- 16,20 ---- import java.awt.Component; import java.awt.Container; + import java.awt.FlowLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; *************** *** 72,81 **** addField(appearancePanel, "Video", fields.colorVideo); ! addField(appearancePanel, "Font", new JLabel("[ placeholder ]")); JPanel alarmsPanel = new JPanel(); ! addField(alarmsPanel, "Alarm", fields.alarmCB); ! addField(alarmsPanel, "Distance", fields.distanceTF); JPanel gpsPanel = new JPanel(); --- 75,85 ---- addField(appearancePanel, "Video", fields.colorVideo); ! addField(appearancePanel, "Font Size", fields.fontSizeCB); JPanel alarmsPanel = new JPanel(); ! addField(alarmsPanel, "Alarms Active", fields.alarmFields.isAllAlarmsActive); ! addField(alarmsPanel, "Distance", fields.alarmFields.distancePanel); ! addField(alarmsPanel, "Altitude", fields.alarmFields.altitudePanel); JPanel gpsPanel = new JPanel(); *************** *** 85,88 **** --- 89,93 ---- JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); buttonPanel.add(fields.saveButton); buttonPanel.add(fields.cancelButton); *************** *** 127,130 **** --- 132,136 ---- protected JComboBox dataProtocolCB; + protected JComboBox fontSizeCB; protected JComboBox dataTransportCB; *************** *** 132,137 **** protected JComboBox unitsCB; - protected JCheckBox alarmCB; - protected JTextField distanceTF; protected JTextField agwpePortTF; protected JTextField agwpeIpTF; --- 138,141 ---- *************** *** 147,151 **** protected ColorSetting colorForeground; protected ColorSetting colorWarning; ! protected ColorSetting colorVideo; protected JButton saveButton; --- 151,157 ---- protected ColorSetting colorForeground; protected ColorSetting colorWarning; ! protected ColorSetting colorVideo; ! ! protected AlarmFields alarmFields; protected JButton saveButton; *************** *** 156,163 **** this.parentDialog = parentDialog; ! alarmCB = new JCheckBox(); initComboBoxes(); - distanceTF = new JTextField(); remoteVehicleCallSign = new JTextField(); groundStationCallSign = new JTextField(); --- 162,168 ---- this.parentDialog = parentDialog; ! alarmFields = new AlarmFields(); initComboBoxes(); remoteVehicleCallSign = new JTextField(); groundStationCallSign = new JTextField(); *************** *** 176,180 **** agwpePortTF.setColumns(7); agwpeIpTF.setColumns(7); - distanceTF.setColumns(7); colorBackground = new ColorSetting(); --- 181,184 ---- *************** *** 193,198 **** setMaxSize(serialPortCB); setMaxSize(unitsCB); ! setMaxSize(alarmCB); ! setMaxSize(distanceTF); setMaxSize(agwpePortTF); setMaxSize(agwpeIpTF); --- 197,201 ---- setMaxSize(serialPortCB); setMaxSize(unitsCB); ! setMaxSize(fontSizeCB); setMaxSize(agwpePortTF); setMaxSize(agwpeIpTF); *************** *** 211,215 **** } ! private void setMaxSize(JComponent c) { c.setMaximumSize(c.getPreferredSize()); } --- 214,218 ---- } ! protected static void setMaxSize(JComponent c) { c.setMaximumSize(c.getPreferredSize()); } *************** *** 241,250 **** UserPreferences.CONST_UNIT_FORMAT_IMPERIAL }; ! dataProtocolCB = new JComboBox(protocols); dataTransportCB = new JComboBox(formats); serialPortCB = new JComboBox(serialConnectionPort); unitsCB = new JComboBox(units); ! } --- 244,259 ---- UserPreferences.CONST_UNIT_FORMAT_IMPERIAL }; ! String[] fontSizes = { ! UserPreferences.CONST_FONT_SIZE_SMALL, ! UserPreferences.CONST_FONT_SIZE_MEDIUM, ! UserPreferences.CONST_FONT_SIZE_LARGE ! }; ! ! dataProtocolCB = new JComboBox(protocols); dataTransportCB = new JComboBox(formats); serialPortCB = new JComboBox(serialConnectionPort); unitsCB = new JComboBox(units); ! fontSizeCB = new JComboBox(fontSizes); } *************** *** 252,256 **** // set booleans ! this.alarmCB.setSelected(UserPreferences.isAlarmActive()); // set strings --- 261,268 ---- // set booleans ! this.alarmFields.isAllAlarmsActive.setSelected(UserPreferences.isAllAlarmsActive()); ! this.alarmFields.isDistanceAlarmActive.setSelected(UserPreferences.isDistanceAlarmActive()); ! this.alarmFields.isAltitudeAlarmActive.setSelected(UserPreferences.isAltitudeAlarmActive()); ! // set strings *************** *** 259,267 **** this.serialPortCB.setSelectedItem(UserPreferences.getDataConnectionType()); this.unitsCB.setSelectedItem(UserPreferences.getUnitFormat()); this.gpsHomeLatitudeTF.setText(GPS.gpsToString(UserPreferences.getHomeLatitude())); this.gpsHomeLongitudeTF.setText(GPS.gpsToString(UserPreferences.getHomeLongitude())); this.remoteVehicleCallSign.setText(UserPreferences.getRemoteVehicleCallSign()); this.groundStationCallSign.setText(UserPreferences.getGroundStationCallSign()); ! this.distanceTF.setText(UserPreferences.getDistance()); this.agwpePortTF.setText(UserPreferences.getAgwpePort()); this.agwpeIpTF.setText(UserPreferences.getAgwpeIP()); --- 271,283 ---- this.serialPortCB.setSelectedItem(UserPreferences.getDataConnectionType()); this.unitsCB.setSelectedItem(UserPreferences.getUnitFormat()); + this.fontSizeCB.setSelectedItem(UserPreferences.getFontSize()); this.gpsHomeLatitudeTF.setText(GPS.gpsToString(UserPreferences.getHomeLatitude())); this.gpsHomeLongitudeTF.setText(GPS.gpsToString(UserPreferences.getHomeLongitude())); this.remoteVehicleCallSign.setText(UserPreferences.getRemoteVehicleCallSign()); this.groundStationCallSign.setText(UserPreferences.getGroundStationCallSign()); ! this.alarmFields.distanceTF.setText(UserPreferences.getAlarmDistance()); ! this.alarmFields.altitudeMaxTF.setText(UserPreferences.getAlarmAltitudeMax()); ! this.alarmFields.altitudeMinTF.setText(UserPreferences.getAlarmAltitudeMin()); ! this.agwpePortTF.setText(UserPreferences.getAgwpePort()); this.agwpeIpTF.setText(UserPreferences.getAgwpeIP()); *************** *** 278,286 **** int lat = GPS.stringToGPS(gpsHomeLatitudeTF.getText(), GPS.LATITUDE); int lon = GPS.stringToGPS(gpsHomeLongitudeTF.getText(),GPS.LONGITUDE); System.out.println ("lat: " + lat); System.out.println ("lon: " + lon); ! if (lat < -64800000 || lon < -64800000 ){ JOptionPane.showMessageDialog(null, "GPS Coordinates need to be in the format {-}DD MM.MMM", "Alert", JOptionPane.ERROR_MESSAGE); return(-1); --- 294,303 ---- int lat = GPS.stringToGPS(gpsHomeLatitudeTF.getText(), GPS.LATITUDE); int lon = GPS.stringToGPS(gpsHomeLongitudeTF.getText(),GPS.LONGITUDE); + boolean isGpsFieldBlank = (gpsHomeLatitudeTF.getText() + gpsHomeLongitudeTF.getText()).trim().length() == 0; System.out.println ("lat: " + lat); System.out.println ("lon: " + lon); ! if ((lat < -64800000 || lon < -64800000) && !isGpsFieldBlank){ JOptionPane.showMessageDialog(null, "GPS Coordinates need to be in the format {-}DD MM.MMM", "Alert", JOptionPane.ERROR_MESSAGE); return(-1); *************** *** 291,295 **** // get booleans ! UserPreferences.setAlarmActive(this.alarmCB.isSelected()); // get strings --- 308,314 ---- // get booleans ! UserPreferences.setAllAlarmsActive(this.alarmFields.isAllAlarmsActive.isSelected()); ! UserPreferences.setDistanceAlarmActive(this.alarmFields.isDistanceAlarmActive.isSelected()); ! UserPreferences.setAltitudeAlarmActive(this.alarmFields.isAltitudeAlarmActive.isSelected()); // get strings *************** *** 297,305 **** UserPreferences.setDataFormat((String)dataTransportCB.getSelectedItem()); UserPreferences.setDataConnectionType((String)serialPortCB.getSelectedItem()); ! UserPreferences.setUnitFormat((String)unitsCB.getSelectedItem()); UserPreferences.setRemoteVehicleCallSign(this.remoteVehicleCallSign.getText()); UserPreferences.setGroundStationCallSign(this.groundStationCallSign.getText()); ! UserPreferences.setDistance(this.distanceTF.getText()); UserPreferences.setAgwpeIP(this.agwpeIpTF.getText()); --- 316,328 ---- UserPreferences.setDataFormat((String)dataTransportCB.getSelectedItem()); UserPreferences.setDataConnectionType((String)serialPortCB.getSelectedItem()); ! UserPreferences.setUnitFormat((String)unitsCB.getSelectedItem()); ! UserPreferences.setFontSize((String)fontSizeCB.getSelectedItem()); UserPreferences.setRemoteVehicleCallSign(this.remoteVehicleCallSign.getText()); UserPreferences.setGroundStationCallSign(this.groundStationCallSign.getText()); ! ! UserPreferences.setAlarmDistance(this.alarmFields.distanceTF.getText()); ! UserPreferences.setAlarmAltitudeMax(this.alarmFields.altitudeMaxTF.getText()); ! UserPreferences.setAlarmAltitudeMin(this.alarmFields.altitudeMinTF.getText()); UserPreferences.setAgwpeIP(this.agwpeIpTF.getText()); *************** *** 580,582 **** --- 603,708 ---- } + class AlarmFields implements ChangeListener { + + public JCheckBox isAllAlarmsActive; + public JCheckBox isDistanceAlarmActive; + public JCheckBox isAltitudeAlarmActive; + + public JTextField distanceTF; + public JTextField altitudeMinTF; + public JTextField altitudeMaxTF; + + public JPanel distancePanel; + public JPanel altitudePanel; + + private JLabel fromLabel; + private JLabel toLabel; + private JLabel unitLabel; + private JLabel unitLabelForDistance; + + AlarmFields() { + + isAllAlarmsActive = new JCheckBox(); + isDistanceAlarmActive = new JCheckBox(); + isAltitudeAlarmActive = new JCheckBox(); + + isAllAlarmsActive.addChangeListener(this); + isDistanceAlarmActive.addChangeListener(this); + isAltitudeAlarmActive.addChangeListener(this); + + distanceTF = new JTextField(6); + altitudeMinTF = new JTextField(6); + altitudeMaxTF = new JTextField(6); + + String unit = " (" + UserPreferences.getUnitFormatAbbreviation() + ") "; + unitLabel = new JLabel(unit); + unitLabelForDistance = new JLabel(unit); + toLabel = new JLabel(" To "); + fromLabel = new JLabel(" From "); + + UserPreferencesDialogFields.setMaxSize(this.isAllAlarmsActive); + createJPanels(); + updateFieldVisibility(); + } + + private void createJPanels() { + + FlowLayout layoutA = new FlowLayout(); + FlowLayout layoutB = new FlowLayout(); + layoutA.setAlignment(FlowLayout.LEFT); + layoutB.setAlignment(FlowLayout.LEFT); + layoutA.setHgap(0); + layoutB.setHgap(0); + + distancePanel = new JPanel(); + distancePanel.setLayout(layoutA); + distancePanel.add(this.isDistanceAlarmActive); + distancePanel.add(this.distanceTF); + distancePanel.add(unitLabelForDistance); + + altitudePanel = new JPanel(); + altitudePanel.setLayout(layoutB); + altitudePanel.add(this.isAltitudeAlarmActive); + altitudePanel.add(fromLabel); + altitudePanel.add(this.altitudeMinTF); + altitudePanel.add(toLabel); + altitudePanel.add(this.altitudeMaxTF); + altitudePanel.add(unitLabel); + + UserPreferencesDialogFields.setMaxSize(altitudePanel); + UserPreferencesDialogFields.setMaxSize(distancePanel); + } + + public void stateChanged(ChangeEvent arg0) { + updateFieldVisibility(); + } + + private void updateFieldVisibility() { + if (!isAllAlarmsActive.isSelected()) { + isDistanceAlarmActive.setEnabled(false); + isAltitudeAlarmActive.setEnabled(false); + setDistanceAlarmEnabled(false); + setAltitudeAlarmEnabled(false); + } + else { + isDistanceAlarmActive.setEnabled(true); + isAltitudeAlarmActive.setEnabled(true); + setDistanceAlarmEnabled(isDistanceAlarmActive.isSelected()); + setAltitudeAlarmEnabled(isAltitudeAlarmActive.isSelected()); + } + } + + private void setDistanceAlarmEnabled(boolean enabled) { + distanceTF.setEnabled(enabled); + this.unitLabelForDistance.setEnabled(enabled); + } + private void setAltitudeAlarmEnabled(boolean enabled) { + altitudeMinTF.setEnabled(enabled); + altitudeMaxTF.setEnabled(enabled); + fromLabel.setEnabled(enabled); + toLabel.setEnabled(enabled); + unitLabel.setEnabled(enabled); + } + + } Index: UserPreferences.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/UserPreferences.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UserPreferences.java 14 Mar 2004 14:15:53 -0000 1.5 --- UserPreferences.java 15 Mar 2004 08:56:53 -0000 1.6 *************** *** 35,38 **** --- 35,39 ---- import java.awt.Color; + import java.util.StringTokenizer; import java.util.prefs.Preferences; *************** *** 52,62 **** private static final String KEY_GROUND_STATION_CALL_SIGN = "callsign.groundstation"; private static final String KEY_REMOTE_VEHICLE_CALL_SIGN = "callsign.remotevehicle"; - private static final String KEY_DISTANCE = "distance"; - private static final String KEY_IS_ALARM_ACTIVE = "isalarmactive"; private static final String KEY_DATA_FORMAT = "data.format"; private static final String KEY_DATA_CONNECTION_TYPE = "data.connection_type"; private static final String KEY_DATA_PROTOCOL = "data.protocol"; private static final String KEY_UNIT_FORMAT = "unit_format"; ! public static final String CONST_DATA_TRANSPORT_AGWPE = "AGWPE"; public static final String CONST_DATA_TRANSPORT_SERIAL = "Serial"; --- 53,71 ---- private static final String KEY_GROUND_STATION_CALL_SIGN = "callsign.groundstation"; private static final String KEY_REMOTE_VEHICLE_CALL_SIGN = "callsign.remotevehicle"; private static final String KEY_DATA_FORMAT = "data.format"; private static final String KEY_DATA_CONNECTION_TYPE = "data.connection_type"; private static final String KEY_DATA_PROTOCOL = "data.protocol"; private static final String KEY_UNIT_FORMAT = "unit_format"; ! private static final String KEY_TABLE_VIEW_FIELD_ORDER = "table.field_order"; ! private static final String KEY_FONT_SIZE = "font_size"; ! ! private static final String KEY_ALARM_DISTANCE = "alarm.distance"; ! private static final String KEY_ALARM_IS_DISTANCE_ACTIVE = "alarm.is_distance_alarm_active"; ! private static final String KEY_ALARM_IS_ALL_ACTIVE = "alarm.is_all_active"; ! private static final String KEY_ALARM_IS_ALTITUDE_ACTIVE = "alarm.is_altitude_active"; ! private static final String KEY_ALARM_ALTITUDE_MIN = "alarm.altitude_min"; ! private static final String KEY_ALARM_ALTITUDE_MAX = "alarm.altitude_max"; ! ! public static final String CONST_DATA_TRANSPORT_AGWPE = "AGWPE"; public static final String CONST_DATA_TRANSPORT_SERIAL = "Serial"; *************** *** 71,74 **** --- 80,88 ---- public static final String CONST_UNIT_FORMAT_NAUTICAL = "Nautical"; public static final String CONST_UNIT_FORMAT_IMPERIAL = "Imperial"; + + public static final String CONST_FONT_SIZE_SMALL = "Small"; + public static final String CONST_FONT_SIZE_MEDIUM = "Medium"; + public static final String CONST_FONT_SIZE_LARGE = "Large"; + private static Preferences prefs; *************** *** 80,83 **** --- 94,114 ---- private UserPreferences() {} + + public static String getUnitFormatAbbreviation() { + String format = UserPreferences.getUnitFormat(); + if (CONST_UNIT_FORMAT_METRIC.equals(format)) { + return "m"; + } + else if (CONST_UNIT_FORMAT_NAUTICAL.equals(format)) { + return "knots"; + } + else if (CONST_UNIT_FORMAT_IMPERIAL.equals(format)) { + return "ft"; + } + else { + return ""; + } + } + public static String getAgwpeIP(){ *************** *** 145,155 **** - public static String getDistance(){ - return get(KEY_DISTANCE); - } - public static void setDistance(String s){ - set(KEY_DISTANCE, s); - } - public static String getUnitFormat(){ return get(KEY_UNIT_FORMAT); --- 176,179 ---- *************** *** 173,186 **** } ! ! public static boolean isAlarmActive(){ ! return prefs.getBoolean(KEY_IS_ALARM_ACTIVE, true); } ! public static void setAlarmActive(boolean b){ ! prefs.putBoolean(KEY_IS_ALARM_ACTIVE, b); } public static float getTrackerZoom(){ return prefs.getFloat(KEY_TRACKER_ZOOM, 5); --- 197,262 ---- } + public static String getFontSize(){ + return get(KEY_FONT_SIZE); + } + public static void setFontSize(String s){ + set(KEY_FONT_SIZE, s); + } + ! ! public static boolean isAllAlarmsActive() { ! return prefs.getBoolean(KEY_ALARM_IS_ALL_ACTIVE, false); ! } ! public static void setAllAlarmsActive(boolean b) { ! prefs.putBoolean(KEY_ALARM_IS_ALL_ACTIVE, b); ! } ! ! public static boolean isDistanceAlarmActive() { ! return prefs.getBoolean(KEY_ALARM_IS_DISTANCE_ACTIVE, false); ! } ! public static void setDistanceAlarmActive(boolean b) { ! prefs.putBoolean(KEY_ALARM_IS_DISTANCE_ACTIVE, b); ! } ! ! public static boolean isAltitudeAlarmActive() { ! return prefs.getBoolean(KEY_ALARM_IS_ALTITUDE_ACTIVE, false); ! } ! public static void setAltitudeAlarmActive(boolean b) { ! prefs.putBoolean(KEY_ALARM_IS_ALTITUDE_ACTIVE, b); ! } ! ! public static String getAlarmDistance() { ! return get(KEY_ALARM_DISTANCE); ! } ! public static void setAlarmDistance(String s) { ! set(KEY_ALARM_DISTANCE, s); ! } ! ! public static String getAlarmAltitudeMin() { ! return get(KEY_ALARM_ALTITUDE_MIN); ! } ! public static void setAlarmAltitudeMin(String s) { ! set(KEY_ALARM_ALTITUDE_MIN, s); ! } ! ! public static String getAlarmAltitudeMax() { ! return get(KEY_ALARM_ALTITUDE_MAX); } ! public static void setAlarmAltitudeMax(String s) { ! set(KEY_ALARM_ALTITUDE_MAX, s); } + + public static void setTableViewFieldOrder(String[] values) { + set(KEY_TABLE_VIEW_FIELD_ORDER, values); + } + + public static String[] getTableViewFieldOrder() { + return getStringArray(KEY_TABLE_VIEW_FIELD_ORDER); + } + + public static float getTrackerZoom(){ return prefs.getFloat(KEY_TRACKER_ZOOM, 5); *************** *** 248,251 **** --- 324,353 ---- } + private static void set(String key, String[] values) { + String arrayAsString = ""; + if (values != null) { + for (int i=0; i < values.length; i++) { + String value = values[i]; + if (value != null) value.replace(',', ' '); // we use commas to separate values later, so remove them here + arrayAsString += value; + if (i != values.length-1) { + arrayAsString += ", "; + } + } + } + } + + private static String[] getStringArray(String key) { + String arrayAsString = prefs.get(key, ""); + StringTokenizer tokenizer = new StringTokenizer(arrayAsString, ","); + String[] array = new String[tokenizer.countTokens()]; + int i = 0; + while (tokenizer.hasMoreTokens()) { + array[i++] = tokenizer.nextToken(); + } + return array; + } + + /** * Saves changes that have been made since the last flush. Index: TelemetryTable.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/TelemetryTable.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TelemetryTable.java 9 Mar 2004 20:31:52 -0000 1.5 --- TelemetryTable.java 15 Mar 2004 08:56:53 -0000 1.6 *************** *** 34,38 **** import java.text.NumberFormat; import java.text.DecimalFormat; ! public class TelemetryTable extends JPanel implements TelemetryDataChangedEventListener{ --- 34,38 ---- import java.text.NumberFormat; import java.text.DecimalFormat; ! import java.util.ArrayList; public class TelemetryTable extends JPanel implements TelemetryDataChangedEventListener{ *************** *** 55,336 **** public JTextField cog; public JTextField sog; - - public TelemetryTable(TelemetryData tdata) { - Color fgcolor = UserPreferences.getForegroundColor(); - Color bgcolor = UserPreferences.getBackgroundColor(); - TelemetryDataChangedEventListener l = this; tdata.addTelemetryDataChangedListener(l); ! this.setBackground(UserPreferences.getVidColor()); ! this.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - - c.gridx = 0; - c.gridy = 0; - JLabel label = new JLabel("Latitude: " , JLabel.RIGHT); - label.setForeground(fgcolor); - this.add(label, c); - lat = new JTextField(6); - lat.setName("Latittude"); - lat.setEditable(false); - lat.setOpaque(true); - lat.setForeground(fgcolor); - lat.setBackground(bgcolor); - lat.setText("-"); - c.gridx = 1; - c.gridy = 0; - this.add(lat, c); - - c.gridx = 0; - c.gridy = 1; - label = new JLabel("Longitude: " , JLabel.RIGHT); - label.setForeground(fgcolor); - this.add(label, c); - lon = new JTextField(6); - lon.setEditable(false); - lon.setOpaque(true); - lon.setForeground(fgcolor); - lon.setBackground(bgcolor); - lon.setText("-"); - c.gridx = 1; - c.gridy = 1; - this.add(lon, c); - - c.gridx = 0; - c.gridy = 2; - label = new JLabel("Altitude: " , JLabel.RIGHT); - label.setForeground(fgcolor); - this.add(label, c); - alt = new JTextField(6); - alt.setEditable(false); - alt.setOpaque(true); - alt.setForeground(fgcolor); - alt.setBackground(bgcolor); - alt.setText("-"); - c.gridx = 1; - c.gridy = 2; - this.add(alt, c); ! c.gridx = 0; ! c.gridy = 3; ! label = new JLabel("Speed: " , JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! speed = new JTextField(6); ! speed.setEditable(false); ! speed.setOpaque(true); ! speed.setForeground(fgcolor); ! speed.setBackground(bgcolor); ! speed.setText("-"); ! c.gridx = 1; ! c.gridy = 3; ! this.add(speed,c); ! ! c.gridx = 0; ! c.gridy = 4; ! label = new JLabel("Course: " , JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! course = new JTextField(6); ! course.setEditable(false); ! course.setOpaque(true); ! course.setForeground(fgcolor); ! course.setBackground(bgcolor); ! course.setText("-"); ! c.gridx = 1; ! c.gridy = 4; ! this.add(course,c); ! ! c.gridx = 0; ! c.gridy = 5; ! label = new JLabel("SOG: " , JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! sog = new JTextField(6); ! sog.setEditable(false); ! sog.setOpaque(true); ! sog.setForeground(fgcolor); ! sog.setBackground(bgcolor); ! sog.setText("-"); ! c.gridx = 1; ! c.gridy = 5; ! this.add(sog,c); ! ! c.gridx = 0; ! c.gridy = 6; ! label = new JLabel("COG: ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! cog = new JTextField(6); ! cog.setEditable(false); ! cog.setOpaque(true); ! cog.setForeground(fgcolor); ! cog.setBackground(bgcolor); ! cog.setText("-"); ! c.gridx = 1; ! c.gridy = 6; ! this.add(cog,c); ! ! c.gridx = 0; ! c.gridy = 7; ! label = new JLabel("Bearing: ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! bearing = new JTextField(6); ! bearing.setEditable(false); ! bearing.setOpaque(true); ! bearing.setForeground(fgcolor); ! bearing.setBackground(bgcolor); ! bearing.setText("-"); ! c.gridx = 1; ! c.gridy = 7; ! this.add(bearing,c); ! ! c.gridx = 0; ! c.gridy = 8; ! label = new JLabel("Distance: ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! distance = new JTextField(6); ! distance.setEditable(false); ! distance.setOpaque(true); ! distance.setForeground(fgcolor); ! distance.setBackground(bgcolor); ! distance.setText("-"); ! c.gridx = 1; ! c.gridy = 8; ! this.add(distance,c); ! ! c.gridx = 0; ! c.gridy = 9; ! label = new JLabel("Temp.: ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! outemp = new JTextField(6); ! outemp.setEditable(false); ! outemp.setOpaque(true); ! outemp.setForeground(fgcolor); ! outemp.setBackground(bgcolor); ! outemp.setText("-"); ! c.gridx = 1; ! c.gridy = 9; ! this.add(outemp,c); ! ! c.gridx = 0; ! c.gridy = 10; ! label = new JLabel("Pressure: ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! barom = new JTextField(6); ! barom.setEditable(false); ! barom.setOpaque(true); ! barom.setForeground(fgcolor); ! barom.setBackground(bgcolor); ! barom.setText("-"); ! c.gridx = 1; ! c.gridy = 10; ! this.add(barom,c); ! ! c.gridx = 0; ! c.gridy = 11; ! label = new JLabel("RPM: ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! engrpm = new JTextField(6); ! engrpm.setEditable(false); ! engrpm.setOpaque(true); ! engrpm.setForeground(fgcolor); ! engrpm.setBackground(bgcolor); ! engrpm.setText("-"); ! c.gridx = 1; ! c.gridy = 11; ! this.add(engrpm,c); ! ! c.gridx = 0; ! c.gridy = 12; ! label = new JLabel("Eng. Temp.: ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! engtemp = new JTextField(6); ! engtemp.setEditable(false); ! engtemp.setOpaque(true); ! engtemp.setForeground(fgcolor); ! engtemp.setBackground(bgcolor); ! engtemp.setText("-"); ! c.gridx = 1; ! c.gridy = 12; ! this.add(engtemp,c); ! ! c.gridx = 0; ! c.gridy = 13; ! label = new JLabel("Voltage : ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! battV = new JTextField(6); ! battV.setEditable(false); ! battV.setOpaque(true); ! battV.setForeground(fgcolor); ! battV.setBackground(bgcolor); ! battV.setText("-"); ! c.gridx = 1; ! c.gridy = 13; ! this.add(battV,c); ! ! c.gridx = 0; ! c.gridy = 14; ! label = new JLabel("Fuel : ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! fuel = new JTextField(6); ! fuel.setEditable(false); ! fuel.setOpaque(true); ! fuel.setForeground(fgcolor); ! fuel.setBackground(bgcolor); ! fuel.setText("-"); ! c.gridx = 1; ! c.gridy = 14; ! this.add(fuel,c); ! ! c.gridx = 0; ! c.gridy = 15; ! label = new JLabel("Satelites : ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! gpssats = new JTextField(6); ! gpssats.setEditable(false); ! gpssats.setOpaque(true); ! gpssats.setForeground(fgcolor); ! gpssats.setBackground(bgcolor); ! gpssats.setText("-"); ! c.gridx = 1; ! c.gridy = 15; ! this.add(gpssats,c); ! ! c.gridx = 0; ! c.gridy = 16; ! label = new JLabel("RSSI : ", JLabel.RIGHT); ! label.setForeground(fgcolor); ! this.add(label, c); ! rssi = new JTextField(6); ! rssi.setEditable(false); ! rssi.setOpaque(true); ! rssi.setForeground(fgcolor); ! rssi.setBackground(bgcolor); ! rssi.setText("-"); ! rssi.setAlignmentX(JTextField.RIGHT_ALIGNMENT); ! c.gridx = 1; ! c.gridy = 16; ! this.add(rssi,c); this.setPreferredSize(new Dimension(150,600)); this.setVisible(true); } public void telemetryDataChanged(TelemetryDataChangedEvent ev) { --- 55,153 ---- public JTextField cog; public JTextField sog; + private GridBagConstraints c; + private int currentRow; + + private ArrayList textFields; + public TelemetryTable(TelemetryData tdata) { TelemetryDataChangedEventListener l = this; tdata.addTelemetryDataChangedListener(l); ! c = new GridBagConstraints(); this.setLayout(new GridBagLayout()); ! initFields(); ! layoutFields(null); this.setPreferredSize(new Dimension(150,600)); + this.setBackground(UserPreferences.getVidColor()); this.setVisible(true); } + /** Initializes text fields */ + + private void initFields() { + + textFields = new ArrayList(); + lat = buildJTextField("Latittude"); + lon = buildJTextField("Longitude"); + alt = buildJTextField("Altitude"); + speed = buildJTextField("Speed"); + course = buildJTextField("Course"); + sog = buildJTextField("SOG"); + cog = buildJTextField("COG"); + bearing = buildJTextField("Bearing"); + distance = buildJTextField("Distance"); + outemp = buildJTextField("Temp"); + barom = buildJTextField("Pressure"); + engrpm = buildJTextField("RPM"); + engtemp = buildJTextField("Eng. Temp."); + battV = buildJTextField("Voltage"); + fuel = buildJTextField("Fuel"); + gpssats = buildJTextField("Satelites"); + rssi = buildJTextField("RSSI"); + + rssi.setAlignmentX(JTextField.RIGHT_ALIGNMENT); + + } + + /** Lays out fields according to the UserPreferences, which + * determines which fields will be visible and in what + * order they're listed. If a null array is passed, all + * fields will be displayed. + */ + + private void layoutFields(String[] fields) { + this.removeAll(); + ArrayList fieldsToDisplay = new ArrayList(); + if (fields != null) fieldsToDisplay = new ArrayList(java.util.Arrays.asList(fields)); + for (int i=0; i < textFields.size(); i++) { + JComponent field = (JComponent) textFields.get(i); + String name = field.getName(); + if (fields == null || fieldsToDisplay.contains(name)) { + addToGridBag(field); + } + } + } + + private JTextField buildJTextField(String name) { + JTextField tf = new JTextField(6); + tf.setEditable(false); + tf.setOpaque(true); + tf.setName(name); + + tf.setForeground(UserPreferences.getForegroundColor()); + tf.setBackground(UserPreferences.getBackgroundColor()); + tf.setText("-"); + tf.setAlignmentX(JTextField.RIGHT_ALIGNMENT); + textFields.add(tf); + return tf; + } + private void addToGridBag(JComponent field) { + + JLabel label = new JLabel(field.getName(), JLabel.RIGHT); + label.setForeground(UserPreferences.getForegroundColor()); + + c.gridx = 0; + c.gridy = currentRow; + this.add(label,c); + c.gridx = 1; + this.add(field,c); + currentRow++; + } + public void telemetryDataChanged(TelemetryDataChangedEvent ev) { |
From: <mjp...@us...> - 2004-03-14 20:00:43
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4529 Added Files: DataAPRS.java DataAUAVTP.java DataNMEA.java Log Message: protocol handlers --- NEW FILE: DataAPRS.java --- package rcpilot.rcgs; import java.nio.ByteBuffer; abstract public class DataAPRS{ public static void parseData(byte[] info){ } } --- NEW FILE: DataAUAVTP.java --- package rcpilot.rcgs; import java.nio.ByteBuffer; abstract public class DataAUAVTP{ public static void parseData(byte[] info){ byte b; int t; int i; ByteBuffer bbinfo = ByteBuffer.wrap(info); while (bbinfo.hasRemaining()){ b = bbinfo.get(); t = (b & 0xff); switch (t) { case 1: short pitch = 0; pitch = bbinfo.getShort(); Rcgs.tdata.setPitch(pitch); break; case 2: short roll = 0; roll = bbinfo.getShort(); Rcgs.tdata.setRoll(roll); break; case 4: short speed = 0; speed = bbinfo.getShort(); Rcgs.tdata.setSpeed(speed);; break; case 5: short alt = 0; alt = bbinfo.getShort(); Rcgs.tdata.setAltitude(alt); break; case 6: short course = 0; course = bbinfo.getShort(); Rcgs.tdata.setCourse(course); break; case 16: short rpm = 0; rpm = bbinfo.getShort(); Rcgs.tdata.setEngineRPM(rpm); break; case 32: int lat = 0; lat = bbinfo.getInt(); Rcgs.tdata.setGPSLatitude(lat); break; case 33: int lon = 0; lon = bbinfo.getInt(); Rcgs.tdata.setGPSLongitude(lon); break; default: break; } } } } --- NEW FILE: DataNMEA.java --- package rcpilot.rcgs; import java.nio.ByteBuffer; abstract public class DataNMEA{ public static void parseData(byte[] info){ } } |
From: <mjp...@us...> - 2004-03-14 19:58:56
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4246 Modified Files: Agwpe.java Log Message: lookup protocol and send it to appropriate handler Index: Agwpe.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/Agwpe.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Agwpe.java 12 Mar 2004 17:10:16 -0000 1.8 --- Agwpe.java 14 Mar 2004 19:49:56 -0000 1.9 *************** *** 141,162 **** sendToMonitor(head); sendToMonitor(dat); ! ! switch(type) ! { ! case 'U': ! dout(10,"UNPROTO"); ! parseUnProto(dat); ! Rcgs.tdata.dataUpdated(); ! break; ! case 'K': ! dout(10,"RAW AX.25"); ! parseAX25(dat); ! Rcgs.tdata.dataUpdated(); ! break; ! default: ! dout(10,"unknown type="+type); ! break; } --- 141,166 ---- sendToMonitor(head); sendToMonitor(dat); ! ! // If the packet comes from our Remote Vehicle pass it to a handler ! if (cfs.equals(UserPreferences.getRemoteVehicleCallSign())){ ! ! switch(type) ! { ! case 'U': ! dout(10,"UNPROTO"); ! parseUnProto(dat); ! Rcgs.tdata.dataUpdated(); ! break; ! case 'K': ! dout(10,"RAW AX.25"); ! parseAX25(dat); ! Rcgs.tdata.dataUpdated(); ! break; ! default: ! dout(10,"unknown type="+type); ! break; ! } } *************** *** 191,195 **** public static void parseUnProto(byte[] dat){ ! int pos = 0; --- 195,203 ---- public static void parseUnProto(byte[] dat){ ! /* ! * ! * LEAVE THIS HERE TO SUPPORT TESTSERVER ! * ! */ int pos = 0; *************** *** 299,310 **** public static void parseAX25(byte[] dat){ ! ! byte b; ! int t; ! int i; ! AGWAX25 frame = new AGWAX25(); frame.decodeAX25(dat); System.out.println ("Port: " + frame.port); System.out.println ("Dest: " + frame.destination); --- 307,324 ---- public static void parseAX25(byte[] dat){ ! AGWAX25 frame = new AGWAX25(); frame.decodeAX25(dat); + String protocol = UserPreferences.getDataProtocol(); + + if (protocol.equals(UserPreferences.CONST_DATA_PROTOCOL_AUAVTP)){ + DataAUAVTP.parseData(frame.info); + } else if (protocol.equals(UserPreferences.CONST_DATA_PROTOCOL_NMEA0183)){ + DataNMEA.parseData(frame.info); + } else if (protocol.equals(UserPreferences.CONST_DATA_PROTOCOL_APRS)){ + DataAPRS.parseData(frame.info); + } + System.out.println ("Port: " + frame.port); System.out.println ("Dest: " + frame.destination); *************** *** 316,385 **** Functions.printhex(frame.info); - ByteBuffer info = ByteBuffer.wrap(dat); - - - while (info.hasRemaining()){ - b = info.get(); - t = (b & 0xff); - - switch (t) { - - - case 1: - short pitch = 0; - pitch = info.getShort(); - Rcgs.tdata.setPitch(pitch); - break; - - - case 2: - short roll = 0; - roll = info.getShort(); - Rcgs.tdata.setRoll(roll); - break; - - - case 4: - short speed = 0; - speed = info.getShort(); - Rcgs.tdata.setSpeed(speed);; - break; - - - case 5: - short alt = 0; - alt = info.getShort(); - Rcgs.tdata.setAltitude(alt); - break; - - case 6: - short course = 0; - course = info.getShort(); - Rcgs.tdata.setCourse(course); - break; - - case 16: - short rpm = 0; - rpm = info.getShort(); - Rcgs.tdata.setEngineRPM(rpm); - break; - - case 32: - int lat = 0; - lat = info.getInt(); - Rcgs.tdata.setGPSLatitude(lat); - break; - - case 33: - int lon = 0; - lon = info.getInt(); - Rcgs.tdata.setGPSLongitude(lon); - break; - - default: - break; - - } - } } --- 330,333 ---- *************** *** 424,428 **** // byte[] loginpass; // buildFrame("", "", "",512,'P',0, buf); ! // TXout(); } --- 372,376 ---- // byte[] loginpass; // buildFrame("", "", "",512,'P',0, buf); ! // TXout(); } *************** *** 447,457 **** } - // methods required by the PacketUser interface ! /** ! * a packet is available to the user or the state has changed ! * uses invokeLater to put this packet on the system event queue so Swing will run it ! * @param pkt a data packet ! */ public void postPacket(Packet pkt) { --- 395,408 ---- } ! ! ! // methods required by the PacketUser interface ! ! /** ! * a packet is available to the user or the state has changed ! * uses invokeLater to put this packet on the system event queue so Swing will run it ! * @param pkt a data packet ! */ public void postPacket(Packet pkt) { *************** *** 459,465 **** } ! /** ! * the run method in a packet calls this when invoked by the SwingUtilities on the AWT EDT ! */ public void runPacket(Packet pkt) { --- 410,418 ---- } ! ! ! /** ! * the run method in a packet calls this when invoked by the SwingUtilities on the AWT EDT ! */ public void runPacket(Packet pkt) { *************** *** 487,492 **** --- 440,449 ---- } + + static public void dout(int level, String text){Functions.dout(level,text);} + + private void sendToMonitor(byte[] dat){ |
From: <mjp...@us...> - 2004-03-14 14:25:05
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8460 Modified Files: UserPreferences.java UserPreferencesDialog.java Log Message: Added Data Protocol to user settings Index: UserPreferences.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/UserPreferences.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UserPreferences.java 10 Mar 2004 00:45:47 -0000 1.4 --- UserPreferences.java 14 Mar 2004 14:15:53 -0000 1.5 *************** *** 7,11 **** * * ! * Copyright 2004 Michael J. Pawlowsky * * This file is part of R/C Ground Station a module of the R/C Pilot Project. --- 7,12 ---- * * ! * Copyright 2004 Ian Dallas ! * 2004 Michael Pawlowsky * * This file is part of R/C Ground Station a module of the R/C Pilot Project. *************** *** 35,54 **** import java.awt.Color; import java.util.prefs.Preferences; - //import javax.swing.JOptionPane; - //import rcpilot.agw.Agwpe; - - /** - * @author ian - * - * To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ - /** - * @author ian - * - * To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ public class UserPreferences { --- 36,40 ---- *************** *** 70,73 **** --- 56,60 ---- private static final String KEY_DATA_FORMAT = "data.format"; private static final String KEY_DATA_CONNECTION_TYPE = "data.connection_type"; + private static final String KEY_DATA_PROTOCOL = "data.protocol"; private static final String KEY_UNIT_FORMAT = "unit_format"; *************** *** 75,79 **** public static final String CONST_DATA_TRANSPORT_SERIAL = "Serial"; public static final String CONST_DATA_TRANSPORT_SERIAL_COMM_PORT1 = "Com1"; ! public static final String CONST_DATA_TRANSPORT_SERIAL_COMM_PORT2 = "Com2"; public static final String CONST_UNIT_FORMAT_METRIC = "Metric"; public static final String CONST_UNIT_FORMAT_NAUTICAL = "Nautical"; --- 62,71 ---- public static final String CONST_DATA_TRANSPORT_SERIAL = "Serial"; public static final String CONST_DATA_TRANSPORT_SERIAL_COMM_PORT1 = "Com1"; ! public static final String CONST_DATA_TRANSPORT_SERIAL_COMM_PORT2 = "Com2"; ! ! public static final String CONST_DATA_PROTOCOL_AUAVTP = "AUAVTP"; ! public static final String CONST_DATA_PROTOCOL_NMEA0183 = "NMEA0183"; ! public static final String CONST_DATA_PROTOCOL_APRS = "APRS"; ! public static final String CONST_UNIT_FORMAT_METRIC = "Metric"; public static final String CONST_UNIT_FORMAT_NAUTICAL = "Nautical"; *************** *** 103,106 **** --- 95,106 ---- set(KEY_AGWPE_PORT, port); } + + // Data Protocol (AUAVTP, NMEA0183 APRS) + public static String getDataProtocol(){ + return get(KEY_DATA_PROTOCOL); + } + public static void setDataProtocol(String port){ + set(KEY_DATA_PROTOCOL, port); + } Index: UserPreferencesDialog.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/UserPreferencesDialog.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UserPreferencesDialog.java 10 Mar 2004 00:45:47 -0000 1.5 --- UserPreferencesDialog.java 14 Mar 2004 14:15:54 -0000 1.6 *************** *** 53,56 **** --- 53,57 ---- JPanel connectionPanel = new JPanel(); + addField(connectionPanel, "Protocol", fields.dataProtocolCB); addField(connectionPanel, "Transport", fields.dataTransportCB); *************** *** 125,128 **** --- 126,131 ---- private UserPreferencesDialog parentDialog; + protected JComboBox dataProtocolCB; + protected JComboBox dataTransportCB; protected JComboBox serialPortCB; *************** *** 186,189 **** --- 189,193 ---- cancelButton.addActionListener(this); + setMaxSize(dataProtocolCB); setMaxSize(dataTransportCB); setMaxSize(serialPortCB); *************** *** 213,216 **** --- 217,227 ---- private void initComboBoxes() { + + String[] protocols = { + UserPreferences.CONST_DATA_PROTOCOL_AUAVTP, + UserPreferences.CONST_DATA_PROTOCOL_NMEA0183, + UserPreferences.CONST_DATA_PROTOCOL_APRS + }; + String[] formats = { *************** *** 219,226 **** }; String[] serialConnectionPort = { UserPreferences.CONST_DATA_TRANSPORT_SERIAL_COMM_PORT1, UserPreferences.CONST_DATA_TRANSPORT_SERIAL_COMM_PORT2 ! }; String[] units = { UserPreferences.CONST_UNIT_FORMAT_METRIC, --- 230,239 ---- }; + String[] serialConnectionPort = { UserPreferences.CONST_DATA_TRANSPORT_SERIAL_COMM_PORT1, UserPreferences.CONST_DATA_TRANSPORT_SERIAL_COMM_PORT2 ! }; ! String[] units = { UserPreferences.CONST_UNIT_FORMAT_METRIC, *************** *** 229,232 **** --- 242,246 ---- }; + dataProtocolCB = new JComboBox(protocols); dataTransportCB = new JComboBox(formats); serialPortCB = new JComboBox(serialConnectionPort); *************** *** 241,244 **** --- 255,259 ---- // set strings + this.dataProtocolCB.setSelectedItem(UserPreferences.getDataProtocol()); this.dataTransportCB.setSelectedItem(UserPreferences.getDataFormat()); this.serialPortCB.setSelectedItem(UserPreferences.getDataConnectionType()); *************** *** 279,282 **** --- 294,298 ---- // get strings + UserPreferences.setDataProtocol((String)dataProtocolCB.getSelectedItem()); UserPreferences.setDataFormat((String)dataTransportCB.getSelectedItem()); UserPreferences.setDataConnectionType((String)serialPortCB.getSelectedItem()); |
From: <mjp...@us...> - 2004-03-12 21:04:15
|
Update of /cvsroot/rcpilot/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13494 Modified Files: README.txt Log Message: no message Index: README.txt =================================================================== RCS file: /cvsroot/rcpilot/src/README.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README.txt 12 Mar 2004 18:08:55 -0000 1.2 --- README.txt 12 Mar 2004 20:36:32 -0000 1.3 *************** *** 1,21 **** ! Make sure AGWPE is up and running. ! If you do not have AGWPE you may download it at: ! http://www.raag.org/sv2agw/inst.htm ! The TCPIP interface needs to be enabled. ! (use the default listening port of 8000) - Start RCGS from a command prompt by typing: - C:> java -jar rcgs.jar ! If you have .jar files associates with javaw you may simply double click on it as well. ! Select "Connect" from the file menu. ! To have demo telemtry data sent to RCGS, you may use TelData.jar. Start TelData from a command prompt by typing: C:> java -jar teldata.jar --- 1,34 ---- ! R/C Ground Station ! Part of the ! R/C Pilot Project ! http://rcpilot.sourceforge.net/ ! R/C Ground Station (RCGS) is a telemetry application design for viewing telemetry data from remote aerial vehicles. + Currently it requires the use of the AGW Packet Engine. AGWPE is available at http://www.raag.org/sv2agw/inst.htm. + Future version will also work using serial communication. ! The protocol of the telemetry data can be found at: ! http://rcpilot.sourceforge.net/docs/AX25DataDef.html ! Future version will also support NMEA. ! Getting Started: ! ! Make sure AGWPE is up and running. ! The TCPIP interface needs to be enabled. ! (Use the default listening port of 8000) ! ! If you have .jar files associates with javaw you may simply double click on it as well. ! If not you may start RCGS from a command prompt by typing: ! C:> java -jar rcgs.jar ! ! Select "Connect" from the file menu. ! ! To have demo telemetry data sent to RCGS, you can use TelData.jar. Start TelData from a command prompt by typing: C:> java -jar teldata.jar *************** *** 27,35 **** Demo data should now be sent to RCGS. ! You may adjust the tx delay of the data in TelData. However a value of at least 50 is recommended. ! For more more info or support, join the Mailing list at: http://rcpilot.sourceforge.net/ --- 40,48 ---- Demo data should now be sent to RCGS. ! You may adjust the TX delay of the data in TelData. However a value of at least 50 is recommended. ! For more information or support, join the Mailing list at: http://rcpilot.sourceforge.net/ |
From: <mjp...@us...> - 2004-03-12 18:37:40
|
Update of /cvsroot/rcpilot/src/rcpilot/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12773 Modified Files: TelData.java Log Message: Made sure delay value is greater than 0. Index: TelData.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/tests/TelData.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TelData.java 12 Mar 2004 17:12:09 -0000 1.6 --- TelData.java 12 Mar 2004 18:10:01 -0000 1.7 *************** *** 318,324 **** void mnuAGWSetDelay() { ! String txt = JOptionPane.showInputDialog("Enter delay in ms."); if (txt == null)return; ! delay = Functions.toInt(txt,200); } --- 318,325 ---- void mnuAGWSetDelay() { ! String txt = JOptionPane.showInputDialog("Enter delay in ms > 0."); if (txt == null)return; ! int i = Functions.toInt(txt,200); ! delay = Math.max(1, i); } |
From: <mjp...@us...> - 2004-03-12 18:36:31
|
Update of /cvsroot/rcpilot/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12523 Modified Files: README.txt Log Message: Added instructions for TelData Index: README.txt =================================================================== RCS file: /cvsroot/rcpilot/src/README.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.txt 7 Mar 2004 14:09:04 -0000 1.1 --- README.txt 12 Mar 2004 18:08:55 -0000 1.2 *************** *** 1,12 **** ! To begin start the testserver app from a command prompt. ! This simulates AGWPE receiving data from a remote vehicle. ! C:> java -jar testserver.jar - From another command prompt start the R/C Ground Station C:> java -jar rcgs.jar ! To close testserver simply close the command prompt window. --- 1,36 ---- + Make sure AGWPE is up and running. ! If you do not have AGWPE you may download it at: ! http://www.raag.org/sv2agw/inst.htm ! The TCPIP interface needs to be enabled. ! (use the default listening port of 8000) + Start RCGS from a command prompt by typing: C:> java -jar rcgs.jar ! If you have .jar files associates with javaw you may simply double click on it as well. ! ! ! Select "Connect" from the file menu. ! ! ! To have demo telemtry data sent to RCGS, you may use TelData.jar. ! Start TelData from a command prompt by typing: ! C:> java -jar teldata.jar ! ! If you have .jar files associates with javaw you may simply double click on it as well. ! ! Select "Connect" from the file menu. ! Select "Send Telemetry Data" from the file menu. ! ! Demo data should now be sent to RCGS. ! You may adjust the tx delay of the data in TelData. ! However a value of at least 50 is recommended. ! ! ! For more more info or support, join the Mailing list at: http://rcpilot.sourceforge.net/ ! ! |
From: <mjp...@us...> - 2004-03-12 17:39:49
|
Update of /cvsroot/rcpilot/src/rcpilot/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv484 Modified Files: TelData.java TelDataData.java Log Message: Sends out telemetry data constantly. Added lat and lon. Index: TelData.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/tests/TelData.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TelData.java 9 Mar 2004 20:33:34 -0000 1.5 --- TelData.java 12 Mar 2004 17:12:09 -0000 1.6 *************** *** 14,20 **** import rcpilot.common.Functions; import rcpilot.agw.*; - import java.util.*; import java.text.*; import java.io.*; --- 14,25 ---- import rcpilot.common.Functions; import rcpilot.agw.*; import java.text.*; import java.io.*; + import java.util.Timer; + import java.util.TimerTask; + import java.util.Arrays; + + + *************** *** 38,42 **** JMenuItem agw_port_info_item = new JMenuItem("AGWPE Port Info"); JMenuItem agwMonitorItem = new JMenuItem("On AX.25"); ! JMenuItem agwRegCallItem = new JMenuItem("Register Call Sign"); JMenuItem sendTelItem = new JMenuItem("Send Telemetry Data"); JMenuItem debugItem = new JMenuItem("Debug level"); --- 43,47 ---- JMenuItem agw_port_info_item = new JMenuItem("AGWPE Port Info"); JMenuItem agwMonitorItem = new JMenuItem("On AX.25"); ! JMenuItem agw_data_delay_item = new JMenuItem("Set TX Delay"); JMenuItem sendTelItem = new JMenuItem("Send Telemetry Data"); JMenuItem debugItem = new JMenuItem("Debug level"); *************** *** 45,48 **** --- 50,55 ---- JMenu fileMenu = new JMenu("File"); JMenu helpMenu = new JMenu("Help"); + + Timer timer; public static int debugLevel = 1; *************** *** 53,56 **** --- 60,65 ---- // 1 = ON private static int agw_ax25_status = 0; + private static int agw_tx_status = 0; + private static int delay = 200; *************** *** 151,155 **** agw_port_item.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e){mnuAGWPort();}}); ! fileMenu.add(agw_port_item); agw_version_item.addActionListener(new ActionListener() --- 160,164 ---- agw_port_item.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e){mnuAGWPort();}}); ! fileMenu.add(agw_port_item); agw_version_item.addActionListener(new ActionListener() *************** *** 161,174 **** fileMenu.add(agwMonitorItem); ! agwRegCallItem.addActionListener(new ActionListener() ! {public void actionPerformed(ActionEvent e){regCall();}}); ! fileMenu.add(agwRegCallItem); ! ! agw_connect_item.addActionListener(new ActionListener() ! {public void actionPerformed(ActionEvent e){agwConnect();}}); ! fileMenu.add(agw_connect_item); sendTelItem.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e){sendTelData();}}); fileMenu.add(sendTelItem); --- 170,180 ---- fileMenu.add(agwMonitorItem); ! agw_data_delay_item.addActionListener(new ActionListener() ! {public void actionPerformed(ActionEvent e){mnuAGWSetDelay();}}); ! fileMenu.add(agw_data_delay_item); sendTelItem.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e){sendTelData();}}); + sendTelItem.setAccelerator(KeyStroke.getKeyStroke('S', Toolkit.getDefaultToolkit( ).getMenuShortcutKeyMask( ), false)); fileMenu.add(sendTelItem); *************** *** 308,364 **** toLog("Did you connect?"); } ! } ! ! ! void regCall(){ ! byte[] from = {'V','E','2','M','U','D','-','1'}; ! toLog("send register call sign VE2MUD-1"); ! Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet ! pkt.setDataKind('X'); ! pkt.setCallFrom(from); ! pkt.setPort(0); ! try { ! remote.send(pkt); ! }catch(Exception e){ ! toLog(e.toString()); ! } } - - - void agwConnect(){ - byte[] from = {'V','E','2','M','U','D'}; - byte[] to = {'V','E','2','M','U','D', '-','1'}; - toLog("Connect From VE2MUD To VE2MUD-1"); - Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet - pkt.setDataKind('C'); - pkt.setCallFrom(from); - pkt.setCallTo(to); - pkt.setPort(agw_port); - try { - remote.send(pkt); - }catch(Exception e){ - toLog(e.toString()); - } - } void sendTelData(){ ! byte[] from = {'V','E','2','M','U','D', '-', '1'}; ! byte[] to = {'B','E','A','C','O','N'}; ! toLog("send telemetry data"); ! ByteBuffer buf = ByteBuffer.allocateDirect(1024); ! TelDataData.BuildDataBuffer(buf); ! Packet pkt = new Packet(this, Packet.SEND, null, buf); // get an empty send packet ! pkt.setDataKind('M'); ! pkt.setCallFrom(from); ! pkt.setCallTo(to); ! pkt.setDataLength(18); ! pkt.setPort(agw_port); ! try { ! remote.send(pkt); ! }catch(Exception e){ ! toLog(e.toString()); ! } } --- 314,339 ---- toLog("Did you connect?"); } ! } ! void mnuAGWSetDelay() ! { ! String txt = JOptionPane.showInputDialog("Enter delay in ms."); ! if (txt == null)return; ! delay = Functions.toInt(txt,200); } void sendTelData(){ ! ! if (agw_tx_status == 0){ ! timer = new Timer(); ! timer.schedule(new txdata(), 0, delay); ! agw_tx_status = 1; ! sendTelItem.setText("Stop Telemetry Data"); ! } else { ! timer.cancel(); ! agw_tx_status = 0; ! sendTelItem.setText("Send Telemetry Data"); ! } } *************** *** 388,391 **** --- 363,367 ---- System.exit(0); } + private void sendText(String txt) *************** *** 568,570 **** --- 544,571 ---- } } + + + + class txdata extends TimerTask { + public void run() { + byte[] from = {'V','E','2','M','U','D', '-', '1'}; + byte[] to = {'B','E','A','C','O','N'}; + toLog("send telemetry data"); + ByteBuffer buf = ByteBuffer.allocateDirect(1024); + TelDataData.BuildDataBuffer(buf); + Packet pkt = new Packet(null, Packet.SEND, null, buf); // get an empty send packet + pkt.setDataKind('M'); + pkt.setCallFrom(from); + pkt.setCallTo(to); + System.out.println ("Limit: " + buf.limit()); + pkt.setDataLength(buf.limit()); + pkt.setPort(agw_port); + try { + remote.send(pkt); + }catch(Exception e){ + toLog(e.toString()); + } + } + } + } \ No newline at end of file Index: TelDataData.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/tests/TelDataData.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TelDataData.java 7 Mar 2004 20:27:11 -0000 1.2 --- TelDataData.java 12 Mar 2004 17:12:09 -0000 1.3 *************** *** 32,50 **** abstract class TelDataData{ - private static short altitude = 1000; - private static int altdir = 1; - private static short speed = 50; - private static short roll = 0; - private static short pitch = 0; - private static short course = 0; - private static short rpm = 12000; - private static int latitude = 1999675000; - private static int longitutde = 0; public static void BuildDataBuffer(ByteBuffer buf){ - int datalen = 18; - // Pitch (3 bytes) doPitch(); --- 32,54 ---- abstract class TelDataData{ + private static short altitude = 1000; + private static short speed = 50; + private static short roll = 0; + private static short pitch = 0; + private static short course = 0; + private static short rpm = 12000; + private static int lat = 16363980; + private static int lon = -26609700; + + private static int altdir = 1; + private static int rolldir = 1; + private static int coursedir = 1; + private static int latdir = 1; + private static int londir = 1; + public static void BuildDataBuffer(ByteBuffer buf){ // Pitch (3 bytes) doPitch(); *************** *** 75,79 **** doRPM(); buf.put((byte)0xA0); ! buf.putShort(rpm); // Set the buffer limit to the current position and the position to zero. --- 79,91 ---- doRPM(); buf.put((byte)0xA0); ! buf.putShort(rpm); ! ! doLat(); ! buf.put((byte)0x20); ! buf.putInt(lat); ! ! doLon(); ! buf.put((byte)0x21); ! buf.putInt(lon); // Set the buffer limit to the current position and the position to zero. *************** *** 82,137 **** ! ! private static void doAlt(){ ! ! if (altitude > 2000 ) { ! altdir = -1; ! } else if (altitude < 200){ ! altdir = 1; ! } ! altitude = (short)(altitude + (altdir * (int)(10 * Math.random()))); ! altitude = (short)Math.max(100, altitude); ! } ! ! ! private static void doSpeed(){ ! speed = (short)(speed + ((altdir*-1) * (int)(2 * Math.random()))); ! speed = (short)Math.max(20, speed); ! speed = (short)Math.min(120, speed); ! } ! ! private static void doRoll(){ ! int dir = Math.random() > 0.5 ?1:-1; ! roll = (short)(roll + (altdir * (int)(2 * Math.random()))); ! roll = (short)Math.max(-30, roll); ! roll = (short)Math.min(30, roll); ! } ! ! private static void doPitch(){ ! pitch = (short)(pitch + (altdir * (int)(2 * Math.random()))); ! pitch = (short)Math.max(-30, pitch); ! pitch = (short)Math.min(30, pitch); ! } ! ! private static void doRPM(){ ! int dir = Math.random() > 0.5 ?1:-1; ! rpm = (short)(rpm + (dir * (int)(200 * Math.random()))); ! rpm = (short)Math.max(2000, rpm); ! rpm = (short)Math.min(35000, rpm); ! } ! ! private static void doCourse(){ ! int dir = Math.random() > 0.5 ?1:-1; ! course = (short)(course + (dir * (int)(2 * Math.random()))); ! course = (short)Math.max(0, course); ! course = (short)Math.min(359, course); ! } ! ! ! private static void doLatitude(){ ! int dir = Math.random() > 0.5 ?1:-1; ! latitude = (int)(latitude + (dir * (int)(10 * Math.random()))); ! latitude = (int)Math.max(-1944000000, latitude); ! latitude = (int)Math.min(1944000000, latitude); ! } } \ No newline at end of file --- 94,174 ---- ! ! public static void doAlt(){ ! ! if (altitude > 1000 ) { ! altdir = -1; ! } else if (altitude < 200){ ! altdir = 1; ! } ! ! int rnd = (int)(10 * Math.random()); ! ! altitude = (short)(altitude + (altdir * (int)(rnd * Math.random()))); ! altitude = (short)Math.max(100, altitude); ! } ! ! ! public static void doSpeed(){ ! speed = (short)(speed + ((altdir*-1) * (int)(2 * Math.random()))); ! speed = (short)Math.max(20, speed); ! speed = (short)Math.min(120, speed); ! } ! ! public static void doRoll(){ ! if(Math.random() > 0.8){ ! rolldir = rolldir * -1; ! } ! roll = (short)(roll + (rolldir * (int)(2 * Math.random()))); ! roll = (short)Math.max(-30, roll); ! roll = (short)Math.min(30, roll); ! } ! ! public static void doPitch(){ ! pitch = (short)(pitch + (altdir * (int)(2 * Math.random()))); ! pitch = (short)Math.max(-30, pitch); ! pitch = (short)Math.min(30, pitch); ! } ! ! public static void doRPM(){ ! int dir = Math.random() > 0.5 ?1:-1; ! rpm = (short)(rpm + (dir * (int)(200 * Math.random()))); ! rpm = (short)Math.max(2000, rpm); ! rpm = (short)Math.min(35000, rpm); ! } ! ! public static void doCourse(){ ! ! if (course < 1){ ! coursedir = 1; ! } else if (coursedir > 358){ ! coursedir = -1; ! } else if (Math.random() > 0.8){ ! coursedir = coursedir * -1; ! } ! ! course = (short)(course + (coursedir * (int)(5 * Math.random()))); ! course = (short)Math.max(0, course); ! course = (short)Math.min(359, course); ! } ! ! ! public static void doLat(){ ! if(Math.random() > 0.8){ ! latdir = latdir * -1; ! } ! lat = (int)(lat + (latdir * (int)(50 * Math.random()))); ! lat = (int)Math.max(-1944000000, lat); ! lat = (int)Math.min(1944000000, lat); ! } ! ! public static void doLon(){ ! if(Math.random() > 0.8){ ! londir = londir * -1; ! } ! lon = (int)(lon + (londir * (int)(50 * Math.random()))); ! lon = (int)Math.max(-1944000000, lon); ! lon = (int)Math.min(1944000000, lon); ! } ! } \ No newline at end of file |
From: <mjp...@us...> - 2004-03-12 17:38:56
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32733 Added Files: AGWAX25.java Log Message: Parses AGW Rax AX25 frames --- NEW FILE: AGWAX25.java --- package rcpilot.rcgs; import java.nio.ByteBuffer; import java.nio.Buffer; import java.nio.ByteOrder; public class AGWAX25{ public int port; public String destination; public String source; public String repeater_1; public String repeater_2; public byte control; public byte PID; public byte[] info; public AGWAX25(){ } public int decodeAX25(byte[] dat){ // Let's make sure we have the minimum size required if (dat.length < 17) return(-1); ByteBuffer bdat = ByteBuffer.wrap(dat); StringBuffer sb; // bdat.order(ByteOrder.LITTLE_ENDIAN); byte b; int t; // Get the port b = bdat.get(); port = (b&0xff); //Get the destination field sb = new StringBuffer(); for (int i = 0; i<6; i++){ b = bdat.get(); t = (b & 0xff); t = t >> 1; sb.append((char)t); } b = bdat.get(); int s = makeSSID(b); if (s != 0) { sb.append('-'); sb.append(Integer.toString(s)); } this.destination = sb.toString(); // Get the source field sb = new StringBuffer(); int more = 0; for (int i = 0; i<6; i++){ b = bdat.get(); more = (b & 0x01); t = (b & 0xff); t = t >> 1; sb.append((char)t); } b = bdat.get(); s = makeSSID(b); if (s != 0) { sb.append('-'); sb.append(Integer.toString(s)); } this.source = sb.toString(); // If we have a repeater_1 if (more == 1){ sb = new StringBuffer(); for (int i = 0; i<6; i++){ b = bdat.get(); more = (b & 0x01); t = (b & 0xff); t = t >> 1; sb.append((char)t); } b = bdat.get(); s = makeSSID(b); if (s != 0) { sb.append('-'); sb.append(Integer.toString(s)); } this.repeater_1 = sb.toString(); } // If we have a repeater_1 if (more == 1){ sb = new StringBuffer(); for (int i = 0; i<6; i++){ b = bdat.get(); more = b & 0x01; t = (b & 0xff); t = t >> 1; sb.append((char)t); } b = bdat.get(); s = makeSSID(b); if (s != 0) { sb.append('-'); sb.append(Integer.toString(s)); } this.repeater_2 = sb.toString(); } // Get the control byte control = bdat.get(); // Getthe PID byte PID = bdat.get(); // Get the info bytes info = new byte[bdat.remaining()]; bdat.get(info, 0, bdat.remaining()); return(0); } private int makeSSID(byte ssid){ int i = (int)(ssid & 0x0E); return(i); } } |
From: <mjp...@us...> - 2004-03-12 17:37:55
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32403 Modified Files: Agwpe.java Debug.java RcgsJMenuBar.java Log Message: On "Connect" also asks to receive AX25 from AGWPE Added printBinary to Debug. Agwpe handles raw AGW AX.25 frames. Index: Agwpe.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/Agwpe.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Agwpe.java 9 Mar 2004 20:16:55 -0000 1.7 --- Agwpe.java 12 Mar 2004 17:10:16 -0000 1.8 *************** *** 300,400 **** public static void parseAX25(byte[] dat){ ! ! int pos = 17; ! while (pos < dat.length){ ! switch (dat[pos]) { ! case 0x01: short pitch = 0; ! pitch |= (0xFF & dat[pos+2]); ! pitch <<= 8; ! pitch |= (0xFF & dat[pos+1]); Rcgs.tdata.setPitch(pitch); - pos = pos + 3; break; ! case 0x02: short roll = 0; ! roll |= (0xFF & dat[pos+2]); ! roll <<= 8; ! roll |= (0xFF & dat[pos+1]); ! Rcgs.tdata.setRoll(roll); ! pos = pos + 3; break; ! case 0x04: short speed = 0; ! speed |= (0xFF & dat[pos+2]); ! speed <<= 8; ! speed |= (0xFF & dat[pos+1]); Rcgs.tdata.setSpeed(speed);; - pos = pos + 3; break; ! case 0x05: short alt = 0; ! alt |= (0xFF & dat[pos+2]); ! alt <<= 8; ! alt |= (0xFF & dat[pos+1]); Rcgs.tdata.setAltitude(alt); - pos = pos + 3; break; ! case 0x06: short course = 0; ! course |= (0xFF & dat[pos+2]); ! course <<= 8; ! course |= (0xFF & dat[pos+1]); Rcgs.tdata.setCourse(course); - pos = pos + 3; break; ! case (byte)0xA0: short rpm = 0; ! rpm |= (0xFF & dat[pos+2]); ! rpm <<= 8; ! rpm |= (0xFF & dat[pos+1]); Rcgs.tdata.setEngineRPM(rpm); - pos = pos + 3; break; ! case (byte)0x20: int lat = 0; ! lat |= (0xFF & dat[pos+4]); ! lat <<= 8; ! lat |= (0xFF & dat[pos+3]); ! lat <<= 8; ! lat |= (0xFF & dat[pos+2]); ! lat <<= 8; ! lat |= (0xFF & dat[pos+1]); ! Rcgs.tdata.setGPSLatitude(lat); ! pos = pos + 5; break; ! case (byte)0x21: int lon = 0; ! lon |= (0xFF & dat[pos+4]); ! lon <<= 8; ! lon |= (0xFF & dat[pos+3]); ! lon <<= 8; ! lon |= (0xFF & dat[pos+2]); ! lon <<= 8; ! lon |= (0xFF & dat[pos+1]); Rcgs.tdata.setGPSLongitude(lon); ! pos = pos + 5; ! break; default: - pos++; break; } ! } } --- 300,385 ---- public static void parseAX25(byte[] dat){ + byte b; + int t; + int i; ! AGWAX25 frame = new AGWAX25(); ! frame.decodeAX25(dat); ! ! System.out.println ("Port: " + frame.port); ! System.out.println ("Dest: " + frame.destination); ! System.out.println ("Source: " + frame.source); ! System.out.println ("Rep1: " + frame.repeater_1); ! System.out.println ("Rep2: " + frame.repeater_2); ! System.out.println ("Control: " + frame.control); ! System.out.println ("PID : " + frame.PID); ! Functions.printhex(frame.info); ! ByteBuffer info = ByteBuffer.wrap(dat); ! ! ! while (info.hasRemaining()){ ! b = info.get(); ! t = (b & 0xff); ! ! switch (t) { ! case 1: short pitch = 0; ! pitch = info.getShort(); Rcgs.tdata.setPitch(pitch); break; ! case 2: short roll = 0; ! roll = info.getShort(); ! Rcgs.tdata.setRoll(roll); break; ! case 4: short speed = 0; ! speed = info.getShort(); Rcgs.tdata.setSpeed(speed);; break; ! case 5: short alt = 0; ! alt = info.getShort(); Rcgs.tdata.setAltitude(alt); break; ! case 6: short course = 0; ! course = info.getShort(); Rcgs.tdata.setCourse(course); break; ! case 16: short rpm = 0; ! rpm = info.getShort(); Rcgs.tdata.setEngineRPM(rpm); break; ! case 32: int lat = 0; ! lat = info.getInt(); ! Rcgs.tdata.setGPSLatitude(lat); break; ! case 33: int lon = 0; ! lon = info.getInt(); Rcgs.tdata.setGPSLongitude(lon); ! break; default: break; } ! } } *************** *** 422,425 **** --- 407,422 ---- } + + /** + * send a request for raw AX.25 frames + */ + public void askForRawFrames() + { + Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet + pkt.setDataKind((int)'k'); // set the type + TXout(pkt); + } + + public void login() { Index: Debug.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/Debug.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Debug.java 3 Mar 2004 03:10:19 -0000 1.1.1.1 --- Debug.java 12 Mar 2004 17:10:16 -0000 1.2 *************** *** 82,84 **** --- 82,94 ---- } + + public static void showBinary(byte b) { + System.out.println("------------"); + for (int i = 7; i >= 0; i--) { + System.out.print((b >> i) & 1); + } + System.out.println(); + System.out.println("------------"); + } + } Index: RcgsJMenuBar.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/RcgsJMenuBar.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RcgsJMenuBar.java 9 Mar 2004 20:27:29 -0000 1.3 --- RcgsJMenuBar.java 12 Mar 2004 17:10:16 -0000 1.4 *************** *** 52,55 **** --- 52,56 ---- boolean connected = Rcgs.pEng.connectAgwpe(); if (connected) { + Rcgs.pEng.askForRawFrames(); } else { |
From: <mjp...@us...> - 2004-03-12 17:36:22
|
Update of /cvsroot/rcpilot/src/rcpilot/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31964 Modified Files: Functions.java Log Message: look for null byte[] Index: Functions.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/common/Functions.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Functions.java 4 Mar 2004 11:45:39 -0000 1.1 --- Functions.java 12 Mar 2004 17:08:48 -0000 1.2 *************** *** 59,63 **** public static void printhex(byte[]ba) { ! printhex(ba,0,ba.length); } --- 59,67 ---- public static void printhex(byte[]ba) { ! if (ba != null){ ! printhex(ba,0,ba.length); ! } else { ! println("null"); ! } } *************** *** 70,74 **** public static void printhex(byte[]ba, int ofs, int len) { ! println(atohex(ba,ofs,len)); } --- 74,82 ---- public static void printhex(byte[]ba, int ofs, int len) { ! if (ba != null){ ! println(atohex(ba,ofs,len)); ! } else { ! println("null"); ! } } |
From: <mjp...@us...> - 2004-03-10 21:15:12
|
Update of /cvsroot/rcpilot/rcpm/circuit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26309 Added Files: rcpm-ckt.jpg Log Message: JPEG image of circuit --- NEW FILE: rcpm-ckt.jpg --- (This appears to be a binary file; contents omitted.) |
From: <mjp...@us...> - 2004-03-10 14:57:56
|
Update of /cvsroot/rcpilot/rcap/circuit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7031 Removed Files: ap-bw.PCB Log Message: no message --- ap-bw.PCB DELETED --- |
From: <mjp...@us...> - 2004-03-10 14:36:35
|
Update of /cvsroot/rcpilot/rcap/circuit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2659 Modified Files: ap.PCB Log Message: Enlarged some and standardized drills Index: ap.PCB =================================================================== RCS file: /cvsroot/rcpilot/rcap/circuit/ap.PCB,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ap.PCB 14 Feb 2004 13:33:35 -0000 1.1.1.1 --- ap.PCB 10 Mar 2004 14:10:40 -0000 1.2 *************** *** 1,248 **** PCB FILE 4 COMP ! R5 ! AXIAL0.3 ! 3400 5512 60 0 10 7 ! 3535 5343 60 0 10 7 ! 3431 5456 1 1 2 CP ! 3431 5456 62 62 1 28 1 13 [...2334 lines suppressed...] NETDEF ! NETR4_1 0 ( ! C4-2 ) { } NETDEF ! NET0 0 ( ! C2-1 ! C2-2 ! C4-1 ) { + 2 3 0 } ENDPCB |
From: <mjp...@us...> - 2004-03-10 01:11:16
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20695 Modified Files: GPS.java UserPreferences.java UserPreferencesDialog.java Log Message: Fixed up GPS HOME coordinates to be saved in RCGSGEO format. Some minor value checking is also done. Index: GPS.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/GPS.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GPS.java 9 Mar 2004 20:19:23 -0000 1.3 --- GPS.java 10 Mar 2004 00:45:47 -0000 1.4 *************** *** 53,57 **** ! public class GPS { --- 53,60 ---- ! abstract public class GPS { ! ! public static final int LATITUDE = 1; ! public static final int LONGITUDE = 2; *************** *** 136,139 **** --- 139,176 ---- + /* l is either GPS.LATITUDE or GPS.LONGITUDE. + * We pass this so we can do some value checking. + * If an error occurs a value less than -64800000 will be returned. + */ + public static int stringToGPS(String s, int l){ + + s.trim(); + int n = s.indexOf(' '); + int i = 0; + int e = -64800001; // Error + + if (s.length() > 8 && n > 1){ + + int deg = Integer.parseInt(s.substring(0,n)); + float min = Float.parseFloat(s.substring(n+1)); + + if (deg > 0){ + i = (int)((deg * 360000) + (min * 6000)); + } else { + i = (int)((deg * 360000) - (min * 6000)); + } + + + // Make sure values are in range + if (l == LATITUDE && (i < -32400000 || i > 32400000 )) return(e); + if (l == LONGITUDE && (i < -64800000 || i > 64800000 )) return(e); + return(i); + + } else { + return (e); + } + } + + // Return the geopoint in degrees. public static double secToDeg(int i){ Index: UserPreferences.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/UserPreferences.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UserPreferences.java 8 Mar 2004 16:05:54 -0000 1.3 --- UserPreferences.java 10 Mar 2004 00:45:47 -0000 1.4 *************** *** 113,129 **** ! public static String getHomeLatitude(){ ! return get(KEY_GPS_HOME_LAT); } ! public static void setHomeLatitude(String s){ ! set(KEY_GPS_HOME_LAT, s); } ! public static String getHomeLongitude(){ ! return get(KEY_GPS_HOME_LON); } ! public static void setHomeLongitude(String s){ ! set(KEY_GPS_HOME_LON, s); } --- 113,129 ---- ! public static int getHomeLatitude(){ ! return prefs.getInt(KEY_GPS_HOME_LAT, 0); } ! public static void setHomeLatitude(int i){ ! prefs.putInt(KEY_GPS_HOME_LAT, i); } ! public static int getHomeLongitude(){ ! return prefs.getInt(KEY_GPS_HOME_LON, 0); } ! public static void setHomeLongitude(int i){ ! prefs.putInt(KEY_GPS_HOME_LON, i); } Index: UserPreferencesDialog.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/UserPreferencesDialog.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UserPreferencesDialog.java 9 Mar 2004 20:28:55 -0000 1.4 --- UserPreferencesDialog.java 10 Mar 2004 00:45:47 -0000 1.5 *************** *** 45,50 **** SpringUtilities.makeCompactGrid(panel, rows, 2, //rows, cols ! 6, 6, //initX, initY ! 6, 6); //xPad, yPad } --- 45,50 ---- SpringUtilities.makeCompactGrid(panel, rows, 2, //rows, cols ! 6, 6, //initX, initY ! 6, 6); //xPad, yPad } *************** *** 244,249 **** this.serialPortCB.setSelectedItem(UserPreferences.getDataConnectionType()); this.unitsCB.setSelectedItem(UserPreferences.getUnitFormat()); ! this.gpsHomeLatitudeTF.setText(UserPreferences.getHomeLatitude()); ! this.gpsHomeLongitudeTF.setText(UserPreferences.getHomeLongitude()); this.remoteVehicleCallSign.setText(UserPreferences.getRemoteVehicleCallSign()); this.groundStationCallSign.setText(UserPreferences.getGroundStationCallSign()); --- 244,249 ---- this.serialPortCB.setSelectedItem(UserPreferences.getDataConnectionType()); this.unitsCB.setSelectedItem(UserPreferences.getUnitFormat()); ! this.gpsHomeLatitudeTF.setText(GPS.gpsToString(UserPreferences.getHomeLatitude())); ! this.gpsHomeLongitudeTF.setText(GPS.gpsToString(UserPreferences.getHomeLongitude())); this.remoteVehicleCallSign.setText(UserPreferences.getRemoteVehicleCallSign()); this.groundStationCallSign.setText(UserPreferences.getGroundStationCallSign()); *************** *** 259,263 **** } ! private void saveChanges() { // get booleans --- 259,277 ---- } ! private int saveChanges() { ! ! int lat = GPS.stringToGPS(gpsHomeLatitudeTF.getText(), GPS.LATITUDE); ! int lon = GPS.stringToGPS(gpsHomeLongitudeTF.getText(),GPS.LONGITUDE); ! ! System.out.println ("lat: " + lat); ! System.out.println ("lon: " + lon); ! ! if (lat < -64800000 || lon < -64800000 ){ ! JOptionPane.showMessageDialog(null, "GPS Coordinates need to be in the format {-}DD MM.MMM", "Alert", JOptionPane.ERROR_MESSAGE); ! return(-1); ! } ! ! UserPreferences.setHomeLatitude(lat); ! UserPreferences.setHomeLongitude(lon); // get booleans *************** *** 267,275 **** UserPreferences.setDataFormat((String)dataTransportCB.getSelectedItem()); UserPreferences.setDataConnectionType((String)serialPortCB.getSelectedItem()); ! UserPreferences.setUnitFormat((String)unitsCB.getSelectedItem()); ! - UserPreferences.setHomeLatitude(gpsHomeLatitudeTF.getText()); - UserPreferences.setHomeLongitude(gpsHomeLongitudeTF.getText()); UserPreferences.setRemoteVehicleCallSign(this.remoteVehicleCallSign.getText()); UserPreferences.setGroundStationCallSign(this.groundStationCallSign.getText()); --- 281,286 ---- UserPreferences.setDataFormat((String)dataTransportCB.getSelectedItem()); UserPreferences.setDataConnectionType((String)serialPortCB.getSelectedItem()); ! UserPreferences.setUnitFormat((String)unitsCB.getSelectedItem()); UserPreferences.setRemoteVehicleCallSign(this.remoteVehicleCallSign.getText()); UserPreferences.setGroundStationCallSign(this.groundStationCallSign.getText()); *************** *** 290,300 **** JOptionPane.showMessageDialog(parentDialog, "Unable to save preferences. Error: " + e.getLocalizedMessage()); } } public void actionPerformed(ActionEvent e) { if (e.getSource() == saveButton) { ! saveChanges(); } else if (e.getSource() == aquireFromGPS) { this.gpsHomeLatitudeTF.setText(GPS.gpsToString(Rcgs.tdata.getGPSLatitude())); } else { parentDialog.dispose(); --- 301,313 ---- JOptionPane.showMessageDialog(parentDialog, "Unable to save preferences. Error: " + e.getLocalizedMessage()); } + return (0); } public void actionPerformed(ActionEvent e) { if (e.getSource() == saveButton) { ! if (saveChanges() >= 0) parentDialog.dispose(); } else if (e.getSource() == aquireFromGPS) { this.gpsHomeLatitudeTF.setText(GPS.gpsToString(Rcgs.tdata.getGPSLatitude())); + this.gpsHomeLongitudeTF.setText(GPS.gpsToString(Rcgs.tdata.getGPSLongitude())); } else { parentDialog.dispose(); |
From: <mjp...@us...> - 2004-03-09 21:00:28
|
Update of /cvsroot/rcpilot/src/rcpilot/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28103 Modified Files: TestServer.java Log Message: Added lattitude and longitude. Index: TestServer.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/tests/TestServer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestServer.java 9 Mar 2004 00:45:11 -0000 1.2 --- TestServer.java 9 Mar 2004 20:35:08 -0000 1.3 *************** *** 12,16 **** private static byte[] data = new byte[1024]; ! private final static int dataSize = 54; private static short altitude = 1000; --- 12,16 ---- private static byte[] data = new byte[1024]; ! private final static int dataSize = 64; private static short altitude = 1000; *************** *** 20,29 **** private static short course = 0; private static short rpm = 12000; ! private static int latitude = 1999675000; ! private static int longitutde = 0; private static int altdir = 1; private static int rolldir = 1; ! private static int coursedir = 1; --- 20,31 ---- private static short course = 0; private static short rpm = 12000; ! private static int lat = 16363980; ! private static int lon = -26609700; private static int altdir = 1; private static int rolldir = 1; ! private static int coursedir = 1; ! private static int latdir = 1; ! private static int londir = 1; *************** *** 88,98 **** ! public static void doLatitude(){ ! int dir = Math.random() > 0.5 ?1:-1; ! latitude = (int)(latitude + (dir * (int)(10 * Math.random()))); ! latitude = (int)Math.max(-1944000000, latitude); ! latitude = (int)Math.min(1944000000, latitude); } public static void buildData(){ --- 90,111 ---- ! public static void doLat(){ ! if(Math.random() > 0.8){ ! latdir = latdir * -1; ! } ! lat = (int)(lat + (latdir * (int)(50 * Math.random()))); ! lat = (int)Math.max(-1944000000, lat); ! lat = (int)Math.min(1944000000, lat); } + public static void doLon(){ + if(Math.random() > 0.8){ + londir = londir * -1; + } + lon = (int)(lon + (londir * (int)(50 * Math.random()))); + lon = (int)Math.max(-1944000000, lon); + lon = (int)Math.min(1944000000, lon); + } + public static void buildData(){ *************** *** 130,134 **** data[27] = 0x00; // Call To - Null Terminated ! data[28] = 0x12; // Data Length little endian data[29] = 0x00; // Data Length data[30] = 0x00; // Data Length --- 143,147 ---- data[27] = 0x00; // Call To - Null Terminated ! data[28] = 0x1C; // Data Length little endian data[29] = 0x00; // Data Length data[30] = 0x00; // Data Length *************** *** 171,175 **** data[51] = (byte)0xA0; data[52] = (byte)(rpm & 0xFF); // little endian ! data[53] = (byte)((rpm >> 8) & 0xFF); } --- 184,203 ---- data[51] = (byte)0xA0; data[52] = (byte)(rpm & 0xFF); // little endian ! data[53] = (byte)((rpm >> 8) & 0xFF); ! ! doLat(); ! data[54] = (byte)0x20; ! data[55] = (byte)(lat & 0xFF); // little endian ! data[56] = (byte)((lat >> 8) & 0xFF); ! data[57] = (byte)((lat >> 16) & 0xFF); ! data[58] = (byte)((lat >> 24) & 0xFF); ! ! doLon(); ! data[59] = (byte)0x21; ! data[60] = (byte)(lon & 0xFF); // little endian ! data[61] = (byte)((lon >> 8) & 0xFF); ! data[62] = (byte)((lon >> 16) & 0xFF); ! data[63] = (byte)((lon >> 24) & 0xFF); ! } |
From: <mjp...@us...> - 2004-03-09 20:58:54
|
Update of /cvsroot/rcpilot/src/rcpilot/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27708 Modified Files: TelData.java Log Message: Changed monitoring to turn on AX.25 instead. Index: TelData.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/tests/TelData.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TelData.java 8 Mar 2004 15:31:19 -0000 1.4 --- TelData.java 9 Mar 2004 20:33:34 -0000 1.5 *************** *** 37,41 **** JMenuItem agw_connect_item = new JMenuItem("AGWPE Connect"); JMenuItem agw_port_info_item = new JMenuItem("AGWPE Port Info"); ! JMenuItem agwMonitorItem = new JMenuItem("On AGWPE Monitor"); JMenuItem agwRegCallItem = new JMenuItem("Register Call Sign"); JMenuItem sendTelItem = new JMenuItem("Send Telemetry Data"); --- 37,41 ---- JMenuItem agw_connect_item = new JMenuItem("AGWPE Connect"); JMenuItem agw_port_info_item = new JMenuItem("AGWPE Port Info"); ! JMenuItem agwMonitorItem = new JMenuItem("On AX.25"); JMenuItem agwRegCallItem = new JMenuItem("Register Call Sign"); JMenuItem sendTelItem = new JMenuItem("Send Telemetry Data"); *************** *** 45,51 **** JMenu fileMenu = new JMenu("File"); JMenu helpMenu = new JMenu("Help"); ! private static int agw_monitor_status = 0; ! public static int debugLevel = 1; ! private static int agw_port = 0; Container cp; --- 45,57 ---- JMenu fileMenu = new JMenu("File"); JMenu helpMenu = new JMenu("Help"); ! ! public static int debugLevel = 1; ! private static int agw_port = 0; ! ! // Raw AX.25 frame request from AGEPE ! // 0 = OFF ! // 1 = ON ! private static int agw_ax25_status = 0; ! Container cp; *************** *** 152,156 **** agwMonitorItem.addActionListener(new ActionListener() ! {public void actionPerformed(ActionEvent e){monitorAGW();}}); fileMenu.add(agwMonitorItem); --- 158,162 ---- agwMonitorItem.addActionListener(new ActionListener() ! {public void actionPerformed(ActionEvent e){getRawAX25();}}); fileMenu.add(agwMonitorItem); *************** *** 284,302 **** ! void monitorAGW(){ toLog("send monitor request"); Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet ! pkt.setDataKind((int)'m'); // set the type pkt.setPort(0); - pkt.setCallTo(null); - pkt.setCallFrom(null); try { remote.send(pkt); ! if (agw_monitor_status == 0){ ! agw_monitor_status = 1; ! agwMonitorItem.setText("Off AGWPE Monitor"); } else { ! agwMonitorItem.setText("On AGWPE Monitor"); ! agw_monitor_status = 0; } }catch(Exception e){ --- 290,306 ---- ! void getRawAX25(){ toLog("send monitor request"); Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet ! pkt.setDataKind((byte)'k'); // set the type pkt.setPort(0); try { remote.send(pkt); ! if (agw_ax25_status == 0){ ! agw_ax25_status = 1; ! agwMonitorItem.setText("Off AX.25"); } else { ! agwMonitorItem.setText("On AX.25"); ! agw_ax25_status = 0; } }catch(Exception e){ *************** *** 309,314 **** void regCall(){ ! byte[] from = {'G','R','O','U','N','D'}; ! toLog("send register call sign GROUND"); Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet pkt.setDataKind('X'); --- 313,318 ---- void regCall(){ ! byte[] from = {'V','E','2','M','U','D','-','1'}; ! toLog("send register call sign VE2MUD-1"); Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet pkt.setDataKind('X'); *************** *** 321,329 **** } } ! void agwConnect(){ byte[] from = {'V','E','2','M','U','D'}; ! byte[] to = {'G','R','O','U','N','D'}; ! toLog("send register call sign GROUND"); Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet pkt.setDataKind('C'); --- 325,334 ---- } } ! ! void agwConnect(){ byte[] from = {'V','E','2','M','U','D'}; ! byte[] to = {'V','E','2','M','U','D', '-','1'}; ! toLog("Connect From VE2MUD To VE2MUD-1"); Packet pkt = new Packet(this, Packet.SEND, null, null); // get an empty send packet pkt.setDataKind('C'); *************** *** 340,345 **** void sendTelData(){ ! byte[] from = {'V','E','2','M','U','D'}; ! byte[] to = {'G','R','O','U','N','D'}; toLog("send telemetry data"); ByteBuffer buf = ByteBuffer.allocateDirect(1024); --- 345,350 ---- void sendTelData(){ ! byte[] from = {'V','E','2','M','U','D', '-', '1'}; ! byte[] to = {'B','E','A','C','O','N'}; toLog("send telemetry data"); ByteBuffer buf = ByteBuffer.allocateDirect(1024); *************** *** 479,484 **** case Packet.CLOSED: startItem.setText("Connect"); ! agwMonitorItem.setText("On AGWPE Monitor"); ! agw_monitor_status = 0; setStatus("Disconnected"); remote = null; --- 484,489 ---- case Packet.CLOSED: startItem.setText("Connect"); ! agwMonitorItem.setText("On AX.25"); ! agw_ax25_status = 0; setStatus("Disconnected"); remote = null; |
From: <mjp...@us...> - 2004-03-09 20:57:16
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27299 Modified Files: TelemetryTable.java Log Message: Adding formating to bearing and distance Index: TelemetryTable.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/TelemetryTable.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TelemetryTable.java 8 Mar 2004 16:46:30 -0000 1.4 --- TelemetryTable.java 9 Mar 2004 20:31:52 -0000 1.5 *************** *** 32,35 **** --- 32,37 ---- import java.awt.*; import javax.swing.*; + import java.text.NumberFormat; + import java.text.DecimalFormat; *************** *** 333,336 **** --- 335,340 ---- public void telemetryDataChanged(TelemetryDataChangedEvent ev) { + NumberFormat f = new DecimalFormat("0.0"); + this.lat.setText(GPS.gpsToString(Rcgs.tdata.getGPSLatitude())); this.lon.setText(GPS.gpsToString(Rcgs.tdata.getGPSLongitude())); *************** *** 338,343 **** this.speed.setText(Double.toString(Rcgs.tdata.getSpeed())); this.course.setText(Double.toString(Rcgs.tdata.getCourse())); ! this.bearing.setText(Double.toString(Rcgs.tdata.getBearingToVehicle())); ! this.distance.setText(Double.toString(Rcgs.tdata.getDistanceToVehicle())); this.gpssats.setText(Double.toString(Rcgs.tdata.getGPSSatelites())); this.barom.setText(Double.toString(Rcgs.tdata.getBarometricPressure())); --- 342,347 ---- this.speed.setText(Double.toString(Rcgs.tdata.getSpeed())); this.course.setText(Double.toString(Rcgs.tdata.getCourse())); ! this.bearing.setText(f.format(Rcgs.tdata.getBearingToVehicle())); ! this.distance.setText(f.format(Rcgs.tdata.getDistanceToVehicle())); this.gpssats.setText(Double.toString(Rcgs.tdata.getGPSSatelites())); this.barom.setText(Double.toString(Rcgs.tdata.getBarometricPressure())); |
From: <mjp...@us...> - 2004-03-09 20:56:23
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26922 Modified Files: Tracker.java Log Message: Moved bearing and distance calculation to TelemetryData Index: Tracker.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/Tracker.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Tracker.java 8 Mar 2004 22:12:02 -0000 1.6 --- Tracker.java 9 Mar 2004 20:31:02 -0000 1.7 *************** *** 119,124 **** // Get the distance and bearing of the vehicle from the home point ! int dist = (int)(((5 / viewsize) * (ringsize / 2)) * getDistance()); ! double b = getBearing(); // plot the vehicle's bearing --- 119,124 ---- // Get the distance and bearing of the vehicle from the home point ! int dist = (int)(((5 / viewsize) * (ringsize / 2)) * Rcgs.tdata.getDistanceToVehicle()); ! double b = Rcgs.tdata.getBearingToVehicle(); // plot the vehicle's bearing *************** *** 162,187 **** } ! ! ! // ********** ! // ! // DISTANCE AND BEARING WILL BE IN TelemetryData AND CALCULATED EVERYTIME NEW DATA COMES IN ! // ! // ************ ! ! private double getDistance(){ ! double d = GPS.geoDistance(GPS.secToDeg(Global.homeLat), GPS.secToDeg(Global.homeLon), GPS.secToDeg(Global.curLat), GPS.secToDeg(Global.curLon)); ! return(d); ! } ! ! private double getBearing(){ ! ! double lat1 = GPS.secToDeg(Global.homeLat); ! double lon1 = GPS.secToDeg(Global.homeLon); ! double lat2 = GPS.secToDeg(Global.curLat); ! double lon2 = GPS.secToDeg(Global.curLon); ! ! double d = GPS.geoBearing(lat1,lon1 , lat2, lon2); ! return(d); ! } } --- 162,165 ---- } ! } |
From: <mjp...@us...> - 2004-03-09 20:55:17
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26729 Modified Files: TelemetryData.java Log Message: Moved bearing and distance calculation to here. Index: TelemetryData.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/TelemetryData.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TelemetryData.java 8 Mar 2004 20:29:16 -0000 1.4 --- TelemetryData.java 9 Mar 2004 20:29:57 -0000 1.5 *************** *** 73,77 **** --- 73,100 ---- public void dataUpdated(){ this.fireTelemetryDataChanged(); + this.bearing_to_vehicle = calcBearing(); + this.distance_to_vehicle = calcDistance(); + System.out.println ("dist: " + this.distance_to_vehicle + " bearing: " + this.bearing_to_vehicle ); + } + + + private double calcDistance(){ + double d = GPS.geoDistance(GPS.secToDeg(Global.homeLat), GPS.secToDeg(Global.homeLon), GPS.secToDeg(this.gps_latitude), GPS.secToDeg(this.gps_longitude)); + return(d); + } + + private double calcBearing(){ + + double lat1 = GPS.secToDeg(Global.homeLat); + double lon1 = GPS.secToDeg(Global.homeLon); + double lat2 = GPS.secToDeg(this.gps_latitude); + double lon2 = GPS.secToDeg(this.gps_longitude); + + double d = GPS.geoBearing(lat1,lon1 , lat2, lon2); + return(d); } + + + *************** *** 95,99 **** public void setRoll(double r) { - System.out.println ("roll: " + r); r = Math.min(r, 180); r = Math.max(r, -180); --- 118,121 ---- |