Update DeviceManager [dep:osp-appfw, osp-app-service]
[platform/framework/native/common-service.git] / inc / FSys_RuntimeInfoStub.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         FSys_RuntimeInfoStub.h
20  * @brief       This is the header file of the _RuntimeInfoStub class.
21  *
22  * This header file contains the declarations of the _RuntimeInfoStub class.
23  */
24
25 #ifndef _FSYS_RUNTIME_INFO_STUB_H_
26 #define _FSYS_RUNTIME_INFO_STUB_H_
27
28 #include <unique_ptr.h>
29 #include <FBase.h>
30 #include <FSystem.h>
31 #include <FIo_IIpcServerEventListener.h>
32
33 #include "FSys_SystemServiceIpcEventForAsync.h"
34
35 namespace Tizen { namespace System
36 {
37 class _OSP_EXPORT_ _RuntimeInfoStub
38         : public Tizen::Base::Object
39         , public Tizen::Io::_IIpcServerEventListener
40 {
41 public:
42         static _RuntimeInfoStub* GetInstance(void);
43         virtual ~_RuntimeInfoStub(void);
44
45 private:
46         static void InitSingleton(void);
47         static void DestroySingleton(void);
48
49         _RuntimeInfoStub(void);
50         result Construct(void);
51
52         bool OnRequestOccured(const Tizen::Base::Collection::ArrayList& request, Tizen::Base::Collection::ArrayList* response);
53         virtual void OnIpcRequestReceived(Tizen::Io::_IpcServer& server, const IPC::Message& message);
54         result SendDataAsync(const int pid, Tizen::Base::Collection::ArrayList* data);
55
56         static void SendResponse(int pid, int msg_id, long long size, result rcode);
57         static void* GetDirectorySizeAsync(void* data);
58
59         virtual void OnIpcServerStarted(const Tizen::Io::_IpcServer& server) {}
60         virtual void OnIpcServerStopped(const Tizen::Io::_IpcServer& server) {}
61         virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId) {}
62         virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId) {}
63
64 private:
65         int __currentPid;
66         Tizen::Base::String __serviceId;
67         Tizen::Base::String __command;
68         Tizen::Base::String __result;
69
70         std::unique_ptr< Tizen::Io::_IpcServer > __pIpcServer;
71         std::unique_ptr< _SystemServiceIpcEventForAsync > __pIpcEventForAsync;
72
73         static _RuntimeInfoStub* __pRuntimeInfoStub;
74         Tizen::Base::Runtime::Mutex __Mutex;
75 }; // _RuntimeInfoStub
76
77 }} // Tizen::System
78
79 #endif // _FSYS_RUNTIME_INFO_STUB_H_