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 ChannelService.cpp
20 * @brief This is the implementation for the ChannelService class.
23 #include "ChannelService.h"
25 #include <FBaseSysLog.h>
26 #include <FIo_ChannelService.h>
27 #include <FIo_ChannelServiceStub.h>
28 #include <FIo_ChannelServiceManager.h>
30 #include <FIo_MessagePortStub.h>
31 #include <FIo_MessagePortService.h>
33 using namespace Tizen::Base;
34 using namespace Tizen::Io;
35 using namespace Tizen::App;
37 ChannelService::ChannelService()
38 : __pChannelService(null)
39 , __pChannelServiceStub(null)
40 , __pMessagePortService(null)
41 , __pMessagePortStub(null)
43 SysLog(NID_IO, "Enter.");
46 ChannelService::~ChannelService()
48 SysLog(NID_IO, "Exit.");
50 delete __pChannelService;
51 delete __pChannelServiceStub;
53 delete __pMessagePortService;
54 delete __pMessagePortStub;
58 ChannelService::CreateInstance(void)
60 // Create the instance through the constructor.
61 return new ChannelService();
65 ChannelService::OnAppInitializing(AppRegistry& appRegistry)
69 __pChannelServiceStub = new (std::nothrow) _ChannelServiceStub();
70 if (__pChannelServiceStub == null)
75 r = __pChannelServiceStub->Construct();
78 delete __pChannelServiceStub;
79 __pChannelServiceStub = null;
84 __pChannelService = new (std::nothrow) _ChannelService;
85 if (__pChannelService == null)
87 delete __pChannelServiceStub;
88 __pChannelServiceStub = null;
93 r = __pChannelService->Construct(*__pChannelServiceStub);
96 delete __pChannelService;
97 __pChannelService = null;
99 delete __pChannelServiceStub;
100 __pChannelServiceStub = null;
105 _ChannelServiceManager::GetInstance()->SetChannelService(__pChannelService);
109 __pMessagePortStub = new (std::nothrow) _MessagePortStub();
110 if (__pMessagePortStub == null)
115 r = __pMessagePortStub->Construct();
118 delete __pMessagePortStub;
119 __pMessagePortStub = null;
124 __pMessagePortService = new (std::nothrow) _MessagePortService();
125 if (__pMessagePortService == null)
127 delete __pMessagePortStub;
128 __pMessagePortStub = null;
133 r = __pMessagePortService->Construct(*__pMessagePortStub);
136 delete __pMessagePortService;
137 __pMessagePortService = null;
139 delete __pMessagePortStub;
140 __pMessagePortStub = null;
145 __pMessagePortStub->SetMessagePortService(*__pMessagePortService);
151 ChannelService::OnAppInitialized(void)
157 ChannelService::OnAppWillTerminate(void)
163 ChannelService::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
169 ChannelService::OnLowMemory(void)