Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Account / IAccountService.h
1 /*
2  * Copyright (c) 2011 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
18 /**
19  * @file        IAccount.h
20  * @author      Lukasz Marek (l.marek@samsung.com)
21  * @version     0.1
22  */
23
24 #ifndef _ABSTRACT_LAYER_IACCOUNT_H_
25 #define _ABSTRACT_LAYER_IACCOUNT_H_
26
27 #include <string>
28 #include <dpl/log/log.h>
29 #include <dpl/shared_ptr.h>
30 //#include "CalendarEvent.h"
31 //#include "EventFilter.h"
32 #include "IEventCreateAccount.h"
33 #include "IEventAddAccount.h"
34 #include "IEventDeleteAccount.h"
35 #include "IEventFindAccounts.h"
36 #include "IEventUpdateAccount.h"
37 #include "IEventGetAccountById.h"
38 #include "IEventGetServiceTypeById.h"
39 #include "IEventGetProviderById.h"
40 #include "IEventFindProviders.h"
41
42 #include "OnAddEventsChanged.h"
43 #include "OnUpdateEventsChanged.h"
44 #include "OnDeleteEventsChanged.h"
45
46 namespace TizenApis {
47 namespace Api {
48 namespace Account{
49 class IAccountService :
50     public WrtDeviceApis::Commons::EventRequestReceiver< IEventDeleteAccount >,
51     public WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateAccount >,
52     public WrtDeviceApis::Commons::EventRequestReceiver< IEventFindAccounts >,
53     public WrtDeviceApis::Commons::EventRequestReceiver< IEventCreateAccount >,
54     public WrtDeviceApis::Commons::EventRequestReceiver< IEventAddAccount >
55 {
56   public:
57
58     typedef enum
59     {
60         TYPE_NONE,
61      //   TYPE_SIM,
62      //   TYPE_TOKEN,
63      //   TYPE_HW,
64         TYPE_INTERNET
65      //   TYPE_LOCAL,
66      //   TYPE_OTHER
67     } AccountType;
68
69     IAccountService();
70     virtual ~IAccountService();
71     virtual void                createAccount(IEventCreateAccountPtr &event);
72     virtual void                addAccount(IEventAddAccountPtr &event);
73     virtual void                updateAccount(IEventUpdateAccountPtr &event);
74     virtual void                deleteAccount(IEventDeleteAccountPtr &event);
75     virtual void                findAccounts(IEventFindAccountsPtr &event);
76
77
78     virtual std::string         getName() const
79     {
80         return m_name;
81     }
82     virtual void                setName(const std::string &value)
83     {
84         m_name = value;
85     }
86     virtual AccountType        getType() const
87     {
88         return m_type;
89     }
90     virtual void                setType(const AccountType value)
91     {
92         m_type = value;
93     }
94     virtual int                 getId() const
95     {
96         return m_id;
97     }
98     virtual void                setId(const int value)
99     {
100         m_id = value;
101     }
102
103    //TODO: check the meaning of emitters as below.
104     virtual OnAddEventsChangedEmitterPtr getAddEmitter() const
105     {
106         return m_addEmitter;
107     }
108     virtual void                setAddEmitter(OnAddEventsChangedEmitterPtr value)
109     {
110         m_addEmitter = value;
111     }
112     virtual OnUpdateEventsChangedEmitterPtr getUpdateEmitter() const
113     {
114         return m_updateEmitter;
115     }
116     virtual void                setUpdateEmitter(OnUpdateEventsChangedEmitterPtr value)
117     {
118         m_updateEmitter = value;
119     }
120         virtual OnDeleteEventsChangedEmitterPtr getDeleteEmitter() const
121     {
122         return m_deleteEmitter;
123     }
124     virtual void                setDeleteEmitter(OnDeleteEventsChangedEmitterPtr value)
125     {
126         m_deleteEmitter = value;
127     }
128   protected:
129     int m_id;
130     std::string m_name;
131     AccountType m_type;
132     OnAddEventsChangedEmitterPtr m_addEmitter;
133     OnUpdateEventsChangedEmitterPtr m_updateEmitter;
134     OnDeleteEventsChangedEmitterPtr m_deleteEmitter;
135
136     virtual void OnRequestReceived(const IEventDeleteAccountPtr &event) = 0;
137     virtual void OnRequestReceived(const IEventUpdateAccountPtr &event) = 0;
138     virtual void OnRequestReceived(const IEventFindAccountsPtr &event) = 0;
139     virtual void OnRequestReceived(const IEventCreateAccountPtr &event) = 0;
140     virtual void OnRequestReceived(const IEventAddAccountPtr &event) = 0;
141 };
142
143 typedef DPL::SharedPtr<IAccountService> IAccountServicePtr;
144 }
145 }
146 }
147
148 #endif /* _ABSTRACT_LAYER_IACCOUNT_H_ */