#include <message.h>
#include <sensor_log.h>
#include <sensor_utils.h>
+#include <sensor_types_private.h>
using namespace sensor;
sensor_type_t type = sensor::utils::get_type(m_info.get_uri());
m_info.set_type(type);
+
+ /* TODO: temporary walkaround for sensors that require multiple privileges */
+ switch (m_info.get_type()) {
+ case EXTERNAL_EXERCISE_SENSOR:
+ case EXERCISE_STANDALONE_SENSOR:
+ m_info.add_privilege(PRIVILEGE_LOCATION_URI);
+ break;
+ default:
+ break;
+ }
}
bool sensor_handler::has_observer(sensor_observer *ob)
#include <sensor_info.h>
#include <sensor_handler.h>
#include <sensor_utils.h>
+#include <sensor_types_private.h>
#include <command_types.h>
#include "permission_checker.h"
#include "application_sensor_handler.h"
-#define PRIV_DELIMINATOR ";"
-
using namespace sensor;
using namespace ipc;
bool server_channel_handler::has_privileges(int fd, std::string priv)
{
std::vector<std::string> privileges;
- privileges = utils::tokenize(priv, PRIV_DELIMINATOR);
+ privileges = utils::tokenize(priv, PRIV_DELIMITER);
for (auto it = privileges.begin(); it != privileges.end(); ++it) {
if (!has_privilege(fd, *it))
#include "sensor_info.h"
#include <sensor_types.h>
+#include <sensor_types_private.h>
#include <sensor_log.h>
#include <algorithm>
#include <string>
m_privilege = privilege;
}
+void sensor_info::add_privilege(const char *privilege)
+{
+ if (!m_privilege.empty())
+ m_privilege.append(PRIV_DELIMITER);
+ m_privilege.append(privilege);
+}
+
void sensor_info::serialize(raw_data_t &data)
{
put(data, m_type);
void set_max_batch_count(int max_batch_count);
void set_wakeup_supported(bool supported);
void set_privilege(const char *privilege);
+ void add_privilege(const char *privilege);
void clear(void);
#define PREDEFINED_TYPE_URI "http://tizen.org/sensor/"
+#define PRIV_DELIMITER ";"
#define URI_DELIMITER "/"
+
#define PRIVILEGE_HEALTHINFO_STR "healthinfo"
#define PRIVILEGE_HEALTHINFO_URI "http://tizen.org/privilege/healthinfo"
+#define PRIVILEGE_LOCATION_STR "location"
+#define PRIVILEGE_LOCATION_URI "http://tizen.org/privilege/location"
+
#define URI_PRIV_INDEX 4
#define URI_SENSOR_TYPE_INDEX 5
{ACTIVITY_TRACKER_SENSOR, "http://tizen.org/sensor/general/activity_tracker"},
{ACTIVITY_LEVEL_MONITOR_SENSOR, "http://tizen.org/sensor/general/activity_level_monitor"},
- {GPS_BATCH_SENSOR, "http://tizen.org/sensor/general/gps_batch"},
+ {GPS_BATCH_SENSOR, "http://tizen.org/sensor/location/gps_batch"},
{HRM_CTRL_SENSOR, "http://tizen.org/sensor/general/hrm_ctrl"},
if (uri.substr(start + 1, size) == PRIVILEGE_HEALTHINFO_STR)
return PRIVILEGE_HEALTHINFO_URI;
+ else if (uri.substr(start + 1, size) == PRIVILEGE_LOCATION_STR)
+ return PRIVILEGE_LOCATION_URI;
return "";
}