Created
May 23, 2020 01:37
-
-
Save paulocanedo/1bfa75916266efb923283f273e84702e to your computer and use it in GitHub Desktop.
update date and time of a onvif cam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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