1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_hal_Types_h
7 #define mozilla_hal_Types_h
9 #include "IPCMessageUtils.h"
15 * These are defined by libhardware, specifically, hardware/libhardware/include/hardware/lights.h
16 * in the gonk subsystem.
17 * If these change and are exposed to JS, make sure nsIHal.idl is updated as well.
20 eHalLightID_Backlight
= 0,
21 eHalLightID_Keyboard
= 1,
22 eHalLightID_Buttons
= 2,
23 eHalLightID_Battery
= 3,
24 eHalLightID_Notifications
= 4,
25 eHalLightID_Attention
= 5,
26 eHalLightID_Bluetooth
= 6,
28 eHalLightID_Count
= 8 // This should stay at the end
31 eHalLightMode_User
= 0, // brightness is managed by user setting
32 eHalLightMode_Sensor
= 1, // brightness is managed by a light sensor
36 eHalLightFlash_None
= 0,
37 eHalLightFlash_Timed
= 1, // timed flashing. Use flashOnMS and flashOffMS for timing
38 eHalLightFlash_Hardware
= 2, // hardware assisted flashing
43 eHalShutdownMode_Unknown
= -1,
44 eHalShutdownMode_PowerOff
= 0,
45 eHalShutdownMode_Reboot
= 1,
46 eHalShutdownMode_Restart
= 2,
47 eHalShutdownMode_Count
= 3
53 SWITCH_DEVICE_UNKNOWN
= -1,
60 SWITCH_STATE_UNKNOWN
= -1,
63 SWITCH_STATE_HEADSET
, // Headphone with microphone
64 SWITCH_STATE_HEADPHONE
, // without microphone
68 typedef Observer
<SwitchEvent
> SwitchObserver
;
70 enum ProcessPriority
{
71 PROCESS_PRIORITY_BACKGROUND
,
72 PROCESS_PRIORITY_BACKGROUND_HOMESCREEN
,
73 PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE
,
74 // Any priority greater than or equal to FOREGROUND is considered
75 // "foreground" for the purposes of priority testing, for example
76 // CurrentProcessIsForeground().
77 PROCESS_PRIORITY_FOREGROUND
,
78 PROCESS_PRIORITY_MASTER
,
83 * Used by ModifyWakeLock
85 enum WakeLockControl
{
86 WAKE_LOCK_REMOVE_ONE
= -1,
87 WAKE_LOCK_NO_CHANGE
= 0,
88 WAKE_LOCK_ADD_ONE
= 1,
92 class FMRadioOperationInformation
;
94 enum FMRadioOperation
{
95 FM_RADIO_OPERATION_UNKNOWN
= -1,
96 FM_RADIO_OPERATION_ENABLE
,
97 FM_RADIO_OPERATION_DISABLE
,
98 FM_RADIO_OPERATION_SEEK
,
99 NUM_FM_RADIO_OPERATION
102 enum FMRadioOperationStatus
{
103 FM_RADIO_OPERATION_STATUS_UNKNOWN
= -1,
104 FM_RADIO_OPERATION_STATUS_SUCCESS
,
105 FM_RADIO_OPERATION_STATUS_FAIL
,
106 NUM_FM_RADIO_OPERATION_STATUS
109 enum FMRadioSeekDirection
{
110 FM_RADIO_SEEK_DIRECTION_UNKNOWN
= -1,
111 FM_RADIO_SEEK_DIRECTION_UP
,
112 FM_RADIO_SEEK_DIRECTION_DOWN
,
113 NUM_FM_RADIO_SEEK_DIRECTION
116 enum FMRadioCountry
{
117 FM_RADIO_COUNTRY_UNKNOWN
= -1,
118 FM_RADIO_COUNTRY_US
, //USA
120 FM_RADIO_COUNTRY_JP_STANDARD
,
121 FM_RADIO_COUNTRY_JP_WIDE
,
122 FM_RADIO_COUNTRY_DE
, //Germany
123 FM_RADIO_COUNTRY_AW
, //Aruba
124 FM_RADIO_COUNTRY_AU
, //Australlia
125 FM_RADIO_COUNTRY_BS
, //Bahamas
126 FM_RADIO_COUNTRY_BD
, //Bangladesh
127 FM_RADIO_COUNTRY_CY
, //Cyprus
128 FM_RADIO_COUNTRY_VA
, //Vatican
129 FM_RADIO_COUNTRY_CO
, //Colombia
130 FM_RADIO_COUNTRY_KR
, //Korea
131 FM_RADIO_COUNTRY_DK
, //Denmark
132 FM_RADIO_COUNTRY_EC
, //Ecuador
133 FM_RADIO_COUNTRY_ES
, //Spain
134 FM_RADIO_COUNTRY_FI
, //Finland
135 FM_RADIO_COUNTRY_FR
, //France
136 FM_RADIO_COUNTRY_GM
, //Gambia
137 FM_RADIO_COUNTRY_HU
, //Hungary
138 FM_RADIO_COUNTRY_IN
, //India
139 FM_RADIO_COUNTRY_IR
, //Iran
140 FM_RADIO_COUNTRY_IT
, //Italy
141 FM_RADIO_COUNTRY_KW
, //Kuwait
142 FM_RADIO_COUNTRY_LT
, //Lithuania
143 FM_RADIO_COUNTRY_ML
, //Mali
144 FM_RADIO_COUNTRY_MA
, //Morocco
145 FM_RADIO_COUNTRY_NO
, //Norway
146 FM_RADIO_COUNTRY_NZ
, //New Zealand
147 FM_RADIO_COUNTRY_OM
, //Oman
148 FM_RADIO_COUNTRY_PG
, //Papua New Guinea
149 FM_RADIO_COUNTRY_NL
, //Netherlands
150 FM_RADIO_COUNTRY_QA
, //Qatar
151 FM_RADIO_COUNTRY_CZ
, //Czech Republic
152 FM_RADIO_COUNTRY_UK
, //United Kingdom of Great Britain and Northern Ireland
153 FM_RADIO_COUNTRY_RW
, //Rwandese Republic
154 FM_RADIO_COUNTRY_SN
, //Senegal
155 FM_RADIO_COUNTRY_SG
, //Singapore
156 FM_RADIO_COUNTRY_SI
, //Slovenia
157 FM_RADIO_COUNTRY_ZA
, //South Africa
158 FM_RADIO_COUNTRY_SE
, //Sweden
159 FM_RADIO_COUNTRY_CH
, //Switzerland
160 FM_RADIO_COUNTRY_TW
, //Taiwan
161 FM_RADIO_COUNTRY_TR
, //Turkey
162 FM_RADIO_COUNTRY_UA
, //Ukraine
163 FM_RADIO_COUNTRY_USER_DEFINED
,
167 typedef Observer
<FMRadioOperationInformation
> FMRadioObserver
;
169 } // namespace mozilla
174 * Light type serializer.
177 struct ParamTraits
<mozilla::hal::LightType
>
178 : public EnumSerializer
<mozilla::hal::LightType
,
179 mozilla::hal::eHalLightID_Backlight
,
180 mozilla::hal::eHalLightID_Count
>
184 * Light mode serializer.
187 struct ParamTraits
<mozilla::hal::LightMode
>
188 : public EnumSerializer
<mozilla::hal::LightMode
,
189 mozilla::hal::eHalLightMode_User
,
190 mozilla::hal::eHalLightMode_Count
>
194 * Flash mode serializer.
197 struct ParamTraits
<mozilla::hal::FlashMode
>
198 : public EnumSerializer
<mozilla::hal::FlashMode
,
199 mozilla::hal::eHalLightFlash_None
,
200 mozilla::hal::eHalLightFlash_Count
>
204 * Serializer for ShutdownMode.
207 struct ParamTraits
<mozilla::hal::ShutdownMode
>
208 : public EnumSerializer
<mozilla::hal::ShutdownMode
,
209 mozilla::hal::eHalShutdownMode_Unknown
,
210 mozilla::hal::eHalShutdownMode_Count
>
214 * WakeLockControl serializer.
217 struct ParamTraits
<mozilla::hal::WakeLockControl
>
218 : public EnumSerializer
<mozilla::hal::WakeLockControl
,
219 mozilla::hal::WAKE_LOCK_REMOVE_ONE
,
220 mozilla::hal::NUM_WAKE_LOCK
>
224 * Serializer for SwitchState
227 struct ParamTraits
<mozilla::hal::SwitchState
>:
228 public EnumSerializer
<mozilla::hal::SwitchState
,
229 mozilla::hal::SWITCH_STATE_UNKNOWN
,
230 mozilla::hal::NUM_SWITCH_STATE
> {
234 * Serializer for SwitchDevice
237 struct ParamTraits
<mozilla::hal::SwitchDevice
>:
238 public EnumSerializer
<mozilla::hal::SwitchDevice
,
239 mozilla::hal::SWITCH_DEVICE_UNKNOWN
,
240 mozilla::hal::NUM_SWITCH_DEVICE
> {
244 struct ParamTraits
<mozilla::hal::ProcessPriority
>:
245 public EnumSerializer
<mozilla::hal::ProcessPriority
,
246 mozilla::hal::PROCESS_PRIORITY_BACKGROUND
,
247 mozilla::hal::NUM_PROCESS_PRIORITY
> {
251 * Serializer for FMRadioOperation
254 struct ParamTraits
<mozilla::hal::FMRadioOperation
>:
255 public EnumSerializer
<mozilla::hal::FMRadioOperation
,
256 mozilla::hal::FM_RADIO_OPERATION_UNKNOWN
,
257 mozilla::hal::NUM_FM_RADIO_OPERATION
>
261 * Serializer for FMRadioOperationStatus
264 struct ParamTraits
<mozilla::hal::FMRadioOperationStatus
>:
265 public EnumSerializer
<mozilla::hal::FMRadioOperationStatus
,
266 mozilla::hal::FM_RADIO_OPERATION_STATUS_UNKNOWN
,
267 mozilla::hal::NUM_FM_RADIO_OPERATION_STATUS
>
271 * Serializer for FMRadioSeekDirection
274 struct ParamTraits
<mozilla::hal::FMRadioSeekDirection
>:
275 public EnumSerializer
<mozilla::hal::FMRadioSeekDirection
,
276 mozilla::hal::FM_RADIO_SEEK_DIRECTION_UNKNOWN
,
277 mozilla::hal::NUM_FM_RADIO_SEEK_DIRECTION
>
281 * Serializer for FMRadioCountry
284 struct ParamTraits
<mozilla::hal::FMRadioCountry
>:
285 public EnumSerializer
<mozilla::hal::FMRadioCountry
,
286 mozilla::hal::FM_RADIO_COUNTRY_UNKNOWN
,
287 mozilla::hal::NUM_FM_RADIO_COUNTRY
>
291 #endif // mozilla_hal_Types_h