hal/Hal.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set sw=2 ts=8 et ft=cpp : */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef mozilla_Hal_h
michael@0 8 #define mozilla_Hal_h
michael@0 9
michael@0 10 #include "mozilla/hal_sandbox/PHal.h"
michael@0 11 #include "mozilla/HalTypes.h"
michael@0 12 #include "base/basictypes.h"
michael@0 13 #include "mozilla/Observer.h"
michael@0 14 #include "mozilla/Types.h"
michael@0 15 #include "nsTArray.h"
michael@0 16 #include "prlog.h"
michael@0 17 #include "mozilla/dom/battery/Types.h"
michael@0 18 #include "mozilla/dom/network/Types.h"
michael@0 19 #include "mozilla/dom/power/Types.h"
michael@0 20 #include "mozilla/hal_sandbox/PHal.h"
michael@0 21 #include "mozilla/dom/ScreenOrientation.h"
michael@0 22 #include "mozilla/HalScreenConfiguration.h"
michael@0 23
michael@0 24 /*
michael@0 25 * Hal.h contains the public Hal API.
michael@0 26 *
michael@0 27 * By default, this file defines its functions in the hal namespace, but if
michael@0 28 * MOZ_HAL_NAMESPACE is defined, we'll define our functions in that namespace.
michael@0 29 *
michael@0 30 * This is used by HalImpl.h and HalSandbox.h, which define copies of all the
michael@0 31 * functions here in the hal_impl and hal_sandbox namespaces.
michael@0 32 */
michael@0 33
michael@0 34 class nsIDOMWindow;
michael@0 35
michael@0 36 #ifndef MOZ_HAL_NAMESPACE
michael@0 37 # define MOZ_HAL_NAMESPACE hal
michael@0 38 # define MOZ_DEFINED_HAL_NAMESPACE 1
michael@0 39 #endif
michael@0 40
michael@0 41 namespace mozilla {
michael@0 42
michael@0 43 namespace hal {
michael@0 44
michael@0 45 typedef Observer<void_t> AlarmObserver;
michael@0 46
michael@0 47 class WindowIdentifier;
michael@0 48
michael@0 49 extern PRLogModuleInfo *GetHalLog();
michael@0 50 #define HAL_LOG(msg) PR_LOG(mozilla::hal::GetHalLog(), PR_LOG_DEBUG, msg)
michael@0 51
michael@0 52 typedef Observer<int64_t> SystemClockChangeObserver;
michael@0 53 typedef Observer<SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
michael@0 54
michael@0 55 } // namespace hal
michael@0 56
michael@0 57 namespace MOZ_HAL_NAMESPACE {
michael@0 58
michael@0 59 /**
michael@0 60 * Turn the default vibrator device on/off per the pattern specified
michael@0 61 * by |pattern|. Each element in the pattern is the number of
michael@0 62 * milliseconds to turn the vibrator on or off. The first element in
michael@0 63 * |pattern| is an "on" element, the next is "off", and so on.
michael@0 64 *
michael@0 65 * If |pattern| is empty, any in-progress vibration is canceled.
michael@0 66 *
michael@0 67 * Only an active window within an active tab may call Vibrate; calls
michael@0 68 * from inactive windows and windows on inactive tabs do nothing.
michael@0 69 *
michael@0 70 * If you're calling hal::Vibrate from the outside world, pass an
michael@0 71 * nsIDOMWindow* in place of the WindowIdentifier parameter.
michael@0 72 * The method with WindowIdentifier will be called automatically.
michael@0 73 */
michael@0 74 void Vibrate(const nsTArray<uint32_t>& pattern,
michael@0 75 nsIDOMWindow* aWindow);
michael@0 76 void Vibrate(const nsTArray<uint32_t>& pattern,
michael@0 77 const hal::WindowIdentifier &id);
michael@0 78
michael@0 79 /**
michael@0 80 * Cancel a vibration started by the content window identified by
michael@0 81 * WindowIdentifier.
michael@0 82 *
michael@0 83 * If the window was the last window to start a vibration, the
michael@0 84 * cancellation request will go through even if the window is not
michael@0 85 * active.
michael@0 86 *
michael@0 87 * As with hal::Vibrate(), if you're calling hal::CancelVibrate from the outside
michael@0 88 * world, pass an nsIDOMWindow*. The method with WindowIdentifier will be called
michael@0 89 * automatically.
michael@0 90 */
michael@0 91 void CancelVibrate(nsIDOMWindow* aWindow);
michael@0 92 void CancelVibrate(const hal::WindowIdentifier &id);
michael@0 93
michael@0 94 /**
michael@0 95 * Inform the battery backend there is a new battery observer.
michael@0 96 * @param aBatteryObserver The observer that should be added.
michael@0 97 */
michael@0 98 void RegisterBatteryObserver(BatteryObserver* aBatteryObserver);
michael@0 99
michael@0 100 /**
michael@0 101 * Inform the battery backend a battery observer unregistered.
michael@0 102 * @param aBatteryObserver The observer that should be removed.
michael@0 103 */
michael@0 104 void UnregisterBatteryObserver(BatteryObserver* aBatteryObserver);
michael@0 105
michael@0 106 /**
michael@0 107 * Returns the current battery information.
michael@0 108 */
michael@0 109 void GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo);
michael@0 110
michael@0 111 /**
michael@0 112 * Notify of a change in the battery state.
michael@0 113 * @param aBatteryInfo The new battery information.
michael@0 114 */
michael@0 115 void NotifyBatteryChange(const hal::BatteryInformation& aBatteryInfo);
michael@0 116
michael@0 117 /**
michael@0 118 * Determine whether the device's screen is currently enabled.
michael@0 119 */
michael@0 120 bool GetScreenEnabled();
michael@0 121
michael@0 122 /**
michael@0 123 * Enable or disable the device's screen.
michael@0 124 *
michael@0 125 * Note that it may take a few seconds for the screen to turn on or off.
michael@0 126 */
michael@0 127 void SetScreenEnabled(bool enabled);
michael@0 128
michael@0 129 /**
michael@0 130 * Get the brightness of the device's screen's backlight, on a scale from 0
michael@0 131 * (very dim) to 1 (full blast).
michael@0 132 *
michael@0 133 * If the display is currently disabled, this returns the brightness the
michael@0 134 * backlight will have when the display is re-enabled.
michael@0 135 */
michael@0 136 double GetScreenBrightness();
michael@0 137
michael@0 138 /**
michael@0 139 * Set the brightness of the device's screen's backlight, on a scale from 0
michael@0 140 * (very dimm) to 1 (full blast). Values larger than 1 are treated like 1, and
michael@0 141 * values smaller than 0 are treated like 0.
michael@0 142 *
michael@0 143 * Note that we may reduce the resolution of the given brightness value before
michael@0 144 * sending it to the screen. Therefore if you call SetScreenBrightness(x)
michael@0 145 * followed by GetScreenBrightness(), the value returned by
michael@0 146 * GetScreenBrightness() may not be exactly x.
michael@0 147 */
michael@0 148 void SetScreenBrightness(double brightness);
michael@0 149
michael@0 150 /**
michael@0 151 * Determine whether the device is allowed to sleep.
michael@0 152 */
michael@0 153 bool GetCpuSleepAllowed();
michael@0 154
michael@0 155 /**
michael@0 156 * Set whether the device is allowed to suspend automatically after
michael@0 157 * the screen is disabled.
michael@0 158 */
michael@0 159 void SetCpuSleepAllowed(bool allowed);
michael@0 160
michael@0 161 /**
michael@0 162 * Set the value of a light to a particular color, with a specific flash pattern.
michael@0 163 * light specifices which light. See Hal.idl for the list of constants
michael@0 164 * mode specifies user set or based on ambient light sensor
michael@0 165 * flash specifies whether or how to flash the light
michael@0 166 * flashOnMS and flashOffMS specify the pattern for XXX flash mode
michael@0 167 * color specifies the color. If the light doesn't support color, the given color is
michael@0 168 * transformed into a brightness, or just an on/off if that is all the light is capable of.
michael@0 169 * returns true if successful and false if failed.
michael@0 170 */
michael@0 171 bool SetLight(hal::LightType light, const hal::LightConfiguration& aConfig);
michael@0 172 /**
michael@0 173 * GET the value of a light returning a particular color, with a specific flash pattern.
michael@0 174 * returns true if successful and false if failed.
michael@0 175 */
michael@0 176 bool GetLight(hal::LightType light, hal::LightConfiguration* aConfig);
michael@0 177
michael@0 178
michael@0 179 /**
michael@0 180 * Register an observer for the sensor of given type.
michael@0 181 *
michael@0 182 * The observer will receive data whenever the data generated by the
michael@0 183 * sensor is avaiable.
michael@0 184 */
michael@0 185 void RegisterSensorObserver(hal::SensorType aSensor,
michael@0 186 hal::ISensorObserver *aObserver);
michael@0 187
michael@0 188 /**
michael@0 189 * Unregister an observer for the sensor of given type.
michael@0 190 */
michael@0 191 void UnregisterSensorObserver(hal::SensorType aSensor,
michael@0 192 hal::ISensorObserver *aObserver);
michael@0 193
michael@0 194 /**
michael@0 195 * Post a value generated by a sensor.
michael@0 196 *
michael@0 197 * This API is internal to hal; clients shouldn't call it directly.
michael@0 198 */
michael@0 199 void NotifySensorChange(const hal::SensorData &aSensorData);
michael@0 200
michael@0 201 /**
michael@0 202 * Enable sensor notifications from the backend
michael@0 203 *
michael@0 204 * This method is only visible from implementation of sensor manager.
michael@0 205 * Rest of the system should not try this.
michael@0 206 */
michael@0 207 void EnableSensorNotifications(hal::SensorType aSensor);
michael@0 208
michael@0 209 /**
michael@0 210 * Disable sensor notifications from the backend
michael@0 211 *
michael@0 212 * This method is only visible from implementation of sensor manager.
michael@0 213 * Rest of the system should not try this.
michael@0 214 */
michael@0 215 void DisableSensorNotifications(hal::SensorType aSensor);
michael@0 216
michael@0 217
michael@0 218 /**
michael@0 219 * Inform the network backend there is a new network observer.
michael@0 220 * @param aNetworkObserver The observer that should be added.
michael@0 221 */
michael@0 222 void RegisterNetworkObserver(NetworkObserver* aNetworkObserver);
michael@0 223
michael@0 224 /**
michael@0 225 * Inform the network backend a network observer unregistered.
michael@0 226 * @param aNetworkObserver The observer that should be removed.
michael@0 227 */
michael@0 228 void UnregisterNetworkObserver(NetworkObserver* aNetworkObserver);
michael@0 229
michael@0 230 /**
michael@0 231 * Returns the current network information.
michael@0 232 */
michael@0 233 void GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo);
michael@0 234
michael@0 235 /**
michael@0 236 * Notify of a change in the network state.
michael@0 237 * @param aNetworkInfo The new network information.
michael@0 238 */
michael@0 239 void NotifyNetworkChange(const hal::NetworkInformation& aNetworkInfo);
michael@0 240
michael@0 241 /**
michael@0 242 * Adjusting system clock.
michael@0 243 * @param aDeltaMilliseconds The difference compared with current system clock.
michael@0 244 */
michael@0 245 void AdjustSystemClock(int64_t aDeltaMilliseconds);
michael@0 246
michael@0 247 /**
michael@0 248 * Set timezone
michael@0 249 * @param aTimezoneSpec The definition can be found in
michael@0 250 * http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
michael@0 251 */
michael@0 252 void SetTimezone(const nsCString& aTimezoneSpec);
michael@0 253
michael@0 254 /**
michael@0 255 * Get timezone
michael@0 256 * http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
michael@0 257 */
michael@0 258 nsCString GetTimezone();
michael@0 259
michael@0 260 /**
michael@0 261 * Get timezone offset
michael@0 262 * returns the timezone offset relative to UTC in minutes (DST effect included)
michael@0 263 */
michael@0 264 int32_t GetTimezoneOffset();
michael@0 265
michael@0 266 /**
michael@0 267 * Register observer for system clock changed notification.
michael@0 268 * @param aObserver The observer that should be added.
michael@0 269 */
michael@0 270 void RegisterSystemClockChangeObserver(
michael@0 271 hal::SystemClockChangeObserver* aObserver);
michael@0 272
michael@0 273 /**
michael@0 274 * Unregister the observer for system clock changed.
michael@0 275 * @param aObserver The observer that should be removed.
michael@0 276 */
michael@0 277 void UnregisterSystemClockChangeObserver(
michael@0 278 hal::SystemClockChangeObserver* aObserver);
michael@0 279
michael@0 280 /**
michael@0 281 * Notify of a change in the system clock.
michael@0 282 * @param aClockDeltaMS
michael@0 283 */
michael@0 284 void NotifySystemClockChange(const int64_t& aClockDeltaMS);
michael@0 285
michael@0 286 /**
michael@0 287 * Register observer for system timezone changed notification.
michael@0 288 * @param aObserver The observer that should be added.
michael@0 289 */
michael@0 290 void RegisterSystemTimezoneChangeObserver(
michael@0 291 hal::SystemTimezoneChangeObserver* aObserver);
michael@0 292
michael@0 293 /**
michael@0 294 * Unregister the observer for system timezone changed.
michael@0 295 * @param aObserver The observer that should be removed.
michael@0 296 */
michael@0 297 void UnregisterSystemTimezoneChangeObserver(
michael@0 298 hal::SystemTimezoneChangeObserver* aObserver);
michael@0 299
michael@0 300 /**
michael@0 301 * Notify of a change in the system timezone.
michael@0 302 * @param aSystemTimezoneChangeInfo
michael@0 303 */
michael@0 304 void NotifySystemTimezoneChange(
michael@0 305 const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
michael@0 306
michael@0 307 /**
michael@0 308 * Reboot the device.
michael@0 309 *
michael@0 310 * This API is currently only allowed to be used from the main process.
michael@0 311 */
michael@0 312 void Reboot();
michael@0 313
michael@0 314 /**
michael@0 315 * Power off the device.
michael@0 316 *
michael@0 317 * This API is currently only allowed to be used from the main process.
michael@0 318 */
michael@0 319 void PowerOff();
michael@0 320
michael@0 321 /**
michael@0 322 * Enable wake lock notifications from the backend.
michael@0 323 *
michael@0 324 * This method is only used by WakeLockObserversManager.
michael@0 325 */
michael@0 326 void EnableWakeLockNotifications();
michael@0 327
michael@0 328 /**
michael@0 329 * Disable wake lock notifications from the backend.
michael@0 330 *
michael@0 331 * This method is only used by WakeLockObserversManager.
michael@0 332 */
michael@0 333 void DisableWakeLockNotifications();
michael@0 334
michael@0 335 /**
michael@0 336 * Inform the wake lock backend there is a new wake lock observer.
michael@0 337 * @param aWakeLockObserver The observer that should be added.
michael@0 338 */
michael@0 339 void RegisterWakeLockObserver(WakeLockObserver* aObserver);
michael@0 340
michael@0 341 /**
michael@0 342 * Inform the wake lock backend a wake lock observer unregistered.
michael@0 343 * @param aWakeLockObserver The observer that should be removed.
michael@0 344 */
michael@0 345 void UnregisterWakeLockObserver(WakeLockObserver* aObserver);
michael@0 346
michael@0 347 /**
michael@0 348 * Adjust a wake lock's counts on behalf of a given process.
michael@0 349 *
michael@0 350 * In most cases, you shouldn't need to pass the aProcessID argument; the
michael@0 351 * default of CONTENT_PROCESS_ID_UNKNOWN is probably what you want.
michael@0 352 *
michael@0 353 * @param aTopic lock topic
michael@0 354 * @param aLockAdjust to increase or decrease active locks
michael@0 355 * @param aHiddenAdjust to increase or decrease hidden locks
michael@0 356 * @param aProcessID indicates which process we're modifying the wake lock
michael@0 357 * on behalf of. It is interpreted as
michael@0 358 *
michael@0 359 * CONTENT_PROCESS_ID_UNKNOWN: The current process
michael@0 360 * CONTENT_PROCESS_ID_MAIN: The root process
michael@0 361 * X: The process with ContentChild::GetID() == X
michael@0 362 */
michael@0 363 void ModifyWakeLock(const nsAString &aTopic,
michael@0 364 hal::WakeLockControl aLockAdjust,
michael@0 365 hal::WakeLockControl aHiddenAdjust,
michael@0 366 uint64_t aProcessID = hal::CONTENT_PROCESS_ID_UNKNOWN);
michael@0 367
michael@0 368 /**
michael@0 369 * Query the wake lock numbers of aTopic.
michael@0 370 * @param aTopic lock topic
michael@0 371 * @param aWakeLockInfo wake lock numbers
michael@0 372 */
michael@0 373 void GetWakeLockInfo(const nsAString &aTopic, hal::WakeLockInformation *aWakeLockInfo);
michael@0 374
michael@0 375 /**
michael@0 376 * Notify of a change in the wake lock state.
michael@0 377 * @param aWakeLockInfo The new wake lock information.
michael@0 378 */
michael@0 379 void NotifyWakeLockChange(const hal::WakeLockInformation& aWakeLockInfo);
michael@0 380
michael@0 381 /**
michael@0 382 * Inform the backend there is a new screen configuration observer.
michael@0 383 * @param aScreenConfigurationObserver The observer that should be added.
michael@0 384 */
michael@0 385 void RegisterScreenConfigurationObserver(hal::ScreenConfigurationObserver* aScreenConfigurationObserver);
michael@0 386
michael@0 387 /**
michael@0 388 * Inform the backend a screen configuration observer unregistered.
michael@0 389 * @param aScreenConfigurationObserver The observer that should be removed.
michael@0 390 */
michael@0 391 void UnregisterScreenConfigurationObserver(hal::ScreenConfigurationObserver* aScreenConfigurationObserver);
michael@0 392
michael@0 393 /**
michael@0 394 * Returns the current screen configuration.
michael@0 395 */
michael@0 396 void GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration);
michael@0 397
michael@0 398 /**
michael@0 399 * Notify of a change in the screen configuration.
michael@0 400 * @param aScreenConfiguration The new screen orientation.
michael@0 401 */
michael@0 402 void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConfiguration);
michael@0 403
michael@0 404 /**
michael@0 405 * Lock the screen orientation to the specific orientation.
michael@0 406 * @return Whether the lock has been accepted.
michael@0 407 */
michael@0 408 bool LockScreenOrientation(const dom::ScreenOrientation& aOrientation);
michael@0 409
michael@0 410 /**
michael@0 411 * Unlock the screen orientation.
michael@0 412 */
michael@0 413 void UnlockScreenOrientation();
michael@0 414
michael@0 415 /**
michael@0 416 * Register an observer for the switch of given SwitchDevice.
michael@0 417 *
michael@0 418 * The observer will receive data whenever the data generated by the
michael@0 419 * given switch.
michael@0 420 */
michael@0 421 void RegisterSwitchObserver(hal::SwitchDevice aDevice, hal::SwitchObserver *aSwitchObserver);
michael@0 422
michael@0 423 /**
michael@0 424 * Unregister an observer for the switch of given SwitchDevice.
michael@0 425 */
michael@0 426 void UnregisterSwitchObserver(hal::SwitchDevice aDevice, hal::SwitchObserver *aSwitchObserver);
michael@0 427
michael@0 428 /**
michael@0 429 * Notify the state of the switch.
michael@0 430 *
michael@0 431 * This API is internal to hal; clients shouldn't call it directly.
michael@0 432 */
michael@0 433 void NotifySwitchChange(const hal::SwitchEvent& aEvent);
michael@0 434
michael@0 435 /**
michael@0 436 * Get current switch information.
michael@0 437 */
michael@0 438 hal::SwitchState GetCurrentSwitchState(hal::SwitchDevice aDevice);
michael@0 439
michael@0 440 /**
michael@0 441 * Notify switch status change from input device.
michael@0 442 */
michael@0 443 void NotifySwitchStateFromInputDevice(hal::SwitchDevice aDevice,
michael@0 444 hal::SwitchState aState);
michael@0 445
michael@0 446 /**
michael@0 447 * Register an observer that is notified when a programmed alarm
michael@0 448 * expires.
michael@0 449 *
michael@0 450 * Currently, there can only be 0 or 1 alarm observers.
michael@0 451 */
michael@0 452 bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver);
michael@0 453
michael@0 454 /**
michael@0 455 * Unregister the alarm observer. Doing so will implicitly cancel any
michael@0 456 * programmed alarm.
michael@0 457 */
michael@0 458 void UnregisterTheOneAlarmObserver();
michael@0 459
michael@0 460 /**
michael@0 461 * Notify that the programmed alarm has expired.
michael@0 462 *
michael@0 463 * This API is internal to hal; clients shouldn't call it directly.
michael@0 464 */
michael@0 465 void NotifyAlarmFired();
michael@0 466
michael@0 467 /**
michael@0 468 * Program the real-time clock to expire at the time |aSeconds|,
michael@0 469 * |aNanoseconds|. These specify a point in real time relative to the
michael@0 470 * UNIX epoch. The alarm will fire at this time point even if the
michael@0 471 * real-time clock is changed; that is, this alarm respects changes to
michael@0 472 * the real-time clock. Return true iff the alarm was programmed.
michael@0 473 *
michael@0 474 * The alarm can be reprogrammed at any time.
michael@0 475 *
michael@0 476 * This API is currently only allowed to be used from non-sandboxed
michael@0 477 * contexts.
michael@0 478 */
michael@0 479 bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds);
michael@0 480
michael@0 481 /**
michael@0 482 * Set the priority of the given process. A process's priority is a two-tuple
michael@0 483 * consisting of a hal::ProcessPriority value and a hal::ProcessCPUPriority
michael@0 484 * value.
michael@0 485 *
michael@0 486 * Two processes with the same ProcessCPUPriority value don't necessarily have
michael@0 487 * the same CPU priority; the CPU priority we assign to a process is a function
michael@0 488 * of its ProcessPriority and ProcessCPUPriority.
michael@0 489 *
michael@0 490 * Exactly what this does will vary between platforms. On *nix we might give
michael@0 491 * background processes higher nice values. On other platforms, we might
michael@0 492 * ignore this call entirely.
michael@0 493 */
michael@0 494 void SetProcessPriority(int aPid,
michael@0 495 hal::ProcessPriority aPriority,
michael@0 496 hal::ProcessCPUPriority aCPUPriority,
michael@0 497 uint32_t aLRU = 0);
michael@0 498
michael@0 499 /**
michael@0 500 * Register an observer for the FM radio.
michael@0 501 */
michael@0 502 void RegisterFMRadioObserver(hal::FMRadioObserver* aRadioObserver);
michael@0 503
michael@0 504 /**
michael@0 505 * Unregister the observer for the FM radio.
michael@0 506 */
michael@0 507 void UnregisterFMRadioObserver(hal::FMRadioObserver* aRadioObserver);
michael@0 508
michael@0 509 /**
michael@0 510 * Notify observers that a call to EnableFMRadio, DisableFMRadio, or FMRadioSeek
michael@0 511 * has completed, and indicate what the call returned.
michael@0 512 */
michael@0 513 void NotifyFMRadioStatus(const hal::FMRadioOperationInformation& aRadioState);
michael@0 514
michael@0 515 /**
michael@0 516 * Enable the FM radio and configure it according to the settings in aInfo.
michael@0 517 */
michael@0 518 void EnableFMRadio(const hal::FMRadioSettings& aInfo);
michael@0 519
michael@0 520 /**
michael@0 521 * Disable the FM radio.
michael@0 522 */
michael@0 523 void DisableFMRadio();
michael@0 524
michael@0 525 /**
michael@0 526 * Seek to an available FM radio station.
michael@0 527 *
michael@0 528 */
michael@0 529 void FMRadioSeek(const hal::FMRadioSeekDirection& aDirection);
michael@0 530
michael@0 531 /**
michael@0 532 * Get the current FM radio settings.
michael@0 533 */
michael@0 534 void GetFMRadioSettings(hal::FMRadioSettings* aInfo);
michael@0 535
michael@0 536 /**
michael@0 537 * Set the FM radio's frequency.
michael@0 538 */
michael@0 539 void SetFMRadioFrequency(const uint32_t frequency);
michael@0 540
michael@0 541 /**
michael@0 542 * Get the FM radio's frequency.
michael@0 543 */
michael@0 544 uint32_t GetFMRadioFrequency();
michael@0 545
michael@0 546 /**
michael@0 547 * Get FM radio power state
michael@0 548 */
michael@0 549 bool IsFMRadioOn();
michael@0 550
michael@0 551 /**
michael@0 552 * Get FM radio signal strength
michael@0 553 */
michael@0 554 uint32_t GetFMRadioSignalStrength();
michael@0 555
michael@0 556 /**
michael@0 557 * Cancel FM radio seeking
michael@0 558 */
michael@0 559 void CancelFMRadioSeek();
michael@0 560
michael@0 561 /**
michael@0 562 * Get FM radio band settings by country.
michael@0 563 */
michael@0 564 hal::FMRadioSettings GetFMBandSettings(hal::FMRadioCountry aCountry);
michael@0 565
michael@0 566 /**
michael@0 567 * Start a watchdog to compulsively shutdown the system if it hangs.
michael@0 568 * @param aMode Specify how to shutdown the system.
michael@0 569 * @param aTimeoutSecs Specify the delayed seconds to shutdown the system.
michael@0 570 *
michael@0 571 * This API is currently only allowed to be used from the main process.
michael@0 572 */
michael@0 573 void StartForceQuitWatchdog(hal::ShutdownMode aMode, int32_t aTimeoutSecs);
michael@0 574
michael@0 575 /**
michael@0 576 * Perform Factory Reset to wipe out all user data.
michael@0 577 */
michael@0 578 void FactoryReset();
michael@0 579
michael@0 580 /**
michael@0 581 * Start monitoring the status of gamepads attached to the system.
michael@0 582 */
michael@0 583 void StartMonitoringGamepadStatus();
michael@0 584
michael@0 585 /**
michael@0 586 * Stop monitoring the status of gamepads attached to the system.
michael@0 587 */
michael@0 588 void StopMonitoringGamepadStatus();
michael@0 589
michael@0 590 /**
michael@0 591 * Start monitoring disk space for low space situations.
michael@0 592 *
michael@0 593 * This API is currently only allowed to be used from the main process.
michael@0 594 */
michael@0 595 void StartDiskSpaceWatcher();
michael@0 596
michael@0 597 /**
michael@0 598 * Stop monitoring disk space for low space situations.
michael@0 599 *
michael@0 600 * This API is currently only allowed to be used from the main process.
michael@0 601 */
michael@0 602 void StopDiskSpaceWatcher();
michael@0 603
michael@0 604 /**
michael@0 605 * Get total system memory of device being run on in bytes.
michael@0 606 *
michael@0 607 * Returns 0 if we are unable to determine this information from /proc/meminfo.
michael@0 608 */
michael@0 609 uint32_t GetTotalSystemMemory();
michael@0 610
michael@0 611 } // namespace MOZ_HAL_NAMESPACE
michael@0 612 } // namespace mozilla
michael@0 613
michael@0 614 #ifdef MOZ_DEFINED_HAL_NAMESPACE
michael@0 615 # undef MOZ_DEFINED_HAL_NAMESPACE
michael@0 616 # undef MOZ_HAL_NAMESPACE
michael@0 617 #endif
michael@0 618
michael@0 619 #endif // mozilla_Hal_h

mercurial