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 _AppMessageImpl;
44 class _SqlDataControlImpl;
45 class _MapDataControlImpl;
47 enum _DataControlRequestType
49 _DATACONTROL_REQUEST_TYPE_UNDEFINED = 0,
50 _DATACONTROL_REQUEST_TYPE_SQL_QUERY,
51 _DATACONTROL_REQUEST_TYPE_SQL_INSERT,
52 _DATACONTROL_REQUEST_TYPE_SQL_UPDATE,
53 _DATACONTROL_REQUEST_TYPE_SQL_DELETE,
54 _DATACONTROL_REQUEST_TYPE_MAP_QUERY,
55 _DATACONTROL_REQUEST_TYPE_MAP_INSERT,
56 _DATACONTROL_REQUEST_TYPE_MAP_UPDATE,
57 _DATACONTROL_REQUEST_TYPE_MAP_DELETE
60 #define OSP_K_LAUNCH_TYPE "__OSP_LAUNCH_TYPE__"
61 #define OSP_K_ARG "__OSP_ARGS__"
62 #define OSP_K_COND "__OSP_COND_NAME__"
63 #define OSP_K_APPID "__OSP_APPID__"
64 #define OSP_K_REQUEST_ID "__OSP_REQUEST_ID__"
65 #define OSP_K_APPCONTROL_INTERNAL_OPERATION "__OSP_APPCONTROL_INTERNAL_INTERNAL_OPERATION__"
66 #define OSP_K_DATACONTROL_PROVIDER "__OSP_DATACONTROL_PROVIDER__"
67 #define OSP_K_DATACONTROL_DATA "__OSP_DATACONTROL_DATA__"
68 #define OSP_K_DATACONTROL_REQUEST_TYPE "__OSP_DATACONTROL_REQUEST_TYPE__"
69 #define OSP_K_DATACONTROL_PROTOCOL_VERSION "__OSP_DATACONTROL_PROTOCOL_VERSION__"
75 class _OSP_EXPORT_ _AppArg
82 result Construct(const Tizen::Base::String& argText);
84 result Construct(const Tizen::Base::Collection::IList* pList);
86 result Construct(const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
88 result Construct(const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
90 result Construct(const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
92 result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IList* pList);
94 result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IMap* pMap);
96 result Construct(const bundle* b);
98 result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
99 result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList, const Tizen::Base::Collection::IMap* pMap);
101 Tizen::Base::Collection::ArrayList* GetArgListN(int num) const;
103 Tizen::Base::Collection::ArrayList* GetArgListN(void) const;
105 Tizen::Base::Collection::HashMap* GetArgMapN(void) const;
107 Tizen::Base::String GetValue(const char* key) const;
109 bundle* GetBundle(void) const
114 _AppHandler GetHandler(void) const
116 return GetHandler(__pBundle);
119 AppId GetCallerAppId(void) const;
121 int GetCallerPid(void) const
123 return GetCallerPid(__pBundle);
126 AppId GetCalleeAppId(void) const
128 return GetCalleeAppId(__pBundle);
136 void UpdateAppId(const AppId& appId)
138 UpdateAppId(__pBundle, appId);
141 void UpdateRequestId(int reqId)
143 UpdateRequestId(__pBundle, reqId);
146 void UpdateKeyValue(const char* pKey, const Tizen::Base::String& value)
148 UpdateKeyValue(__pBundle, pKey, value);
151 result UpdateWindowHandle(long handle)
153 return UpdateWindowHandle(__pBundle, handle);
156 static int GetCallerPid(bundle* b);
158 static void Print(bundle* b);
160 static void PrintSvcHandle(void* svc);
162 static _AppHandler GetHandler(bundle* b);
164 static bundle* GetBundleFromSvc(void* svc);
166 static Tizen::Base::String GetRequestId(int num);
168 static int GetRequestId(const Tizen::Base::String& id);
170 static void UpdateAppId(bundle* b, const AppId& appid);
172 static int GetRequestIdFromBundle(bundle* p);
174 static void UpdateRequestId(bundle* b, int reqId);
176 static void UpdateKeyValue(bundle* b, const char* pKey, const Tizen::Base::String& value);
178 static void UpdateSubMode(bundle* b);
180 static bool IsSubMode(bundle* b);
182 static void UpdateServiceApp(bundle* b);
184 static bool IsServiceApp(bundle* b);
186 static AppId GetCalleeAppId(bundle* b);
188 static result UpdateWindowHandle(bundle* b, long handle);
190 static Tizen::Base::Collection::ArrayList* GetListN(bundle* b, const char* key);
192 static result AddStrMap(bundle* b, const Tizen::Base::Collection::IMap* pMap);
194 static result FillMapFromList(Tizen::Base::Collection::IMap* pMap, const Tizen::Base::Collection::IList* pList);
196 static result FillLegacyAppControlResult(Tizen::Base::Collection::IList& list, int res, const Tizen::Base::Collection::IMap* pMap, const Tizen::Base::String& aId);
198 static result SetArgMap(bundle* pBundle, Tizen::Base::Collection::HashMap* pMap);
201 _AppArg(const _AppArg& value);
203 _AppArg& operator =(const _AppArg& source);
205 static result CreateNotificationArg(bundle* b, const Tizen::Base::String& arg);
207 static result CreateLaunchArg(bundle* b, const Tizen::Base::Collection::IList* pList);
209 static result CreateSqlDataControlArg(bundle* b, const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
211 static result CreateMapDataControlArg(bundle* b, const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
213 static result CreateAppLaunchConditionArg(bundle* b, const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
215 static result CreateResultArg(bundle* b, const Tizen::Base::Collection::IList* pList);
217 static result CreateResultArg(bundle* b, const Tizen::Base::Collection::IMap* pList);
219 static result AddStrArray(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
221 static result AddStrArray(bundle* b, const Tizen::Base::String& key, const Tizen::Base::Collection::IList* pList);
223 static bundle* CreateBundleFromSvc(void* svc);
225 static inline void AddListFromBundle(Tizen::Base::Collection::ArrayList* pList, bundle* b, const char* key);
227 static result SetArgList(bundle* pBundle, Tizen::Base::Collection::ArrayList* pList);
235 #endif //_FAPP_INTERNAL_APP_ARG_H_