Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / platform / Tizen / Account / AccountWrapper.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        AccountWrapper.h
20  * @author      Jihwa Park (jh7979.park@samsung.com)
21  * @author      Sangtai Kim
22  * @version     0.1
23  */
24
25 #ifndef _TIZEN_ACCOUNT_WRAPPER_H_
26 #define _TIZEN_ACCOUNT_WRAPPER_H_
27
28 #include <string>
29 #include <dpl/shared_ptr.h>
30 #include <API/Account/EventAccount.h>
31 #include <API/Account/AccountServiceTypeProperty.h>
32 #include <API/Account/AccountServiceProviderProperty.h>
33 #include <API/Account/AccountServiceFilterProperty.h>
34
35 #include "account.h"
36
37 using namespace TizenApis::Api::Account;
38 using namespace WrtDeviceApis::Commons;
39
40 typedef struct
41 {
42         char* AccountId;
43         char* displayName;
44         char* icon;
45         bool enabled;
46         char* AccountServiceProviderId;
47         unsigned long credentialId;
48         GList* services; // AccountService_t
49         char* settings;
50 }UserAccount_t;
51
52 namespace TizenApis {
53 namespace Platform {
54 namespace Account{
55
56 class AccountWrapper
57 {
58         public:
59                 AccountWrapper();
60                 explicit AccountWrapper(const EventAccountPtr &event);
61                 virtual ~AccountWrapper();
62                 char  *convertAbstractAccountToPlatformAccount();
63                 EventAccountPtr convertPlatformAccountToAbstractAccount();
64                 EventAccountPtr convertPlatformAccountToAbstractAccount(account_h account_info);
65
66                 char  *getPlatformAccount() const;
67                 EventAccountPtr getAbstractAccount() const;
68                 void        freePlatformAccount();
69                 void        saveAccount();
70                 void        loadAccount(int id);
71                 void        deleteAccount();
72                 void            getAccountbyId();
73                 AccountServiceProviderPropertyArrayPtr          findProviders(std::string serviceTypeId);
74                 AccountServiceTypePropertyArrayPtr              findServiceTypes();
75                 void            setTags(std::vector<std::string> &tagsVector, GList* tags_list);
76
77                 AccountServiceTypePropertyPtr getAccountServiceTypebyId();
78                 AccountServiceProviderPropertyPtr getAccountServiceProviderProperty();
79
80                 EventAccountListPtr findAccountsByFilter(AccountServiceFilterPropertyPtr filterPropertyPtr);
81                 AccountServicesArrayPtr findServiceByFilter(AccountServiceFilterPropertyPtr filterPropertyPtr);
82
83                 //dummy method
84                 void setDummyServices();
85
86         protected:
87                 int  getIDFromPlatformAccount() const;
88
89                 void setIDFromPlatformAccount();
90                 void setIDToPlatformAccount();
91
92                 void setDisplayNameFromPlatformAccount();
93                 void setDisplayNameToPlatformAccount();
94
95                 void setIconPathFromPlatformAccount();
96                 void setIconPathToPlatformAccount();
97
98                 void setProviderNameFromPlatformAccount();
99                 void setProviderNameToPlatformAccount();
100
101                 void setEmailAddressFromPlatformAccount();
102                 void setEmailAddressToPlatformAccount();
103
104                 void setDomainNameFromPlatformAccount();
105                 void setDomainNameToPlatformAccount();
106
107                 void setAccountServices();
108                 void getAccountServices();
109
110         private:
111                 void displayAbstractAccount();     //only for debugging
112                 void displayPlatformAccount();     //only for debugging
113
114                 account_h m_platformAccount;
115                 EventAccountPtr m_abstractAccount;
116
117                 UserAccount_t* account;
118
119 //              static std::map<std::string, std::string> attrSvcMap;
120
121 };
122
123 typedef DPL::SharedPtr<AccountWrapper> AccountWrapperPtr;
124 }
125 }
126 }
127 #endif