projects
/
platform
/
core
/
uifw
/
dali-adaptor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Coverity issues
[platform/core/uifw/dali-adaptor.git]
/
adaptors
/
tizen
/
tilt-sensor-impl-tizen.cpp
diff --git
a/adaptors/tizen/tilt-sensor-impl-tizen.cpp
b/adaptors/tizen/tilt-sensor-impl-tizen.cpp
index
4957f64
..
d4d9aef
100644
(file)
--- a/
adaptors/tizen/tilt-sensor-impl-tizen.cpp
+++ b/
adaptors/tizen/tilt-sensor-impl-tizen.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 201
4
Samsung Electronics Co., Ltd.
+ * Copyright (c) 201
7
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-58,7
+58,7
@@
namespace Adaptor
#ifdef SENSOR_ENABLED
static void sensor_changed_cb (sensor_h sensor, sensor_event_s *event, void *user_data)
{
#ifdef SENSOR_ENABLED
static void sensor_changed_cb (sensor_h sensor, sensor_event_s *event, void *user_data)
{
- TiltSensor* tiltSensor =
(TiltSensor*)user_data
;
+ TiltSensor* tiltSensor =
reinterpret_cast< TiltSensor* >( user_data )
;
if(tiltSensor)
{
if(tiltSensor)
{
@@
-171,7
+171,13
@@
bool TiltSensor::Connect()
{
DALI_LOG_ERROR("sensor does not support SENSOR_ORIENTATION\n");
{
DALI_LOG_ERROR("sensor does not support SENSOR_ORIENTATION\n");
- sensor_is_supported(SENSOR_ACCELEROMETER, &isSupported);
+ ret = sensor_is_supported(SENSOR_ACCELEROMETER, &isSupported);
+
+ if(ret < 0)
+ {
+ DALI_LOG_ERROR("sensor_is_supported() failed : %s\n", get_sensor_error_string(ret).c_str());
+ return false;
+ }
if(isSupported == false)
{
if(isSupported == false)
{
@@
-229,7
+235,7
@@
void TiltSensor::Disconnect()
bool TiltSensor::Start()
{
bool TiltSensor::Start()
{
- if(
mSensorListener && mState == CONNECTED
)
+ if(
mSensorListener && ( mState == CONNECTED || mState == STOPPED )
)
{
#ifdef SENSOR_ENABLED
int ret = 0;
{
#ifdef SENSOR_ENABLED
int ret = 0;
@@
-247,9
+253,14
@@
bool TiltSensor::Start()
}
else
{
}
else
{
- if(mState != CONNECTED)
+ if( mState == STARTED )
+ {
+ DALI_LOG_ERROR("TiltSensor is already started. Current state [%d]\n", mState);
+ }
+ else
{
{
- DALI_LOG_ERROR("Wrong state [%d]\n", mState);
+ // mState is DISCONNECTED
+ DALI_LOG_ERROR("TiltSensor is disconnected. Current state [%d]\n", mState);
}
return false;
}
}
return false;
}
@@
-267,19
+278,7
@@
void TiltSensor::Stop()
#endif
}
#endif
}
-bool TiltSensor::Enable()
-{
- // start sensor callback
- return Start();
-}
-
-void TiltSensor::Disable()
-{
- // stop sensor callback
- Stop();
-}
-
-bool TiltSensor::IsEnabled() const
+bool TiltSensor::IsStarted() const
{
return ( mSensorListener && mState == STARTED );
}
{
return ( mSensorListener && mState == STARTED );
}