return true;
for (auto it = m_sensors.begin(); it != m_sensors.end(); ++it) {
- std::size_t found = (*it).get_uri().rfind(uri);
+ if ((*it).get_uri() == uri)
+ return true;
+
+ std::size_t found = (*it).get_uri().find_last_of("/");
+ if (found == std::string::npos)
+ continue;
- if (found != std::string::npos)
+ if ((*it).get_uri().substr(0, found) == uri)
return true;
}
return &m_sensors[0];
for (auto it = m_sensors.begin(); it != m_sensors.end(); ++it) {
- std::size_t found = (*it).get_uri().rfind(uri);
-
- if (found == std::string::npos)
+ if ((*it).get_uri() != uri)
continue;
- if ((*it).get_privilege().empty())
+ if ((*it).get_privilege().empty() || has_privilege((*it).get_uri()))
return &*it;
- if (has_privilege((*it).get_uri()))
+ return NULL;
+ }
+
+ for (auto it = m_sensors.begin(); it != m_sensors.end(); ++it) {
+ std::size_t found = (*it).get_uri().find_last_of("/");
+ if (found == std::string::npos)
+ continue;
+ if ((*it).get_uri().substr(0, found) != uri)
+ continue;
+
+ if ((*it).get_privilege().empty() || has_privilege((*it).get_uri()))
return &*it;
}
all = true;
for (auto it = m_sensors.begin(); it != m_sensors.end(); ++it) {
- std::size_t found = (*it).get_uri().rfind(uri);
-
- if (!all && found == std::string::npos)
+ if ((*it).get_uri() != uri)
continue;
- if ((*it).get_privilege().empty()) {
+ if ((*it).get_privilege().empty() || has_privilege((*it).get_uri()))
infos.push_back(&*it);
+
+ return infos;
+ }
+
+ for (auto it = m_sensors.begin(); it != m_sensors.end(); ++it) {
+ std::size_t found = (*it).get_uri().find_last_of("/");
+ if (!all && found == std::string::npos)
+ continue;
+ if (!all && (*it).get_uri().substr(0, found) != uri)
continue;
- }
- if (has_privilege((*it).get_uri()))
+ if ((*it).get_privilege().empty() || has_privilege((*it).get_uri()))
infos.push_back(&*it);
}
{ALL_SENSOR, "http://tizen.org/sensor/all"},
{ACCELEROMETER_SENSOR, "http://tizen.org/sensor/accelerometer"},
{GRAVITY_SENSOR, "http://tizen.org/sensor/gravity"},
- {LINEAR_ACCEL_SENSOR, "http://tizen.org/sensor/linear_accel"},
- {GEOMAGNETIC_SENSOR, "http://tizen.org/sensor/geomagnetic"},
+ {LINEAR_ACCEL_SENSOR, "http://tizen.org/sensor/linear_acceleration"},
+ {GEOMAGNETIC_SENSOR, "http://tizen.org/sensor/magnetic"},
{ROTATION_VECTOR_SENSOR, "http://tizen.org/sensor/rotation_vector"},
{ORIENTATION_SENSOR, "http://tizen.org/sensor/orientation"},
{GYROSCOPE_SENSOR, "http://tizen.org/sensor/gyroscope"},
{TEMPERATURE_SENSOR, "http://tizen.org/sensor/temperature"},
{HUMIDITY_SENSOR, "http://tizen.org/sensor/humidity"},
{HRM_SENSOR, "http://tizen.org/sensor/heart_rate_monitor"},
- {HRM_LED_GREEN_SENSOR, "http://tizen.org/sensor/hrm_led_green"},
- {HRM_LED_IR_SENSOR, "http://tizen.org/sensor/hrm_led_ir"},
- {HRM_LED_RED_SENSOR, "http://tizen.org/sensor/hrm_led_red"},
- {GYROSCOPE_UNCAL_SENSOR, "http://tizen.org/sensor/gyro_uncalibrated"},
- {GEOMAGNETIC_UNCAL_SENSOR, "http://tizen.org/sensor/mag_uncalibrated"},
- {GYROSCOPE_RV_SENSOR, "http://tizen.org/sensor/gyro_rotation_vector"},
- {GEOMAGNETIC_RV_SENSOR, "http://tizen.org/sensor/mag_rotation_vector"},
+ {HRM_LED_GREEN_SENSOR, "http://tizen.org/sensor/heart_rate_monitor.led_green"},
+ {HRM_LED_IR_SENSOR, "http://tizen.org/sensor/heart_rate_monitor.led_ir"},
+ {HRM_LED_RED_SENSOR, "http://tizen.org/sensor/heart_rate_monitor.led_red"},
+ {GYROSCOPE_UNCAL_SENSOR, "http://tizen.org/sensor/gyroscope.uncalibrated"},
+ {GEOMAGNETIC_UNCAL_SENSOR, "http://tizen.org/sensor/geomagnetic.uncalibrated"},
+ {GYROSCOPE_RV_SENSOR, "http://tizen.org/sensor/gyroscope_rotation_vector"},
+ {GEOMAGNETIC_RV_SENSOR, "http://tizen.org/sensor/geomagnetic_rotation_vector"},
{HUMAN_PEDOMETER_SENSOR, "http://tizen.org/sensor/human_pedometer"},
{HUMAN_SLEEP_MONITOR_SENSOR, "http://tizen.org/sensor/human_sleep_monitor"},