// // Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /** * @file FLoc_LocationMonitor.cpp * @brief This is the implementation file for the %_LocationMonitor class. * * This implementation file contains the definitions of the %_LocationMonitor class methods. */ #include #include "FLoc_LocationMonitor.h" using namespace Tizen::Base::Runtime; using namespace std; namespace Tizen { namespace Locations { _LocationMonitor::_LocationMonitor(void) : __pMonitor(null) , __pLocation(null) { } _LocationMonitor::~_LocationMonitor(void) { delete __pLocation; } result _LocationMonitor::Construct(int timeout, LocationAccuracy accuracy) { unique_ptr< Tizen::Base::Runtime::Monitor > pMonitor(new (std::nothrow) Monitor()); SysTryReturn(NID_LOC, pMonitor, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); result r = pMonitor->Construct(); SysTryReturn(NID_LOC, r == E_SUCCESS, r, r, "[%s] Error from Monitor::Construct(). Propagating.", GetErrorMessage(r)); __pMonitor = std::move(pMonitor); __timeout = timeout; __accuracy = accuracy; return r; } result _LocationMonitor::Enter(void) { return __pMonitor->Enter(); } result _LocationMonitor::Wait(void) { return __pMonitor->Wait(); } result _LocationMonitor::Notify(void) { return __pMonitor->Notify(); } result _LocationMonitor::Exit(void) { return __pMonitor->Exit(); } Location* _LocationMonitor::GetLocationN(void) { Location* pLocation = __pLocation; __pLocation = null; return pLocation; } void _LocationMonitor::SetLocation(Tizen::Locations::Location* pLocation) { if (__pLocation != null) { delete __pLocation; } __pLocation = pLocation; } int _LocationMonitor::GetTimeout(void) const { return __timeout; } LocationAccuracy _LocationMonitor::GetAccuracy(void) const { return __accuracy; } }}