summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorEunyoung Lee <ey928.lee@samsung.com>2017-08-11 13:46:39 +0900
committerEunyoung Lee <ey928.lee@samsung.com>2017-08-11 13:46:39 +0900
commit6c80a375452c235e967e3fc2691926715fcc17a2 (patch)
treea107e35ae4007eb1e36ad7f5f90f6573d7b51ca2 /inc
parenta990059394b7509e66c259390aa2f9ecd41384a9 (diff)
downloadrcc-6c80a375452c235e967e3fc2691926715fcc17a2.tar.gz
rcc-6c80a375452c235e967e3fc2691926715fcc17a2.tar.bz2
rcc-6c80a375452c235e967e3fc2691926715fcc17a2.zip
Add comments for sensor and connectivity API
Change-Id: Ib643d2fd31bf5662e3a5b3ea10e363f619959dbc
Diffstat (limited to 'inc')
-rw-r--r--inc/connectivity.h40
-rw-r--r--inc/resource/resource_illuminance_sensor.h8
-rw-r--r--inc/resource/resource_illuminance_sensor_internal.h3
-rw-r--r--inc/resource/resource_infrared_motion_sensor.h7
-rw-r--r--inc/resource/resource_infrared_motion_sensor_internal.h6
-rw-r--r--inc/resource/resource_infrared_obstacle_avoidance_sensor.h7
-rw-r--r--inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h4
-rw-r--r--inc/resource/resource_touch_sensor.h7
-rw-r--r--inc/resource/resource_touch_sensor_internal.h4
-rw-r--r--inc/resource/resource_ultrasonic_sensor.h9
-rw-r--r--inc/resource/resource_ultrasonic_sensor_internal.h5
11 files changed, 98 insertions, 2 deletions
diff --git a/inc/connectivity.h b/inc/connectivity.h
index 7b21043..affff20 100644
--- a/inc/connectivity.h
+++ b/inc/connectivity.h
@@ -31,11 +31,51 @@ struct connectivity_resource {
typedef struct connectivity_resource connectivity_resource_s;
+/**
+ * @brief Create connectivity resources and registers the resource in server.
+ * @param[in] uri_path The URI path of the resource
+ * @param[in] type The string data to insert into the resource types (e.g. "org.tizen.light")
+ * @param[out] out_resource_info A structure containing information about connectivity resources
+ * @return 0 on success, otherwise a negative error value
+ * @see uri_path length must be less than 128.
+ * @see You must destroy resource by calling iotcon_resource_destroy() if resource is no longer needed.
+ */
extern int connectivity_set_resource(const char *uri_path, const char *type, connectivity_resource_s **out_resource_info);
+
+/**
+ * @brief Releases all resources about connectivity.
+ * @param[in] resource_info A structure containing information about connectivity resources
+ */
extern void connectivity_unset_resource(connectivity_resource_s *resource);
+/**
+ * @brief Notifies specific clients that resource's attributes have changed with boolean vaule.
+ * @param[in] resource_info A structure containing information about connectivity resources
+ * @param[in] key A new key to be added into attributes
+ * @param[in] value A boolean value to be added into attributes
+ * @return 0 on success, otherwise a negative error value
+ * @see If key is already exists, current value will be replaced with new value.
+ */
extern int connectivity_notify_bool(connectivity_resource_s *resource_info, const char *key, bool value);
+
+/**
+ * @brief Notifies specific clients that resource's attributes have changed with int vaule.
+ * @param[in] resource_info A structure containing information about connectivity resources
+ * @param[in] key A new key to be added into attributes
+ * @param[in] value A int value to be added into attributes
+ * @return 0 on success, otherwise a negative error value
+ * @see If key is already exists, current value will be replaced with new value.
+ */
extern int connectivity_notify_int(connectivity_resource_s *resource_info, const char *key, int value);
+
+/**
+ * @brief Notifies specific clients that resource's attributes have changed with double vaule.
+ * @param[in] resource_info A structure containing information about connectivity resources
+ * @param[in] key A new key to be added into attributes
+ * @param[in] value A double value to be added into attributes
+ * @return 0 on success, otherwise a negative error value
+ * @see If key is already exists, current value will be replaced with new value.
+ */
extern int connectivity_notify_double(connectivity_resource_s *resource_info, const char *key, double value);
#endif /* __POSITION_FINDER_CONNECTIVITY_H__ */
diff --git a/inc/resource/resource_illuminance_sensor.h b/inc/resource/resource_illuminance_sensor.h
index 4203ebe..2e8925d 100644
--- a/inc/resource/resource_illuminance_sensor.h
+++ b/inc/resource/resource_illuminance_sensor.h
@@ -22,7 +22,13 @@
#ifndef __POSITION_FINDER_RESOURCE_ILLUMINANCE_SENSOR_H__
#define __POSITION_FINDER_RESOURCE_ILLUMINANCE_SENSOR_H__
-/* You have to use this illuminance sensor ONLY ONE in the pi board */
+/**
+ * @brief Reads the value of i2c bus connected illuminance sensor.
+ * @param[in] i2c_bus The i2c bus number that the slave device is connected
+ * @param[out] out_value The vaule read by the illuminance sensor
+ * @return 0 on success, otherwise a negative error value
+ * @see If the i2c bus is not open, creates i2c handle before reading data from the i2c slave device.
+ */
extern int resource_read_illuminance_sensor(int i2c_bus, int *out_value);
#endif /* __POSITION_FINDER_RESOURCE_ILLUMINANCE_SENSOR_H__ */
diff --git a/inc/resource/resource_illuminance_sensor_internal.h b/inc/resource/resource_illuminance_sensor_internal.h
index bdcf255..3193a5b 100644
--- a/inc/resource/resource_illuminance_sensor_internal.h
+++ b/inc/resource/resource_illuminance_sensor_internal.h
@@ -22,6 +22,9 @@
#ifndef __POSITION_FINDER_RESOURCE_ILLUMINANCE_SENSOR_INTERNAL_H__
#define __POSITION_FINDER_RESOURCE_ILLUMINANCE_SENSOR_INTERNAL_H__
+/**
+ * @brief Destory the i2c handle and changes the gpio pin state to the close(0).
+ */
extern void resource_close_illuminance_sensor(void);
#endif /* __POSITION_FINDER_RESOURCE_ILLUMINANCE_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_infrared_motion_sensor.h b/inc/resource/resource_infrared_motion_sensor.h
index 7914678..6f9ff36 100644
--- a/inc/resource/resource_infrared_motion_sensor.h
+++ b/inc/resource/resource_infrared_motion_sensor.h
@@ -22,6 +22,13 @@
#ifndef __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_H__
#define __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_H__
+/**
+ * @brief Reads the value of gpio connected infrared motion sensor(HC-SR501).
+ * @param[in] pin_num The number of the gpio pin connected to the infrared motion sensor
+ * @param[out] out_value The vaule of the gpio (zero or non-zero)
+ * @return 0 on success, otherwise a negative error value
+ * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
+ */
extern int resource_read_infrared_motion_sensor(int pin_num, int *out_value);
#endif /* __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_H__ */
diff --git a/inc/resource/resource_infrared_motion_sensor_internal.h b/inc/resource/resource_infrared_motion_sensor_internal.h
index 773ada5..3737e15 100644
--- a/inc/resource/resource_infrared_motion_sensor_internal.h
+++ b/inc/resource/resource_infrared_motion_sensor_internal.h
@@ -22,6 +22,10 @@
#ifndef __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_INTERNAL_H__
#define __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_INTERNAL_H__
-extern void resource_close_infrared_motion_sensor(int sensor_index);
+/**
+ * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
+ * @param[in] pin_num The number of the gpio pin connected to the infrared motion sensor
+ */
+extern void resource_close_infrared_motion_sensor(int pin_num);
#endif /* __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_infrared_obstacle_avoidance_sensor.h b/inc/resource/resource_infrared_obstacle_avoidance_sensor.h
index 640bc40..dd25e25 100644
--- a/inc/resource/resource_infrared_obstacle_avoidance_sensor.h
+++ b/inc/resource/resource_infrared_obstacle_avoidance_sensor.h
@@ -22,6 +22,13 @@
#ifndef __POSITION_FINDER_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__
#define __POSITION_FINDER_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__
+/**
+ * @brief Reads the value of gpio connected infrared obstacle avoidance sensor.
+ * @param[in] pin_num The number of the gpio pin connected to the infrared obstacle avoidance sensor
+ * @param[out] out_value The vaule of the gpio (zero or non-zero)
+ * @return 0 on success, otherwise a negative error value
+ * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
+ */
extern int resource_read_infrared_obstacle_avoidance_sensor(int pin_num, int *out_value);
#endif /* __POSITION_FINDER_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__ */
diff --git a/inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h b/inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h
index 0e6e44e..f52cdf1 100644
--- a/inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h
+++ b/inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h
@@ -22,6 +22,10 @@
#ifndef __POSITION_FINDER_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_INTERNAL_H__
#define __POSITION_FINDER_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_INTERNAL_H__
+/**
+ * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
+ * @param[in] pin_num The number of the gpio pin connected to the infrared obstacle avoidance sensor
+ */
extern void resource_close_infrared_obstacle_avoidance_sensor(int pin_num);
#endif /* __POSITION_FINDER_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_touch_sensor.h b/inc/resource/resource_touch_sensor.h
index f6f31db..ea2866f 100644
--- a/inc/resource/resource_touch_sensor.h
+++ b/inc/resource/resource_touch_sensor.h
@@ -22,6 +22,13 @@
#ifndef __POSITION_FINDER_RESOURCE_TOUCH_SENSOR_H__
#define __POSITION_FINDER_RESOURCE_TOUCH_SENSOR_H__
+/**
+ * @brief Reads the value of gpio connected touch sensor.
+ * @param[in] pin_num The number of the gpio pin connected to the touch sensor
+ * @param[out] out_value The vaule of the gpio (zero or non-zero)
+ * @return 0 on success, otherwise a negative error value
+ * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
+ */
extern int resource_read_touch_sensor(int pin_num, int *out_value);
#endif /* __POSITION_FINDER_RESOURCE_TOUCH_SENSOR_H__ */
diff --git a/inc/resource/resource_touch_sensor_internal.h b/inc/resource/resource_touch_sensor_internal.h
index dcd0e09..3bde69b 100644
--- a/inc/resource/resource_touch_sensor_internal.h
+++ b/inc/resource/resource_touch_sensor_internal.h
@@ -22,6 +22,10 @@
#ifndef __POSITION_FINDER_RESOURCE_TOUCH_SENSOR_INTERNAL_H__
#define __POSITION_FINDER_RESOURCE_TOUCH_SENSOR_INTERNAL_H__
+/**
+ * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
+ * @param[in] pin_num The number of the gpio pin connected to the touch sensor
+ */
extern void resource_close_touch_sensor(int pin_num);
#endif /* __POSITION_FINDER_RESOURCE_TOUCH_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_ultrasonic_sensor.h b/inc/resource/resource_ultrasonic_sensor.h
index e2956b4..cfcfe64 100644
--- a/inc/resource/resource_ultrasonic_sensor.h
+++ b/inc/resource/resource_ultrasonic_sensor.h
@@ -22,6 +22,15 @@
#ifndef __POSITION_FINDER_RESOURCE_ULTRASONIC_SENSOR_H__
#define __POSITION_FINDER_RESOURCE_ULTRASONIC_SENSOR_H__
+/**
+ * @brief Reads the value of gpio connected ultrasonic sensor(HC-SR04).
+ * @param[in] trig_pin_num The number of the gpio pin connected to the trig of the ultrasonic sensor
+ * @param[in] echo_pin_num The number of the gpio pin connected to the echo of the ultrasonic sensor
+ * @param[in] cb A callback function to be invoked when the gpio interrupt is triggered
+ * @param[in] data The data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value
+ * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
+ */
extern int resource_read_ultrasonic_sensor(int trig_pin_num, int echo_pin_num, resource_read_cb cb, void *data);
#endif /* __POSITION_FINDER_RESOURCE_ULTRASONIC_SENSOR_H__ */
diff --git a/inc/resource/resource_ultrasonic_sensor_internal.h b/inc/resource/resource_ultrasonic_sensor_internal.h
index bf86d73..e7821c0 100644
--- a/inc/resource/resource_ultrasonic_sensor_internal.h
+++ b/inc/resource/resource_ultrasonic_sensor_internal.h
@@ -22,6 +22,11 @@
#ifndef __POSITION_FINDER_RESOURCE_ULTRASONIC_SENSOR_INTERNAL_H__
#define __POSITION_FINDER_RESOURCE_ULTRASONIC_SENSOR_INTERNAL_H__
+/**
+ * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
+ * @param[in] trig_pin_num The number of the gpio pin connected to the trig of the ultrasonic sensor
+ * @param[in] echo_pin_num The number of the gpio pin connected to the echo of the ultrasonic sensor
+ */
extern void resource_close_ultrasonic_sensor(int echo_pin_num, int trig_pin_num);
#endif /* __POSITION_FINDER_RESOURCE_ULTRASONIC_SENSOR_INTERNAL_H__ */