Var level=() ĭocument.getElementById("CurrentBrightness").innerHTML="Current Brightness: "+level Sets the screen brightness of the device. SetScreenBrightness() method: Method of PowerManager interface. Returns the current screen brightness of the device. GetScreenBrightness() method: Method of PowerManager interface. Required Privilege in config.xml is power privilege Part B: Adjust Screen Brightness using Power APIĪt first, the privileges need to be added for accessing screen brightness data from web app. Stop() method is used to stop the sensor. tChangeListener (onGetSuccessCB, onerrorCB) The start() method must be called to turn on the sensor, or the sensor data will not change. Note that the setChangeListener() method only registers the listener. SetChangeListener() registers a change listener to be called when sensor data of the given type changes. Step-5: Setting OnChangeListener to read data on change LightSensor.getLightSensorData (onGetSuccessCB, onerrorCB) ĭocument.getElementById("light-result").innerHTML="Light Sensor data: " +sensorData.lightLevel+" lux" Note that the start() method should be called before calling the getLightSensorData() method to turn on the sensor. GetLightSensorData() : Gets the current sensor data. The LightSensor interface provides getLightSensorData() method to access light sensor data. To start the sensor use start() function. Capability testing & Getting default sensor Next step is to get device’s default sensor getDefaultSensor() function gets the default sensor of the device for the given sensor type. To check if the given type is supported or not, SystemInfo API can be used. Step-2: Capability testing & Selecting SensorsĬheck whether the sensor is supported by the device using the getCapability () method of the SystemInfo interface for the proper capability related to the sensor. Required Privilege in config.xml for accessing sensor data is healthinfo privilege. Part A: Ambient light detection using Light sensorĪt first, the privileges need to be added for accessing sensor data from web app. The Ideal condition would be determined based on the luminance of ambient light and analysis of relation between screen brightness and ambient light. In this document, we focused on adjusting device’s screen brightness based on the ambient light using Tizen Web APIs.Ī sample application is developed to adjust device’s screen brightness to ideal condition both for user visibility and efficient power consumption. The light sensor data can then be used to develop features like indoor lighting control, IoT light device control, photographic environment justification, camera flashlight automation. Tizen web provides Sensor API to manage data from light sensor.
0 Comments
Leave a Reply. |