Sync with tizen 2.4
[platform/core/messaging/msg-service.git] / plugin / mms_plugin / include / MmsPluginConnManWrapper.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 "MsgMutex.h"
21 #include "net_connection.h"
22
23 typedef enum {
24         MSG_CM_ERR_NONE = 0,
25         MSG_CM_ERR_UNKNOWN,
26  } cm_error_e;
27
28 class MmsPluginCmAgent
29 {
30 public:
31         static MmsPluginCmAgent *instance();
32
33         bool open();
34         void close();
35
36         bool getCmStatus() { return isCmOpened; }
37
38         void connection_profile_open_callback(connection_error_e result, void* user_data);
39         void connection_profile_close_callback(connection_error_e result, void* user_data);
40         void connection_profile_state_changed_cb(connection_profile_state_e state, void* user_data);
41         bool getInterfaceName(const char **deviceName);
42         bool getProxyAddr(const char **proxyAddr);
43         bool getHomeUrl(const char **homeURL);
44 private:
45         MmsPluginCmAgent();
46         ~MmsPluginCmAgent();
47
48         static MmsPluginCmAgent *pInstance;
49
50         void lock() { mx.lock(); }
51         void unlock() { mx.unlock(); }
52         void signal() { cv.signal(); }
53
54         void setCmStatus() { isCmOpened = true; }
55         void resetCmStatus() { isCmOpened = false; }
56
57         bool isCmOpened; //connection & profile connect
58         bool waitProfileOpen;
59         char *home_url;
60         char *interface_name;
61         char *proxy_address;
62         Mutex mx;
63         CndVar cv;
64
65 };
66
67 #endif //MMS_PLUGIN_CONNMAN_H