runtime/BACnet_config.py
changeset 2667 253110ba0fd7
parent 2649 db68cb0e6bdc
equal deleted inserted replaced
2666:5f48d5e60a81 2667:253110ba0fd7
    85 _BACnetConfFilename = "/tmp/BeremizBACnetConfig.json"
    85 _BACnetConfFilename = "/tmp/BeremizBACnetConfig.json"
    86 
    86 
    87 
    87 
    88 
    88 
    89 
    89 
       
    90 class BN_StrippedString(annotate.String):
       
    91     def __init__(self, *args, **kwargs):
       
    92         annotate.String.__init__(self, strip = True, *args, **kwargs)
       
    93 
    90 
    94 
    91 
    95 
    92 BACnet_parameters = [
    96 BACnet_parameters = [
    93     #    param. name             label                                            ctype type      annotate type
    97     #    param. name             label                                            ctype type      annotate type
    94     # (C code var name)         (used on web interface)                          (C data type)    (web data type)
    98     # (C code var name)         (used on web interface)                          (C data type)    (web data type)
    95     #                                                                                             (annotate.String,
    99     #                                                                                             (annotate.String,
    96     #                                                                                              annotate.Integer, ...)
   100     #                                                                                              annotate.Integer, ...)
    97     ("network_interface"      , _("Network Interface")                         , ctypes.c_char_p, annotate.String),
   101     ("network_interface"      , _("Network Interface")                         , ctypes.c_char_p, BN_StrippedString),
    98     ("port_number"            , _("UDP Port Number")                           , ctypes.c_char_p, annotate.String),
   102     ("port_number"            , _("UDP Port Number")                           , ctypes.c_char_p, BN_StrippedString),
    99     ("comm_control_passwd"    , _("BACnet Communication Control Password")     , ctypes.c_char_p, annotate.String),
   103     ("comm_control_passwd"    , _("BACnet Communication Control Password")     , ctypes.c_char_p, annotate.String),
   100     ("device_id"              , _("BACnet Device ID")                          , ctypes.c_int,    annotate.Integer),
   104     ("device_id"              , _("BACnet Device ID")                          , ctypes.c_int,    annotate.Integer),
   101     ("device_name"            , _("BACnet Device Name")                        , ctypes.c_char_p, annotate.String),
   105     ("device_name"            , _("BACnet Device Name")                        , ctypes.c_char_p, annotate.String),
   102     ("device_location"        , _("BACnet Device Location")                    , ctypes.c_char_p, annotate.String),
   106     ("device_location"        , _("BACnet Device Location")                    , ctypes.c_char_p, annotate.String),
   103     ("device_description"     , _("BACnet Device Description")                 , ctypes.c_char_p, annotate.String),
   107     ("device_description"     , _("BACnet Device Description")                 , ctypes.c_char_p, annotate.String),
   267         _NS.ConfigurableSettings.addSettings(
   271         _NS.ConfigurableSettings.addSettings(
   268             "BACnetConfigDelSaved",                   # name
   272             "BACnetConfigDelSaved",                   # name
   269             _("BACnet Configuration"),                # description
   273             _("BACnet Configuration"),                # description
   270             [],                                       # fields  (empty, no parameters required!)
   274             [],                                       # fields  (empty, no parameters required!)
   271             _("Delete Configuration Stored in Persistent Storage"), # button label
   275             _("Delete Configuration Stored in Persistent Storage"), # button label
   272             OnButtonDel)                              # callback    
   276             OnButtonDel,                              # callback    
   273 
   277             "BACnetConfigParm")                       # Add after entry xxxx
   274 
   278 
   275 
   279 
   276 def OnButtonSave(**kwargs):
   280 def OnButtonSave(**kwargs):
   277     """
   281     """
   278     # Function called when user clicks 'Save' button in web interface
   282     # Function called when user clicks 'Save' button in web interface