@@ -60,6 +60,18 @@ Script.serveEvent("CSK_DeviceNetworkConfig.OnNewInterfaceChoice", "DeviceNetwork
6060Script .serveEvent (" CSK_DeviceNetworkConfig.OnNewDNS" , " DeviceNetworkConfig_OnNewDNS" )
6161Script .serveEvent (" CSK_DeviceNetworkConfig.OnDNSIPError" , " DeviceNetworkConfig_OnDNSIPError" )
6262
63+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusShowBridgeFeature' , ' DeviceNetworkConfig_OnNewStatusShowBridgeFeature' )
64+
65+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusBridgeIP' , ' DeviceNetworkConfig_OnNewStatusBridgeIP' )
66+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusBridgeSubnetMask' , ' DeviceNetworkConfig_OnNewStatusBridgeSubnetMask' )
67+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusBridgeGateway' , ' DeviceNetworkConfig_OnNewStatusBridgeGateway' )
68+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusBridgeActive' , ' DeviceNetworkConfig_OnNewStatusBridgeActive' )
69+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusListOfEthernetInterfaces' , ' DeviceNetworkConfig_OnNewStatusListOfEthernetInterfaces' )
70+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusBridgeInterfaces' , ' DeviceNetworkConfig_OnNewStatusBridgeInterfaces' )
71+
72+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusBridgeDelay' , ' DeviceNetworkConfig_OnNewStatusBridgeDelay' )
73+ Script .serveEvent (' CSK_DeviceNetworkConfig.OnNewStatusBridgeTestTime' , ' DeviceNetworkConfig_OnNewStatusBridgeTestTime' )
74+
6375Script .serveEvent (" CSK_DeviceNetworkConfig.OnUserLevelOperatorActive" , " DeviceNetworkConfig_OnUserLevelOperatorActive" )
6476Script .serveEvent (" CSK_DeviceNetworkConfig.OnUserLevelMaintenanceActive" , " DeviceNetworkConfig_OnUserLevelMaintenanceActive" )
6577Script .serveEvent (" CSK_DeviceNetworkConfig.OnUserLevelServiceActive" , " DeviceNetworkConfig_OnUserLevelServiceActive" )
153165
154166local function refresh ()
155167 interfacesTable = deviceNetworkConfig_Model .refreshInterfaces ()
156- jsonInterfaceListContent = deviceNetworkConfig_Model .helperFuncs .createJsonList (interfacesTable , selectedInterfaceName )
168+ jsonInterfaceListContent = deviceNetworkConfig_Model .helperFuncs .createSpecificJsonList (interfacesTable , selectedInterfaceName )
157169 Script .notifyEvent (" DeviceNetworkConfig_OnNewInterfaceTable" , jsonInterfaceListContent )
158170 checkWhatToDisable ()
159171end
@@ -352,7 +364,20 @@ local function handleOnExpiredTmrDeviceNetworkConfig()
352364 Script .notifyEvent (" DeviceNetworkConfig_OnNewDefaultGateway" , ' -' )
353365 Script .notifyEvent (" DeviceNetworkConfig_OnNewInterfaceChoice" ,' -' )
354366 Script .notifyEvent (" DeviceNetworkConfig_OnNewEthernetConfigStatus" , ' empty' )
355-
367+
368+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusShowBridgeFeature" , deviceNetworkConfig_Model .showBridgeFeature )
369+
370+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusBridgeIP" , deviceNetworkConfig_Model .parameters .bridgeIP )
371+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusBridgeSubnetMask" , deviceNetworkConfig_Model .parameters .bridgeSubnetMask )
372+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusBridgeGateway" , deviceNetworkConfig_Model .parameters .bridgeGateway )
373+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusBridgeActive" , deviceNetworkConfig_Model .parameters .bridgeActive )
374+
375+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusListOfEthernetInterfaces" , deviceNetworkConfig_Model .helperFuncs .createJsonList (deviceNetworkConfig_Model .listOfInterfaces ))
376+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusBridgeInterfaces" , deviceNetworkConfig_Model .helperFuncs .createJsonList (deviceNetworkConfig_Model .parameters .bridgeInterfaces ))
377+
378+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusBridgeDelay" , deviceNetworkConfig_Model .parameters .bridgeDelay )
379+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusBridgeTestTime" , deviceNetworkConfig_Model .parameters .bridgeTestTime )
380+
356381 local dnsList = deviceNetworkConfig_Model .helperFuncs .json .encode (getNameserverList ())
357382 if dnsList == ' []' or dnsList == ' ' then
358383 dnsList = ' [{"dns":"-"}]'
@@ -449,7 +474,7 @@ local function selectInterface(row_selected)
449474 Script .notifyEvent (" DeviceNetworkConfig_OnGatewayDisabled" , true )
450475 end
451476 Script .sleep (100 )
452- jsonInterfaceListContent = deviceNetworkConfig_Model .helperFuncs .createJsonList (interfacesTable , selectedInterfaceName )
477+ jsonInterfaceListContent = deviceNetworkConfig_Model .helperFuncs .createSpecificJsonList (interfacesTable , selectedInterfaceName )
453478 Script .notifyEvent (" DeviceNetworkConfig_OnNewInterfaceTable" , jsonInterfaceListContent )
454479 checkWhatToDisable ()
455480end
@@ -502,6 +527,65 @@ local function setDHCPState(newDHCPState)
502527end
503528Script .serveFunction (" CSK_DeviceNetworkConfig.setDHCPState" , setDHCPState )
504529
530+ local function setShowBridgeFeature (status )
531+ if _G .availableAPIs .bridge then
532+ deviceNetworkConfig_Model .showBridgeFeature = status
533+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusShowBridgeFeature" , status )
534+ else
535+ _G .logger :info (nameOfModule .. " : Bridge feature not supported on device." )
536+ Script .notifyEvent (" DeviceNetworkConfig_OnNewStatusShowBridgeFeature" , false )
537+ end
538+ end
539+ Script .serveFunction (' CSK_DeviceNetworkConfig.setShowBridgeFeature' , setShowBridgeFeature )
540+
541+ local function setBridgeIP (ip )
542+ deviceNetworkConfig_Model .parameters .bridgeIP = ip
543+ end
544+ Script .serveFunction (' CSK_DeviceNetworkConfig.setBridgeIP' , setBridgeIP )
545+
546+ local function setBridgeSubnetMask (mask )
547+ deviceNetworkConfig_Model .parameters .bridgeSubnetMask = mask
548+ end
549+ Script .serveFunction (' CSK_DeviceNetworkConfig.setBridgeSubnetMask' , setBridgeSubnetMask )
550+
551+ local function setBridgeGateway (gateway )
552+ deviceNetworkConfig_Model .parameters .bridgeGateway = gateway
553+ end
554+ Script .serveFunction (' CSK_DeviceNetworkConfig.setBridgeGateway' , setBridgeGateway )
555+
556+ local function setBridgeActive (status )
557+ if _G .availableAPIs .bridge then
558+ deviceNetworkConfig_Model .parameters .bridgeActive = status
559+
560+ if status then
561+ deviceNetworkConfig_Model .createBridge ()
562+ else
563+ deviceNetworkConfig_Model .deleteBridge ()
564+ end
565+ else
566+ _G .logger :info (nameOfModule .. " : Bridge feature not supported on device." )
567+ end
568+ end
569+ Script .serveFunction (' CSK_DeviceNetworkConfig.setBridgeActive' , setBridgeActive )
570+
571+ local function setBridgeInterfaces (interfaces )
572+ deviceNetworkConfig_Model .parameters .bridgeInterfaces = {}
573+ for _ , value in pairs (interfaces ) do
574+ table.insert (deviceNetworkConfig_Model .parameters .bridgeInterfaces , value )
575+ end
576+ end
577+ Script .serveFunction (' CSK_DeviceNetworkConfig.setBridgeInterfaces' , setBridgeInterfaces )
578+
579+ local function setBridgeDelay (delay )
580+ deviceNetworkConfig_Model .parameters .bridgeDelay = delay
581+ end
582+ Script .serveFunction (' CSK_DeviceNetworkConfig.setBridgeDelay' , setBridgeDelay )
583+
584+ local function setBridgeTestTime (time )
585+ deviceNetworkConfig_Model .parameters .bridgeTestTime = time
586+ end
587+ Script .serveFunction (' CSK_DeviceNetworkConfig.setBridgeTestTime' , setBridgeTestTime )
588+
505589local function setPingIPAddress (ping_ip )
506590 deviceNetworkConfig_Model .ping_ip_adress = ping_ip
507591end
@@ -589,12 +673,24 @@ local function loadParameters()
589673 if data then
590674 _G .logger :info (nameOfModule .. " : Loaded parameters from CSK_PersistentData module." )
591675 deviceNetworkConfig_Model .parameters = deviceNetworkConfig_Model .helperFuncs .convertContainer2Table (data )
676+ deviceNetworkConfig_Model .parameters = deviceNetworkConfig_Model .helperFuncs .checkParameters (deviceNetworkConfig_Model .parameters , deviceNetworkConfig_Model .helperFuncs .defaultParameters .getParameters ())
592677
593678 -- Load nameservers
594679 if deviceNetworkConfig_Model .deviceType ~= ' AppEngine' then
595680 updateNameservers (deviceNetworkConfig_Model .parameters .nameservers )
596681 end
597682
683+ if _G .availableAPIs .bridge and deviceNetworkConfig_Model .parameters .bridgeActive then
684+ deviceNetworkConfig_Model .showBridgeFeature = true
685+ if deviceNetworkConfig_Model .parameters .bridgeDelay ~= 0 then
686+ deviceNetworkConfig_Model .bridgeDelayTimer :setExpirationTime (deviceNetworkConfig_Model .parameters .bridgeDelay * 1000 )
687+ deviceNetworkConfig_Model .bridgeDelayTimer :start ()
688+ _G .logger :info (nameOfModule .. " : Start timer for bridge delay" )
689+ else
690+ deviceNetworkConfig_Model .createBridge ()
691+ end
692+ end
693+
598694 CSK_DeviceNetworkConfig .pageCalled ()
599695 return true
600696 else
@@ -630,10 +726,6 @@ local function handleOnInitialDataLoaded()
630726
631727 if parameterName then
632728 deviceNetworkConfig_Model .parametersName = parameterName
633- deviceNetworkConfig_Model .parameterLoadOnReboot = loadOnReboot
634- end
635-
636- if deviceNetworkConfig_Model .parameterLoadOnReboot then
637729 loadParameters ()
638730 end
639731 Script .notifyEvent (' DeviceNetworkConfig_OnDataLoadedOnReboot' )
0 commit comments