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.
18 * @file FApp_AppLaunchConditionHandlerBase.h
19 * @brief This is the header file of the _AppLaunchConditionHandlerBase class.
21 * This header file contains the declarations of the _AppLaunchConditionHandlerBase class.
23 #ifndef _FAPP_INTERNAL_APP_LAUNCH_CONDITION_HANDLER_BASE_H_
24 #define _FAPP_INTERNAL_APP_LAUNCH_CONDITION_HANDLER_BASE_H_
26 #include <FBaseObject.h>
27 #include <FAppTypes.h>
29 #include <FBaseSysLog.h>
30 #include "FApp_IAppLaunchConditionEventListener.h"
31 #include "FApp_AppLaunchCondition.h"
33 namespace Tizen { namespace App {
37 * @class _AppLaunchConditionHandlerBase
38 * @brief This class is the abstract base class of all conditional app launch handlers(plugin).
41 * All conditional app launch handlers(plugin) should inherit this abstract class.
42 * and all plugins must provide both a creation and a destruction function like following.
45 * extern "C" _AppLaunchConditionHandlerBase* CreatePlugin()
47 * return new (std::nothrow) _AlarmConditionHandler;// create and return your own class instance.
50 * extern "C" void DestroyPlugin(_AppLaunchConditionHandlerBase* p)
56 class _OSP_EXPORT_ _AppLaunchConditionHandlerBase
57 : public Tizen::Base::Object
61 * This is the constructor for this class.
65 _AppLaunchConditionHandlerBase(void);
68 * This is the destructor for this class.
72 virtual ~_AppLaunchConditionHandlerBase(void);
75 * Sets event listener instance. @n
76 * The listener can listen to OnAppLaunchConditionMet event.
79 * @param[in] The operation registered conditional operation with current condition.
80 * @remark _ConditionManagerService uses this function to sets itself as listener.
82 result SetEventListener(_IAppLaunchConditionEventListener& eventListener);
85 * Register app launch condition for the plug-in.
88 * @return An error code
89 * @param[in] operation The conditional operation to register
90 * @exception E_SUCCESS The method is successful.
91 * @exception E_INVALID_FORMAT The specified condition format is invalid.
92 * @exception E_INVALID_CONDITION The specified condition format is valid but the condition has at least one or more invalid values.
93 * @exception E_OUT_OF_MEMORY The memory is insufficient.
94 * @exception E_SYSTEM A system error has occurred.
95 * @remark Plugin should implement this register condition code
96 * _ConditionManagerService calls this method when RegisterAppLaunch method invoked.
99 virtual result Register( _AppLaunchCondition& condition) = 0;//, const Tizen::Base::Object*& pHandle) = 0;
102 * Unregister app launch condition for the plug-in.
105 * @param[in] operation The conditional operation to register
106 * @remark Plugin should implement this unregister condition code
107 * _ConditionManagerService calls this method when UnregisterAppLaunch method invoked.
110 virtual result Unregister( _AppLaunchCondition& condition) = 0;//, const Tizen::Base::Object* pHandle) = 0;
115 * Fires the OnAppLaunchConditionMet event.
118 * @return An error code
119 * @exception E_SUCCESS The method is successful.
120 * @exception E_INVALID_STATE The event handler isn't initialized yet.
121 * @param[in] operation The conditional operation registered.
122 * @param[in] pExtraData The extra data being delivered in which elements are a pair of key and value of Tizen::Base::String.
123 * @see _IAppLaunchConditionEventListener::OnAppLaunchConditionMet
125 result Fire(const _AppLaunchCondition& condition, Tizen::Base::Collection::IMap* pExtraData = null);
128 _IAppLaunchConditionEventListener* __pEventListener;
129 }; //_AppLaunchConditionHandlerBase
133 #endif // _FAPP_INTERNAL_APP_LAUNCH_CONDITION_HANDLER_BASE_H_