, __pLocRequestInfoList(null)
, __pSyncLocRequestInfoList(null)
, __pLocUpdateTimer(null)
- , __initialized(false)
{
}
bool
_LocationManager::IsAppEnabled(void)
{
- SysTryReturn(NID_LOC, __initialized, false, E_SYSTEM, "[%s] Location manager is not initialized.", GetErrorMessage(E_SYSTEM));
+ SysTryReturn(NID_LOC, __waitLoopListener.GetValue(), false, E_SYSTEM, "[%s] Location manager is not initialized.", GetErrorMessage(E_SYSTEM));
Boolean enable(false);
Monitor synchronizer;
__gpsHandler.pLocation= std::move(pGpsLocation);
__wpsHandler.pLocation= std::move(pWpsLocation);
- __initialized = true;
+ __waitLoopListener.SetValue(true);
SysLog(NID_LOC, "All the resources for location manager successfully created.");
return true;
void
_LocationManager::OnStop(void)
{
- __initialized = false;
+ __waitLoopListener.SetValue(false);
if (__gpsHandler.handle)
{
r = pLocMgr->Start();
SysTryReturnVoidResult(NID_LOC, r == E_SUCCESS, r, "[%s] Falied to start the Location Manager. Propagating.", GetErrorMessage(r));
+ WaitingLoop::GetInstance()->Wait(*pLocMgr->GetWaitLoopListener());
+
__pUniqueInstance = pLocMgr.release();
std::atexit(DestroyLocationManager);
}
#include <FLocLocation.h>
#include "FLoc_ILocationManagerListener.h"
#include "FLoc_Types.h"
+#include "FLoc_WaitLoopListener.h"
namespace Tizen { namespace Locations
{
//
bool IsAppEnabled(void);
+ // This method returns the wait loop listener of this class.
+ //
+ // @since 2.0
+ //
+ _WaitLoopListener* GetWaitLoopListener(void){return &__waitLoopListener;}
+
// This method returns the single instance of the location maanger.
//
// @since 2.0
}
__locationMgrState;
- class __LocationManagerHandle
+ class _LocationManagerHandle
{
public:
- __LocationManagerHandle(void)
+ _LocationManagerHandle(void)
: serviceState(LOCATIONS_SERVICE_DISABLED)
, handle(null)
, pLocation(null)
{
}
- ~__LocationManagerHandle(void)
+ ~_LocationManagerHandle(void)
{
}
LocationAccuracy __minRequestedAccuracy;
int __timerInterval;
int __timerTicks;
- __LocationManagerHandle __gpsHandler;
- __LocationManagerHandle __wpsHandler;
+ _LocationManagerHandle __gpsHandler;
+ _LocationManagerHandle __wpsHandler;
std::unique_ptr< Tizen::Base::Collection::ArrayList, Tizen::Base::Collection::AllElementsDeleter > __pLocRequestInfoList;
std::unique_ptr< Tizen::Base::Collection::ArrayList, Tizen::Base::Collection::AllElementsDeleter > __pSyncLocRequestInfoList;
std::unique_ptr< Tizen::Base::Runtime::Timer > __pLocUpdateTimer;
static _LocationManager* __pUniqueInstance;
- bool __initialized;
+ _WaitLoopListener __waitLoopListener;
friend class std::default_delete< _LocationManager >;
}; // class _LocationManager
--- /dev/null
+//
+// 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_WaitLoopListener.h
+ * @brief This is the header file for the %_WaitLoopListener class.
+ *
+ * This header file contains the declarations of the %_WaitLoopListener class methods.
+ */
+
+#ifndef _FLOC_INTERNAL_WAITLOOP_LISTENER_H_
+#define _FLOC_INTERNAL_WAITLOOP_LISTENER_H_
+
+#include <FBaseRtIWaitingLoopCondition.h>
+
+namespace Tizen { namespace Locations
+{
+
+class _WaitLoopListener
+ : public Tizen::Base::Object
+ , public Tizen::Base::Runtime::IWaitingLoopCondition
+{
+public:
+ _WaitLoopListener(void)
+ : Tizen::Base::Object()
+ , __isThreadInitialized(false)
+ {
+ }
+
+ ~_WaitLoopListener(void)
+ {
+ }
+
+ void SetValue(bool isInit)
+ {
+ __isThreadInitialized = isInit;
+ }
+
+ bool GetValue(void)
+ {
+ return __isThreadInitialized;
+ }
+
+private:
+ virtual bool IsMet(void)
+ {
+ return (__isThreadInitialized == true) ? true : false;
+ }
+
+private:
+ bool __isThreadInitialized;
+} ;// class _WaitLoopListener
+}} // Tizen::Locations
+#endif // _FLOC_INTERNAL_WAITLOOP_LISTENER_H_
\ No newline at end of file