05-09-2017, 09:31 PM
@moicphil,
Je ne connais pas Qnap.
Mais c'est quand-même grâce à @grinchka que j'y suis arrivé,
même s'il me reste encore beaucoup à faire pour terminer.
Si maître @grinchka est ok (et je je trouve le courage/le temps), je partagerais bien ma solution finale sous forme d'un tuto avec tout et tout.
@pepite,
Voici le code JavaScript "final"
Je ne connais pas Qnap.
Mais c'est quand-même grâce à @grinchka que j'y suis arrivé,
même s'il me reste encore beaucoup à faire pour terminer.
Si maître @grinchka est ok (et je je trouve le courage/le temps), je partagerais bien ma solution finale sous forme d'un tuto avec tout et tout.
@pepite,
Voici le code JavaScript "final"
Citation :maxcameras = 4pour les automates, j'en ferai 3 :
obj = JSON.parse(trame)
if (typeof obj.data != "undefined") {
// Update SID
if (typeof obj.data.sid != "undefined") {
Idsession = obj.data.sid
ldprint ("ID : " + Idsession)
// Status of cameras
} else if (typeof obj.data.total != "undefined") {
ldprint ("data.total (cameras) : " + obj.data.total)
if (obj.data.total > maxcameras) {
total = maxcameras
} else {
total = obj.data.total
}
ldprint ("total = " + total)
for (i=0; i < total; i++) {
ldprint ("data.cameras[" + i + "].id : " + obj.data.cameras[i].id)
eval ("Cameras" + i + "_id = obj.data.cameras[" + i + "].id")
ldprint ("data.cameras[" + i + "].name : " + obj.data.cameras[i].name)
eval ("Cameras" + i + "_name = obj.data.cameras[" + i + "].name")
ldprint ("data.cameras[" + i + "].recStatus : " + obj.data.cameras[i].recStatus)
eval ("Cameras" + i + "_recStatus = obj.data.cameras[" + i + "].recStatus")
ldprint ("data.cameras[" + i + "].enabled : " + obj.data.cameras[i].enabled)
eval ("Cameras" + i + "_enabled = obj.data.cameras[" + i + "].enabled")
}
}
} else {
ldprint ("else obj.data : " + obj.success)
}
success = obj.success
- SS_actions : recording ON/OFF - enable/disable
- SS_SID_update : pour générer un nouvel SID, si nécessaire
- SS_status : pour mettre à jour le status des caméras.