#define CONVERT_OPTION_TO_PAUSE_POLICY(option) ((option) ^ 0b11)
#define MAX_LISTENER 100
+#define MAX_PROVIDER 20
using namespace sensor;
static sensor::sensor_manager manager;
static std::unordered_map<int, sensor::sensor_listener *> listeners;
static cmutex lock;
+static uint providerCnt = 0;
static gboolean sensor_events_callback_dispatcher(gpointer data)
{
/* Sensor provider */
API int sensord_create_provider(const char *uri, sensord_provider_h *provider)
{
+ retvm_if(providerCnt >= MAX_PROVIDER, -EPERM, "Exceeded the maximum provider");
retvm_if(!provider, -EINVAL, "Invalid paramter");
std::string str_uri(uri);
retvm_if(!p, -ENOMEM, "Failed to allocate memory");
*provider = static_cast<sensord_provider_h>(p);
+ providerCnt++;
return OP_SUCCESS;
}
retvm_if(!provider, -EINVAL, "Invalid paramter");
delete static_cast<sensor::sensor_provider *>(provider);
+ providerCnt--;
return OP_SUCCESS;
}