apply FSL(Flora Software License)
[profile/ivi/download-provider.git] / src / include / download-provider-network.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file        download-provider-network.h
19  * @author      Jungki Kwak (jungki.kwak@samsung.com)
20  * @brief       Download netowkr manager
21  */
22
23 #ifndef DOWNLOAD_PROVIDER_NETWORK_H
24 #define DOWNLOAD_PROVIDER_NETWORK_H
25
26 #include "vconf.h"
27 #include "vconf-keys.h"
28 #include "download-provider-event.h"
29
30 class NetMgr {
31 public:
32         static NetMgr& getInstance(void) {
33                 static NetMgr inst;
34                 return inst;
35         }
36         void initNetwork(void);
37         void deinitNetwork(void);
38         void netStatusChanged(void);
39         void netConfigChanged(void);
40         inline void subscribe(Observer *o) { m_subject.attach(o); }
41         inline void deSubscribe(Observer *o) { m_subject.detach(o); }
42         static void netStatusChangedCB(keynode_t *keynode, void *data);
43         static void netConfigChangedCB(keynode_t *keynode, void *data);
44 private:
45         NetMgr(void);
46         ~NetMgr(void);
47         int getConnectionState(void);
48         int getCellularStatus(void);
49         int getWifiStatus(void);
50         void getProxy(void);
51         void getIPAddress(void);
52         inline void notify() { m_subject.notify(); }
53         int m_netStatus;
54         Subject m_subject;
55 };
56
57 #endif