michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set sw=2 ts=8 et ft=cpp : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include protocol PContent; michael@0: include protocol PBrowser; michael@0: michael@0: using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h"; michael@0: using mozilla::hal::FlashMode from "mozilla/HalTypes.h"; michael@0: using mozilla::hal::LightType from "mozilla/HalTypes.h"; michael@0: using mozilla::hal::LightMode from "mozilla/HalTypes.h"; michael@0: using mozilla::hal::SensorType from "mozilla/HalSensor.h"; michael@0: using mozilla::hal::SensorAccuracyType from "mozilla/HalSensor.h"; michael@0: using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h"; michael@0: using mozilla::hal::SwitchState from "mozilla/HalTypes.h"; michael@0: using mozilla::hal::SwitchDevice from "mozilla/HalTypes.h"; michael@0: using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h"; michael@0: using struct nsIntRect from "nsRect.h"; michael@0: using PRTime from "prtime.h"; michael@0: using mozilla::hal::FMRadioCountry from "mozilla/HalTypes.h"; michael@0: using mozilla::hal::FMRadioOperation from "mozilla/HalTypes.h"; michael@0: using mozilla::hal::FMRadioOperationStatus from "mozilla/HalTypes.h"; michael@0: michael@0: namespace mozilla { michael@0: michael@0: namespace hal { michael@0: struct BatteryInformation { michael@0: double level; michael@0: bool charging; michael@0: double remainingTime; michael@0: }; michael@0: michael@0: struct LightConfiguration { michael@0: LightType light; michael@0: LightMode mode; michael@0: FlashMode flash; michael@0: uint32_t flashOnMS; michael@0: uint32_t flashOffMS; michael@0: uint32_t color; michael@0: }; michael@0: michael@0: struct SensorData { michael@0: SensorType sensor; michael@0: PRTime timestamp; michael@0: float[] values; michael@0: SensorAccuracyType accuracy; michael@0: }; michael@0: michael@0: struct NetworkInformation { michael@0: uint32_t type; michael@0: bool isWifi; michael@0: uint32_t dhcpGateway; michael@0: }; michael@0: michael@0: struct SwitchEvent { michael@0: SwitchDevice device; michael@0: SwitchState status; michael@0: }; michael@0: michael@0: struct WakeLockInformation { michael@0: nsString topic; michael@0: uint32_t numLocks; michael@0: uint32_t numHidden; michael@0: uint64_t[] lockingProcesses; michael@0: }; michael@0: michael@0: struct ScreenConfiguration { michael@0: nsIntRect rect; michael@0: ScreenOrientation orientation; michael@0: uint32_t colorDepth; michael@0: uint32_t pixelDepth; michael@0: }; michael@0: michael@0: struct FMRadioOperationInformation { michael@0: FMRadioOperation operation; michael@0: FMRadioOperationStatus status; michael@0: uint32_t frequency; michael@0: }; michael@0: michael@0: struct FMRadioSettings { michael@0: FMRadioCountry country; michael@0: uint32_t upperLimit; michael@0: uint32_t lowerLimit; michael@0: uint32_t spaceType; michael@0: uint32_t preEmphasis; michael@0: }; michael@0: michael@0: struct SystemTimezoneChangeInformation { michael@0: // These timezone offsets are relative to UTC in minutes and michael@0: // have already taken daylight saving time (DST) into account. michael@0: int32_t oldTimezoneOffsetMinutes; michael@0: int32_t newTimezoneOffsetMinutes; michael@0: }; michael@0: michael@0: } // namespace hal michael@0: michael@0: namespace hal_sandbox { michael@0: michael@0: sync protocol PHal { michael@0: manager PContent; michael@0: michael@0: child: michael@0: NotifyBatteryChange(BatteryInformation aBatteryInfo); michael@0: NotifyNetworkChange(NetworkInformation aNetworkInfo); michael@0: NotifyWakeLockChange(WakeLockInformation aWakeLockInfo); michael@0: NotifyScreenConfigurationChange(ScreenConfiguration aScreenOrientation); michael@0: NotifySwitchChange(SwitchEvent aEvent); michael@0: NotifySystemClockChange(int64_t aClockDeltaMS); michael@0: NotifySystemTimezoneChange(SystemTimezoneChangeInformation aSystemTimezoneChangeInfo); michael@0: michael@0: parent: michael@0: Vibrate(uint32_t[] pattern, uint64_t[] id, PBrowser browser); michael@0: CancelVibrate(uint64_t[] id, PBrowser browser); michael@0: michael@0: EnableBatteryNotifications(); michael@0: DisableBatteryNotifications(); michael@0: sync GetCurrentBatteryInformation() michael@0: returns (BatteryInformation aBatteryInfo); michael@0: michael@0: EnableNetworkNotifications(); michael@0: DisableNetworkNotifications(); michael@0: sync GetCurrentNetworkInformation() michael@0: returns (NetworkInformation aNetworkInfo); michael@0: michael@0: sync GetScreenEnabled() returns (bool enabled); michael@0: SetScreenEnabled(bool enabled); michael@0: michael@0: sync GetCpuSleepAllowed() returns (bool allowed); michael@0: SetCpuSleepAllowed(bool allowed); michael@0: michael@0: sync GetScreenBrightness() returns (double brightness); michael@0: SetScreenBrightness(double brightness); michael@0: michael@0: AdjustSystemClock(int64_t aDeltaMilliseconds); michael@0: SetTimezone(nsCString aTimezoneSpec); michael@0: sync GetTimezone() michael@0: returns (nsCString aTimezoneSpec); michael@0: sync GetTimezoneOffset() michael@0: returns (int32_t aTimezoneOffset); michael@0: EnableSystemClockChangeNotifications(); michael@0: DisableSystemClockChangeNotifications(); michael@0: EnableSystemTimezoneChangeNotifications(); michael@0: DisableSystemTimezoneChangeNotifications(); michael@0: michael@0: sync SetLight(LightType light, LightConfiguration aConfig) michael@0: returns (bool status); michael@0: sync GetLight(LightType light) michael@0: returns (LightConfiguration aConfig, bool status); michael@0: michael@0: ModifyWakeLock(nsString aTopic, michael@0: WakeLockControl aLockAdjust, michael@0: WakeLockControl aHiddenAdjust, michael@0: uint64_t aProcessID); michael@0: EnableWakeLockNotifications(); michael@0: DisableWakeLockNotifications(); michael@0: sync GetWakeLockInfo(nsString aTopic) michael@0: returns (WakeLockInformation aWakeLockInfo); michael@0: michael@0: EnableScreenConfigurationNotifications(); michael@0: DisableScreenConfigurationNotifications(); michael@0: sync GetCurrentScreenConfiguration() michael@0: returns (ScreenConfiguration aScreenConfiguration); michael@0: sync LockScreenOrientation(ScreenOrientation aOrientation) michael@0: returns (bool allowed); michael@0: UnlockScreenOrientation(); michael@0: michael@0: EnableSwitchNotifications(SwitchDevice aDevice); michael@0: DisableSwitchNotifications(SwitchDevice aDevice); michael@0: sync GetCurrentSwitchState(SwitchDevice aDevice) michael@0: returns (SwitchState aState); michael@0: NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState); michael@0: michael@0: FactoryReset(); michael@0: michael@0: child: michael@0: NotifySensorChange(SensorData aSensorData); michael@0: michael@0: parent: michael@0: EnableSensorNotifications(SensorType aSensor); michael@0: DisableSensorNotifications(SensorType aSensor); michael@0: michael@0: __delete__(); michael@0: }; michael@0: michael@0: } // namespace hal michael@0: } // namespace mozilla