GithubHelp home page GithubHelp logo

utopiantools / node-visca Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 3.0 130 KB

Advanced nodejs library for working with VISCA-based PTZ cameras over IP and over serial connections.

TypeScript 100.00%
javascript nodejs ptz-control ptzoptics sony typescript visca

node-visca's People

Contributors

cgarwood avatar hrueger avatar jeffmikels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-visca's Issues

Basic Usage Example

Hi. Great work. Thank you. Is there any chance you could provide a basic usage example for Visca over IP please?

Lib Crashing when creating a new `Camera`

Hi @jeffmikels ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch @utopian/[email protected] for the project I'm working on.

When using the UDP Transport, my application would always crash when creating a new Camera object. The following patch should fix that.
It also disables the console.log output.

Here is the diff that solved my problem:

diff --git a/node_modules/@utopian/visca/dist/visca-ip.js b/node_modules/@utopian/visca/dist/visca-ip.js
index 8b20046..146feec 100644
--- a/node_modules/@utopian/visca/dist/visca-ip.js
+++ b/node_modules/@utopian/visca/dist/visca-ip.js
@@ -105,11 +105,11 @@ class UDPTransport extends events_1.EventEmitter {
         if (this.debug)
             console.log('Sent: ' + packet);
         // sending packet
-        this.socket.send(packet, this.port, this.host, function (error) {
+        this.socket.send(Buffer.from(packet), this.port, this.host, (error) => {
             if (error) {
                 this.socket.close();
             }
-            else {
+            else if(this.debug) {
                 console.log('Data sent !!!');
             }
         });

This issue body was partially generated by patch-package.

Note that this auto-generated diff fixes the compiled js, but I don't think it is hard to find that lines in the TS.

Would you accept a PR?

Syntax error sending Preset Recall to Prisual Camera

When testing the library with a Prisual 20x Camera using UDP Visca I am receiving a syntax error sending the Preset Recall command and Preset Set Commands.

Here is the code

import { Camera } from "../src/visca/visca";
import { ViscaController,ViscaCameraConfig, ViscaControllerConfig,ViscaCommand } from "../src/visca/visca";

let config = {
    viscaSerial:{port:"COM7",baud:9600},
    //viscaIPCameras: [],
    viscaServer:{basePort: 52381,}
}
let ipConfig = {
    
} as ViscaCameraConfig;
let viscaConfig = config as ViscaControllerConfig;
viscaConfig.viscaSerial.baud = 9600;
viscaConfig.viscaSerial.port = "COM7";
ipConfig.id = 1;
ipConfig.ip = "192.168.100.88";
ipConfig.name= "Test";
ipConfig.port=1259;
const controller = new ViscaController(viscaConfig);
let cam1 = controller.addIPCamera(ipConfig);
cam1.on('update',()=>{
    console.log('cam 1 updated:');
    console.log(JSON.stringify(cam1));
});
let cmd = ViscaCommand.cmdCameraPresetRecall(1,1);
console.log(JSON.stringify(cmd));
cmd = ViscaCommand.cmdCameraPresetSet(1,1);
console.log(JSON.stringify(cmd));
cmd.onError = function(err){
    console.log(`preset error: ${err}`);
};
cam1.sendCommand(cmd);
console.log("started")


Attached is the log output.
node-visca.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.