How to use the onvif.Discovery function in onvif

To help you get started, we’ve selected a few onvif examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bartbutenaers / node-red-contrib-onvif-nodes / onvif_discovery.js View on Github external
console.info("Discovery request ignored, since other discovery is active");
                return;
            }
            
            node.status({fill:"yellow",shape:"dot",text:"discovering"});
            node.counter = 0;
            node.discovering = true;
            
            var options = { 
                timeout: node.timeout, // Discovery should end after the specified timeout
                resolve: false // Return discovered devices as data objects, instead of Cam instances
            };

            // Start discovery of the ONVIF network devices.
            // The callback function will be called only once, when the broadcast is finished (after the timeout).
            onvif.Discovery.probe(options, function(err, result) {
                if (err) { 
                    console.error(err.message);
                    node.status({fill:"red",shape:"dot",text: "failed"});
                }
                else {
                    node.status({fill:"green",shape:"dot",text: "completed (" + node.counter + "x)"});
                }           
                
                if (!node.separate) {
                    var devices = [];
                    
                    // Convert the array to an easy format
                    for (var i = 0; i < result.length; i++) {
                        devices.push(simplifyResult(result[i]));
                    }
github bartbutenaers / node-red-contrib-onvif-nodes / onvif_discovery.js View on Github external
return probeMatch;
        }
        
        function handleResult(result) {
            node.counter++;
            
            if (node.separate) {
                // Send a separate output message for every discovered OnVif-compliant IP device
                node.send({payload: simplifyResult(result)}); 
            }
        }
        
        // Register once a listener for device events.
        // The callback function will be called immediately when a device responses.
        onvif.Discovery.on('device', handleResult);
        
        node.on("input", function(msg) {         
            if (node.discovering) {
                console.info("Discovery request ignored, since other discovery is active");
                return;
            }
            
            node.status({fill:"yellow",shape:"dot",text:"discovering"});
            node.counter = 0;
            node.discovering = true;
            
            var options = { 
                timeout: node.timeout, // Discovery should end after the specified timeout
                resolve: false // Return discovered devices as data objects, instead of Cam instances
            };
github out4b / cdif / modules / onvif-manager / index.js View on Github external
OnvifManager.prototype.discoverDevices = function(callback) {

    console.log("Hello OnvifManager!");

    onvif.Discovery.probe(function(err, cams) {
    if(err) { throw err; }

        cams.forEach(function(cam) {
            //FIXME: this user/pass info is just a test
            cam.username = 'admin';
            cam.password = 'xsVLX842';
            cam.connect(function(err) {
                if (err) {throw err;}
                cam.getDeviceInformation(function(err, info, xml) {
                    if (err) {throw err;}
                    console.log("Camera Info:  " + JSON.stringify(info));
                    fs.readFile('./onvif.json', 'utf8', function(err, data) {
                        if (err) { throw err; }
                        var devSpec = JSON.parse(data);
                        devSpec.device.friendlyName = info.manufacturer;
                        devSpec.device.manufacturer = info.manufacturer;
github godka / node-rtsp-live555 / example / server.js View on Github external
app.get('/search', function (req, res) {
			onvif.Discovery.probe(function (err, cams) {
				if (err) {
					console.log(err);
					res.send({ result: false });
					return;
				}
				searchForNextTick(res, [], cams, 0);
			});
		});
		app.use(express.static('html'));

onvif

Client to ONVIF NVT devices Profile S: cameras

MIT
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis

Popular onvif functions