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 =
Istantiate a client
const client = lib32100
Note that each client can handle one device (camera) and multiple cloud servers.
Add servers
client
Set the device UID
client
Add listeners
clientclient
Send commands to the Cloud servers
clientclient
Add camera address
client
Set camera credentials
client
Open direct camera session
client
Check credentials
client
Get snapshot
client
Send custom GET request
client
Send multiple GET requests
client
Get live video stream
client
Get live audio stream
client
Stop video stream
client
Stop audio stream
client
Get various information
clientclientclientclientclientclientclientclientclientclientclientclient
Move in directions in steps
clientclientclientclient
Move in directions
clientclientclientclientclient
Close session
client
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