hal/sandbox/PHal.ipdl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/hal/sandbox/PHal.ipdl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,188 @@
     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
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +include protocol PContent;
    1.11 +include protocol PBrowser;
    1.12 +
    1.13 +using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
    1.14 +using mozilla::hal::FlashMode from "mozilla/HalTypes.h";
    1.15 +using mozilla::hal::LightType from "mozilla/HalTypes.h";
    1.16 +using mozilla::hal::LightMode from "mozilla/HalTypes.h";
    1.17 +using mozilla::hal::SensorType from "mozilla/HalSensor.h";
    1.18 +using mozilla::hal::SensorAccuracyType from "mozilla/HalSensor.h";
    1.19 +using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
    1.20 +using mozilla::hal::SwitchState from "mozilla/HalTypes.h";
    1.21 +using mozilla::hal::SwitchDevice from "mozilla/HalTypes.h";
    1.22 +using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
    1.23 +using struct nsIntRect from "nsRect.h";
    1.24 +using PRTime from "prtime.h";
    1.25 +using mozilla::hal::FMRadioCountry from "mozilla/HalTypes.h";
    1.26 +using mozilla::hal::FMRadioOperation from "mozilla/HalTypes.h";
    1.27 +using mozilla::hal::FMRadioOperationStatus from "mozilla/HalTypes.h";
    1.28 +
    1.29 +namespace mozilla {
    1.30 +
    1.31 +namespace hal {
    1.32 +struct BatteryInformation {
    1.33 +  double level;
    1.34 +  bool   charging;
    1.35 +  double remainingTime;
    1.36 +};
    1.37 +
    1.38 +struct LightConfiguration {
    1.39 +  LightType light;
    1.40 +  LightMode mode;
    1.41 +  FlashMode flash;
    1.42 +  uint32_t flashOnMS;
    1.43 +  uint32_t flashOffMS;
    1.44 +  uint32_t color;
    1.45 +};
    1.46 +
    1.47 +struct SensorData {
    1.48 +  SensorType sensor;
    1.49 +  PRTime timestamp;
    1.50 +  float[] values;
    1.51 +  SensorAccuracyType accuracy;
    1.52 +};
    1.53 +
    1.54 +struct NetworkInformation {
    1.55 +  uint32_t type;
    1.56 +  bool   isWifi;
    1.57 +  uint32_t dhcpGateway;
    1.58 +};
    1.59 +
    1.60 +struct SwitchEvent {
    1.61 +  SwitchDevice device;
    1.62 +  SwitchState status;
    1.63 +};
    1.64 +
    1.65 +struct WakeLockInformation {
    1.66 +  nsString topic;
    1.67 +  uint32_t numLocks;
    1.68 +  uint32_t numHidden;
    1.69 +  uint64_t[] lockingProcesses;
    1.70 +};
    1.71 +
    1.72 +struct ScreenConfiguration {
    1.73 +  nsIntRect rect;
    1.74 +  ScreenOrientation orientation;
    1.75 +  uint32_t colorDepth;
    1.76 +  uint32_t pixelDepth;
    1.77 +};
    1.78 +
    1.79 +struct FMRadioOperationInformation {
    1.80 +  FMRadioOperation operation;
    1.81 +  FMRadioOperationStatus status;
    1.82 +  uint32_t frequency;
    1.83 +};
    1.84 +
    1.85 +struct FMRadioSettings {
    1.86 +  FMRadioCountry country;
    1.87 +  uint32_t upperLimit;
    1.88 +  uint32_t lowerLimit;
    1.89 +  uint32_t spaceType;
    1.90 +  uint32_t preEmphasis;
    1.91 +};
    1.92 +
    1.93 +struct SystemTimezoneChangeInformation {
    1.94 +  // These timezone offsets are relative to UTC in minutes and
    1.95 +  // have already taken daylight saving time (DST) into account.
    1.96 +  int32_t oldTimezoneOffsetMinutes;
    1.97 +  int32_t newTimezoneOffsetMinutes;
    1.98 +};
    1.99 +
   1.100 +} // namespace hal
   1.101 +
   1.102 +namespace hal_sandbox {
   1.103 +
   1.104 +sync protocol PHal {
   1.105 +    manager PContent;
   1.106 +
   1.107 +child:
   1.108 +    NotifyBatteryChange(BatteryInformation aBatteryInfo);
   1.109 +    NotifyNetworkChange(NetworkInformation aNetworkInfo);
   1.110 +    NotifyWakeLockChange(WakeLockInformation aWakeLockInfo);
   1.111 +    NotifyScreenConfigurationChange(ScreenConfiguration aScreenOrientation);
   1.112 +    NotifySwitchChange(SwitchEvent aEvent);
   1.113 +    NotifySystemClockChange(int64_t aClockDeltaMS); 
   1.114 +    NotifySystemTimezoneChange(SystemTimezoneChangeInformation aSystemTimezoneChangeInfo); 
   1.115 +
   1.116 +parent:
   1.117 +    Vibrate(uint32_t[] pattern, uint64_t[] id, PBrowser browser);
   1.118 +    CancelVibrate(uint64_t[] id, PBrowser browser);
   1.119 +
   1.120 +    EnableBatteryNotifications();
   1.121 +    DisableBatteryNotifications();
   1.122 +    sync GetCurrentBatteryInformation()
   1.123 +      returns (BatteryInformation aBatteryInfo);
   1.124 +
   1.125 +    EnableNetworkNotifications();
   1.126 +    DisableNetworkNotifications();
   1.127 +    sync GetCurrentNetworkInformation()
   1.128 +      returns (NetworkInformation aNetworkInfo);
   1.129 +
   1.130 +    sync GetScreenEnabled() returns (bool enabled);
   1.131 +    SetScreenEnabled(bool enabled);
   1.132 +
   1.133 +    sync GetCpuSleepAllowed() returns (bool allowed);
   1.134 +    SetCpuSleepAllowed(bool allowed);
   1.135 +
   1.136 +    sync GetScreenBrightness() returns (double brightness);
   1.137 +    SetScreenBrightness(double brightness);
   1.138 +
   1.139 +    AdjustSystemClock(int64_t aDeltaMilliseconds);
   1.140 +    SetTimezone(nsCString aTimezoneSpec);
   1.141 +    sync GetTimezone()
   1.142 +      returns (nsCString aTimezoneSpec);
   1.143 +    sync GetTimezoneOffset()
   1.144 +      returns (int32_t aTimezoneOffset);
   1.145 +    EnableSystemClockChangeNotifications();
   1.146 +    DisableSystemClockChangeNotifications();
   1.147 +    EnableSystemTimezoneChangeNotifications();
   1.148 +    DisableSystemTimezoneChangeNotifications();
   1.149 +
   1.150 +    sync SetLight(LightType light, LightConfiguration aConfig)
   1.151 +      returns (bool status);
   1.152 +    sync GetLight(LightType light)
   1.153 +      returns (LightConfiguration aConfig, bool status);
   1.154 +
   1.155 +    ModifyWakeLock(nsString aTopic,
   1.156 +                   WakeLockControl aLockAdjust,
   1.157 +                   WakeLockControl aHiddenAdjust,
   1.158 +                   uint64_t aProcessID);
   1.159 +    EnableWakeLockNotifications();
   1.160 +    DisableWakeLockNotifications();
   1.161 +    sync GetWakeLockInfo(nsString aTopic)
   1.162 +      returns (WakeLockInformation aWakeLockInfo);
   1.163 +
   1.164 +    EnableScreenConfigurationNotifications();
   1.165 +    DisableScreenConfigurationNotifications();
   1.166 +    sync GetCurrentScreenConfiguration()
   1.167 +      returns (ScreenConfiguration aScreenConfiguration);
   1.168 +    sync LockScreenOrientation(ScreenOrientation aOrientation)
   1.169 +      returns (bool allowed);
   1.170 +    UnlockScreenOrientation();
   1.171 + 
   1.172 +    EnableSwitchNotifications(SwitchDevice aDevice);
   1.173 +    DisableSwitchNotifications(SwitchDevice aDevice);
   1.174 +    sync GetCurrentSwitchState(SwitchDevice aDevice)
   1.175 +      returns (SwitchState aState);
   1.176 +    NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState);
   1.177 +
   1.178 +    FactoryReset();
   1.179 +
   1.180 +child:
   1.181 +    NotifySensorChange(SensorData aSensorData);
   1.182 +
   1.183 +parent:
   1.184 +    EnableSensorNotifications(SensorType aSensor);
   1.185 +    DisableSensorNotifications(SensorType aSensor);
   1.186 +
   1.187 +    __delete__();
   1.188 +};
   1.189 +
   1.190 +} // namespace hal
   1.191 +} // namespace mozilla

mercurial