Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accelerator-home-ui/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"log": true,
"enableAppSuspended": true,
"showVersion": false,
"version": "6.0.27"
"version": "6.0.28"
}
}
25 changes: 1 addition & 24 deletions accelerator-home-ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,30 +780,7 @@ export default class App extends Router.App {
this.LOG("App getActiveSourceStatus: " + JSON.stringify(res) + " UICacheCECActiveSourceStatus:" + JSON.stringify(Storage.get("UICacheCECActiveSourceStatus")));
});
} else {
cecApi.activate().then(() => {
let getfriendlyname, getosdname;
setTimeout(() => {
appApi.getFriendlyName().then(res => {
getfriendlyname = res.friendlyName;
this.LOG("AppApi getFriendlyName :" + JSON.stringify(getfriendlyname));
}).catch(err => {
this.ERR("AppApi getFriendlyName Error: " + JSON.stringify(err));
})
cecApi.getOSDName().then(result => {
getosdname = result.name;
this.LOG("CECApi getOSDName :" + JSON.stringify(getosdname));
if (getfriendlyname !== getosdname) {
cecApi.setOSDName(getfriendlyname);
}
}).catch(err => {
this.ERR("CECApi getOSDName Error :" + JSON.stringify(err));
})
}, 5000);
cecApi.getActiveSourceStatus().then((res) => {
Storage.set("UICacheCECActiveSourceStatus", res);
this.LOG("App getActiveSourceStatus: " + JSON.stringify(res) + " UICacheCECActiveSourceStatus:" + JSON.stringify(Storage.get("UICacheCECActiveSourceStatus")));
});
}).catch((err) => this.ERR(JSON.stringify(err)))
this.LOG('HdmiCecSource is inactive during boot; leaving it disabled until the user enables it from the UI')
}
})
this._subscribeToIOPortNotifications()
Expand Down
4 changes: 2 additions & 2 deletions accelerator-home-ui/src/api/CECApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export default class CECApi {
})
}

setEnabled() {
setEnabled(enabled = true) {
return new Promise((resolve) => {
thunder.call('org.rdk.HdmiCecSource', 'setEnabled', { enabled: true })
thunder.call('org.rdk.HdmiCecSource', 'setEnabled', { enabled })
.then(result => {
resolve(result)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,25 @@

_init() {
this.cecApi = new CECApi()
this.cecApi.activate()
.then(() => {
this.tag('CECControl.Button').src = Utils.asset('images/settings/ToggleOnOrange.png')
this.performOTPAction()
this.cecApi.getEnabled()
.then(res => {
Comment thread
SudarsananComcast marked this conversation as resolved.
const isEnabled = !!(res && res.enabled)
this.tag('CECControl.Button').src = Utils.asset(
isEnabled
? 'images/settings/ToggleOnOrange.png'
: 'images/settings/ToggleOffWhite.png'
)
if (isEnabled) {
this.performOTPAction()
}
})
this._setState('CECControl')
}
_focus() {
this._setState('CECControl')
}
performOTPAction() {
this.cecApi.setEnabled().then(res => {
this.cecApi.setEnabled(true).then(res => {
if (res.success) {
this.cecApi.performOTP().then(otpRes => {
if (otpRes.success) {
Expand All @@ -200,18 +207,22 @@
this.cecApi.getEnabled()
.then(res => {
this.LOG("toggleCEC getEnabled result: " + JSON.stringify(res))
if (res.enabled) {
this.cecApi.deactivate()
.then(() => {
this.tag('CECControl.Button').src = Utils.asset('images/settings/ToggleOffWhite.png')
})
}
else {
this.cecApi.activate()
.then(() => {
this.tag('CECControl.Button').src = Utils.asset('images/settings/ToggleOnOrange.png')
})
}
const newEnabledState = !(res && res.enabled)
this.cecApi.setEnabled(newEnabledState)
.then(setRes => {
if (!(setRes && setRes.success)) {
this.WARN('CEC setEnabled failed: ' + JSON.stringify(setRes))
return
}
const imageSrc = newEnabledState
? 'images/settings/ToggleOnOrange.png'
: 'images/settings/ToggleOffWhite.png'
this.tag('CECControl.Button').src = Utils.asset(imageSrc)

if (newEnabledState) {
this.performOTPAction()
}
})
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,20 @@ export default class AdvanceSettingsScreen extends Lightning.Component {

_init() {
this.cecApi = new CECApi()
this.cecApi.activate()
.then(() => {
this.tag('CECControl.Button').src = Utils.asset('images/settings/ToggleOnOrange.png')
this.performOTPAction()
this.cecApi.getEnabled()
.then(res => {
Comment thread
SudarsananComcast marked this conversation as resolved.
// get the current state of CEC and set the toggle button based on status.
const isEnabled = !!(res && res.enabled)
console.log(`CEC initial status: ${isEnabled}`)
Comment thread
SudarsananComcast marked this conversation as resolved.
Comment thread
SudarsananComcast marked this conversation as resolved.
Comment on lines +188 to +189

Comment on lines +188 to +190
this.tag('CECControl.Button').src = Utils.asset(
isEnabled
? 'images/settings/ToggleOnOrange.png'
: 'images/settings/ToggleOffWhite.png'
)
if (isEnabled) {
this.performOTPAction()
}
})
this._setState('TTSOptions')
}
Expand All @@ -200,7 +210,7 @@ export default class AdvanceSettingsScreen extends Lightning.Component {
}

performOTPAction() {
this.cecApi.setEnabled().then(res => {
this.cecApi.setEnabled(true).then(res => {
if (res.success) {
this.cecApi.performOTP().then(otpRes => {
if (otpRes.success) {
Expand All @@ -215,18 +225,19 @@ export default class AdvanceSettingsScreen extends Lightning.Component {
this.cecApi.getEnabled()
.then(res => {
this.LOG("cec getenabled result:" + JSON.stringify(res))
if (res.enabled) {
this.cecApi.deactivate()
.then(() => {
this.tag('CECControl.Button').src = Utils.asset('images/settings/ToggleOffWhite.png')
})
}
else {
this.cecApi.activate()
.then(() => {
this.tag('CECControl.Button').src = Utils.asset('images/settings/ToggleOnOrange.png')
})
}
// get the current state and toggle it.
const newEnabledState = !(res && res.enabled)
this.cecApi.setEnabled(newEnabledState)
.then(() => {
// Update UI based on new state
const imageSrc = newEnabledState
? 'images/settings/ToggleOnOrange.png'
: 'images/settings/ToggleOffWhite.png'
this.tag('CECControl.Button').src = Utils.asset(imageSrc)
if (newEnabledState) {
this.performOTPAction()
}
})
Comment thread
SudarsananComcast marked this conversation as resolved.
Comment thread
SudarsananComcast marked this conversation as resolved.
Comment on lines +230 to +240
Comment thread
SudarsananComcast marked this conversation as resolved.
Comment thread
SudarsananComcast marked this conversation as resolved.
Comment on lines +230 to +240
Comment on lines +228 to +240
})
}
static _states() {
Expand Down
4 changes: 2 additions & 2 deletions bolt/package-configs/com.rdkcentral.refui.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "com.rdkcentral.refui",
"version": "6.0.27",
"versionName": "6.0.27",
"version": "6.0.28",
"versionName": "6.0.28",
"name": "RDK Ref UI Home Screen",
"packageType": "application",
"entryPoint": "--lightning --dev file:///usr/share/refui/index.html",
Expand Down