Coder Social home page Coder Social logo

hyperdeck-js-lib's Introduction

NPM

Build Status npm version Greenkeeper badge

Hyperdeck-JS-Lib

A javascript library for communication with the Blackmagic Hyperdeck.

Installing

npm install --save hyperdeck-js-lib

Using The Library

The makeRequest() function returns a promise which will resolve with the response from the hyperdeck if it is a succcesful response. Otherwise it will reject. If the connection was lost the response object will be null otherwise it will be the error response from the hyperdeck.

The response is an object with the following properties:

  • code: The nuemeric response code.
  • text: The response text.

If the response from the hyperdeck also contains data the following keys will also exist:

  • rawData: A string which contains the unparsed data.
  • params: An object where the keys are the parameter keys in the response, and the values are the corresponding values in the response. This is best-effort, and if the response is not structured in the params format shown in the documentation, may be an empty object. It will try to parse each line in the response individually.
var HyperdeckLib = require("hyperdeck-js-lib");

var hyperdeck = new HyperdeckLib.Hyperdeck("192.168.1.12");
hyperdeck.onConnected().then(function() {
	// connected to hyperdeck
	// Note: you do not have to wait for the connection before you start making requests.
	// Requests are buffered until the connection completes. If the connection fails, any
	// buffered requests will be rejected.
	hyperdeck.makeRequest("device info").then(function(response) {
	  console.log("Got response with code "+response.code+".");
	  console.log("Hyperdeck unique id: "+response.params["unique id"]);
	}).catch(function(errResponse) {
	  if (!errResponse) {
	    console.error("The request failed because the hyperdeck connection was lost.");
	  }
	  else {
	    console.error("The hyperdeck returned an error with status code "+errResponse.code+".");
	  }
	});

	hyperdeck.getNotifier().on("asynchronousEvent", function(response) {
	  console.log("Got an asynchronous event with code "+response.code+".");
	});

	hyperdeck.getNotifier().on("connectionLost", function() {
	  console.error("Connection lost.");
	});
}).catch(function() {
	console.error("Failed to connect to hyperdeck.");
});

There are a number of different predefined commands which can be called upon:

hyperdeck.play();
hyperdeck.play(35); //play at 35%
hyperdeck.stop();
hyperdeck.record();
hyperdeck.goTo("00:13:03:55"); //goes to timecode in format hh:mm:ss:ff
hyperdeck.slotSelect(2);
hyperdeck.slotInfo(); //Gives info on currently selected slot
hyperdeck.slotInfo(1);
hyperdeck.clipsGet();
hyperdeck.nextClip();
hyperdeck.prevClip();
hyperdeck.transportInfo();
hyperdeck.format(format);

API Documentation

The hyperdeck API documentation can be found at "https://www.blackmagicdesign.com/uk/manuals/HyperDeck/HyperDeck_Manual.pdf".

Debugging

You can enable logging:

var HyperdeckLib = require("hyperdeck-js-lib");
var Logger = HyperdeckLib.Logger;
Logger.setLevel(Logger.DEBUG);
Logger.setLevel(Logger.INFO);
Logger.setLevel(Logger.WARN);
Logger.setLevel(Logger.ERROR);
Logger.setLevel(Logger.OFF);

hyperdeck-js-lib's People

Contributors

benjaminkay93 avatar dependabot[bot] avatar dylanreeve avatar greenkeeper[bot] avatar greenkeeperio-bot avatar iamjohnbarker avatar jcalado avatar joshhodgson avatar tjenkinson avatar tomkaltz avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hyperdeck-js-lib's Issues

Next/Previous clip

Hey - Love this module, thanks for making it happen!

I'd really like to see a Next/Previous clip functionality built in - Happy to create a branch/PR for it if you don't have time.

I'm thinking something like...

hyperdeck.nextClip()
this.nextClip = function() { return this.makeRequest('goto: clip id: +1'); };

hyperdeck.previousClip()
this.previousClip = function() { return this.makeRequest('goto: clip id: -1'); };

An in-range update of sinon is breaking the build 🚨

Version 4.1.6 of sinon was just published.

