Allow connecting multiple Detector Plugins+

merge-requests/55/head
Moe 2019-03-05 18:18:52 -08:00
parent 9c4b153ab4
commit 18e0923a7e
2 changed files with 8 additions and 4 deletions

View File

@ -17,7 +17,6 @@ module.exports = function(s,config,lang){
break; break;
} }
} }
//multi plugin connections
s.connectedPlugins = {} s.connectedPlugins = {}
s.connectedDetectorPlugins = {} s.connectedDetectorPlugins = {}
s.detectorPluginArray = [] s.detectorPluginArray = []
@ -151,7 +150,13 @@ module.exports = function(s,config,lang){
socket.on('ocv',s.pluginEventController); socket.on('ocv',s.pluginEventController);
socket.on('disconnect', function(){ socket.on('disconnect', function(){
s.connectedPlugins[v.id].plugged=false s.connectedPlugins[v.id].plugged=false
delete(s.api[v.id]) if(v.type === 'detector'){
s.tx({f:'detector_unplugged',plug:v.id},'CPU')
s.removeDetectorPlugin(v.id)
s.sendDetectorInfoToClient({f:'detector_plugged'},function(data){
s.tx(data,'CPU')
})
}
s.systemLog('Plugin Disconnected : '+v.id) s.systemLog('Plugin Disconnected : '+v.id)
s.connectedPlugins[v.id].reconnector = setInterval(function(){ s.connectedPlugins[v.id].reconnector = setInterval(function(){
if(socket.connected===true){ if(socket.connected===true){

View File

@ -1365,9 +1365,8 @@ module.exports = function(s,config,lang,io){
} }
} }
if(cn.pluginEngine){ if(cn.pluginEngine){
s.connectedPlugins[cn.pluginEngine].plugged=false s.connectedPlugins[cn.pluginEngine].plugged = false
s.tx({f:'plugin_engine_unplugged',plug:cn.pluginEngine},'CPU') s.tx({f:'plugin_engine_unplugged',plug:cn.pluginEngine},'CPU')
delete(s.api[cn.pluginEngine])
} }
if(cn.cron){ if(cn.cron){
delete(s.cron); delete(s.cron);