@cldmv/node-android-tv-remote 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cldmv/node-android-tv-remote",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "A Node.js library for controlling Android TV devices via ADB keycodes and text input.",
5
5
  "main": "src/lib/android-tv-remote.js",
6
6
  "scripts": {
@@ -403,6 +403,7 @@ module.exports = function (config) {
403
403
  /**
404
404
  * Returns the current connection status as tracked by the module.
405
405
  * Optionally performs a live check against adb devices if requested.
406
+ * Also updates the internal connected state if a live check is performed.
406
407
  * @public
407
408
  * @param {boolean} [liveCheck=false] - If true, checks adb devices for actual connection.
408
409
  * @returns {Promise<"connected"|"disconnected"|"unknown">}
@@ -418,8 +419,10 @@ module.exports = function (config) {
418
419
  const devices = await client.listDevices();
419
420
  const deviceId = host;
420
421
  const found = devices.some((d) => d.id === deviceId);
422
+ connected = found; // Keep internal state in sync with live check
421
423
  return found ? "connected" : "disconnected";
422
424
  } catch {
425
+ connected = false;
423
426
  return "unknown";
424
427
  }
425
428
  }
@@ -3,7 +3,7 @@
3
3
  // Usage: node test/interactive-remote.js
4
4
 
5
5
  const readline = require("readline");
6
- const remote = require("../src/lib/android-tv-remote");
6
+ const createRemote = require("../src/lib/android-tv-remote");
7
7
 
8
8
  /**
9
9
  * Prompts the user for input in the terminal.
@@ -36,7 +36,8 @@ async function main() {
36
36
  process.exit(1);
37
37
  }
38
38
  try {
39
- await remote.connect({ ip, port });
39
+ const remote = createRemote({ ip, port });
40
+ await remote.connect();
40
41
  console.log(`Connected to ${ip}:${port}`);
41
42
  // List of buttons to press (as method names on remote.press)
42
43
  const buttons = ["home", "up", "down", "left", "right", "ok", "back"];