All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
iOSConnectivityService.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "IConnectivityService.h"
6 #include "Reachability.h"
7 #include "Types.h"
8 #include "CallbackCollection.h"
9 
10 namespace Eegeo
11 {
12  namespace iOS
13  {
14  class iOSConnectivityService;
15  }
16 }
17 
18 @interface ConnectivityQuerier : NSObject {
19  Reachability* reachability;
20  NetworkStatus internetStatus;
22 }
23 
24 - (NSString *) getCurrentWifiHotSpotName;
25 
26 - (id) initWithConnectivityCallback: (Eegeo::Helpers::TCallback1<Eegeo::iOS::iOSConnectivityService, const bool&>*) callback;
27 - (bool)isConnected;
28 - (bool)isWifi;
29 
30 - (void) handleNetworkChange_Callback:(NSNotification *)notice;
31 @end
32 
34 {
35  ConnectivityQuerier* pQuerier;
36 };
37 
38 namespace Eegeo
39 {
40  namespace iOS
41  {
42  class iOSConnectivityService : public Eegeo::Web::IConnectivityService, public Eegeo::NonCopyable
43  {
44  public:
45  iOSConnectivityService();
46 
47  ~iOSConnectivityService();
48 
49  bool HasConnectivity();
50 
51  Web::ConnectivityType GetConnectivityType();
52 
53  void RegisterConnectivityChangedCallback(Helpers::ICallback1<const bool&>& callback);
54  void UnregisterConnectivityChangedCallback(Helpers::ICallback1<const bool&>& callback);
55 
56  void SetHasConnectivity(const bool& hasConnectivity);
57 
58  void ForceConnectivityChangedCallback();
59 
60  const std::string& GetSSIDForCurrentWifi();
61 
62  private:
63  bool m_hasConnectivity;
64  std::string m_currentSSID;
65  ConnectivityQuerierWrapper* m_pQuerierWrapper;
66  Helpers::CallbackCollection1<const bool&> m_callbacks;
67 
68  static void NetworkChangeCallback(CFNotificationCenterRef center, void* observer, CFStringRef name, const void *object, CFDictionaryRef userInfo);
70  };
71  }
72 }