All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AndroidConnectivityService.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include <jni.h>
6 #include "IConnectivityService.h"
7 #include "CallbackCollection.h"
8 #include <string>
9 
10 struct AndroidNativeState;
11 
12 namespace Eegeo
13 {
14  namespace Android
15  {
17  {
18  public:
21 
22  bool HasConnectivity();
23  Web::ConnectivityType GetConnectivityType();
24  void SetConnectivityType(const int connectivityType, const std::string& wifiSSID);
25 
26  const std::string& GetSSIDForCurrentWifi();
27 
28  void RegisterConnectivityChangedCallback(Helpers::ICallback1<const bool&>& callback);
29  void UnregisterConnectivityChangedCallback(Helpers::ICallback1<const bool&>& callback);
30 
31  private:
32  AndroidNativeState* m_pNativeState;
33 
34  jclass m_networkChangeReceiverClass;
35  jobject m_networkChangeReceiverInstance;
36 
37  jclass m_networkChangeReceiverRegistrationServiceClass;
38  jobject m_networkChangeReceiverRegistrationServiceInstance;
39 
40  std::string m_currentSSID;
41 
42  bool m_hasConnectivity;
43  int m_connectivityType;
44 
46 
47  void SetHasConnectivity(const bool hasConnectivity, const std::string& wifiSSID);
48  void GetInitialConnectivity();
49  };
50  }
51 }
52 
53 extern "C"
54 {
55  JNIEXPORT void JNICALL Java_com_eegeo_web_ConnectivityServiceJniMethods_SetConnectivityType(
56  JNIEnv* jenv, jobject obj,
57  jlong nativeObjectPtr,
58  jint connectivityType,
59  jstring jWifiSSID);
60 }