1b098972469c9058c4b112497f087ef8b3eddb56
[platform/framework/native/appfw.git] / src / io / inc / FIo_IIpcServerEventListener.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file        FIo_IIpcServerEventListener.h
20  * @brief       This is the header file for the _IIpcServerEventListener class.
21  *
22  * This file contains the declarations of _IIpcServerEventListener.
23  */
24
25 #include <FOspConfig.h>
26 #include <FBaseRtIEventListener.h>
27
28 #ifndef _FIO_INTERNAL_IIPC_SERVER_EVENT_LISTENER_H_
29 #define _FIO_INTERNAL_IIPC_SERVER_EVENT_LISTENER_H_
30
31 namespace IPC { class Message; }
32
33 namespace Tizen { namespace Io
34 {
35
36 class _IpcServer;
37 /**
38  * @interface _IIpcServerEventListener
39  * @brief     This interface provides listener method for the request event from an IPC client.
40  */
41 class _OSP_EXPORT_ _IIpcServerEventListener
42         : virtual Tizen::Base::Runtime::IEventListener
43 {
44 public:
45         /**
46          * This is the destructor for this class.
47          */
48         virtual ~_IIpcServerEventListener(void);
49
50         /**
51          * Called when an IPC server started.
52          *
53          * @param[in] server The IPC server
54          */
55         virtual void OnIpcServerStarted(const _IpcServer& server) = 0;
56
57         /**
58          * Called when an IPC server stopped.
59          *
60          * @param[in] server The IPC server
61          */
62         virtual void OnIpcServerStopped(const _IpcServer& server) = 0;
63
64         /**
65          * Called when an IPC client connected.
66          *
67          * @param[in] server The IPC server
68          */
69         virtual void OnIpcClientConnected(const _IpcServer& server, int clientId) = 0;
70
71         /**
72          * Called when an IPC client disconnected.
73          *
74          * @param[in] server The IPC server
75          * @param[in] clientId The id of the connected IPC client
76          */
77         virtual void OnIpcClientDisconnected(const _IpcServer& server, int clientId) = 0;
78
79         /**
80          * Called when an IPC request message received.
81          *
82          * @code
83          *
84          * bool
85          * CalculatorStub::OnSumRequested(int a, int b, int* pC)
86          * {
87          *    *pC = a + b;
88          *    return true;
89          * }
90          *
91          * bool
92          * CalculatorStub::OnMultiplyRequested(int a, int b, int* pC)
93          * {
94          *    *pC = a * b;
95          *    return true;
96          * }
97          *
98          * bool
99          * CalculatorStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
100          * {
101          *    IPC_BEGIN_MESSAGE_MAP(CalculatorStub, message)
102          *         IPC_MESSAGE_HANDLER(My_sum, OnSumRequested, &server)
103          *         IPC_MESSAGE_HANDLER(My_mul, OnMultiplyRequested, &server)
104          *    IPC_END_MESSAGE_MAP()
105          *
106          *    return true;
107          * }
108          *
109          * @endcode
110          * @param[in] server    The IPC server
111          * @param[in] message   The received message
112          */
113         virtual void OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message) = 0;
114 }; // _IIpcServerEventListener
115
116
117 } } // Tizen::Io
118
119 #endif //_FIO_IIPCSERVEREVENTLISTENER_H_