Fix issue : fail to make thumbnail
[platform/core/messaging/msg-service.git] / plugin / mms_plugin / include / MmsPluginUserAgent.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_USERAGENT_H
18 #define MMS_PLUGIN_USERAGENT_H
19
20 #include "MsgThread.h"
21 #include "MsgMutex.h"
22 #include "MsgQueue.h"
23 #include "MmsPluginTypes.h"
24
25 class MmsPluginUaManager: public MsgThread {
26         public:
27                 static MmsPluginUaManager *instance();
28                 virtual void start();
29
30                 void addMmsReqEntity(mmsTranQEntity *req);
31                 void getMmsPduData(mmsTranQEntity *qEntity);
32                 bool processReceivedData(int msgId, char *pRcvdBody, int rcvdBodyLen, char *retrievedFilePath);
33
34                 void lock() { mx.lock(); }
35                 void unlock() { mx.unlock(); }
36                 void wait() { cv.wait(mx.pMsgMutex()); }
37                 void signal() { cv.signal(); }
38
39         private:
40                 MmsPluginUaManager();
41                 ~MmsPluginUaManager();
42
43                 static MmsPluginUaManager *pInstance;
44                 virtual void run();
45
46                 MsgMutex mx;
47                 MsgCndVar cv;
48
49                 MMS_NET_ERROR_T submitHandler(mmsTranQEntity *qEntity);
50                 MMS_NET_ERROR_T waitingConf(mmsTranQEntity *qEntity);
51
52                 /* condition values */
53                 bool running;           /* flag for thread running */
54
55                 MsgSimpleQ<mmsTranQEntity> mmsTranQ; /* transaction q for mms plugin */
56 };
57
58 #endif /* MMS_PLUGIN_USERAGENT_H */