WHPingTester.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // WHPingTester.h
  3. // BigVPN
  4. //
  5. // Created by wanghe on 2017/5/11.
  6. // Copyright © 2017年 wanghe. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "SimplePing.h"
  10. @protocol WHPingDelegate <NSObject>
  11. @optional
  12. - (void) didPingSucccessWithTime:(float)time withError:(NSError*) error;
  13. - (void) didPingfialewithError:(NSError*)error;
  14. @end
  15. @interface WHPingTester : NSObject<SimplePingDelegate>
  16. @property (nonatomic, weak, readwrite) id<WHPingDelegate> delegate;
  17. - (instancetype) init NS_UNAVAILABLE;
  18. - (instancetype) initWithHostName:(NSString*)hostName NS_DESIGNATED_INITIALIZER;
  19. @property(nonatomic, assign) NSInteger countdownTime; //设置倒计时时间,10s执行一次
  20. - (void) startPing;
  21. - (void) stopPing;
  22. @end
  23. typedef NS_ENUM(NSUInteger, WHPingStatus){
  24. WHPingStatusSending = 0 << 0,
  25. WHPingStatusTimeout = 1 << 1,
  26. WHPingStatusSended = 2 << 2,
  27. };
  28. @interface WHPingItem : NSObject
  29. //@property(nonatomic, assign) WHPingStatus status;
  30. @property(nonatomic, assign) uint16_t sequence;
  31. @property(nonatomic, strong) NSDate* beginDate;
  32. @end