Update change log and spec for wrt-plugins-tizen_0.4.66
[framework/web/wrt-plugins-tizen.git] / src / DataControl / MappedDataControlConsumer.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef TIZENAPIS_PLATFORM_MAPPED_DATACONTRIL_CONSUMER_H_
19 #define TIZENAPIS_PLATFORM_MAPPED_DATACONTRIL_CONSUMER_H_
20
21 #include <vector>
22 #include <string>
23 #include <dpl/noncopyable.h>
24 #include <bundle.h>
25 #include "IMappedDataControlConsumer.h"
26 #include "DataControlFactory.h"
27 #include <dpl/mutex.h>
28
29 namespace DeviceAPI {
30 namespace DataControl {
31
32 class MappedDataControlConsumer : public IMappedDataControlConsumer
33 {
34         friend class DataControl::DataControlFactory;
35
36 public:
37
38         virtual void addValue(const EventAddValuePtr& event);
39         virtual void removeValue(const EventRemoveValuePtr& event);
40         virtual void getValue(const EventGetValuePtr& event);
41         virtual void updateValue(const EventUpdateValuePtr& event);
42         
43         virtual ~MappedDataControlConsumer();
44
45         std::string getType();
46         std::string getDataId();
47         std::string getProviderId();
48
49         void handlePendingEvent(const EventAddValuePtr& event);
50         void handlePendingEvent(const EventRemoveValuePtr& event);
51         void handlePendingEvent(const EventGetValuePtr& event);
52         void handlePendingEvent(const EventUpdateValuePtr& event);
53         void handleCommonErrorEvent(void* userData, unsigned int code, std::string msg);
54 private:
55         std::string m_type;
56         std::string m_dataId;
57         std::string m_providerId;
58         std::string m_appId;
59         std::string m_ProviderPkgId;
60         std::string m_currentAppId;
61         
62         bool checkReqIdUniqueness(unsigned int reqId);
63
64         static DPL::Mutex m_mutex;
65
66
67
68 protected:
69         MappedDataControlConsumer(std::string& provId, std::string& dataId, std::string& type);
70
71         virtual void OnRequestReceived(const EventAddValuePtr& event);
72         virtual void OnRequestReceived(const EventRemoveValuePtr& event);
73         virtual void OnRequestReceived(const EventGetValuePtr& event);
74         virtual void OnRequestReceived(const EventUpdateValuePtr& event);
75
76
77
78 private:
79
80
81 };
82
83
84
85
86 }
87 }
88
89 #endif 
90