SDL  2.0
SDL_dummysensor.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "../../SDL_internal.h"
22 
23 #include "SDL_config.h"
24 
25 #if defined(SDL_SENSOR_DUMMY) || defined(SDL_SENSOR_DISABLED)
26 
27 #include "SDL_error.h"
28 #include "SDL_sensor.h"
29 #include "SDL_dummysensor.h"
30 #include "../SDL_syssensor.h"
31 
32 static int
33 SDL_DUMMY_SensorInit(void)
34 {
35  return 0;
36 }
37 
38 static int
39 SDL_DUMMY_SensorGetCount(void)
40 {
41  return 0;
42 }
43 
44 static void
45 SDL_DUMMY_SensorDetect(void)
46 {
47 }
48 
49 static const char *
50 SDL_DUMMY_SensorGetDeviceName(int device_index)
51 {
52  return NULL;
53 }
54 
55 static SDL_SensorType
56 SDL_DUMMY_SensorGetDeviceType(int device_index)
57 {
58  return SDL_SENSOR_INVALID;
59 }
60 
61 static int
62 SDL_DUMMY_SensorGetDeviceNonPortableType(int device_index)
63 {
64  return -1;
65 }
66 
67 static SDL_SensorID
68 SDL_DUMMY_SensorGetDeviceInstanceID(int device_index)
69 {
70  return -1;
71 }
72 
73 static int
74 SDL_DUMMY_SensorOpen(SDL_Sensor *sensor, int device_index)
75 {
76  return SDL_Unsupported();
77 }
78 
79 static void
80 SDL_DUMMY_SensorUpdate(SDL_Sensor *sensor)
81 {
82 }
83 
84 static void
85 SDL_DUMMY_SensorClose(SDL_Sensor *sensor)
86 {
87 }
88 
89 static void
90 SDL_DUMMY_SensorQuit(void)
91 {
92 }
93 
95 {
96  SDL_DUMMY_SensorInit,
97  SDL_DUMMY_SensorGetCount,
98  SDL_DUMMY_SensorDetect,
99  SDL_DUMMY_SensorGetDeviceName,
100  SDL_DUMMY_SensorGetDeviceType,
101  SDL_DUMMY_SensorGetDeviceNonPortableType,
102  SDL_DUMMY_SensorGetDeviceInstanceID,
103  SDL_DUMMY_SensorOpen,
104  SDL_DUMMY_SensorUpdate,
105  SDL_DUMMY_SensorClose,
106  SDL_DUMMY_SensorQuit,
107 };
108 
109 #endif /* SDL_SENSOR_DUMMY || SDL_SENSOR_DISABLED */
110 
111 /* vi: set ts=4 sw=4 expandtab: */
#define SDL_Unsupported()
Definition: SDL_error.h:89
Sint32 SDL_SensorID
Definition: SDL_sensor.h:60
SDL_SensorType
Definition: SDL_sensor.h:70
@ SDL_SENSOR_INVALID
Definition: SDL_sensor.h:71
SDL_SensorDriver SDL_DUMMY_SensorDriver
#define NULL
Definition: begin_code.h:163