Commit c892bab8 authored by PD0ZRY Rudy's avatar PD0ZRY Rudy
Browse files

Updates

parent 2dedf68c
Pipeline #53 skipped
......@@ -17,6 +17,7 @@ mqttClient.on('connect', function(){
mqttClient.subscribe("Master/+/Session");
})
//Process messages comming from MQTT
mqttClient.on('message', function(source, payload)
{
if(source.search(/Session/i) != -1)
......@@ -25,6 +26,7 @@ mqttClient.on('message', function(source, payload)
}
else
{
//Link to ref if repeater comes online
var data = JSON.parse(payload);
if (per_repeater[data['RepeaterID']])
reset_repeater(data['RepeaterID'],per_repeater[data['RepeaterID']]);
......@@ -34,6 +36,7 @@ mqttClient.on('message', function(source, payload)
}
});
//Process call
function ProcessSession(source, payload)
{
var values = JSON.parse(payload);
......@@ -44,14 +47,15 @@ function ProcessSession(source, payload)
&& values['LinkName'] != "DV4mini"
&& values['DestinationID'] == 9
&& values['Slot'] == 2
&& values['Master'] == master
)
{
//Update the timeout
db[values['ContextID']]={'last': Math.floor(new Date() / 1000), 'ref': values['ReflectorID']};
console.log('Resetting timer for: '+values['ContextID']);
}
}
//Reset reflector function
function reset_repeater(id,ref)
{
if (ref == false) return;
......@@ -62,6 +66,7 @@ function reset_repeater(id,ref)
});
}
//Check timeouts
setInterval(function()
{
for (index in db)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment