-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+/* ****************************************************************
*
- * Licensed under the Flora License, Version 1.1 (the License);
+ * Copyright 2017 Samsung Electronics All Rights Reserved.
+ *
+ * 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://floralicense.org/license/
+ * 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,
+ * 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.
- */
+ *
+ ******************************************************************/
#include <stdlib.h>
#include <pthread.h>
retv_if(type == SENSOR_DATA_TYPE_NONE, NULL);
data = calloc(1, sizeof(sensor_data));
- retv_if(type == SENSOR_DATA_TYPE_NONE, NULL);
+ retv_if(!data, NULL);
data->type = type;
pthread_mutex_init(&data->mutex, NULL);
retv_if(size == 0, -1);
temp = strndup(value, size);
+ retv_if(!temp, -1);
+
pthread_mutex_lock(&data->mutex);
free(data->value.str_val);
data->value.str_val = temp;
return 0;
}
+sensor_data_type_e sensor_data_get_type(sensor_data *data)
+{
+ retv_if(!data, SENSOR_DATA_TYPE_NONE);
+
+ return data->type;
+}
+
int sensor_data_get_int(sensor_data *data, int *value)
{
retv_if(!data, -1);