4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __SENSOR_INTERNAL_DEPRECATED__
21 #define __SENSOR_INTERNAL_DEPRECATED__
24 #define DEPRECATED __attribute__((deprecated))
29 #include <sys/types.h>
31 /*header for common sensor type*/
32 #include <sensor_common.h>
33 #include <sensor_types.h>
34 #include <sensor_deprecated.h>
42 condition_op_t cond_op;
47 size_t event_data_size;
49 } sensor_event_data_t;
51 typedef void (*sensor_callback_func_t)(unsigned int, sensor_event_data_t *, void *);
52 typedef sensor_callback_func_t sensor_legacy_cb_t;
58 } sensor_panning_data_t;
61 * @fn int sf_connect(sensor_type_t sensor)
62 * @brief This API connects a sensor type to respective sensor. The application calls with the type of the sensor (ex. ACCELEROMETER_SENSOR) and on basis of that server takes decision of which plug-in to be connected. Once sensor connected application can proceed for data processing. This API returns a positive handle which should be used by application to communicate on sensor type.
63 * @param[in] sensor_type your desired sensor type
64 * @return if it succeed, it return handle value( >=0 ), otherwise negative value return
66 DEPRECATED int sf_connect(sensor_type_t sensor_type);
69 * @fn int sf_disconnect(int handle)
70 * @brief This API disconnects an attached sensor from an application. Application must use the handle retuned after attaching the sensor. After detaching, the corresponding handle will be released.
71 * @param[in] handle received handle value by sf_connect()
72 * @return if it succeed, it return zero value, otherwise negative value return
74 DEPRECATED int sf_disconnect(int handle);
77 * @fn int sf_start(int handle, int option)
78 * @brief This API sends a start command to sensor server. This intimates server that the client side is ready to handle data and start processing. The parameter option should be '0' for current usages.
79 * @param[in] handle received handle value by sf_connect()
80 * @param[in] option With SENSOR_OPTION_DEFAULT, it stops to sense when LCD is off, and with SENSOR_OPTION_ALWAYS_ON, it continues to sense even when LCD is off
81 * @return if it succeed, it return zero value, otherwise negative value return
83 DEPRECATED int sf_start(int handle, int option);
86 * @fn int sf_stop(int handle)
87 * @brief This API sends a stop command to the Sensor server indicating that the data processing is stopped from application side for this time.
88 * @param[in] handle received handle value by sf_connect()
89 * @return if it succeed, it return zero value, otherwise negative value return
91 DEPRECATED int sf_stop(int handle);
94 * @fn int sf_register_event(int handle, unsigned int event_type, event_conditon_t *event_condition, sensor_callback_func_t cb, void *user_data)
95 * @brief This API registers a user defined callback function with a connected sensor for a particular event. This callback function will be called when there is a change in the state of respective sensor. user_data will be the parameter used during the callback call. Callback interval can be adjusted using even_contion_t argument.
96 * @param[in] handle received handle value by sf_connect()
97 * @param[in] event_type your desired event_type to register it
98 * @param[in] event_condition input event_condition for special event. if you want to register without event_condition, just use a NULL value
99 * @param[in] cb your define callback function
100 * @param[in] user_data your option data that will be send when your define callback function called. if you don't have any option data, just use a NULL value
101 * @return if it succeed, it return zero value, otherwise negative value return
103 DEPRECATED int sf_register_event(int handle, unsigned int event_type, event_condition_t *event_condition, sensor_callback_func_t cb, void *user_data);
106 * @fn int sf_unregister_event(int handle, unsigned int event_type)
107 * @brief This API de-registers a user defined callback function with a sensor registered with the specified handle. After unsubscribe, no event will be sent to the application.
108 * @param[in] handle received handle value by sf_connect()
109 * @param[in] event_type your desired event_type that you want to unregister event
110 * @return if it succeed, it return zero value, otherwise negative value return
112 DEPRECATED int sf_unregister_event(int handle, unsigned int event_type);
115 * @fn int sf_get_data(int handle, unsigned int data_id, sensor_data_t* values)
116 * @brief This API gets raw data from a sensor with connecting the sensor-server. The type of sensor is supplied and return data is stored in the output parameter values [].
117 * @param[in] handle received handle value by sf_connect()
118 * @param[in] data_id predefined data_ID as every sensor in own header - sensor_xxx.h, enum xxx_data_id {}
119 * @param[out] values return values
120 * @return if it succeed, it return zero value, otherwise negative value return
122 DEPRECATED int sf_get_data(int handle, unsigned int data_id, sensor_data_t* values);
125 * @fn int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition)
126 * @brief This API change a user defined callback function condition with a sensor registered with the specified handle.
127 * @param[in] handle received handle value by sf_connect()
128 * @param[in] event_type your desired event_type that you want to unregister event
129 * @param[in] event_condition your desired event condition that you want to change event
130 * @return if it succeed, it return zero value, otherwise negative value return
132 DEPRECATED int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition);
135 * @fn int sf_change_sensor_option(int handle, int option)
136 * @brief This API change sensor option .
137 * @param[in] handle received handle value by sf_connect()
138 * @param[in] option your desired option that you want to turn on sensor during LCD OFF
139 * @return if it succeed, it return zero value, otherwise negative value return
142 DEPRECATED int sf_change_sensor_option(int handle, int option);
145 * @fn int sf_send_sensorhub_data(int handle, const char* buffer, int data_len)
146 * @brief This API sends data to sensorhub.
147 * @param[in] handle received handle by sf_connect()
148 * @param[in] data it holds data to send to sensorhub
149 * @param[in] data_len the length of data
150 * @return if it succeed, it returns zero, otherwise negative value
152 DEPRECATED int sf_send_sensorhub_data(int handle, const char* data, int data_len);
154 DEPRECATED int sf_check_rotation(unsigned long *rotation);