[kismac] [binaervarianz] r205 - in trunk: KisMAC.xcodeproj Resources/Nibs/English.lproj/GPSDialog.nib Sources/Support Sources/WindowControllers
- From: svn@xxxxxxxxxxxxxxxx
- To: kismac@xxxxxxxxxxxxx
- Date: Fri, 13 Oct 2006 06:06:15 +0200
Author: gkruse
Date: 2006-10-13 06:06:05 +0200 (Fri, 13 Oct 2006)
New Revision: 205
Modified:
trunk/KisMAC.xcodeproj/project.pbxproj
trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib
trunk/Resources/Nibs/English.lproj/GPSDialog.nib/info.nib
trunk/Resources/Nibs/English.lproj/GPSDialog.nib/keyedobjects.nib
trunk/Sources/Support/GPSController.m
trunk/Sources/WindowControllers/GPSInfoController.h
trunk/Sources/WindowControllers/GPSInfoController.m
Log:
Themacuser's gps thing
Modified: trunk/KisMAC.xcodeproj/project.pbxproj
===================================================================
--- trunk/KisMAC.xcodeproj/project.pbxproj 2006-10-13 03:19:45 UTC (rev
204)
+++ trunk/KisMAC.xcodeproj/project.pbxproj 2006-10-13 04:06:05 UTC (rev
205)
@@ -476,6 +476,8 @@
6C541AAB0A72002F00B58A95 /* growl-ap-revealed.png in Resources
*/ = {isa = PBXBuildFile; fileRef = 6C541AA80A72002F00B58A95 /*
growl-ap-revealed.png */; };
6C541AAC0A72003000B58A95 /* growl-wpa-challenge.png in
Resources */ = {isa = PBXBuildFile; fileRef = 6C541AA90A72002F00B58A95 /*
growl-wpa-challenge.png */; };
6C541AAD0A72003000B58A95 /* growl-wpa-response.png in Resources
*/ = {isa = PBXBuildFile; fileRef = 6C541AAA0A72002F00B58A95 /*
growl-wpa-response.png */; };
+ 6C94AA2F0ADF3FBC001BE161 /* GPSSatInfo.h in Headers */ = {isa =
PBXBuildFile; fileRef = 6C94AA2D0ADF3FBC001BE161 /* GPSSatInfo.h */; };
+ 6C94AA300ADF3FBC001BE161 /* GPSSatInfo.m in Sources */ = {isa =
PBXBuildFile; fileRef = 6C94AA2E0ADF3FBC001BE161 /* GPSSatInfo.m */; };
6CA3BCCB09B2A58F00DCB407 /* Accelerate.framework in Frameworks
*/ = {isa = PBXBuildFile; fileRef = 6CA3BCCA09B2A58F00DCB407 /*
Accelerate.framework */; };
6CDAFD020AC4FA7D00A5D180 /* KismetXMLImporter.h in Headers */ =
{isa = PBXBuildFile; fileRef = 6CDAFD000AC4FA7D00A5D180 /* KismetXMLImporter.h
*/; };
6CDAFD030AC4FA7D00A5D180 /* KismetXMLImporter.m in Sources */ =
{isa = PBXBuildFile; fileRef = 6CDAFD010AC4FA7D00A5D180 /* KismetXMLImporter.m
*/; };
@@ -828,6 +830,8 @@
6C541AA80A72002F00B58A95 /* growl-ap-revealed.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path =
"growl-ap-revealed.png"; sourceTree = "<group>"; };
6C541AA90A72002F00B58A95 /* growl-wpa-challenge.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path =
"growl-wpa-challenge.png"; sourceTree = "<group>"; };
6C541AAA0A72002F00B58A95 /* growl-wpa-response.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path =
"growl-wpa-response.png"; sourceTree = "<group>"; };
+ 6C94AA2D0ADF3FBC001BE161 /* GPSSatInfo.h */ = {isa =
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path =
GPSSatInfo.h; sourceTree = "<group>"; };
+ 6C94AA2E0ADF3FBC001BE161 /* GPSSatInfo.m */ = {isa =
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc;
path = GPSSatInfo.m; sourceTree = "<group>"; };
6CA3BCCA09B2A58F00DCB407 /* Accelerate.framework */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.framework; name =
Accelerate.framework; path = /System/Library/Frameworks/Accelerate.framework;
sourceTree = "<absolute>"; };
6CDAFD000AC4FA7D00A5D180 /* KismetXMLImporter.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
KismetXMLImporter.h; sourceTree = "<group>"; };
6CDAFD010AC4FA7D00A5D180 /* KismetXMLImporter.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= KismetXMLImporter.m; sourceTree = "<group>"; };
@@ -1203,6 +1207,7 @@
003533FE06A5DD8500AB4577 /* Views */ = {
isa = PBXGroup;
children = (
+ 6C94AA2C0ADF3FBC001BE161 /* GPSSatInfo */,
00971F3B06E4FA52004307EA /* BIViews */,
00A622A706FEE4FB005D248A /* Trace.h */,
00A622A806FEE4FB005D248A /* Trace.m */,
@@ -1471,6 +1476,15 @@
name = Frameworks;
sourceTree = "<group>";
};
+ 6C94AA2C0ADF3FBC001BE161 /* GPSSatInfo */ = {
+ isa = PBXGroup;
+ children = (
+ 6C94AA2D0ADF3FBC001BE161 /* GPSSatInfo.h */,
+ 6C94AA2E0ADF3FBC001BE161 /* GPSSatInfo.m */,
+ );
+ path = GPSSatInfo;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -1652,6 +1666,7 @@
6C1D31C009F37BC70005A9F8 /* PrefsAdvanced.h in
Headers */,
6C41BAB00AA0B52900E0B411 /* GPSInfoController.h
in Headers */,
6CDAFD020AC4FA7D00A5D180 /* KismetXMLImporter.h
in Headers */,
+ 6C94AA2F0ADF3FBC001BE161 /* GPSSatInfo.h in
Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2045,6 +2060,7 @@
6C1D31C109F37BC70005A9F8 /* PrefsAdvanced.m in
Sources */,
6C41BAB10AA0B52900E0B411 /* GPSInfoController.m
in Sources */,
6CDAFD030AC4FA7D00A5D180 /* KismetXMLImporter.m
in Sources */,
+ 6C94AA300ADF3FBC001BE161 /* GPSSatInfo.m in
Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib
===================================================================
--- trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib
2006-10-13 03:19:45 UTC (rev 204)
+++ trunk/Resources/Nibs/English.lproj/GPSDialog.nib/classes.nib
2006-10-13 04:06:05 UTC (rev 205)
@@ -11,17 +11,18 @@
"_alt_field" = NSTextField;
"_fix_indicator" = NSLevelIndicator;
"_fix_type" = NSTextField;
+ "_hdop_field" = NSTextField;
"_hdop_indicator" = NSLevelIndicator;
"_lat_field" = NSTextField;
"_lon_field" = NSTextField;
- "_sats_indicator" = NSLevelIndicator;
+ "_satinfo" = GPSSatInfo;
"_speedBar" = NSProgressIndicator;
"_speedType" = NSPopUpButton;
- "_statusField" = NSTextField;
"_vel_field" = NSTextField;
};
SUPERCLASS = NSWindowController;
},
+ {CLASS = GPSSatInfo; LANGUAGE = ObjC; SUPERCLASS = NSView; },
{CLASS = NSLevelIndicator; LANGUAGE = ObjC; SUPERCLASS = NSControl; }
);
IBVersion = 1;
Modified: trunk/Resources/Nibs/English.lproj/GPSDialog.nib/info.nib
===================================================================
--- trunk/Resources/Nibs/English.lproj/GPSDialog.nib/info.nib 2006-10-13
03:19:45 UTC (rev 204)
+++ trunk/Resources/Nibs/English.lproj/GPSDialog.nib/info.nib 2006-10-13
04:06:05 UTC (rev 205)
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
- <string>189 53 356 240 0 0 1024 746 </string>
+ <string>273 13 356 240 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
@@ -11,6 +11,6 @@
<integer>5</integer>
</array>
<key>IBSystem Version</key>
- <string>8J135</string>
+ <string>8L127</string>
</dict>
</plist>
Modified: trunk/Resources/Nibs/English.lproj/GPSDialog.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/Sources/Support/GPSController.m
===================================================================
--- trunk/Sources/Support/GPSController.m 2006-10-13 03:19:45 UTC (rev
204)
+++ trunk/Sources/Support/GPSController.m 2006-10-13 04:06:05 UTC (rev
205)
@@ -345,6 +345,7 @@
bool updated;
NSDate *date;
NSAutoreleasePool* subpool = [[NSAutoreleasePool alloc] init];
+ GPSInfoController *asdf = [WaveHelper GPSInfoController];
if (_debugEnabled) NSLog(@"GPS read data");
if (q>=1024) q = 0; //just in case something went wrong
@@ -401,7 +402,62 @@
if (_debugEnabled) NSLog(@"GPS data updated.");
updated = YES;
}
- }
+ } else if(strncmp(gpsbuf, "$GPGSV", 6) == 0) { //satellites
and signals
+ int
nmsgs,tmsg,satsinview,prn1,elev1,azi1,snr1,prn2,elev2,azi2,snr2,prn3,elev3,azi3,snr3,prn4,elev4,azi4,snr4;
+ sscanf(gpsbuf,
"%*[^,],%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
+ &nmsgs, &tmsg, &satsinview,
+ &prn1, &elev1, &azi1, &snr1,
+ &prn2, &elev2, &azi2, &snr2,
+ &prn3, &elev3, &azi3, &snr3,
+ &prn4, &elev4, &azi4, &snr4);
+ NSLog(@"nmesgs %i, tmsg %i, satsinview %i, sat1 prn %i
signal %i, sat2 prn %i signal %i, sat3 prn %i signal %i, sat4 prn %i signal %i",
+
nmsgs,tmsg,satsinview,prn1,snr1,prn2,snr2,prn3,snr3,prn4,snr4);
+ if (asdf != NULL)
+ {
+
+ if (prn1 < 200) {// it's obviousy dodgy if it's 200 or
higher
+ [asdf updateSatSignalStrength:((tmsg - 1) * 4)
signal:snr1];
+ [asdf updateSatPRNForSat:((tmsg - 1) * 4) prn:prn1];
+ [asdf updateSatUsed:((tmsg - 1) * 4) used:1];
+ } else {
+ [asdf updateSatSignalStrength:((tmsg - 1) * 4)
signal:0];
+ [asdf updateSatPRNForSat:((tmsg - 1) * 4) prn:0];
+ [asdf updateSatUsed:((tmsg - 1) * 4) used:0];
+ }
+
+ if (prn2 < 200) {
+ [asdf updateSatSignalStrength:(((tmsg - 1) * 4) + 1)
signal:snr2];
+ [asdf updateSatPRNForSat:(((tmsg - 1) * 4) + 1)
prn:prn2];
+ [asdf updateSatUsed:(((tmsg - 1) * 4) + 1) used:1];
+ } else {
+ [asdf updateSatSignalStrength:(((tmsg - 1) * 4) + 1)
signal:0];
+ [asdf updateSatPRNForSat:(((tmsg - 1) * 4) + 1) prn:0];
+ [asdf updateSatUsed:(((tmsg - 1) * 4) + 1) used:0];
+ }
+
+ if (prn3 < 200) {
+ [asdf updateSatSignalStrength:(((tmsg - 1) * 4) + 2)
signal:snr3];
+ [asdf updateSatPRNForSat:(((tmsg - 1) * 4) + 2)
prn:prn3];
+ [asdf updateSatUsed:(((tmsg - 1) * 4) + 2) used:1];
+ } else {
+ [asdf updateSatSignalStrength:(((tmsg - 1) * 4) + 2)
signal:0];
+ [asdf updateSatPRNForSat:(((tmsg - 1) * 4) + 2) prn:0];
+ [asdf updateSatUsed:(((tmsg - 1) * 4) + 2) used:0];
+ }
+
+ if (prn4 < 200) {
+ [asdf updateSatSignalStrength:(((tmsg - 1) * 4) + 3)
signal:snr4];
+ [asdf updateSatPRNForSat:(((tmsg - 1) * 4) + 3)
prn:prn4];
+ [asdf updateSatUsed:(((tmsg - 1) * 4) + 3) used:1];
+ } else {
+ [asdf updateSatSignalStrength:(((tmsg - 1) * 4) + 3)
signal:snr4];
+ [asdf updateSatPRNForSat:(((tmsg - 1) * 4) + 3)
prn:prn4];
+ [asdf updateSatUsed:(((tmsg - 1) * 4) + 3) used:1];
+ }
+
+ }
+ }
+
x+=strlen(gpsbuf)+1;
}
@@ -473,8 +529,7 @@
[[WaveHelper trace] cut];
}
}
-
- GPSInfoController *asdf = [WaveHelper GPSInfoController];
+
if (asdf != NULL)
{
@@ -593,13 +648,71 @@
if (asdf != NULL)
{
[asdf updateDataNS:_ns.coordinates EW:_ew.coordinates
ELV:_elev.coordinates numSats:_numsat HDOP:_hdop VEL:_velkt];
+
+
+
////////////////////////////////////////////////////////////////////////////
+ // start of satellite PRN gathering
+
+ NSString *gpsbuf2, *thisprn;
+ NSRange range,range2;
+ int numsat;
+ int length;
+ int prn,signal,used;
+ NSArray *prns,*attrs;
+
+ if (write(fd, "Y\r\n", 3) < 3) {
+ NSLog(@"GPSd write failed");
+ return NO;
+ }
+
+ if((len = read(fd, &gpsbuf[0], MAX_GPSBUF_LEN)) < 0) {
+ NSLog(@"GPSd read failed");
+ return NO;
+ }
+
+ @try {
+ gpsbuf2 = [NSString stringWithCString:gpsbuf
length:len];
+
+ range = [gpsbuf2 rangeOfString:@":"];
+ range2 = NSMakeRange(range.location - 2,2);
+ numsat = [[gpsbuf2 substringWithRange:range2] intValue];
+ prns = [gpsbuf2 componentsSeparatedByString:@":"];
+
+ length = [prns count];
+ unsigned item;
+ for (item = 1; item <= 12; item++)
+ {
+ if (item < length - 1) {
+ thisprn = [prns objectAtIndex:item];
+ attrs = [thisprn
componentsSeparatedByString:@" "];
+ prn = [[attrs objectAtIndex:0]
intValue];
+ signal = [[attrs objectAtIndex:3]
intValue];
+ used = [[attrs objectAtIndex:4]
intValue];
+ [asdf updateSatSignalStrength:item
signal:signal];
+ [asdf updateSatPRNForSat:item prn:prn];
+ [asdf updateSatUsed:item used:used];
+ // pass out used
+ } else {
+ [asdf updateSatPRNForSat:item prn:0];
+ [asdf updateSatSignalStrength:item
signal:-1];
+ }
+ }
+ }
+ @catch (NSException *exception) {
+ unsigned item;
+ for (item = 1; item <= 12; item++) {
+ [asdf updateSatPRNForSat:item prn:0];
+ [asdf updateSatSignalStrength:item signal:-1];
+ }
}
-
- [date release];
- [subpool release];
+ }
+ [date release];
+ [subpool release];
return YES;
}
+
+
- (void) continousParse:(int) fd {
NSDate *date;
unsigned int i = 0;
Modified: trunk/Sources/WindowControllers/GPSInfoController.h
===================================================================
--- trunk/Sources/WindowControllers/GPSInfoController.h 2006-10-13 03:19:45 UTC
(rev 204)
+++ trunk/Sources/WindowControllers/GPSInfoController.h 2006-10-13 04:06:05 UTC
(rev 205)
@@ -23,11 +23,11 @@
*/
#import <Cocoa/Cocoa.h>
+#import "../Views/GPSSatInfo/GPSSatInfo.h"
@interface GPSInfoController : NSWindowController {
NSMenuItem* _showMenu;
- IBOutlet NSLevelIndicator* _sats_indicator;
IBOutlet NSLevelIndicator* _hdop_indicator;
IBOutlet NSLevelIndicator* _fix_indicator;
IBOutlet NSTextField* _fix_type;
@@ -39,7 +39,8 @@
IBOutlet NSPopUpButton* _altType;
IBOutlet NSProgressIndicator* _speedBar;
IBOutlet NSProgressIndicator* _altBar;
-
+ IBOutlet NSTextField* _hdop_field;
+ IBOutlet GPSSatInfo* _satinfo;
float _vel;
float _velFactor;
@@ -56,4 +57,7 @@
- (IBAction)updateSpeed:(id)sender;
- (IBAction)updateAlt:(id)sender;
- (IBAction)resetPeak:(id)sender;
+- (void)updateSatPRNForSat:(int)sat prn:(int)prn;
+- (void)updateSatSignalStrength:(int)sat signal:(int)signal;
+- (void)updateSatUsed:(int)sat used:(int)used;
@end
Modified: trunk/Sources/WindowControllers/GPSInfoController.m
===================================================================
--- trunk/Sources/WindowControllers/GPSInfoController.m 2006-10-13 03:19:45 UTC
(rev 204)
+++ trunk/Sources/WindowControllers/GPSInfoController.m 2006-10-13 04:06:05 UTC
(rev 205)
@@ -47,12 +47,11 @@
_altFactor = 1;
}
- [_sats_indicator setCriticalValue:3];
if (!sats || ew > 180 || ns > 90 || vel < 0) {
[_fix_indicator setFloatValue:0.1];
[_fix_type setStringValue:@"NO"];
[_hdop_indicator setIntValue:8];
- [_sats_indicator setIntValue:0];
+ [_hdop_field setStringValue:@""];
[_lat_field setStringValue:@""];
[_lon_field setStringValue:@""];
[_vel_field setStringValue:@""];
@@ -63,7 +62,7 @@
[_fix_indicator setFloatValue:0.5];
[_fix_type setStringValue:@"2D"];
[_hdop_indicator setFloatValue:hdop];
- [_sats_indicator setIntValue:sats];
+ [_hdop_field setStringValue:[NSString
stringWithFormat:@"%.1f",hdop]];
[_lat_field setStringValue:[NSString
stringWithFormat:@"%.5f",ns]];
[_lon_field setStringValue:[NSString
stringWithFormat:@"%.5f",ew]];
[_vel_field setStringValue:[NSString
stringWithFormat:@"%.5f",(_vel * _velFactor)]];
@@ -81,7 +80,7 @@
[_fix_indicator setFloatValue:1];
[_fix_type setStringValue:@"3D"];
[_hdop_indicator setFloatValue:hdop];
- [_sats_indicator setIntValue:sats];
+ [_hdop_field setStringValue:[NSString
stringWithFormat:@"%.1f",hdop]];
[_lat_field setStringValue:[NSString
stringWithFormat:@"%.5f",ns]];
[_lon_field setStringValue:[NSString
stringWithFormat:@"%.5f",ew]];
[_vel_field setStringValue:[NSString
stringWithFormat:@"%.5f",(_vel * _velFactor)]];
@@ -90,7 +89,7 @@
[_altBar setDoubleValue:(_alt * _altFactor)];
if ((_vel * _velFactor) > _maxvel) {
- _maxvel = _vel;
+ _maxvel = _vel * _velFactor;
[_speedBar setMaxValue:(_vel * _velFactor)];
}
@@ -102,6 +101,22 @@
}
}
+- (void)updateSatPRNForSat:(int)sat prn:(int)prn {
+ [_satinfo setPRNForSat:sat PRN:prn];
+ [_satinfo redraw];
+}
+
+- (void)updateSatSignalStrength:(int)sat signal:(int)signal {
+ [_satinfo setSignalForSat:sat signal:signal];
+ [_satinfo redraw];
+}
+
+- (void)updateSatUsed:(int)sat used:(int)used {
+ [_satinfo setUsedForSat:sat used:used];
+ [_satinfo redraw];
+}
+
+
- (IBAction)updateSpeed:(id)sender {
if ([[_speedType titleOfSelectedItem] isEqualToString:@"KT"]) {
_velFactor = 1;
Other related posts:
- » [kismac] [binaervarianz] r205 - in trunk: KisMAC.xcodeproj Resources/Nibs/English.lproj/GPSDialog.nib Sources/Support Sources/WindowControllers