Modify flora license version.
[platform/core/messaging/msg-service.git] / plugin / mms_plugin / include / MmsPluginConnManWrapper.h
1 /*
2 * Copyright 2012-2013  Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.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 #ifndef MMS_PLUGIN_CONNMAN_H
18 #define MMS_PLUGIN_CONNMAN_H
19
20 #include <network-cm-intf.h>
21 #include <network-pm-intf.h>
22 #include "MsgMutex.h"
23
24 class MmsPluginCmAgent
25 {
26 public:
27         static MmsPluginCmAgent *instance();
28
29         /* open and close are occasionally called when transaction begins and ends */
30         bool open();
31         void close();
32
33         bool getCmStatus() { return isCmOpened; }
34
35         void processCBdatas(net_event_info_t *event_cb, void *user_data);
36
37         bool getDeviceName(char *deviceName);
38         bool getHomeURL(char *homeURL);
39         bool getProxyAddr(char *proxyAddr);
40         int getProxyPort();
41
42 private:
43         MmsPluginCmAgent();
44         ~MmsPluginCmAgent();
45
46         static MmsPluginCmAgent *pInstance;
47
48         /* register/deregister is called once at initialization/finalization of MMS plugin */
49         bool registration();
50         void deregistration();
51
52
53         void lock() { mx.lock(); }
54         void unlock() { mx.unlock(); }
55         void signal() { cv.signal(); }
56         void setCmStatus() { isCmOpened = true; }
57         void resetCmStatus() { isCmOpened = false; }
58
59         // shared variable between CmAgent and Dnet callback
60         bool isCmOpened;
61         Mutex mx;
62         CndVar cv;
63
64         net_profile_info_t mmsProfile;
65 };
66
67 #endif //MMS_PLUGIN_CONNMAN_H