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.
19 * @file FApp_CommunicationDispatcher.h
20 * @brief This is the header file of the _CommunicationDispatcher class.
22 * This header file contains the declarations of the _CommunicationDispatcher class.
28 #include <FApp_IAppManagerEventListener.h>
29 #include <FIo_IIpcServerEventListener.h>
30 #include "FApp_ICommunicationRequestListener.h"
32 #ifndef _FAPP_INTERNAL_COMMNUICATION_DISPATCHER_H_
33 #define _FAPP_INTERNAL_COMMNUICATION_DISPATCHER_H_
35 namespace Tizen { namespace App
37 class _AppManagerImpl;
40 namespace Tizen { namespace Base
48 namespace Tizen { namespace Io
53 namespace Tizen { namespace App {
56 * @class _CommunicationDispatcher
57 * @brief This class contains implementaion of communication feature for external application.
60 class _CommunicationDispatcher
61 : public Tizen::Io::_IIpcServerEventListener
62 , public _IAppManagerEventListener
63 , virtual public Tizen::Base::Runtime::IEventListener
67 static _CommunicationDispatcher* GetInstance(void);
69 result AddCommunicationEventListener(Tizen::App::_ICommunicationRequestListener& listener);
70 result RemoveCommunicationEventListener(Tizen::App::_ICommunicationRequestListener& listener);
72 virtual void OnIpcServerStarted(const Tizen::Io::_IpcServer& server) {}
73 virtual void OnIpcServerStopped(const Tizen::Io::_IpcServer& server) {}
74 virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId) {}
75 virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer& server, int clientId) {}
76 virtual void OnIpcRequestReceived(Tizen::Io::_IpcServer& server, const IPC::Message& message);
78 virtual void OnApplicationLaunched(const AppId& appId, _AppType type);
79 virtual void OnApplicationTerminated(const AppId& appId, _AppType type);
81 bool OnRequestOccured(const Tizen::Base::Collection::ArrayList& request, Tizen::Base::Collection::ArrayList* response);
82 result SendData(const Tizen::App::AppId appId, Tizen::Base::Collection::ArrayList& data);
85 _CommunicationDispatcher(void);
86 virtual ~_CommunicationDispatcher(void);
87 Tizen::Base::Integer* GetClientId(const Tizen::App::AppId& appId, const Tizen::Base::String& componentId) const;
88 result AddClientId(Tizen::App::AppId appId, Tizen::Base::String componentId, Tizen::Base::Integer clientId);
89 result RemoveClientId(Tizen::App::AppId appId, Tizen::Base::String componentId, Tizen::Base::Integer clientId);
90 result RemoveClientId(Tizen::App::AppId appId, Tizen::Base::String componentId);
91 result RemoveClientId(Tizen::App::AppId appId);
94 Tizen::Io::_IpcServer* __pIpcServer;
95 Tizen::Base::Collection::ArrayList* __pRegisteredAppList;
96 Tizen::App::AppId __currentAppId;
97 Tizen::Base::Integer __currentClientId;
98 Tizen::Base::Runtime::Mutex __Mutex;
99 _AppManagerImpl* __pAppManagerImpl;
100 }; //_CommunicationDispatcher
103 #endif /* _FAPP_INTERNAL_COMMNUICATION_DISPATCHER_H_ */