2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @brief This is the header file of the _AppArg class.
21 * This header file contains the declarations of the _AppArg class.
24 #ifndef _FAPP_INTERNAL_APP_ARG_H_
25 #define _FAPP_INTERNAL_APP_ARG_H_
27 #include <FBaseObject.h>
28 #include <FAppTypes.h>
30 #include "FApp_Types.h"
32 typedef struct _bundle_t bundle;
34 namespace Tizen { namespace Base { namespace Collection {
40 namespace Tizen { namespace App
43 class _AppControlImpl;
44 class _AppMessageImpl;
45 class _SqlDataControlImpl;
46 class _MapDataControlImpl;
48 enum _DataControlRequestType
50 _DATACONTROL_REQUEST_TYPE_UNDEFINED = 0,
51 _DATACONTROL_REQUEST_TYPE_SQL_QUERY,
52 _DATACONTROL_REQUEST_TYPE_SQL_INSERT,
53 _DATACONTROL_REQUEST_TYPE_SQL_UPDATE,
54 _DATACONTROL_REQUEST_TYPE_SQL_DELETE,
55 _DATACONTROL_REQUEST_TYPE_MAP_QUERY,
56 _DATACONTROL_REQUEST_TYPE_MAP_INSERT,
57 _DATACONTROL_REQUEST_TYPE_MAP_UPDATE,
58 _DATACONTROL_REQUEST_TYPE_MAP_DELETE
61 #define OSP_K_LAUNCH_TYPE "__OSP_LAUNCH_TYPE__"
62 #define OSP_K_ARG "__OSP_ARGS__"
63 #define OSP_K_COND "__OSP_COND_NAME__"
64 #define OSP_K_APPID "__OSP_APPID__"
65 #define OSP_K_REQUEST_ID "__OSP_REQUEST_ID__"
66 #define OSP_K_APPCONTROL_INTERNAL_OPERATION "__OSP_APPCONTROL_INTERNAL_INTERNAL_OPERATION__"
67 #define OSP_K_DATACONTROL_PROVIDER "__OSP_DATACONTROL_PROVIDER__"
68 #define OSP_K_DATACONTROL_DATA "__OSP_DATACONTROL_DATA__"
69 #define OSP_K_DATACONTROL_REQUEST_TYPE "__OSP_DATACONTROL_REQUEST_TYPE__"
70 #define OSP_K_DATACONTROL_PROTOCOL_VERSION "__OSP_DATACONTROL_PROTOCOL_VERSION__"
76 class _OSP_EXPORT_ _AppArg
83 result Construct(const Tizen::Base::String& argText);
85 result Construct(const Tizen::Base::Collection::IList* pList);
87 result Construct(const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
89 result Construct(const _AppControlImpl& ac, const Tizen::Base::Collection::IList* pList);
91 result Construct(const _AppControlImpl& ac, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
93 result Construct(const _AppMessageImpl& msg, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime);
95 result Construct(const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
97 result Construct(const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
99 result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IList* pList);
101 result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IMap* pMap);
103 result Construct(bundle* b);
105 result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
106 result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList, const Tizen::Base::Collection::IMap* pMap);
108 Tizen::Base::Collection::ArrayList* GetArgListN(int num) const;
110 Tizen::Base::Collection::ArrayList* GetArgListN(void) const;
112 Tizen::Base::Collection::HashMap* GetArgMapN(void) const;
114 Tizen::Base::String GetValue(const char* key) const;
116 bundle* GetBundle(void) const
121 _AppHandler GetHandler(void) const
123 return GetHandler(__pBundle);
126 AppId GetCallerAppId(void) const;
128 int GetCallerPid(void) const
130 return GetCallerPid(__pBundle);
133 AppId GetCalleeAppId(void) const;
140 void UpdateAppId(const AppId& appId)
142 UpdateAppId(__pBundle, appId);
145 void UpdateRequestId(int reqId)
147 UpdateRequestId(__pBundle, reqId);
150 void UpdateKeyValue(const char* pKey, const Tizen::Base::String& value)
152 UpdateKeyValue(__pBundle, pKey, value);
155 result UpdateWindowHandle(long handle)
157 return UpdateWindowHandle(__pBundle, handle);
160 static int GetCallerPid(bundle* b);
162 static void Print(bundle* b);
164 static void PrintSvcHandle(void* svc);
166 static _AppHandler GetHandler(bundle* b);
168 static bundle* GetBundleFromSvc(void* svc);
170 static Tizen::Base::String GetRequestId(int num);
172 static int GetRequestId(const Tizen::Base::String& id);
174 static void UpdateAppId(bundle* b, const AppId& appid);
176 static int GetRequestIdFromBundle(bundle* p);
178 static void UpdateRequestId(bundle* b, int reqId);
180 static void UpdateKeyValue(bundle* b, const char* pKey, const Tizen::Base::String& value);
182 static void UpdateSubMode(bundle* b);
184 static bool IsSubMode(bundle* b);
186 static void UpdateServiceApp(bundle* b);
188 static bool IsServiceApp(bundle* b);
190 static result UpdateWindowHandle(bundle* b, long handle);
192 static Tizen::Base::Collection::ArrayList* GetListN(bundle* b, const char* key);
194 static result AddStrMap(bundle* b, const Tizen::Base::Collection::IMap* pMap);
196 static result FillMapFromList(Tizen::Base::Collection::IMap* pMap, const Tizen::Base::Collection::IList* pList);
198 static result FillLegacyAppControlResult(Tizen::Base::Collection::IList& list, int res, const Tizen::Base::Collection::IMap* pMap, const Tizen::Base::String& aId);
200 static result SetArgMap(bundle* pBundle, Tizen::Base::Collection::HashMap* pMap);
203 _AppArg(const _AppArg& value);
205 _AppArg& operator =(const _AppArg& source);
207 static result CreateNotificationArg(bundle* b, const Tizen::Base::String& arg);
209 static result CreateLaunchArg(bundle* b, const Tizen::Base::Collection::IList* pList);
211 static result CreateAppControlArg(bundle* b, const _AppControlImpl& ac, const Tizen::Base::Collection::IList* pList);
213 static result CreateAppControlArg(bundle* b, const _AppControlImpl& ac, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pList);
215 static result CreateAppControlArg(bundle* b, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
217 static result CreateSqlDataControlArg(bundle* b, const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
219 static result CreateMapDataControlArg(bundle* b, const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
221 static result CreateAppLaunchConditionArg(bundle* b, const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
223 static result CreateResultArg(bundle* b, const Tizen::Base::Collection::IList* pList);
225 static result CreateResultArg(bundle* b, const Tizen::Base::Collection::IMap* pList);
227 static result AddStrArray(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
229 static result AddStrArray(bundle* b, const Tizen::Base::String& key, const Tizen::Base::Collection::IList* pList);
231 static bundle* CreateBundleFromSvc(void* svc);
233 static inline void AddListFromBundle(Tizen::Base::Collection::ArrayList* pList, bundle* b, const char* key);
235 static result SetArgList(bundle* pBundle, Tizen::Base::Collection::ArrayList* pList);
243 #endif //_FAPP_INTERNAL_APP_ARG_H_