npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ipcam-controller

v1.0.5

Published

Node module for controlling PTZ commands of IPCamera

Downloads

41

Readme

ipcam-controller

Install

npm install -g git+https://github.com/muten84/ipcam-controller.git

or from npm:

npm install -g ipcam-controller

Usage

ipcam [options] action

Where action can be one of: left, right, up, down, left-up, left-down, right-up, right-down

Options:

-h, --help                   output usage information
-u, --user <user>            The user to authenticate as
-p, --password <password>    The user's password
-a, --address <address>      The camera ip address
-m, --modelType <modelType>  The camera model type (e.g.: sricamAP004)
-d, --duration <duration>    The move duration in milliseconds
-s, --schedule <schedule>    Schedule given action with a fuzzy scheduler that execute command in a random moment within the scheduled date. The schedule parameter is in minutes, for instance -s 30 schedules action within 30 minutes it can be before but not after.
-c, --count <count>          Use it in combination with schedule to tels the ipcam-controller how many times should schedule the given action. For instance -s 30 -c 3 will schedule for 3 times the given action and all executions will be made within 30 minutes.

Built-in Camera Model Types

  • sricamAP004

API and Documentation

The ipcam-controller module provides a library for javascript direct usage. The API are very simple. Here you can find the relative documentation about all exported methods. See examples below:

Import

    var IPCamera = require('ipcam-controller');

Create and config a new camera

    var camera = new IPCamera();
    var config = {
        ip: "127.0.0.1",
        name: "Camera",
        type: "sricamAP004",
        user: "admin",
        pwd: "troppsecret",
        duration: "3000" //default moves duration
    }
    camera.createCamera(config.name,config.type,config);

Actions

Possible actions are: moveLeft, moveRight, moveUp, moveDown, every action need a duration after which the service launchs the relative stop command.

    //move camera left direction and after 3 secs stop movement.
    camera.moveLeftFor(3000);

You can invoke a generic action without the relative stop command, in this way you can implement the after execution code in the then method because the generic action method return a promise.

    //generic action return a promise after duration execution time
    function done(){
        //for sricam it is useful to stop movement
    }
    camera.action("moveLeft", 3000).then(done);

Scheduler

With the schdule method you can schedule an action with a fuzzy scheduler, so the scheduled actions will not be predictable.

    //schedule examples: schedule an amount of two moveLeft actions within next 5 minutes, so all moves will be executed within 5 minutes. Duration is the default move duration passed in the config object
    camera.schedule("moveLeft",5,2);

Adding new camera types

You can add new camera type providing a spec object, you can provide your own calling the addType method before calling the createCamera method. Here is the built-in spec object for sricamAP004 model:

    var moveType = "camera.control.ptz.move";
    var stopType = "camera.control.ptz.stop";
    var velocityType = "camera.control.ptz.velocity";

    var sricam_ap004 = {
          auth : {
            userParam: "loginuse",
            passParam: "loginpas"
          },
          ptz : {
            velocity : {
              action: "camera_control.cgi",
              param: "100",
              slow: "1",
              mid: "5",
              fast: "10"
            },

            stop : {
              action: "decoder_control.cgi",
              paramName: "command",
              up: "3",
              down: "1",
              left: "5",
              right: "7"
            },

            move : {
              action: "decoder_control.cgi",
              paramName: "command",
              preset1: "31",
              preset2: "33",
              up: "0",
              down: "2",
              left: "6",
              right: "4"
            }
        },
        actions: [
          {
          key: "moveLeft",
          action:{
            type: moveType,
            value: "left"
          }},
          {
          key: "moveRight",
          action:{
            type: moveType,
            value: "right"
          }},
          {
          key: "stopLeft",
          action:{
            type: stopType,
            value: "left"
          }},
          {
          key: "stopRight",
          action:{
            type: stopType,
            value: "right"
          }}
          ]
      }

      module.exports = sricam_ap004;