Skip to content

Commit

Permalink
Major update 1.1
Browse files Browse the repository at this point in the history
Also:
- (hopefully) better consistency
- less stopping when the connection is dead.
- show latest 10 ping results in menu, including in-flight pings
- killed old useless stats
- show "(over 10s)" when it's been 10 seconds since the last good ping
- show "(no response)" when the past 10 pings have all failed
- host the zip on github
- update screenshow
  • Loading branch information
kalleboo committed Jul 16, 2013
1 parent 8347986 commit 561a6ce
Show file tree
Hide file tree
Showing 13 changed files with 741 additions and 277 deletions.
Binary file added PingMenu.app.zip
Binary file not shown.
7 changes: 7 additions & 0 deletions PingMenu.xcodeproj/project.pbxproj
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
1231FE9A179591A500CC0D12 /* PingEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 1231FE99179591A500CC0D12 /* PingEvent.m */; };
12C9F8BC13E6549300739017 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12C9F8BB13E6549300739017 /* Cocoa.framework */; };
12C9F8C613E6549300739017 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 12C9F8C413E6549300739017 /* InfoPlist.strings */; };
12C9F8C813E6549300739017 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 12C9F8C713E6549300739017 /* main.m */; };
Expand All @@ -17,6 +18,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
1231FE98179591A500CC0D12 /* PingEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PingEvent.h; sourceTree = "<group>"; };
1231FE99179591A500CC0D12 /* PingEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PingEvent.m; sourceTree = "<group>"; };
12C9F8B713E6549300739017 /* PingMenu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PingMenu.app; sourceTree = BUILT_PRODUCTS_DIR; };
12C9F8BB13E6549300739017 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
12C9F8BE13E6549300739017 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -91,6 +94,8 @@
12C9F8DC13E6586600739017 /* SimplePing.h */,
12C9F8DD13E6586600739017 /* SimplePing.m */,
12C9F8C213E6549300739017 /* Supporting Files */,
1231FE98179591A500CC0D12 /* PingEvent.h */,
1231FE99179591A500CC0D12 /* PingEvent.m */,
);
path = PingMenu;
sourceTree = "<group>";
Expand Down Expand Up @@ -170,6 +175,7 @@
12C9F8C813E6549300739017 /* main.m in Sources */,
12C9F8CF13E6549300739017 /* PingMenuAppDelegate.m in Sources */,
12C9F8DE13E6586600739017 /* SimplePing.m in Sources */,
1231FE9A179591A500CC0D12 /* PingEvent.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -289,6 +295,7 @@
12C9F8D713E6549300739017 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectIdentifier</key>
<string>8D0CB63F-EDCA-4F85-AF2C-4C64EAFE8F2E</string>
<key>IDESourceControlProjectName</key>
<string>PingMenu</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>72D60F9D-BE25-49C0-BD29-959F89AAC4B7</key>
<string>https://github.com/kalleboo/PingMenu.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>PingMenu.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>72D60F9D-BE25-49C0-BD29-959F89AAC4B7</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/kalleboo/PingMenu.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>72D60F9D-BE25-49C0-BD29-959F89AAC4B7</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>72D60F9D-BE25-49C0-BD29-959F89AAC4B7</string>
<key>IDESourceControlWCCName</key>
<string>PingMenu</string>
</dict>
</array>
</dict>
</plist>
Binary file not shown.
37 changes: 37 additions & 0 deletions PingMenu/PingEvent.h
@@ -0,0 +1,37 @@
//
// PingEvent.h
// PingMenu
//
// Created by Karl Baron on 2013/07/16.
//
//

#import <Foundation/Foundation.h>


typedef enum PingEventState {
PingEventStateUnknown,
PingEventStateSent,
PingEventStateReceived,
PingEventStateSendError,
PingEventStateErrorUnexpectedPacket
} PingEventState;

@interface PingEvent : NSObject {
unsigned int sequenceNr;
PingEventState state;
NSDate* sentTime;
NSDate* returnTime;
NSString* resultError;
}

@property (nonatomic,assign) unsigned int sequenceNr;
@property (nonatomic,assign) PingEventState state;
@property (nonatomic,retain) NSDate* sentTime;
@property (nonatomic,retain) NSDate* returnTime;
@property (nonatomic,retain) NSString* resultError;

-(NSString*) stateName;
-(double) timeSinceSent;

@end
44 changes: 44 additions & 0 deletions PingMenu/PingEvent.m
@@ -0,0 +1,44 @@
//
// PingEvent.m
// PingMenu
//
// Created by Karl Baron on 2013/07/16.
//
//

#import "PingEvent.h"

@implementation PingEvent
@synthesize sequenceNr;
@synthesize state;
@synthesize sentTime;
@synthesize returnTime;
@synthesize resultError;

-(NSString*) stateName {
switch (self.state) {
case PingEventStateUnknown:
return @"Sending";
case PingEventStateSent:
return @"Sent";
case PingEventStateReceived:
return @"Success";
case PingEventStateSendError:
return @"Error";
default:
return @"Unknown";
break;
}
}

-(double) timeSinceSent {
if (!self.sentTime)
return 0;

if (!self.returnTime)
return [NSDate timeIntervalSinceReferenceDate]-[self.sentTime timeIntervalSinceReferenceDate];

return [self.returnTime timeIntervalSinceReferenceDate]-[self.sentTime timeIntervalSinceReferenceDate];
}

@end
4 changes: 2 additions & 2 deletions PingMenu/PingMenu-Info.plist
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
35 changes: 24 additions & 11 deletions PingMenu/PingMenuAppDelegate.h
Expand Up @@ -13,30 +13,43 @@
NSWindow *window;
NSStatusItem* theItem;
NSMenu* theMenu;
NSMenuItem* menuLine1;
NSMenuItem* menuLine2;
SimplePing* pinger;
NSTimer* pingTimer;
NSTimer* updateTimer;
NSMutableDictionary* pings;
int sent;
int received;
int errored;
int couldntSend;
NSString* currentTitle;
NSTimer* slowPingTimer;
double lastDiff;
BOOL didStart;
BOOL didStartHasSucceeded;
NSMenuItem* menuRow0;
NSMenuItem* menuRow1;
NSMenuItem* menuRow2;
NSMenuItem* menuRow3;
NSMenuItem* menuRow4;
NSMenuItem* menuRow5;
NSMenuItem* menuRow6;
NSMenuItem* menuRow7;
NSMenuItem* menuRow8;
NSMenuItem* menuRow9;
}

@property (assign) IBOutlet NSWindow *window;
@property (retain,nonatomic) NSStatusItem* theItem;
@property (assign) IBOutlet NSMenu* theMenu;
@property (assign) IBOutlet NSMenuItem* menuLine1;
@property (assign) IBOutlet NSMenuItem* menuLine2;
@property (retain,nonatomic) SimplePing* pinger;
@property (retain,nonatomic) NSTimer* pingTimer;
@property (retain,nonatomic) NSTimer* updateTimer;
@property (retain,nonatomic) NSMutableDictionary* pings;
@property (retain,nonatomic) NSString* currentTitle;
@property (retain,nonatomic) NSTimer* slowPingTimer;
@property (assign) IBOutlet NSMenuItem* menuRow0;
@property (assign) IBOutlet NSMenuItem* menuRow1;
@property (assign) IBOutlet NSMenuItem* menuRow2;
@property (assign) IBOutlet NSMenuItem* menuRow3;
@property (assign) IBOutlet NSMenuItem* menuRow4;
@property (assign) IBOutlet NSMenuItem* menuRow5;
@property (assign) IBOutlet NSMenuItem* menuRow6;
@property (assign) IBOutlet NSMenuItem* menuRow7;
@property (assign) IBOutlet NSMenuItem* menuRow8;
@property (assign) IBOutlet NSMenuItem* menuRow9;

-(IBAction)quitMe:(id)sender;

Expand Down

0 comments on commit 561a6ce

Please sign in to comment.