Skip to content

Instantly share code, notes, and snippets.

@paulocanedo
Created May 23, 2020 01:37
Show Gist options
  • Save paulocanedo/1bfa75916266efb923283f273e84702e to your computer and use it in GitHub Desktop.
Save paulocanedo/1bfa75916266efb923283f273e84702e to your computer and use it in GitHub Desktop.
update date and time of a onvif cam
// update date and time of a onvif cam
const onvif = require('onvif');
const Cam = onvif.Cam;
onvif.Discovery.on('device', (cam) => {
new Cam(cam, function (err) {
if (err) {
console.error('Connection Failed for ', err);
return;
}
this.setSystemDateAndTime({
dateTimeType: 'NTP',
daylightSavings: false,
timezone: 'UTC+3',
dateTime: new Date()
}, function(err, value, xml) {
if(err) {
console.error(err);
} else {
console.log('updated cam timestamp: ', value);
}
});
});
});
onvif.Discovery.probe({timeout: 1000, resolve: true});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment