From e2ff8f47b76d8de1dda80cd2b89fccadb513c24f Mon Sep 17 00:00:00 2001 From: ScreenTinker Date: Thu, 18 Jun 2026 13:24:40 -0500 Subject: [PATCH] Tizen player: real Samsung B2B fleet control (#125), folding in #126 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #123 already shipped a placeholder device:command handler (#121/#122): screen_off was a black overlay, reboot/shutdown a toast, update a "re-install" toast. This replaces that with the real control surface from #125, reconciled into the single handler #123 introduced (rather than landing a second, competing handler). - NEW tizen/js/device-control.js: window.STDeviceControl = { run, capabilities, backend }. Feature-detects webapis.systemcontrol.* (Tizen 6.5/7, sync/throws) then b2bapis.b2bcontrol.* (SSSP/Tizen 4, async), normalises both to Promises, re-probes each call. run() never rejects; resolves { ok, supported, action, note, reload }. Panel power: setPanelMute (mute ON = backlight OFF) -> setDisplayPanel/setPanelStatus fallback. reboot -> rebootDevice(); shutdown mutes the panel and notes SSSP has no true power-off; update/reload -> reload:true. - tizen/js/app.js: device:command now calls STDeviceControl.run and reports the outcome via reportCmd (device:log tag=command -> dashboard:device-log, plus a structured device:command-result), reloading ~1.2s later on result.reload. screen_off falls back to the existing black overlay (showScreenOff) when no B2B surface exists; screen_on/launch still clear the overlay + keepAwake. Dropped the now-dead tryPowerControl. reportCapabilities() runs on device:registered so the dashboard sees the backend ("none" on web/URL-Launcher/consumer TV). - tizen/config.xml: partner-level b2bcontrol + systemcontrol privileges (ignored, not fatal, on unsigned/URL-Launcher/web/consumer builds). - tizen/index.html: load $WEBAPIS/webapis.js + $B2BAPIS/b2bapis.js before the app scripts (404 harmlessly off-hardware) and device-control.js before app.js. - tizen/README.md: rewrote the remote-control table for real B2B control + a partner-signing caveat; added device-control.js to the file list. Supersedes PR #126 (feat/tizen-device-command-125), which targeted main unaware that this branch already had a device:command handler. Verified: node --check on both JS files; config.xml well-formed (xmllint). Not yet validated on a real SSSP panel — the control surface only takes effect on a partner-signed .wgt (backend reports "none" on the dev/URL-Launcher build). Co-Authored-By: Claude Opus 4.8 (1M context) --- tizen/README.md | 42 ++++---- tizen/config.xml | 9 ++ tizen/index.html | 6 ++ tizen/js/app.js | 81 ++++++++++------ tizen/js/device-control.js | 192 +++++++++++++++++++++++++++++++++++++ 5 files changed, 284 insertions(+), 46 deletions(-) create mode 100644 tizen/js/device-control.js diff --git a/tizen/README.md b/tizen/README.md index 522b984..ddc3800 100644 --- a/tizen/README.md +++ b/tizen/README.md @@ -31,6 +31,7 @@ config.xml Tizen TV web-app manifest (privileges, profile, icon) index.html setup / pairing / stage screens css/style.css js/app.js device protocol client (register, pair, heartbeat, state) +js/device-control.js Samsung B2B/system fleet control (device:command) — #125 js/player.js fullscreen playlist renderer js/socket.io.min.js socket.io-client v4.7.5 (bundled) icon.png @@ -87,20 +88,31 @@ lives in `~/tizen-studio-data`, password `screentinker`). - **Runtime**: loads + renders in Chromium with no JS errors (setup screen verified). - Not yet on real Tizen hardware — needs signing + a TV (or URL Launcher). -## Remote control & preview (#120 / #121) -The Tizen player now listens for the same dashboard events as the web/Android player. -What it can actually do depends on what a **sideloaded web app** is allowed to do on -the TV runtime: +## Remote control & preview (#120 / #121 / #125) +The Tizen player listens for the same dashboard events as the web/Android player. +`device:command` is handled by `js/device-control.js`, which drives the real Samsung +fleet-control surface (`webapis.systemcontrol` on Tizen 6.5/7, else `b2bapis.b2bcontrol` +on SSSP/Tizen 4) and reports each outcome back via `device:log` (tag `command`, shown +live on the device-detail screen) plus a structured `device:command-result`: -| Command (`device:command` type) | Tizen behaviour | -|-----------------------------------|-----------------------------------------------------------| -| `refresh` | `location.reload()` | -| `launch` / `screen_on` | clears the screen-off overlay + re-requests screen-awake | -| `screen_off` | black full-screen overlay (content keeps running behind) | -| `update` | toast: must re-install the `.wgt` (see **Updates** below) | -| `reboot` / `shutdown` | MDM-only — not reachable from a sideloaded app (toast) | -| `device:screenshot-request` | best-effort capture (see note) | -| `device:remote-start` / `-stop` | start/stop ~1 fps preview streaming | +| Command (`device:command` type) | Tizen behaviour | +|-----------------------------------|------------------------------------------------------------------------| +| `refresh` / `reload` | `location.reload()` | +| `launch` / `screen_on` | clears the screen-off overlay + re-asserts wake; `setPanelMute("OFF")` when the B2B surface is present | +| `screen_off` | `setPanelMute("ON")` (backlight off) on a B2B panel; **black overlay fallback** otherwise | +| `update` | reload to re-pull URL-Launcher content (no in-app OTA — see **Updates**) | +| `reboot` | `rebootDevice()` on a B2B panel; `unsupported` otherwise | +| `shutdown` | `setPanelMute("ON")` + note (SSSP web API has no true power-off) | +| _unknown_ | reported as `unsupported` | +| `device:screenshot-request` | best-effort capture (see note) | +| `device:remote-start` / `-stop` | start/stop ~1 fps preview streaming | + +> **Partner-signing caveat (#125):** the `b2bcontrol` / `systemcontrol` privileges in +> `config.xml` only take effect on a **partner-signed `.wgt` on a real SSSP panel**. On +> the dev/URL-Launcher/web build (or a consumer TV) those surfaces are absent, so reboot +> returns `unsupported`, `screen_off` uses the black overlay, and the startup capability +> log reports `backend=none`. Only a partner-signed build on real hardware fully +> validates reboot / panel power. > **Screenshot/preview note:** the TV decodes `