node-osmo icon indicating copy to clipboard operation
node-osmo copied to clipboard

How to run it?

Open xaionaro opened this issue 11 months ago • 3 comments

I made

yarn install
yarn build

And after that:

nodejs ./examples/scan-for-devices.js

However I got:

xaionaro@void:~/src/node-osmo$ nodejs ./examples/scan-for-devices.js
Starting DJI device scanner...
/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/hci-socket/hci.js:503
  this._socket.write(cmd);
               ^

Error: Invalid argument
    at Hci.setScanEnabled (/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/hci-socket/hci.js:503:16)
    at Gap.stopScanning (/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/hci-socket/gap.js:64:13)
    at NobleBindings.stopScanning (/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/hci-socket/bindings.js:52:13)
    at Noble.stopScanning (/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/noble.js:200:20)
    at DjiDeviceScanner.stopScanningForDevices (file:///home/xaionaro/src/node-osmo/dist/scanner.js:28:21)
    at file:///home/xaionaro/src/node-osmo/examples/scan-for-devices.js:12:9
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:547:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)

Node.js v22.12.0

What is the way to run the tool? :)

xaionaro avatar Jan 01 '25 00:01 xaionaro

When I try to run the other script, it just hangs:

xaionaro@void:~/src/node-osmo$ nodejs ./examples/connect-to-device.js 0 osmoPocket3 OsmoPocket3-XXXX XXXXXXXXXXXX rtmp://192.168.0.131/asdf/asdf
Connecting to device: 0 3
Connected to device: DjiDevice {
  wifiSsid: undefined,
  wifiPassword: undefined,
  rtmpUrl: undefined,
  resolution: '1080p',
  fps: 30,
  bitrate: 6000000,
  imageStabilization: 'RockSteady+',
  deviceId: 0,
  pairPinCode: 'love',
  noble: undefined,
  cameraPeripheral: undefined,
  fff5Characteristic: undefined,
  state: 0,
  startStreamingTimer: undefined,
  stopStreamingTimer: undefined,
  model: 3,
  modelName: 'Osmo Pocket 3',
  onStreamingStateChange: undefined,
  batteryPercentage: undefined
}
Starting live stream...
dji-device: Start live stream for Osmo Pocket 3 with resolution 1080p, fps 30, bitrate 2000000, image stabilization RockSteady+
dji-device: State change 0 -> 1

(I also tried to modify: it had osmoAction4 hardcoded and it ignored my arguments)

Also how to find out the deviceId?

xaionaro avatar Jan 01 '25 00:01 xaionaro

Seems like the last commit broke something. I was trying to fix cross-platform compatibility. Even reverting that, I suspect you might get some error when trying to parse the messages from the dji. I cant for the life of me figure out the exact platform, dependencies and commit where I got everything working. I know i had it working on my Action 4 at one point

As far the hard-coded osmoaction4, i had some dumb issues and ended up hardcoding it. The device id should be returned from the list-all-devices

datagutt avatar Jan 01 '25 17:01 datagutt

I tried to revert one by one last few commits: neither of them work.

The same error:

xaionaro@void:~/src/node-osmo$ nodejs ./examples/scan-for-devices.js
Starting DJI device scanner...
/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/hci-socket/hci.js:503
  this._socket.write(cmd);
               ^

Error: Invalid argument
    at Hci.setScanEnabled (/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/hci-socket/hci.js:503:16)
    at Gap.stopScanning (/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/hci-socket/gap.js:64:13)
    at NobleBindings.stopScanning (/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/hci-socket/bindings.js:52:13)
    at Noble.stopScanning (/home/xaionaro/src/node-osmo/node_modules/@stoprocent/noble/lib/noble.js:200:20)
    at DjiDeviceScanner.stopScanningForDevices (file:///home/xaionaro/src/node-osmo/dist/scanner.js:28:21)
    at file:///home/xaionaro/src/node-osmo/examples/scan-for-devices.js:12:9
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:547:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)

Node.js v22.12.0

xaionaro avatar Jan 01 '25 18:01 xaionaro