orka_b455160b/orka_awt/src/wayland/linux/awt-gamepads.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--  SPDX-License-Identifier: Apache-2.0
--
--  Copyright (c) 2021 onox <denkpadje@gmail.com>
--
--  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://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,
--  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.

with Ada.Containers.Vectors;

with Event_Device.Force_Feedbacks;

private package AWT.Gamepads is
   pragma Preelaborate;

   package ED renames Event_Device;
   package FF renames ED.Force_Feedbacks;

   package Effect_Vectors is new Ada.Containers.Vectors
     (Positive, FF.Force_Feedback_Effect, FF."=");

   type Uploaded_Effect is record
      Stop_At : Duration;
      Cursor  : Effect_Vectors.Cursor;
      Effect  : FF.Force_Feedback_Effect;
   end record;

   package Uploaded_Effect_Vectors is new Ada.Containers.Vectors (Positive, Uploaded_Effect);

   subtype Input_Axis is ED.Absolute_Axis_Kind;

   subtype Input_Hat is ED.Absolute_Axis_Kind range ED.Hat_0X .. ED.Hat_3Y;

   subtype Input_Button is ED.Key_Kind range ED.Button_South .. ED.Button_Thumb_Right;

   subtype Sensor_Axis is ED.Absolute_Axis_Kind range ED.X .. ED.Rz;

   type Abstract_Gamepad is abstract tagged limited record
      Device  : ED.Input_Device;
      Data    : ED.State;
      Path    : SU.Unbounded_String;
      Effects : Uploaded_Effect_Vectors.Vector;

      Sensor_Device : ED.Input_Device;
      Sensor_Data   : ED.State;

      Battery : SU.Unbounded_String;

      LED_Red   : SU.Unbounded_String;
      LED_Green : SU.Unbounded_String;
      LED_Blue  : SU.Unbounded_String;
   end record;

   type Abstract_Effect is record
      Cursor : Effect_Vectors.Cursor;
   end record;

end AWT.Gamepads;