@joraclista/ptz-edge-js

1.0.7 • Public • Published

ptz-edge-js

API for controlling PTZ device on windows inside electron container

Running DEMO Application

  1. npm install
  2. npm start

Build c# project after changes in c# files:

In cmd of project root do one of the next options:

  • run tools\build.bat
  • run dotnet build .\src\logitech-ptz-pro\PTZDevice.csproj and copy dll files from bin\Debug folder to project root: copy /y .\src\logitech-ptz-pro\bin\Debug\*.dll
  • open PTZDevice.csproj in Visual Studio, click 'Build Project' Option, again copy dll files to project root.

Publish npm package:

use npm publish --access public

Mind that only next files are included in npm package:

  • DirectShowLib-2005.dll
  • PTZDevice.dll
  • index.js
  • package.json
  • README.md

So c-sharp source code is not included.

Usage inside your electron app

const ptz = require("@joraclista/ptz-edge-js");

ptz.getCameraZoomInfo('PTZ Pro 2', function(error, result) {
  if (error) throw error;
  console.log(JSON.stringify(result));
});
      
ptz.moveLeft('PTZ Pro 2', function (error, result) {
  if (error) throw error;
  console.log(result);
});      

Available functions:

All function can be run synchronously or async.

To invoke function async, please pass callback as 2nd param: stop(name, callback) To invoke function in sync, please pass true instead of callback: stop(name, true)

getCameraZoomInfo(name, callback), - returns min/max/current zoom, name - is a name of the camera device

moveLeft(name, callback), moves camera a little bit left

moveRight(name, callback),

moveUp(name, callback),

moveDown(name, callback),

zoomIn(name, callback),

zoomOut(name, callback),

startMoveUp(name, callback), - starts continuously moving camera Up until max Up position is reached or until user invokes stop function

startMoveDown(name, callback),

startMoveLeft(name, callback),

startMoveRight(name, callback),

stop(name, callback) - stops camera if it was moving up/down/left/right

+ getCameras(callback) returns array of cameras, from 1.0.6 version

Project dependencies

Project depends on https://github.com/agracio/electron-edge-js which for now supports Electron 11.x - Node.js v12.18.3 at max, so will not run for Node.js v14.x.y

To build electron-edge-js for later Node.js versions:

  • Fork electron-edge-js repo
  • Run in cmd: tools\build.bat release 14.6.0 where after release desired node version is specified.
  • Update lib/edge.js, tools/buildall.bat, tools/build.bat file to include supported Node version
  • Submit pull request to main project

NB. For me described above steps worked after Python 3.7.* installation + setting --msvs_version 2019 in build.bat

Readme

Keywords

Package Sidebar

Install

npm i @joraclista/ptz-edge-js

Weekly Downloads

9

Version

1.0.7

License

ISC

Unpacked Size

454 kB

Total Files

5

Last publish

Collaborators

  • joraclista