Beremiz_service.py
changeset 2659 09bac1f52b1e
parent 2650 449c9539887a
parent 2654 7575050a80c5
child 2669 be233279d179
equal deleted inserted replaced
2650:449c9539887a 2659:09bac1f52b1e
   491 
   491 
   492 
   492 
   493 installThreadExcepthook()
   493 installThreadExcepthook()
   494 havewamp = False
   494 havewamp = False
   495 haveBNconf = False
   495 haveBNconf = False
       
   496 haveMBconf = False
   496 
   497 
   497 
   498 
   498 if havetwisted:
   499 if havetwisted:
   499     if webport is not None:
   500     if webport is not None:
   500         try:
   501         try:
   510         try:
   511         try:
   511             import runtime.BACnet_config as BNconf
   512             import runtime.BACnet_config as BNconf
   512             haveBNconf = True
   513             haveBNconf = True
   513         except Exception:
   514         except Exception:
   514             LogMessageAndException(_("BACnet configuration web interface - import failed :"))
   515             LogMessageAndException(_("BACnet configuration web interface - import failed :"))
   515         
   516 
       
   517     # Try to add support for Modbus configuration via web server interface
       
   518     # NOTE:Modbus web config only makes sense if web server is available
       
   519     if webport is not None:
       
   520         try:
       
   521             import runtime.Modbus_config as MBconf
       
   522             haveMBconf = True
       
   523         except Exception:
       
   524             LogMessageAndException(_("Modbus configuration web interface - import failed :"))
       
   525                 
   516     try:
   526     try:
   517         import runtime.WampClient as WC  # pylint: disable=ungrouped-imports
   527         import runtime.WampClient as WC  # pylint: disable=ungrouped-imports
   518         WC.WorkingDir = WorkingDir
   528         WC.WorkingDir = WorkingDir
   519         havewamp = True
   529         havewamp = True
   520     except Exception:
   530     except Exception:
   554     if haveBNconf:
   564     if haveBNconf:
   555         try:
   565         try:
   556             BNconf.init(plcobj, NS, WorkingDir)
   566             BNconf.init(plcobj, NS, WorkingDir)
   557         except Exception:
   567         except Exception:
   558             LogMessageAndException(_("BACnet web configuration failed startup. "))
   568             LogMessageAndException(_("BACnet web configuration failed startup. "))
       
   569 
       
   570     if haveMBconf:
       
   571         try:
       
   572             MBconf.init(plcobj, NS, WorkingDir)
       
   573         except Exception:
       
   574             LogMessageAndException(_("Modbus web configuration failed startup. "))
   559 
   575 
   560     if havewamp:
   576     if havewamp:
   561         try:
   577         try:
   562             WC.SetServer(pyroserver)
   578             WC.SetServer(pyroserver)
   563             WC.RegisterWampClient(wampconf, PSKpath)
   579             WC.RegisterWampClient(wampconf, PSKpath)