Bacnet plugin web configuration: strip leading and trailing spaces for net. interface and port numb.
authorMario de Sousa <msousa@fe.up.pt>
Sun, 07 Jun 2020 23:46:16 +0100
changeset 2667 253110ba0fd7
parent 2666 5f48d5e60a81
child 2668 cca3e5d7d6f3
child 2713 680ea4684209
Bacnet plugin web configuration: strip leading and trailing spaces for net. interface and port numb.
runtime/BACnet_config.py
--- a/runtime/BACnet_config.py	Sun Jun 07 23:38:20 2020 +0100
+++ b/runtime/BACnet_config.py	Sun Jun 07 23:46:16 2020 +0100
@@ -87,6 +87,10 @@
 
 
 
+class BN_StrippedString(annotate.String):
+    def __init__(self, *args, **kwargs):
+        annotate.String.__init__(self, strip = True, *args, **kwargs)
+
 
 
 BACnet_parameters = [
@@ -94,8 +98,8 @@
     # (C code var name)         (used on web interface)                          (C data type)    (web data type)
     #                                                                                             (annotate.String,
     #                                                                                              annotate.Integer, ...)
-    ("network_interface"      , _("Network Interface")                         , ctypes.c_char_p, annotate.String),
-    ("port_number"            , _("UDP Port Number")                           , ctypes.c_char_p, annotate.String),
+    ("network_interface"      , _("Network Interface")                         , ctypes.c_char_p, BN_StrippedString),
+    ("port_number"            , _("UDP Port Number")                           , ctypes.c_char_p, BN_StrippedString),
     ("comm_control_passwd"    , _("BACnet Communication Control Password")     , ctypes.c_char_p, annotate.String),
     ("device_id"              , _("BACnet Device ID")                          , ctypes.c_int,    annotate.Integer),
     ("device_name"            , _("BACnet Device Name")                        , ctypes.c_char_p, annotate.String),
@@ -269,8 +273,8 @@
             _("BACnet Configuration"),                # description
             [],                                       # fields  (empty, no parameters required!)
             _("Delete Configuration Stored in Persistent Storage"), # button label
-            OnButtonDel)                              # callback    
-
+            OnButtonDel,                              # callback    
+            "BACnetConfigParm")                       # Add after entry xxxx
 
 
 def OnButtonSave(**kwargs):