Branch Build failing 🚨
Dependency sinon
Current Version 4.1.5
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 10 commits.

  • 68c37ed Update docs/changelog.md and set new release id in docs/_config.yml
  • cd8ae51 Add release documentation for v4.1.6
  • 29e80be 4.1.6
  • a5c59a5 Update History.md and AUTHORS for new release
  • 0ae60b6 Merge pull request #1653 from mroderick/upgrade-dependencies
  • dcd4191 Upgrade browserify to latest
  • a316f02 Upgrade markdownlint-cli to latest
  • 78ebdb3 Upgrade lint-staged to latest
  • fcf967b Upgrade dependency supports-color
  • 7c3cb4f Enable StaleBot with default configuration (#1649)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Failing to send any command after Command: [format]

Problem :
After receiving format command response, next command from request Queue (i.e. ping command) is called but no response is generated so the request is in not-finished state hence no next command is requested.

The problem occurs on Raspberry Pi 2.
No problem with Windows/Debian 64 bit.

※May be not related but on Raspberry Pi 2 Logger.debug also does not work, Logger.info is OK.

clipsGet() Error thrown

C:\Users\la1tv\Desktop\hyperdeckjs\node_modules\hyperdeck-js-lib\src\hyperdeck\parser.js:74
        throw new Error("Invalid payload. Unknown response code.");
        ^

Error: Invalid payload. Unknown response code.
    at Object.Parser.parse (C:\Users\la1tv\Desktop\hyperdeckjs\node_modules\hyperdeck-js-lib\src\hyperdeck\parser.js:74:15)
    at Socket.onData (C:\Users\la1tv\Desktop\hyperdeckjs\node_modules\hyperdeck-js-lib\src\hyperdeck\response-handler.js:12:23)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at TCP.onread (net.js:529:20)

An in-range update of jshint is breaking the build 🚨

The devDependency jshint was updated from 2.9.7 to 2.10.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

jshint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for JSHint 2.10.0

2.10.0 (2019-02-05)

This release introduces support for the three most recent editions of
JavaScript: ES7, ES8, and ES9. Users can enable support for any one of these
via the esversion linting option.

Perhaps most notably, this includes "async functions." Since their
standardization in ES2017, no feature has been more requested. We're happy to
add support for this powerful new language feature. If the delay is any
indication, extending JSHint's parser was no small task, and we were able to
make many seemingly-unrelated corrections along the way.

That progress is easiest to see in JSHint's performance on Test262 (the
official test suite for the JavaScript programming language). Version 2.9.6
passed 84% of those tests. Version 2.10.0 passes 96%. We're excited to push
that number higher, especially considering that new language features and new
tests are being added every day. If you're curious about what needs to be done,
we maintain an "expectations file" describing every test JSHint is known to
fail today.

This release also includes brand-new parsing logic for classes. We thank Ethan
Dorta and Alex Kritchevsky, the two first-time contributors who made this
possible!

Bug Fixes

  • Accept new RegExp flag introduced by ES6 (26b9e53)
  • Add global variables introduced in ES2017 (aded551)
  • Add globals for EventTarget interface (b78083a)
  • Add globals for WindowOrWorkerGlobalScope (e0aac94)
  • Allow YieldExpression as computed property (40dca82)
  • Correct implementation of spread/rest (bd0ae0d)
  • Correct invalid function invocation (cda02ae)
  • Correct parsing of let token (030d6b4)
  • Correct parsing of arrow function (8fa6e39)
  • Correct parsing of InExpression (06f54d0)
  • Disallow dups in non-simple parameter list (4a5a4a5)
  • Disallow fn declarations in stmt positions (a0e0305)
  • Disallow YieldExpression in gnrtr params (17ca4e4)
  • Enforce UniqueFormalParameters for methods (280d36b)
  • Honor globals config in JavaScript API (0278731)
  • Report invalid syntax as error (5ca8b1a)
  • Update parsing of object "rest" property (58967ea)

Features

  • Enable object rest/spread via esversion (3fc9c19)
  • Enforce ES2016 restriction on USD (2c2025b)
  • Implement noreturnawait (70ab03d)
  • Implement regexpu option (962dced)
  • Implement ES2019 RegExp "dotall" (457d732)
  • Implement support for async iteration (1af5930)
  • Implement support for ES8 trailing commas (29cab1f)
  • Implement support for object spread/rest (35e1b17)
  • Introduce exponentiation operator (21b8731)
  • Introduce linting option leanswitch (1f008f2)
  • Introduce support for async functions (bc4ae9f)
Commits

The new version differs by 51 commits.

  • b7faa24 v2.10.0
  • 6417978 Merge branch 'v2.10.0'
  • f80e049 [[CHORE]] Reorder parameters of internal function
  • 90904ce [[DOCS]] Document new esversion values
  • aded551 [[FIX]] Add global variables introduced in ES2017
  • 457d732 [[FEAT]] Implement ES2019 RegExp "dotall"
  • 962dced [[FEAT]] Implement regexpu option
  • 1af5930 [[FEAT]] Implement support for async iteration
  • 70ab03d [[FEAT]] Implement noreturnawait
  • bc4ae9f [[FEAT]] Introduce support for async functions
  • e0aac94 [[FIX]] Add globals for WindowOrWorkerGlobalScope
  • b78083a [[FIX]] Add globals for EventTarget interface
  • 40dca82 [[FIX]] Allow YieldExpression as computed property
  • 17ca4e4 [[FIX]] Disallow YieldExpression in gnrtr params
  • 3fc9c19 [[FEAT]] Enable object rest/spread via esversion

There are 51 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.