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

lib32100

v1.5.1

Published

Library implementing port 32100 UDP Cloud protocol

Downloads

12

Readme

npm Standard - JavaScript Style Guide

lib32100

Library implementing port 32100 UDP Cloud protocol used by many P2P cameras. You can find a description of the protocol in the wiki

News

  • Check my new Wireshark dissector to analyze the protocol
  • Warning: since the commands directed to cams turnedo out to be vendor-specific, they will be deprecated and afterwards removed in next major release, keeping just the transport protocol in core lib and leaving higher-level payload interpretation to specific client implementation.

Install

npm install --save lib32100

Usage

Require the Library

const lib32100 = require('lib32100')

Istantiate a client

const client = lib32100.client()

Note that each client can handle one device (camera) and multiple cloud servers.

Add servers

client.addServer({host: "myserver.example.com", port: 32100})

Set the device UID

client.setUid('PROD123456ABCDE')

Add listeners

client.on('stun', (e) => console.log(JSON.stringify(e)))
client.on('lookup', (e) => console.log(JSON.stringify(e)))

Send commands to the Cloud servers

client.sendSTUNRequest()
client.lookupUid()

Add camera address

client.addCamAddress({host: "192.168.0.100", port: 10088})

Set camera credentials

client.setCamCredentials({user: 'admin', pass: 'password'})

Open direct camera session

client.openDirectCamSession({host: "192.168.0.100", port: 10088})

Check credentials

client.checkCredentials()

Get snapshot

client.getSnapshot()

Send custom GET request

client.sendGet('/custom_url.cgi?myparam=hello')

Send multiple GET requests

client.sendMultipleGet(['/custom_url1.cgi', '/custom_url2.cgi', '/custom_url3.cgi'])

Get live video stream

client.getVideoStream()

Get live audio stream

client.getAudioStream()

Stop video stream

client.stopVideoStream()

Stop audio stream

client.stopAudioStream()

Get various information

client.getParams()
client.getCameraParams()
client.getFactoryParam()
client.getStatus()
client.cameraControl()
client.getMisc()
client.login()
client.getRtsp()
client.getOnvif()
client.getRecord()
client.wifiScan()
client.getWifiScanResult()

Move in directions in steps

client.stepDown()
client.stepLeft()
client.stepRight()
client.stepUp()

Move in directions

client.moveDown()
client.moveLeft()
client.moveRight()
client.moveUp()
client.stopMove()

Close session

client.closeCamSession()

Events

You can listen on the following events:

stun (server response)
lookup (server response)
lookupACK (server response)
unknownMsg (any message not yet parsable by the library)
pingpong (camera ping or pong)
close (camera closed session)
confirmed (camera comfirmed ID i.e. session opened)
ack (camera acked a message)
http (an http response)
audio (live audio data)
video (live video data)
complete (a complete http response)
lostConnection (the connection was lost)

TODO

  • [ ] improve documentation
  • [ ] improve reliability (add various checks / validations)
  • [ ] parse camera id in response
  • [ ] automate connection (from uid lookup to selecting the address)
  • [ ] add other connection methods (relays, ...)
  • [ ] add methods to retrieve / set parameters / reboot / etc
  • [ ] parse responses
  • [ ] add more details in events
  • [ ] verify send acks and correct sequence numbers
  • [ ] add callbacks / promises
  • [ ] authenticated http requests
  • [ ] send audio to the camera
  • [ ] implement server
  • [ ] emulate camera
  • [ ] translate stream to RTP

DISCLAIMER

This implementation is not based on official specs but purely on reverse engineering of the protocol. I cannot guarantee it will work on every device.

License

MIT. Copyright (c) Fabrizio Bertone