9cf010dba6cbe87c364356a412c5041ad94625d6
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Account / JSAccountManager.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                JSAccountManager.h
20 * @author               Jihwa Park (jh7979.park@samsung.com)
21  * @author      Sangtai Kim
22  * @version     0.1
23  */
24
25 #ifndef _JS_TIZEN_ACCOUNT_MANAGER_H_
26 #define _JS_TIZEN_ACCOUNT_MANAGER_H_
27
28 #include <JavaScriptCore/JavaScript.h>
29 #include <CommonsJavaScript/PrivateObject.h>
30 #include <API/Account/IAccountManager.h>
31 #include <API/Account/IAccountService.h>
32
33 using namespace TizenApis::Api::Account;
34 using namespace WrtDeviceApis::Commons;
35 using namespace WrtDeviceApis::CommonsJavaScript;
36
37 namespace TizenApis {
38 namespace Tizen1_0 {
39 namespace Account{
40 typedef PrivateObject<IAccountManagerPtr, NoOwnership> AccountManagerPrivObject;
41
42 class JSAccountManager
43 {
44   public:
45
46     enum AccountType
47     {
48         TYPE_NONE,      //0
49      //   TYPE_SIM,   //1
50         TYPE_INTERNET,  //2//1
51         INVALID_TYPE = 10000
52     };
53
54     static const JSClassDefinition* getClassInfo();
55     static const JSClassRef getClassRef();
56
57   private:
58     /**
59      * This structure describes a statically declared function property.
60      */
61     static JSStaticFunction m_function[];
62
63     /**
64      * This member variable contains the initialization values for the
65      * properties of this class. The values are given according to
66      * the data structure JSPropertySpec
67      */
68     static JSStaticValue m_property[];
69
70     /**
71      * This structure contains properties and callbacks
72      * that define a type of object.
73      */
74     static JSClassDefinition m_classInfo;
75
76     static JSClassRef m_jsClassRef;
77
78     /**
79      * The callback invoked when an object is first created.
80      */
81     static void initialize(JSContextRef context,
82             JSObjectRef object);
83
84     /**
85      * The callback invoked when an object is finalized.
86      */
87     static void finalize(JSObjectRef object);
88
89     /**
90      * Get Accounts.
91      */
92
93     static JSValueRef addAccount(JSContextRef context,
94             JSObjectRef object,
95             JSObjectRef thisObject,
96             size_t argumentCount,
97             const JSValueRef arguments[],
98             JSValueRef* exception);
99
100         static JSValueRef addAccountlistener(JSContextRef context,
101                 JSObjectRef object,
102                 JSObjectRef thisObject,
103                 size_t argumentCount,
104                 const JSValueRef arguments[],
105                 JSValueRef* exception);
106
107         static JSValueRef removeAccountlistener(JSContextRef context,
108                 JSObjectRef object,
109                 JSObjectRef thisObject,
110                 size_t argumentCount,
111                 const JSValueRef arguments[],
112                 JSValueRef* exception);
113
114         static JSValueRef getAccountById(JSContextRef context,
115                 JSObjectRef object,
116                 JSObjectRef thisObject,
117                 size_t argumentCount,
118                 const JSValueRef arguments[],
119                 JSValueRef* exception);
120
121         static JSValueRef getServiceTypeById(JSContextRef context,
122                 JSObjectRef object,
123                 JSObjectRef thisObject,
124                 size_t argumentCount,
125                 const JSValueRef arguments[],
126                 JSValueRef* exception);
127
128         static JSValueRef getProviderById(JSContextRef context,
129                 JSObjectRef object,
130                 JSObjectRef thisObject,
131                 size_t argumentCount,
132                 const JSValueRef arguments[],
133                 JSValueRef* exception);
134
135         static JSValueRef findAccountsByServiceType(JSContextRef context,
136                 JSObjectRef object,
137                 JSObjectRef thisObject,
138                 size_t argumentCount,
139                 const JSValueRef arguments[],
140                 JSValueRef* exception);
141
142         static JSValueRef findAccountsByTags(JSContextRef context,
143                 JSObjectRef object,
144                 JSObjectRef thisObject,
145                 size_t argumentCount,
146                 const JSValueRef arguments[],
147                 JSValueRef* exception);
148
149         static JSValueRef findServicesByTags(JSContextRef context,
150                 JSObjectRef object,
151                 JSObjectRef thisObject,
152                 size_t argumentCount,
153                 const JSValueRef arguments[],
154                 JSValueRef* exception);
155
156         static JSValueRef findProviders(JSContextRef context,
157                 JSObjectRef object,
158                 JSObjectRef thisObject,
159                 size_t argumentCount,
160                 const JSValueRef arguments[],
161                 JSValueRef* exception);
162
163         static JSValueRef findServiceTypes(JSContextRef context,
164                 JSObjectRef object,
165                 JSObjectRef thisObject,
166                 size_t argumentCount,
167                 const JSValueRef arguments[],
168                 JSValueRef* exception);
169
170     static JSValueRef getTypeProperty(JSContextRef context,
171             JSObjectRef object,
172             JSStringRef propertyName,
173             JSValueRef* exception);
174
175
176
177
178
179 };
180 }
181 }
182 }
183 #endif /* _JS_TIZEN_ACCOUNT_MANAGER_H_ */