runtime/Modbus_config.py
changeset 2666 5f48d5e60a81
parent 2665 978cf239c689
equal deleted inserted replaced
2665:978cf239c689 2666:5f48d5e60a81
    70 # configured in the loaded PLC (i.e. the .so file loaded into memory)
    70 # configured in the loaded PLC (i.e. the .so file loaded into memory)
    71 # Each entry will be a dictionary. See _AddWebNode() for the details
    71 # Each entry will be a dictionary. See _AddWebNode() for the details
    72 # of the data structure in each entry.
    72 # of the data structure in each entry.
    73 _WebNodeList = []
    73 _WebNodeList = []
    74 
    74 
       
    75 
       
    76 
       
    77 
       
    78 class MB_StrippedString(annotate.String):
       
    79     def __init__(self, *args, **kwargs):
       
    80         annotate.String.__init__(self, strip = True, *args, **kwargs)
    75 
    81 
    76 
    82 
    77 class MB_StopBits(annotate.Choice):
    83 class MB_StopBits(annotate.Choice):
    78     _choices = [0, 1, 2]
    84     _choices = [0, 1, 2]
    79 
    85 
   152 TCPclient_parameters = [                                                   
   158 TCPclient_parameters = [                                                   
   153     #    param. name       label                        ctype type         annotate type
   159     #    param. name       label                        ctype type         annotate type
   154     # (C code var name)   (used on web interface)      (C data type)       (web data type)
   160     # (C code var name)   (used on web interface)      (C data type)       (web data type)
   155     #                                                                      (annotate.String,
   161     #                                                                      (annotate.String,
   156     #                                                                       annotate.Integer, ...)
   162     #                                                                       annotate.Integer, ...)
   157     ("host"             , _("Remote IP Address")     , ctypes.c_char_p,    annotate.String),
   163     ("host"             , _("Remote IP Address")     , ctypes.c_char_p,    MB_StrippedString),
   158     ("port"             , _("Remote Port Number")    , ctypes.c_char_p,    annotate.String),
   164     ("port"             , _("Remote Port Number")    , ctypes.c_char_p,    MB_StrippedString),
   159     ("comm_period"      , _("Invocation Rate (ms)")  , ctypes.c_ulonglong, annotate.Integer)
   165     ("comm_period"      , _("Invocation Rate (ms)")  , ctypes.c_ulonglong, annotate.Integer )
   160     ]
   166     ]
   161 
   167 
   162 RTUclient_parameters = [                                                   
   168 RTUclient_parameters = [                                                   
   163     #    param. name       label                        ctype type         annotate type
   169     #    param. name       label                        ctype type         annotate type
   164     # (C code var name)   (used on web interface)      (C data type)       (web data type)
   170     # (C code var name)   (used on web interface)      (C data type)       (web data type)
   165     #                                                                      (annotate.String,
   171     #                                                                      (annotate.String,
   166     #                                                                       annotate.Integer, ...)
   172     #                                                                       annotate.Integer, ...)
   167     ("device"           , _("Serial Port")           , ctypes.c_char_p,    annotate.String ),
   173     ("device"           , _("Serial Port")           , ctypes.c_char_p,    MB_StrippedString),
   168     ("baud"             , _("Baud Rate")             , ctypes.c_int,       MB_Baud         ),
   174     ("baud"             , _("Baud Rate")             , ctypes.c_int,       MB_Baud         ),
   169     ("parity"           , _("Parity")                , ctypes.c_int,       MB_Parity       ),
   175     ("parity"           , _("Parity")                , ctypes.c_int,       MB_Parity       ),
   170     ("stop_bits"        , _("Stop Bits")             , ctypes.c_int,       MB_StopBits     ),
   176     ("stop_bits"        , _("Stop Bits")             , ctypes.c_int,       MB_StopBits     ),
   171     ("comm_period"      , _("Invocation Rate (ms)")  , ctypes.c_ulonglong, annotate.Integer)
   177     ("comm_period"      , _("Invocation Rate (ms)")  , ctypes.c_ulonglong, annotate.Integer)
   172     ]
   178     ]
   174 TCPserver_parameters = [                                                   
   180 TCPserver_parameters = [                                                   
   175     #    param. name       label                        ctype type         annotate type
   181     #    param. name       label                        ctype type         annotate type
   176     # (C code var name)   (used on web interface)      (C data type)       (web data type)
   182     # (C code var name)   (used on web interface)      (C data type)       (web data type)
   177     #                                                                      (annotate.String,
   183     #                                                                      (annotate.String,
   178     #                                                                       annotate.Integer, ...)
   184     #                                                                       annotate.Integer, ...)
   179     ("host"             , _("Local IP Address")      , ctypes.c_char_p,    annotate.String),
   185     ("host"             , _("Local IP Address")      , ctypes.c_char_p,    MB_StrippedString),
   180     ("port"             , _("Local Port Number")     , ctypes.c_char_p,    annotate.String),
   186     ("port"             , _("Local Port Number")     , ctypes.c_char_p,    MB_StrippedString),
   181     ("slave_id"         , _("Slave ID")              , ctypes.c_ubyte,     annotate.Integer)
   187     ("slave_id"         , _("Slave ID")              , ctypes.c_ubyte,     annotate.Integer )
   182     ]
   188     ]
   183 
   189 
   184 RTUslave_parameters = [                                                   
   190 RTUslave_parameters = [                                                   
   185     #    param. name       label                        ctype type         annotate type
   191     #    param. name       label                        ctype type         annotate type
   186     # (C code var name)   (used on web interface)      (C data type)       (web data type)
   192     # (C code var name)   (used on web interface)      (C data type)       (web data type)
   187     #                                                                      (annotate.String,
   193     #                                                                      (annotate.String,
   188     #                                                                       annotate.Integer, ...)
   194     #                                                                       annotate.Integer, ...)
   189     ("device"           , _("Serial Port")           , ctypes.c_char_p,    annotate.String ),
   195     ("device"           , _("Serial Port")           , ctypes.c_char_p,    MB_StrippedString),
   190     ("baud"             , _("Baud Rate")             , ctypes.c_int,       MB_Baud         ),
   196     ("baud"             , _("Baud Rate")             , ctypes.c_int,       MB_Baud         ),
   191     ("parity"           , _("Parity")                , ctypes.c_int,       MB_Parity       ),
   197     ("parity"           , _("Parity")                , ctypes.c_int,       MB_Parity       ),
   192     ("stop_bits"        , _("Stop Bits")             , ctypes.c_int,       MB_StopBits     ),
   198     ("stop_bits"        , _("Stop Bits")             , ctypes.c_int,       MB_StopBits     ),
   193     ("slave_id"         , _("Slave ID")              , ctypes.c_ulonglong, annotate.Integer)
   199     ("slave_id"         , _("Slave ID")              , ctypes.c_ulonglong, annotate.Integer)
   194     ]
   200     ]