1
wei
2021-01-21 62d098cb78296feaa6f786a20748921338db838c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 
#if TARGET_OS_IOS
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
 
 
/** 
 * Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
 *
 * @see http://nshipster.com/ns_enum-ns_options/
 **/
#ifndef NS_ENUM
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#endif
 
extern NSString *const kTuyaSmartReachabilityChangedNotification;
 
typedef NS_ENUM(NSInteger, TYSDKNetworkStatus) {
    // Apple NetworkStatus Compatible Names.
    TYSDKNotReachable = 0,
    TYSDKReachableViaWiFi = 2,
    TYSDKReachableViaWWAN = 1
};
 
@class TuyaSmartReachability;
 
typedef void (^TuyaSmartNetworkReachable)(TuyaSmartReachability * reachability);
typedef void (^TuyaSmartNetworkUnreachable)(TuyaSmartReachability * reachability);
 
 
@interface TuyaSmartReachability : NSObject
 
@property (nonatomic, copy) TuyaSmartNetworkReachable    reachableBlock;
@property (nonatomic, copy) TuyaSmartNetworkUnreachable  unreachableBlock;
 
@property (nonatomic, assign) BOOL reachableOnWWAN;
 
 
+(TuyaSmartReachability*)reachabilityWithHostname:(NSString*)hostname;
// This is identical to the function above, but is here to maintain
//compatibility with Apples original code. (see .m)
+(TuyaSmartReachability*)reachabilityWithHostName:(NSString*)hostname;
+(TuyaSmartReachability*)reachabilityForInternetConnection;
+(TuyaSmartReachability*)reachabilityWithAddress:(void *)hostAddress;
+(TuyaSmartReachability*)reachabilityForLocalWiFi;
 
-(TuyaSmartReachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
 
-(BOOL)startNotifier;
-(void)stopNotifier;
 
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
 
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
 
-(TYSDKNetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
 
@end
 
#endif