简体   繁体   English

用于Firefox OS应用程序的Panasonic API

[英]Panasonic API for Firefox OS Apps

Thanks to MDN I successfully deployed a simple app on my Panasonic CXW754. 多亏了MDN,我在Panasonic CXW754上成功部署了一个简单的应用程序。 So far so good. 到现在为止还挺好。 Now I'd like to have access to screen settings like brightness etc. Is there an API provided by Panasonic or can I do it with plain Firefox OS API somehow? 现在,我想访问屏幕设置(例如亮度等)。松下是否提供了API,或者可以使用普通的Firefox OS API来实现?

I already looked at https://github.com/mozilla-b2g/gaia/tree/master/tv_apps 我已经看过https://github.com/mozilla-b2g/gaia/tree/master/tv_apps

But navigator.mozSettings is null and navigator.tv does not exist on my TV runtime :( 但是navigator.mozSettings为null,并且我的电视运行时不存在navigator.tv :(

You should be able to change screen brightness using navigator.mozPower.screenBrightness from the PowerManager API. 您应该能够使用PowerManager API中的navigator.mozPower.screenBrightness更改屏幕亮度。 Only certified apps can access this API though. 不过,只有经过认证的应用可以访问此API。

I would use the SettingsManager API instead of using directly navigator.mozPower.screenBrightness. 我将使用SettingsManager API,而不是直接使用navigator.mozPower.screenBrightness。

The SettingsManager let you change almost any setting by firstly requesting and locking that setting. 通过SettingsManager,您可以通过首先请求并锁定该设置来更改几乎所有设置。 It can even let you add Observers: https://developer.mozilla.org/en-US/docs/Web/API/SettingsManager 它甚至可以让您添加观察者: https : //developer.mozilla.org/en-US/docs/Web/API/SettingsManager

For example: https://github.com/shawnjohnjr/releases-mozilla-central/blob/8355c4efc146c9e58f7d11cdb5f567908b5754c0/toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.js 例如: https : //github.com/shawnjohnjr/releases-mozilla-central/blob/8355c4efc146c9e58f7d11cdb5f567908b5754c0/toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.js

But as pointed out by @kumar303, it is only for certified apps. 但正如@ kumar303指出的那样,它仅适用于经过认证的应用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM