2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
20 * @brief This is the header file of the _AppArg class.
22 * This header file contains the declarations of the _AppArg class.
25 #ifndef _FAPP_INTERNAL_APP_ARG_H_
26 #define _FAPP_INTERNAL_APP_ARG_H_
30 #include <FBaseObject.h>
31 #include <FAppTypes.h>
33 #include "FApp_Types.h"
35 namespace Tizen { namespace Base { namespace Collection {
41 namespace Tizen { namespace App
44 class _AppControlImpl;
45 class _AppMessageImpl;
46 class _SqlDataControlImpl;
47 class _MapDataControlImpl;
49 enum _DataControlRequestType
51 _DATACONTROL_REQUEST_TYPE_UNDEFINED = 0,
52 _DATACONTROL_REQUEST_TYPE_SQL_QUERY,
53 _DATACONTROL_REQUEST_TYPE_SQL_INSERT,
54 _DATACONTROL_REQUEST_TYPE_SQL_UPDATE,
55 _DATACONTROL_REQUEST_TYPE_SQL_DELETE,
56 _DATACONTROL_REQUEST_TYPE_MAP_QUERY,
57 _DATACONTROL_REQUEST_TYPE_MAP_INSERT,
58 _DATACONTROL_REQUEST_TYPE_MAP_UPDATE,
59 _DATACONTROL_REQUEST_TYPE_MAP_DELETE
62 #define OSP_K_LAUNCH_TYPE "__OSP_LAUNCH_TYPE__"
63 #define OSP_K_ARG "__OSP_ARGS__"
64 #define OSP_K_COND "__OSP_COND_NAME__"
65 #define OSP_K_APPID "__OSP_APPID__"
66 #define OSP_K_REQUEST_ID "__OSP_REQUEST_ID__"
67 #define OSP_K_APPCONTROL_INTERNAL_OPERATION "__OSP_APPCONTROL_INTERNAL_INTERNAL_OPERATION__"
68 #define OSP_K_DATACONTROL_PROVIDER "__OSP_DATACONTROL_PROVIDER__"
69 #define OSP_K_DATACONTROL_DATA "__OSP_DATACONTROL_DATA__"
70 #define OSP_K_DATACONTROL_REQUEST_TYPE "__OSP_DATACONTROL_REQUEST_TYPE__"
77 class _OSP_EXPORT_ _AppArg
84 result Construct(const Tizen::Base::String& argText);
86 result Construct(const Tizen::Base::Collection::IList* pList);
88 result Construct(const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
90 result Construct(const _AppControlImpl& ac, const Tizen::Base::Collection::IList* pList);
92 result Construct(const _AppControlImpl& ac, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
94 result Construct(const _AppMessageImpl& msg, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime);
96 result Construct(const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
98 result Construct(const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
100 result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IList* pList);
102 result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IMap* pMap);
104 result Construct(bundle* b);
106 result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
107 result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList, const Tizen::Base::Collection::IMap* pMap);
109 Tizen::Base::Collection::ArrayList* GetArgListN(int num) const;
111 Tizen::Base::Collection::ArrayList* GetArgListN(void) const;
113 Tizen::Base::Collection::HashMap* GetArgMapN(void) const;
115 Tizen::Base::String GetValue(const char* key) const;
117 bundle* GetBundle(void) const
122 _AppHandler GetHandler(void) const
124 return GetHandler(__pBundle);
127 AppId GetCallerAppId(void) const;
129 int GetCallerPid(void) const
131 return GetCallerPid(__pBundle);
134 AppId GetCalleeAppId(void) const;
141 void UpdateAppId(const AppId& appId)
143 UpdateAppId(__pBundle, appId);
146 void UpdateRequestId(int reqId)
148 UpdateRequestId(__pBundle, reqId);
151 void UpdateKeyValue(const char* pKey, const Tizen::Base::String& value)
153 UpdateKeyValue(__pBundle, pKey, value);
156 result UpdateWindowHandle(long handle)
158 return UpdateWindowHandle(__pBundle, handle);
161 static int GetCallerPid(bundle* b);
163 static void Print(bundle* b);
165 static void PrintSvcHandle(void* svc);
167 static _AppHandler GetHandler(bundle* b);
169 static bundle* GetBundleFromSvc(void* svc);
171 static Tizen::Base::String GetRequestId(int num);
173 static int GetRequestId(const Tizen::Base::String& id);
175 static void UpdateAppId(bundle* b, const AppId& appid);
177 static int GetRequestIdFromBundle(bundle* p);
179 static void UpdateRequestId(bundle* b, int reqId);
181 static void UpdateKeyValue(bundle* b, const char* pKey, const Tizen::Base::String& value);
183 static result UpdateWindowHandle(bundle* b, long handle);
185 static Tizen::Base::Collection::ArrayList* GetListN(bundle* b, const char* key);
187 static result AddStrMap(bundle* b, const Tizen::Base::Collection::IMap* pMap);
189 static result FillMapFromList(Tizen::Base::Collection::IMap* pMap, const Tizen::Base::Collection::IList* pList);
191 static result FillLegacyAppControlResult(Tizen::Base::Collection::IList& list, int res, const Tizen::Base::Collection::IMap* pMap, const Tizen::Base::String& aId);
193 static result SetArgMap(bundle* pBundle, Tizen::Base::Collection::HashMap* pMap);
196 _AppArg(const _AppArg& value);
198 _AppArg& operator =(const _AppArg& source);
200 static result CreateLaunchArg(bundle* b, const Tizen::Base::String& arg);
202 static result CreateLaunchArg(bundle* b, const Tizen::Base::Collection::IList* pList);
204 static result CreateAppControlArg(bundle* b, const _AppControlImpl& ac, const Tizen::Base::Collection::IList* pList);
206 static result CreateAppControlArg(bundle* b, const _AppControlImpl& ac, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pList);
208 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);
210 static result CreateSqlDataControlArg(bundle* b, const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
212 static result CreateMapDataControlArg(bundle* b, const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
214 static result CreateAppLaunchConditionArg(bundle* b, const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
216 static result CreateResultArg(bundle* b, const Tizen::Base::Collection::IList* pList);
218 static result CreateResultArg(bundle* b, const Tizen::Base::Collection::IMap* pList);
220 static result AddStrArray(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
222 static result AddStrArray(bundle* b, const Tizen::Base::String& key, const Tizen::Base::Collection::IList* pList);
224 static bundle* CreateBundleFromSvc(void* svc);
226 static inline void AddListFromBundle(Tizen::Base::Collection::ArrayList* pList, bundle* b, const char* key);
228 static result SetArgList(bundle* pBundle, Tizen::Base::Collection::ArrayList* pList);
236 #endif //_FAPP_INTERNAL_APP_ARG_H_