4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
\r
6 * Contact: DongGi Jang <dg0402.jang@samsung.com>
\r
8 * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * you may not use this file except in compliance with the License.
\r
10 * You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing, software
\r
15 * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * See the License for the specific language governing permissions and
\r
18 * limitations under the License.
\r
23 #ifndef __DEVMAN_HAPTIC_EXT_CORE_H__
\r
24 #define __DEVMAN_HAPTIC_EXT_CORE_H__
\r
26 #include <sys/types.h>
\r
34 * @file devman_haptic_ext_core.h
\r
35 * @ingroup DEVICE_MANAGER
\r
36 * @brief This file contains the data type, structure and definitions of the haptic extra API
\r
43 * @addtogroup DEVICE_MANAGER
\r
49 * Data types level for haptic extra functions.
\r
51 #define HAPTIC_MAX_MAGNITUDE 10000 /*!< Maximum Force Magnitude */
\r
52 #define HAPTIC_MIN_MAGNITUDE 0 /*!< Minimum Force Magnitude */
\r
56 * Data types level for haptic extra functions.
\r
58 #define HAPTIC_MAX_EFFECT_NAME_LENGTH 128 /*!< Maximum effect name length */
\r
59 #define HAPTIC_INVALID_INDEX -1 /*!< Invalid Index */
\r
61 /* DevicePropertyType */
\r
62 #define HAPTIC_DEVPROPTYPE_PRIORITY 1 /*!< Property type constant to set device priority */
\r
63 #define HAPTIC_DEVPROPTYPE_DISABLE_EFFECTS 2 /*!< Property type constant to enable/disable effects on a device */
\r
64 #define HAPTIC_DEVPROPTYPE_STRENGTH 3 /*!< Property type constant to set the strength (volume) on a device */
\r
65 #define HAPTIC_DEVPROPTYPE_MASTERSTRENGTH 4 /*!< Property type constant to set the strength (volume) on ALL devices */
\r
67 /* Device type returned by device_haptic_get_device_capability_int32 in 'xxxx' field of
\r
68 'yyyy' struct for 'deviceCapabilityType' equal to
\r
69 HAPTIC_DEVCAPTYPE_DEVICE_CATEGORY */
\r
70 #define HAPTIC_DEVICECATEGORY_IFC 0 /*!< Device category constant for IFC Devices */
\r
71 #define HAPTIC_DEVICECATEGORY_IMPULSE 1 /*!< Device category constant for Impulse Devices */
\r
72 #define HAPTIC_DEVICECATEGORY_VIRTUAL 2 /*!< Device category constant for Virtual Devices */
\r
73 #define HAPTIC_DEVICECATEGORY_EMBEDDED 3 /*!< Device category constant for Embedded Devices */
\r
74 #define HAPTIC_DEVICECATEGORY_TETHERED 4 /*!< Device category constant for Tethered Devices */
\r
75 #define HAPTIC_DEVICECATEGORY_IMMERSION_USB 5 /*!< Device category constant for Immersion USB Devices */
\r
76 #define HAPTIC_DEVICECATEGORY_COMPOSITE 6 /*!< Device category constant for Composite Devices */
\r
78 /* Effect type returned by device_haptic_get_IVT_effect_type */
\r
79 #define HAPTIC_EFFECT_TYPE_PERIODIC 0 /*!< Periodic Effect type constant */
\r
80 #define HAPTIC_EFFECT_TYPE_MAGSWEEP 1 /*!< Magsweep Effect type constant */
\r
81 #define HAPTIC_EFFECT_TYPE_TIMELINE 2 /*!< Timeline Effect type constant */
\r
82 #define HAPTIC_EFFECT_TYPE_STREAMING 3 /*!< Streaming Effect type constant */
\r
83 #define HAPTIC_EFFECT_TYPE_WAVEFORM 4 /*!< Waveform Effect type constant */
\r
85 /* Device capability type passed as input 'deviceCapabilityType' argument to device_haptic_get_device_capability_... */
\r
86 #define HAPTIC_DEVCAPTYPE_DEVICE_CATEGORY 0 /*!< Use device_haptic_get_device_capability_int32 >*/
\r
87 #define HAPTIC_DEVCAPTYPE_MAX_NESTED_REPEATS 1 /*!< Use device_haptic_get_device_capability_int32 */
\r
88 #define HAPTIC_DEVCAPTYPE_NUM_ACTUATORS 2 /*!< Use device_haptic_get_device_capability_int32 */
\r
89 #define HAPTIC_DEVCAPTYPE_ACTUATOR_TYPE 3 /*!< Use device_haptic_get_device_capability_int32 */
\r
90 #define HAPTIC_DEVCAPTYPE_NUM_EFFECT_SLOTS 4 /*!< Use device_haptic_get_device_capability_int32 */
\r
91 #define HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES 5 /*!< Use device_haptic_get_device_capability_int32 */
\r
92 /* HAPTIC_DEVCAPTYPE_SUPPORTED_CONTROL_MODES is deprecated and will not be an available constant
\r
93 ** in future versions of this software. Please use HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES instead. */
\r
94 #define HAPTIC_DEVCAPTYPE_SUPPORTED_CONTROL_MODES HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES
\r
95 #define HAPTIC_DEVCAPTYPE_MIN_PERIOD 6 /*!< Use device_haptic_get_device_capability_int32 */
\r
96 #define HAPTIC_DEVCAPTYPE_MAX_PERIOD 7 /*!< Use device_haptic_get_device_capability_int32 */
\r
97 #define HAPTIC_DEVCAPTYPE_MAX_EFFECT_DURATION 8 /*!< Use device_haptic_get_device_capability_int32 */
\r
98 #define HAPTIC_DEVCAPTYPE_SUPPORTED_EFFECTS 9 /*!< Use device_haptic_get_device_capability_int32 */
\r
99 #define HAPTIC_DEVCAPTYPE_DEVICE_NAME 10 /*!< Use device_haptic_get_device_capability_string */
\r
100 #define HAPTIC_DEVCAPTYPE_MAX_ENVELOPE_TIME 11 /*!< Use device_haptic_get_device_capability_int32 */
\r
101 #define HAPTIC_DEVCAPTYPE_APIVERSIONNUMBER 12 /*!< Use device_haptic_get_device_capability_int32 */
\r
102 #define HAPTIC_DEVCAPTYPE_MAX_IVT_SIZE_TETHERED 13 /*!< Use device_haptic_get_device_capability_int32 */
\r
103 #define HAPTIC_DEVCAPTYPE_MAX_IVT_SIZE 14 /*!< Use device_haptic_get_device_capability_int32 */
\r
104 #define HAPTIC_DEVCAPTYPE_EDITION_LEVEL 15 /*!< Use device_haptic_get_device_capability_int32 */
\r
105 #define HAPTIC_DEVCAPTYPE_SUPPORTED_WAVE_TYPES 16 /*!< Use device_haptic_get_device_capability_int32 */
\r
106 #define HAPTIC_DEVCAPTYPE_HANDSET_INDEX 17 /*!< Use device_haptic_get_device_capability_int32 */
\r
109 #define HAPTIC_INVALID_EFFECT_HANDLE_VALUE -1 /*!< Invalid Effect Handle */
\r
110 #define HAPTIC_INVALID_DEVICE_HANDLE_VALUE -1 /*!< Invalid Device Handle */
\r
112 /* Periodic, MagSweep effect Styles are only 4 bits and may be combined with other flags */
\r
113 #define HAPTIC_STYLE_MASK 0x0F /*!< Style mask */
\r
115 /* Periodic, MagSweep effect Styles */
\r
116 #define HAPTIC_STYLE_SMOOTH 0 /*!< "Smooth" style */
\r
117 #define HAPTIC_STYLE_STRONG 1 /*!< "Strong" style */
\r
118 #define HAPTIC_STYLE_SHARP 2 /*!< "Sharp" style */
\r
120 #define HAPTIC_DEFAULT_STYLE HAPTIC_STYLE_STRONG
\r
122 /* HAPTIC_CONTROLMODE_ constants are deprecated and will not be available
\r
123 ** in future versions of this software. Please use the HAPTIC_STYLE_ constants instead. */
\r
124 #define HAPTIC_CONTROLMODE_SMOOTH HAPTIC_STYLE_SMOOTH
\r
125 #define HAPTIC_CONTROLMODE_STRONG HAPTIC_STYLE_STRONG
\r
126 #define HAPTIC_CONTROLMODE_SHARP HAPTIC_STYLE_SHARP
\r
128 #define HAPTIC_DEFAULT_CONTROLMODE HAPTIC_DEFAULT_STYLE
\r
130 /* Effect period resolution */
\r
131 #define HAPTIC_PERIOD_RESOLUTION_MICROSECOND 0x80000000
\r
133 /* Periodic effect Wave Types are only 4 bits and may be combined with other flags */
\r
134 #define HAPTIC_WAVETYPE_SHIFT 4 /*!< Wave type shift */
\r
135 #define HAPTIC_WAVETYPE_MASK 0xF0 /*!< Wave type mask */
\r
137 /* Periodic effect Wave Types */
\r
138 #define HAPTIC_WAVETYPE_SQUARE (1 << HAPTIC_WAVETYPE_SHIFT) /*!< "Square" wave type */
\r
139 #define HAPTIC_WAVETYPE_TRIANGLE (2 << HAPTIC_WAVETYPE_SHIFT) /*!< "Triangle" wave type */
\r
140 #define HAPTIC_WAVETYPE_SINE (3 << HAPTIC_WAVETYPE_SHIFT) /*!< "Sine" wave type */
\r
141 #define HAPTIC_WAVETYPE_SAWTOOTHUP (4 << HAPTIC_WAVETYPE_SHIFT) /*!< "Sawtooth Up" wave type */
\r
142 #define HAPTIC_WAVETYPE_SAWTOOTHDOWN (5 << HAPTIC_WAVETYPE_SHIFT) /*!< "Sawtooth Down" wave type */
\r
144 #define HAPTIC_DEFAULT_WAVETYPE HAPTIC_WAVETYPE_SQUARE
\r
146 /* String length constants */
\r
147 #define HAPTIC_MAX_DEVICE_NAME_LENGTH 64 /*!<Maximum device name length */
\r
148 #define HAPTIC_MAX_CAPABILITY_STRING_LENGTH 64 /*!<Maximum string length use by device_haptic_get_device_capability_string/ device_haptic_set_device_capability_string*/
\r
149 #define HAPTIC_MAX_PROPERTY_STRING_LENGTH 64 /*!<Maximum string length use by device_haptic_get_device_property_string/ device_haptic_set_device_property_string */
\r
151 /* Effect type support bit masks */
\r
152 #define HAPTIC_PERIODIC_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_PERIODIC) /*!< Bitmask for Periodic effect support */
\r
153 #define HAPTIC_MAGSWEEP_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_MAGSWEEP) /*!< Bitmask for Magsweep effect support */
\r
154 #define HAPTIC_TIMELINE_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_TIMELINE) /*!< Bitmask for Timeline effect support */
\r
155 #define HAPTIC_STREAMING_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_STREAMING) /*!< Bitmask for Streaming effect support */
\r
156 #define HAPTIC_WAVEFORM_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_WAVEFORM) /*!< Bitmask for Waveform effect support */
\r
158 /* Effect Style support bit masks */
\r
159 #define HAPTIC_STYLE_SUPPORT_MASK 0x0000FFFF /*!< Effect style support mask */
\r
160 #define HAPTIC_STYLE_SMOOTH_SUPPORT (1 << HAPTIC_STYLE_SMOOTH) /*!< Bitmask for "Smooth" style support */
\r
161 #define HAPTIC_STYLE_STRONG_SUPPORT (1 << HAPTIC_STYLE_STRONG) /*!< Bitmask for "Strong" style support */
\r
162 #define HAPTIC_STYLE_SHARP_SUPPORT (1 << HAPTIC_STYLE_SHARP) /*!< Bitmask for "Sharp" style support */
\r
164 /* Wave type support bit masks */
\r
165 /* Starts at 0x10000 to allow combining the flag with the supported style (nControlMode) 32 bits flag */
\r
166 #define HAPTIC_WAVETYPE_SUPPORT_MASK 0xFFFF0000 /*!< Wave type support mask */
\r
167 #define HAPTIC_WAVETYPE_SQUARE_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_SQUARE >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Square" wave type support */
\r
168 #define HAPTIC_WAVETYPE_TRIANGLE_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_TRIANGLE >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Triangle" wave type support */
\r
169 #define HAPTIC_WAVETYPE_SINE_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_SINE >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Sine" wave type support */
\r
170 #define HAPTIC_WAVETYPE_SAWTOOTHUP_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_SAWTOOTHUP >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Saw tooth up" wave type support */
\r
171 #define HAPTIC_WAVETYPE_SAWTOOTHDOWN_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_SAWTOOTHDOWN >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Saw tooth down" wave type support */
\r
173 /* HAPTIC_CONTROLMODE_*_SUPPORT constants are deprecated and will not be available
\r
174 ** in future versions of this software. Please use the HAPTIC_STYLE_*_SUPPORT constants instead. */
\r
175 #define HAPTIC_CONTROLMODE_SMOOTH_SUPPORT HAPTIC_STYLE_SMOOTH_SUPPORT
\r
176 #define HAPTIC_CONTROLMODE_STRONG_SUPPORT HAPTIC_STYLE_STRONG_SUPPORT
\r
177 #define HAPTIC_CONTROLMODE_SHARP_SUPPORT HAPTIC_STYLE_SHARP_SUPPORT
\r
179 /* Device State constants */
\r
180 #define HAPTIC_DEVICESTATE_ATTACHED (1 << 0) /*!< Device is attached to the system */
\r
181 #define HAPTIC_DEVICESTATE_BUSY (1 << 1) /*!< Device is busy (playing effects) */
\r
183 /* Time in milliseconds */
\r
184 #define HAPTIC_TIME_INFINITE LONG_MAX /*!< Infinite time */
\r
186 /* Effect priority */
\r
187 #define HAPTIC_MIN_DEVICE_PRIORITY 0x0 /*!< Minimum Effect priority */
\r
188 #define HAPTIC_MAX_DEV_DEVICE_PRIORITY 0x7 /*!< Maximum Effect priority for developers */
\r
189 #define HAPTIC_MAX_OEM_DEVICE_PRIORITY 0xF /*!< Maximum Effect priority for OEMs */
\r
190 #define HAPTIC_MAX_DEVICE_PRIORITY HAPTIC_MAX_OEM_DEVICE_PRIORITY /*!< FOR BACKWARD COMPATIBILITY ONLY;
\r
191 new applications should use HAPTIC_MAX_DEV_DEVICE_PRIORITY
\r
192 or HAPTIC_MAX_OEM_DEVICE_PRIORITY */
\r
195 /* Device Actuator Type constants */
\r
196 #define HAPTIC_DEVACTUATORTYPE_ERM 0
\r
197 #define HAPTIC_DEVACTUATORTYPE_BLDC 1
\r
198 #define HAPTIC_DEVACTUATORTYPE_LRA 2
\r
199 #define HAPTIC_DEVACTUATORTYPE_PIEZO 4
\r
200 #define HAPTIC_DEVACTUATORTYPE_PIEZO_WAVE 4
\r
202 /* Device Default priority value */
\r
203 #define HAPTIC_DEVPRIORITY_DEFAULT 0
\r
206 #define HAPTIC_REPEAT_COUNT_INFINITE 255 /*!< Infinite repeat count */
\r
208 /* Streaming Sample */
\r
209 #define HAPTIC_MAX_STREAMING_SAMPLE_SIZE 255 /*!< Maximum size for streaming sample */
\r
211 /* Effect state returned by ImmVibeGetEffectState */
\r
212 #define HAPTIC_EFFECT_STATE_NOT_PLAYING 0 /*!< Not Playing and not paused */
\r
213 #define HAPTIC_EFFECT_STATE_PLAYING 1 /*!< Playing */
\r
214 #define HAPTIC_EFFECT_STATE_PAUSED 2 /*!< Paused */
\r
216 /* Edition levels */
\r
217 #define HAPTIC_EDITION_3000 3000
\r
218 #define HAPTIC_EDITION_4000 4000
\r
219 #define HAPTIC_EDITION_5000 5000
\r
221 /* Element type for IVTElement structure that is used by ImmVibeInsertIVTElement, ImmVibeReadIVTElement and ImmVibeRemoveIVTElement */
\r
222 #define HAPTIC_ELEMTYPE_PERIODIC 0
\r
223 #define HAPTIC_ELEMTYPE_MAGSWEEP 1
\r
224 #define HAPTIC_ELEMTYPE_REPEAT 2
\r
225 /* New in API v3.4 */
\r
226 #define HAPTIC_ELEMTYPE_WAVEFORM 3
\r
228 /* Composite device */
\r
229 #define HAPTIC_MAX_LOGICAL_DEVICE_COUNT 16 /*!< Maximum number of device indices that can be passed to ImmVibeOpenCompositeDevice */
\r
231 /****************************************************************************
\r
235 ****************************************************************************/
\r
236 #define HAPTIC_SUCCEEDED(n) ((n) >= 0)
\r
237 #define HAPTIC_FAILED(n) ((n) < 0)
\r
238 #define HAPTIC_IS_INVALID_DEVICE_HANDLE(n) (((n) == 0) || ((n) == HAPTIC_INVALID_DEVICE_HANDLE_VALUE))
\r
239 #define HAPTIC_IS_INVALID_EFFECT_HANDLE(n) (((n) == 0) || ((n) == HAPTIC_INVALID_EFFECT_HANDLE_VALUE))
\r
240 #define HAPTIC_IS_VALID_DEVICE_HANDLE(n) (((n) != 0) && ((n) != HAPTIC_INVALID_DEVICE_HANDLE_VALUE))
\r
241 #define HAPTIC_IS_VALID_EFFECT_HANDLE(n) (((n) != 0) && ((n) != HAPTIC_INVALID_EFFECT_HANDLE_VALUE))
\r
243 /****************************************************************************
\r
245 * Error and Return value codes.
\r
247 ****************************************************************************/
\r
248 #define HAPTIC_S_SUCCESS 0 /*!< Success */
\r
249 #define HAPTIC_S_FALSE 0 /*!< False */
\r
250 #define HAPTIC_S_TRUE 1 /*!< True */
\r
251 #define HAPTIC_W_NOT_PLAYING 1 /*!< Effect is not playing */
\r
252 #define HAPTIC_W_INSUFFICIENT_PRIORITY 2 /*!< Effect doesn't have enough priority to play: higher priority effect is playing on the device */
\r
253 #define HAPTIC_W_EFFECTS_DISABLED 3 /*!< Effects are disabled on the device */
\r
254 #define HAPTIC_W_NOT_PAUSED 4 /*!< The ImmVibeResumePausedEffect function cannot resume an effect that is not paused */
\r
255 #define HAPTIC_E_NOT_INITIALIZED -2 /*!< The API is already is not initialized */
\r
256 #define HAPTIC_E_INVALID_ARGUMENT -3 /*!< Invalid argument was used in a API function call */
\r
257 #define HAPTIC_E_FAIL -4 /*!< Generic error */
\r
258 #define HAPTIC_E_INCOMPATIBLE_EFFECT_TYPE -5 /*!< Incompatible Effect type has been passed into API function call */
\r
259 #define HAPTIC_E_INCOMPATIBLE_CAPABILITY_TYPE -6 /*!< Incompatible Capability type was used into one of the following functions */
\r
260 #define HAPTIC_E_INCOMPATIBLE_PROPERTY_TYPE -7 /*!< Incompatible Property type was used into one of the following functions */
\r
261 #define HAPTIC_E_DEVICE_NEEDS_LICENSE -8 /*!< Access to the instance of the device is locked until a valid license key is provided. */
\r
262 #define HAPTIC_E_NOT_ENOUGH_MEMORY -9 /*!< The API function cannot allocate memory to complete the process */
\r
263 #define HAPTIC_E_SERVICE_NOT_RUNNING -10 /*!< ImmVibeService is not running */
\r
264 #define HAPTIC_E_INSUFFICIENT_PRIORITY -11 /*!< Not enough priority to achieve the request (insufficient license key priority) */
\r
265 #define HAPTIC_E_SERVICE_BUSY -12 /*!< ImmVibeService is busy and failed to complete the request */
\r
266 #define HAPTIC_E_NOT_SUPPORTED -13 /*!< The API function is not supported by this version of the API */
\r
268 /****************************************************************************
\r
272 ****************************************************************************/
\r
329 const unsigned char *data;
\r
343 HapticPeriodic periodic;
\r
344 HapticMagSweep magsweep;
\r
345 HapticRepeat repeat;
\r
355 HapticPeriodic2 periodic;
\r
356 HapticMagSweep2 magsweep;
\r
357 HapticRepeat repeat;
\r
367 HapticPeriodic2 periodic;
\r
368 HapticMagSweep2 magsweep;
\r
369 HapticRepeat repeat;
\r
370 HapticWaveform waveform;
\r
377 #endif /* __DEVMAN_HAPTIC_EXT_CORE_H__ */
\r