hal/Hal.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/hal/Hal.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,619 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set sw=2 ts=8 et ft=cpp : */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_Hal_h
    1.11 +#define mozilla_Hal_h
    1.12 +
    1.13 +#include "mozilla/hal_sandbox/PHal.h"
    1.14 +#include "mozilla/HalTypes.h"
    1.15 +#include "base/basictypes.h"
    1.16 +#include "mozilla/Observer.h"
    1.17 +#include "mozilla/Types.h"
    1.18 +#include "nsTArray.h"
    1.19 +#include "prlog.h"
    1.20 +#include "mozilla/dom/battery/Types.h"
    1.21 +#include "mozilla/dom/network/Types.h"
    1.22 +#include "mozilla/dom/power/Types.h"
    1.23 +#include "mozilla/hal_sandbox/PHal.h"
    1.24 +#include "mozilla/dom/ScreenOrientation.h"
    1.25 +#include "mozilla/HalScreenConfiguration.h"
    1.26 +
    1.27 +/*
    1.28 + * Hal.h contains the public Hal API.
    1.29 + *
    1.30 + * By default, this file defines its functions in the hal namespace, but if
    1.31 + * MOZ_HAL_NAMESPACE is defined, we'll define our functions in that namespace.
    1.32 + *
    1.33 + * This is used by HalImpl.h and HalSandbox.h, which define copies of all the
    1.34 + * functions here in the hal_impl and hal_sandbox namespaces.
    1.35 + */
    1.36 +
    1.37 +class nsIDOMWindow;
    1.38 +
    1.39 +#ifndef MOZ_HAL_NAMESPACE
    1.40 +# define MOZ_HAL_NAMESPACE hal
    1.41 +# define MOZ_DEFINED_HAL_NAMESPACE 1
    1.42 +#endif
    1.43 +
    1.44 +namespace mozilla {
    1.45 +
    1.46 +namespace hal {
    1.47 +
    1.48 +typedef Observer<void_t> AlarmObserver;
    1.49 +
    1.50 +class WindowIdentifier;
    1.51 +
    1.52 +extern PRLogModuleInfo *GetHalLog();
    1.53 +#define HAL_LOG(msg) PR_LOG(mozilla::hal::GetHalLog(), PR_LOG_DEBUG, msg)
    1.54 +
    1.55 +typedef Observer<int64_t> SystemClockChangeObserver;
    1.56 +typedef Observer<SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
    1.57 +
    1.58 +} // namespace hal
    1.59 +
    1.60 +namespace MOZ_HAL_NAMESPACE {
    1.61 +
    1.62 +/**
    1.63 + * Turn the default vibrator device on/off per the pattern specified
    1.64 + * by |pattern|.  Each element in the pattern is the number of
    1.65 + * milliseconds to turn the vibrator on or off.  The first element in
    1.66 + * |pattern| is an "on" element, the next is "off", and so on.
    1.67 + *
    1.68 + * If |pattern| is empty, any in-progress vibration is canceled.
    1.69 + *
    1.70 + * Only an active window within an active tab may call Vibrate; calls
    1.71 + * from inactive windows and windows on inactive tabs do nothing.
    1.72 + *
    1.73 + * If you're calling hal::Vibrate from the outside world, pass an
    1.74 + * nsIDOMWindow* in place of the WindowIdentifier parameter.
    1.75 + * The method with WindowIdentifier will be called automatically.
    1.76 + */
    1.77 +void Vibrate(const nsTArray<uint32_t>& pattern,
    1.78 +             nsIDOMWindow* aWindow);
    1.79 +void Vibrate(const nsTArray<uint32_t>& pattern,
    1.80 +             const hal::WindowIdentifier &id);
    1.81 +
    1.82 +/**
    1.83 + * Cancel a vibration started by the content window identified by
    1.84 + * WindowIdentifier.
    1.85 + *
    1.86 + * If the window was the last window to start a vibration, the
    1.87 + * cancellation request will go through even if the window is not
    1.88 + * active.
    1.89 + *
    1.90 + * As with hal::Vibrate(), if you're calling hal::CancelVibrate from the outside
    1.91 + * world, pass an nsIDOMWindow*. The method with WindowIdentifier will be called
    1.92 + * automatically.
    1.93 + */
    1.94 +void CancelVibrate(nsIDOMWindow* aWindow);
    1.95 +void CancelVibrate(const hal::WindowIdentifier &id);
    1.96 +
    1.97 +/**
    1.98 + * Inform the battery backend there is a new battery observer.
    1.99 + * @param aBatteryObserver The observer that should be added.
   1.100 + */
   1.101 +void RegisterBatteryObserver(BatteryObserver* aBatteryObserver);
   1.102 +
   1.103 +/**
   1.104 + * Inform the battery backend a battery observer unregistered.
   1.105 + * @param aBatteryObserver The observer that should be removed.
   1.106 + */
   1.107 +void UnregisterBatteryObserver(BatteryObserver* aBatteryObserver);
   1.108 +
   1.109 +/**
   1.110 + * Returns the current battery information.
   1.111 + */
   1.112 +void GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo);
   1.113 +
   1.114 +/**
   1.115 + * Notify of a change in the battery state.
   1.116 + * @param aBatteryInfo The new battery information.
   1.117 + */
   1.118 +void NotifyBatteryChange(const hal::BatteryInformation& aBatteryInfo);
   1.119 +
   1.120 +/**
   1.121 + * Determine whether the device's screen is currently enabled.
   1.122 + */
   1.123 +bool GetScreenEnabled();
   1.124 +
   1.125 +/**
   1.126 + * Enable or disable the device's screen.
   1.127 + *
   1.128 + * Note that it may take a few seconds for the screen to turn on or off.
   1.129 + */
   1.130 +void SetScreenEnabled(bool enabled);
   1.131 +
   1.132 +/**
   1.133 + * Get the brightness of the device's screen's backlight, on a scale from 0
   1.134 + * (very dim) to 1 (full blast).
   1.135 + *
   1.136 + * If the display is currently disabled, this returns the brightness the
   1.137 + * backlight will have when the display is re-enabled.
   1.138 + */
   1.139 +double GetScreenBrightness();
   1.140 +
   1.141 +/**
   1.142 + * Set the brightness of the device's screen's backlight, on a scale from 0
   1.143 + * (very dimm) to 1 (full blast).  Values larger than 1 are treated like 1, and
   1.144 + * values smaller than 0 are treated like 0.
   1.145 + *
   1.146 + * Note that we may reduce the resolution of the given brightness value before
   1.147 + * sending it to the screen.  Therefore if you call SetScreenBrightness(x)
   1.148 + * followed by GetScreenBrightness(), the value returned by
   1.149 + * GetScreenBrightness() may not be exactly x.
   1.150 + */
   1.151 +void SetScreenBrightness(double brightness);
   1.152 +
   1.153 +/**
   1.154 + * Determine whether the device is allowed to sleep.
   1.155 + */
   1.156 +bool GetCpuSleepAllowed();
   1.157 +
   1.158 +/**
   1.159 + * Set whether the device is allowed to suspend automatically after
   1.160 + * the screen is disabled.
   1.161 + */
   1.162 +void SetCpuSleepAllowed(bool allowed);
   1.163 +
   1.164 +/**
   1.165 + * Set the value of a light to a particular color, with a specific flash pattern.
   1.166 + * light specifices which light.  See Hal.idl for the list of constants
   1.167 + * mode specifies user set or based on ambient light sensor
   1.168 + * flash specifies whether or how to flash the light
   1.169 + * flashOnMS and flashOffMS specify the pattern for XXX flash mode
   1.170 + * color specifies the color.  If the light doesn't support color, the given color is
   1.171 + * transformed into a brightness, or just an on/off if that is all the light is capable of.
   1.172 + * returns true if successful and false if failed.
   1.173 + */
   1.174 +bool SetLight(hal::LightType light, const hal::LightConfiguration& aConfig);
   1.175 +/**
   1.176 + * GET the value of a light returning a particular color, with a specific flash pattern.
   1.177 + * returns true if successful and false if failed.
   1.178 + */
   1.179 +bool GetLight(hal::LightType light, hal::LightConfiguration* aConfig);
   1.180 +
   1.181 +
   1.182 +/**
   1.183 + * Register an observer for the sensor of given type.
   1.184 + *
   1.185 + * The observer will receive data whenever the data generated by the
   1.186 + * sensor is avaiable.
   1.187 + */
   1.188 +void RegisterSensorObserver(hal::SensorType aSensor,
   1.189 +                            hal::ISensorObserver *aObserver);
   1.190 +
   1.191 +/**
   1.192 + * Unregister an observer for the sensor of given type.
   1.193 + */
   1.194 +void UnregisterSensorObserver(hal::SensorType aSensor,
   1.195 +                              hal::ISensorObserver *aObserver);
   1.196 +
   1.197 +/**
   1.198 + * Post a value generated by a sensor.
   1.199 + *
   1.200 + * This API is internal to hal; clients shouldn't call it directly.
   1.201 + */
   1.202 +void NotifySensorChange(const hal::SensorData &aSensorData);
   1.203 +
   1.204 +/**
   1.205 + * Enable sensor notifications from the backend
   1.206 + *
   1.207 + * This method is only visible from implementation of sensor manager.
   1.208 + * Rest of the system should not try this.
   1.209 + */
   1.210 +void EnableSensorNotifications(hal::SensorType aSensor);
   1.211 +
   1.212 +/**
   1.213 + * Disable sensor notifications from the backend
   1.214 + *
   1.215 + * This method is only visible from implementation of sensor manager.
   1.216 + * Rest of the system should not try this.
   1.217 + */
   1.218 +void DisableSensorNotifications(hal::SensorType aSensor);
   1.219 +
   1.220 +
   1.221 +/**
   1.222 + * Inform the network backend there is a new network observer.
   1.223 + * @param aNetworkObserver The observer that should be added.
   1.224 + */
   1.225 +void RegisterNetworkObserver(NetworkObserver* aNetworkObserver);
   1.226 +
   1.227 +/**
   1.228 + * Inform the network backend a network observer unregistered.
   1.229 + * @param aNetworkObserver The observer that should be removed.
   1.230 + */
   1.231 +void UnregisterNetworkObserver(NetworkObserver* aNetworkObserver);
   1.232 +
   1.233 +/**
   1.234 + * Returns the current network information.
   1.235 + */
   1.236 +void GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo);
   1.237 +
   1.238 +/**
   1.239 + * Notify of a change in the network state.
   1.240 + * @param aNetworkInfo The new network information.
   1.241 + */
   1.242 +void NotifyNetworkChange(const hal::NetworkInformation& aNetworkInfo);
   1.243 +
   1.244 +/**
   1.245 + * Adjusting system clock.
   1.246 + * @param aDeltaMilliseconds The difference compared with current system clock.
   1.247 + */
   1.248 +void AdjustSystemClock(int64_t aDeltaMilliseconds);
   1.249 +
   1.250 +/**
   1.251 + * Set timezone
   1.252 + * @param aTimezoneSpec The definition can be found in
   1.253 + * http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
   1.254 + */
   1.255 +void SetTimezone(const nsCString& aTimezoneSpec);
   1.256 +
   1.257 +/**
   1.258 + * Get timezone
   1.259 + * http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
   1.260 + */
   1.261 +nsCString GetTimezone();
   1.262 +
   1.263 +/**
   1.264 + * Get timezone offset
   1.265 + * returns the timezone offset relative to UTC in minutes (DST effect included)
   1.266 + */
   1.267 +int32_t GetTimezoneOffset();
   1.268 +
   1.269 +/**
   1.270 + * Register observer for system clock changed notification.
   1.271 + * @param aObserver The observer that should be added.
   1.272 + */
   1.273 +void RegisterSystemClockChangeObserver(
   1.274 +  hal::SystemClockChangeObserver* aObserver);
   1.275 +
   1.276 +/**
   1.277 + * Unregister the observer for system clock changed.
   1.278 + * @param aObserver The observer that should be removed.
   1.279 + */
   1.280 +void UnregisterSystemClockChangeObserver(
   1.281 +  hal::SystemClockChangeObserver* aObserver);
   1.282 +
   1.283 +/**
   1.284 + * Notify of a change in the system clock.
   1.285 + * @param aClockDeltaMS
   1.286 + */
   1.287 +void NotifySystemClockChange(const int64_t& aClockDeltaMS);
   1.288 +
   1.289 +/**
   1.290 + * Register observer for system timezone changed notification.
   1.291 + * @param aObserver The observer that should be added.
   1.292 + */
   1.293 +void RegisterSystemTimezoneChangeObserver(
   1.294 +  hal::SystemTimezoneChangeObserver* aObserver);
   1.295 +
   1.296 +/**
   1.297 + * Unregister the observer for system timezone changed.
   1.298 + * @param aObserver The observer that should be removed.
   1.299 + */
   1.300 +void UnregisterSystemTimezoneChangeObserver(
   1.301 +  hal::SystemTimezoneChangeObserver* aObserver);
   1.302 +
   1.303 +/**
   1.304 + * Notify of a change in the system timezone.
   1.305 + * @param aSystemTimezoneChangeInfo
   1.306 + */
   1.307 +void NotifySystemTimezoneChange(
   1.308 +  const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
   1.309 +
   1.310 +/**
   1.311 + * Reboot the device.
   1.312 + *
   1.313 + * This API is currently only allowed to be used from the main process.
   1.314 + */
   1.315 +void Reboot();
   1.316 +
   1.317 +/**
   1.318 + * Power off the device.
   1.319 + *
   1.320 + * This API is currently only allowed to be used from the main process.
   1.321 + */
   1.322 +void PowerOff();
   1.323 +
   1.324 +/**
   1.325 + * Enable wake lock notifications from the backend.
   1.326 + *
   1.327 + * This method is only used by WakeLockObserversManager.
   1.328 + */
   1.329 +void EnableWakeLockNotifications();
   1.330 +
   1.331 +/**
   1.332 + * Disable wake lock notifications from the backend.
   1.333 + *
   1.334 + * This method is only used by WakeLockObserversManager.
   1.335 + */
   1.336 +void DisableWakeLockNotifications();
   1.337 +
   1.338 +/**
   1.339 + * Inform the wake lock backend there is a new wake lock observer.
   1.340 + * @param aWakeLockObserver The observer that should be added.
   1.341 + */
   1.342 +void RegisterWakeLockObserver(WakeLockObserver* aObserver);
   1.343 +
   1.344 +/**
   1.345 + * Inform the wake lock backend a wake lock observer unregistered.
   1.346 + * @param aWakeLockObserver The observer that should be removed.
   1.347 + */
   1.348 +void UnregisterWakeLockObserver(WakeLockObserver* aObserver);
   1.349 +
   1.350 +/**
   1.351 + * Adjust a wake lock's counts on behalf of a given process.
   1.352 + *
   1.353 + * In most cases, you shouldn't need to pass the aProcessID argument; the
   1.354 + * default of CONTENT_PROCESS_ID_UNKNOWN is probably what you want.
   1.355 + *
   1.356 + * @param aTopic        lock topic
   1.357 + * @param aLockAdjust   to increase or decrease active locks
   1.358 + * @param aHiddenAdjust to increase or decrease hidden locks
   1.359 + * @param aProcessID    indicates which process we're modifying the wake lock
   1.360 + *                      on behalf of.  It is interpreted as
   1.361 + *
   1.362 + *                      CONTENT_PROCESS_ID_UNKNOWN: The current process
   1.363 + *                      CONTENT_PROCESS_ID_MAIN: The root process
   1.364 + *                      X: The process with ContentChild::GetID() == X
   1.365 + */
   1.366 +void ModifyWakeLock(const nsAString &aTopic,
   1.367 +                    hal::WakeLockControl aLockAdjust,
   1.368 +                    hal::WakeLockControl aHiddenAdjust,
   1.369 +                    uint64_t aProcessID = hal::CONTENT_PROCESS_ID_UNKNOWN);
   1.370 +
   1.371 +/**
   1.372 + * Query the wake lock numbers of aTopic.
   1.373 + * @param aTopic        lock topic
   1.374 + * @param aWakeLockInfo wake lock numbers
   1.375 + */
   1.376 +void GetWakeLockInfo(const nsAString &aTopic, hal::WakeLockInformation *aWakeLockInfo);
   1.377 +
   1.378 +/**
   1.379 + * Notify of a change in the wake lock state.
   1.380 + * @param aWakeLockInfo The new wake lock information.
   1.381 + */
   1.382 +void NotifyWakeLockChange(const hal::WakeLockInformation& aWakeLockInfo);
   1.383 +
   1.384 +/**
   1.385 + * Inform the backend there is a new screen configuration observer.
   1.386 + * @param aScreenConfigurationObserver The observer that should be added.
   1.387 + */
   1.388 +void RegisterScreenConfigurationObserver(hal::ScreenConfigurationObserver* aScreenConfigurationObserver);
   1.389 +
   1.390 +/**
   1.391 + * Inform the backend a screen configuration observer unregistered.
   1.392 + * @param aScreenConfigurationObserver The observer that should be removed.
   1.393 + */
   1.394 +void UnregisterScreenConfigurationObserver(hal::ScreenConfigurationObserver* aScreenConfigurationObserver);
   1.395 +
   1.396 +/**
   1.397 + * Returns the current screen configuration.
   1.398 + */
   1.399 +void GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration);
   1.400 +
   1.401 +/**
   1.402 + * Notify of a change in the screen configuration.
   1.403 + * @param aScreenConfiguration The new screen orientation.
   1.404 + */
   1.405 +void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConfiguration);
   1.406 +
   1.407 +/**
   1.408 + * Lock the screen orientation to the specific orientation.
   1.409 + * @return Whether the lock has been accepted.
   1.410 + */
   1.411 +bool LockScreenOrientation(const dom::ScreenOrientation& aOrientation);
   1.412 +
   1.413 +/**
   1.414 + * Unlock the screen orientation.
   1.415 + */
   1.416 +void UnlockScreenOrientation();
   1.417 +
   1.418 +/**
   1.419 + * Register an observer for the switch of given SwitchDevice.
   1.420 + *
   1.421 + * The observer will receive data whenever the data generated by the
   1.422 + * given switch.
   1.423 + */
   1.424 +void RegisterSwitchObserver(hal::SwitchDevice aDevice, hal::SwitchObserver *aSwitchObserver);
   1.425 +
   1.426 +/**
   1.427 + * Unregister an observer for the switch of given SwitchDevice.
   1.428 + */
   1.429 +void UnregisterSwitchObserver(hal::SwitchDevice aDevice, hal::SwitchObserver *aSwitchObserver);
   1.430 +
   1.431 +/**
   1.432 + * Notify the state of the switch.
   1.433 + *
   1.434 + * This API is internal to hal; clients shouldn't call it directly.
   1.435 + */
   1.436 +void NotifySwitchChange(const hal::SwitchEvent& aEvent);
   1.437 +
   1.438 +/**
   1.439 + * Get current switch information.
   1.440 + */
   1.441 +hal::SwitchState GetCurrentSwitchState(hal::SwitchDevice aDevice);
   1.442 +
   1.443 +/**
   1.444 + * Notify switch status change from input device.
   1.445 + */
   1.446 +void NotifySwitchStateFromInputDevice(hal::SwitchDevice aDevice,
   1.447 +                                      hal::SwitchState aState);
   1.448 +
   1.449 +/**
   1.450 + * Register an observer that is notified when a programmed alarm
   1.451 + * expires.
   1.452 + *
   1.453 + * Currently, there can only be 0 or 1 alarm observers.
   1.454 + */
   1.455 +bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver);
   1.456 +
   1.457 +/**
   1.458 + * Unregister the alarm observer.  Doing so will implicitly cancel any
   1.459 + * programmed alarm.
   1.460 + */
   1.461 +void UnregisterTheOneAlarmObserver();
   1.462 +
   1.463 +/**
   1.464 + * Notify that the programmed alarm has expired.
   1.465 + *
   1.466 + * This API is internal to hal; clients shouldn't call it directly.
   1.467 + */
   1.468 +void NotifyAlarmFired();
   1.469 +
   1.470 +/**
   1.471 + * Program the real-time clock to expire at the time |aSeconds|,
   1.472 + * |aNanoseconds|.  These specify a point in real time relative to the
   1.473 + * UNIX epoch.  The alarm will fire at this time point even if the
   1.474 + * real-time clock is changed; that is, this alarm respects changes to
   1.475 + * the real-time clock.  Return true iff the alarm was programmed.
   1.476 + *
   1.477 + * The alarm can be reprogrammed at any time.
   1.478 + *
   1.479 + * This API is currently only allowed to be used from non-sandboxed
   1.480 + * contexts.
   1.481 + */
   1.482 +bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds);
   1.483 +
   1.484 +/**
   1.485 + * Set the priority of the given process.  A process's priority is a two-tuple
   1.486 + * consisting of a hal::ProcessPriority value and a hal::ProcessCPUPriority
   1.487 + * value.
   1.488 + *
   1.489 + * Two processes with the same ProcessCPUPriority value don't necessarily have
   1.490 + * the same CPU priority; the CPU priority we assign to a process is a function
   1.491 + * of its ProcessPriority and ProcessCPUPriority.
   1.492 + *
   1.493 + * Exactly what this does will vary between platforms.  On *nix we might give
   1.494 + * background processes higher nice values.  On other platforms, we might
   1.495 + * ignore this call entirely.
   1.496 + */
   1.497 +void SetProcessPriority(int aPid,
   1.498 +                        hal::ProcessPriority aPriority,
   1.499 +                        hal::ProcessCPUPriority aCPUPriority,
   1.500 +                        uint32_t aLRU = 0);
   1.501 +
   1.502 +/**
   1.503 + * Register an observer for the FM radio.
   1.504 + */
   1.505 +void RegisterFMRadioObserver(hal::FMRadioObserver* aRadioObserver);
   1.506 +
   1.507 +/**
   1.508 + * Unregister the observer for the FM radio.
   1.509 + */
   1.510 +void UnregisterFMRadioObserver(hal::FMRadioObserver* aRadioObserver);
   1.511 +
   1.512 +/**
   1.513 + * Notify observers that a call to EnableFMRadio, DisableFMRadio, or FMRadioSeek
   1.514 + * has completed, and indicate what the call returned.
   1.515 + */
   1.516 +void NotifyFMRadioStatus(const hal::FMRadioOperationInformation& aRadioState);
   1.517 +
   1.518 +/**
   1.519 + * Enable the FM radio and configure it according to the settings in aInfo.
   1.520 + */
   1.521 +void EnableFMRadio(const hal::FMRadioSettings& aInfo);
   1.522 +
   1.523 +/**
   1.524 + * Disable the FM radio.
   1.525 + */
   1.526 +void DisableFMRadio();
   1.527 +
   1.528 +/**
   1.529 + * Seek to an available FM radio station.
   1.530 + *
   1.531 + */
   1.532 +void FMRadioSeek(const hal::FMRadioSeekDirection& aDirection);
   1.533 +
   1.534 +/**
   1.535 + * Get the current FM radio settings.
   1.536 + */
   1.537 +void GetFMRadioSettings(hal::FMRadioSettings* aInfo);
   1.538 +
   1.539 +/**
   1.540 + * Set the FM radio's frequency.
   1.541 + */
   1.542 +void SetFMRadioFrequency(const uint32_t frequency);
   1.543 +
   1.544 +/**
   1.545 + * Get the FM radio's frequency.
   1.546 + */
   1.547 +uint32_t GetFMRadioFrequency();
   1.548 +
   1.549 +/**
   1.550 + * Get FM radio power state
   1.551 + */
   1.552 +bool IsFMRadioOn();
   1.553 +
   1.554 +/**
   1.555 + * Get FM radio signal strength
   1.556 + */
   1.557 +uint32_t GetFMRadioSignalStrength();
   1.558 +
   1.559 +/**
   1.560 + * Cancel FM radio seeking
   1.561 + */
   1.562 +void CancelFMRadioSeek();
   1.563 +
   1.564 +/**
   1.565 + * Get FM radio band settings by country.
   1.566 + */
   1.567 +hal::FMRadioSettings GetFMBandSettings(hal::FMRadioCountry aCountry);
   1.568 +
   1.569 +/**
   1.570 + * Start a watchdog to compulsively shutdown the system if it hangs.
   1.571 + * @param aMode Specify how to shutdown the system.
   1.572 + * @param aTimeoutSecs Specify the delayed seconds to shutdown the system.
   1.573 + *
   1.574 + * This API is currently only allowed to be used from the main process.
   1.575 + */
   1.576 +void StartForceQuitWatchdog(hal::ShutdownMode aMode, int32_t aTimeoutSecs);
   1.577 +
   1.578 +/**
   1.579 + * Perform Factory Reset to wipe out all user data.
   1.580 + */
   1.581 +void FactoryReset();
   1.582 +
   1.583 +/**
   1.584 + * Start monitoring the status of gamepads attached to the system.
   1.585 + */
   1.586 +void StartMonitoringGamepadStatus();
   1.587 +
   1.588 +/**
   1.589 + * Stop monitoring the status of gamepads attached to the system.
   1.590 + */
   1.591 +void StopMonitoringGamepadStatus();
   1.592 +
   1.593 +/**
   1.594 + * Start monitoring disk space for low space situations.
   1.595 + *
   1.596 + * This API is currently only allowed to be used from the main process.
   1.597 + */
   1.598 +void StartDiskSpaceWatcher();
   1.599 +
   1.600 +/**
   1.601 + * Stop monitoring disk space for low space situations.
   1.602 + *
   1.603 + * This API is currently only allowed to be used from the main process.
   1.604 + */
   1.605 +void StopDiskSpaceWatcher();
   1.606 +
   1.607 +/**
   1.608 + * Get total system memory of device being run on in bytes.
   1.609 + *
   1.610 + * Returns 0 if we are unable to determine this information from /proc/meminfo.
   1.611 + */
   1.612 +uint32_t GetTotalSystemMemory();
   1.613 +
   1.614 +} // namespace MOZ_HAL_NAMESPACE
   1.615 +} // namespace mozilla
   1.616 +
   1.617 +#ifdef MOZ_DEFINED_HAL_NAMESPACE
   1.618 +# undef MOZ_DEFINED_HAL_NAMESPACE
   1.619 +# undef MOZ_HAL_NAMESPACE
   1.620 +#endif
   1.621 +
   1.622 +#endif  // mozilla_Hal_h

mercurial