@@ -63,7 +63,7 @@ def __init__(self, protocol):
6363
6464 try :
6565 from minicps import __file__
66- self ._minicps_path = __file__ [:- 12 ]
66+ self ._minicps_path = __file__ [:- 12 ] # XXX: remove trailing chars
6767 except Exception as error :
6868 print 'ERROR Protocol __init__ set _minicps_path: ' , error
6969
@@ -518,22 +518,27 @@ def __init__(self, protocol):
518518 # TODO: implement it
519519
520520
521+ # TODO: still not sure about the tags API
521522 @classmethod
522- def _start_server (cls , address , tags , cmd_path , mode = 1 ):
523+ def _start_server (cls , cmd_path , address = 'localhost:502' ,
524+ tags = (20 , 20 , 20 , 20 ), mode = 1 ):
523525 """Start a pymodbus modbus server.
524526
525527 The command used to start the server is generated by
526528 ``_start_server_cmd``.
527529
528- Notice that the client has to manage the new process,
529- eg:kill it after use .
530+ Consistency between modbus server key-values and state key-values has to
531+ be guaranteed by the client .
530532
531- :address: to serve
532533 :cmd_path: path to the script to start a server
534+ :address: ip:port
533535 :tags: ordered tuple of ints representing the numbers of discrete
534536 inputs, coils, input registers, and holding registers to be init.
535537 Current pymodbus servers only support ModbusSequentialDataBlock.
536538 :mode: int greater than 1, typically set by the constructor
539+
540+ :returns: list of strings generated with shlex.split,
541+ passable to subprocess.Popen object
537542 """
538543
539544 try :
@@ -546,25 +551,10 @@ def _start_server(cls, address, tags, cmd_path, mode=1):
546551 print 'ERROR modbus _start_server: ' , error
547552
548553
549- # TODO: still not sure about the tags API
550554 @classmethod
551555 def _start_server_cmd (cls , cmd_path , address = 'localhost:502' ,
552- tags = (10 , 10 , 10 , 10 ), mode = 1 ):
553- # ('CO1', 1, 'CO'), ('HR1', 1, 'HR'))):
554- """Build a subprocess.Popen cmd string for pycomm server.
555-
556- Consistency between modbus server key-values and state key-values has to
557- be guaranteed by the client.
558-
559- :address: to serve
560- :cmd_path: path to the script to start a server
561- :tags: ordered tuple of ints representing the numbers of discrete
562- inputs, coils, input registers, and holding registers to be init.
563- Current pymodbus servers only support ModbusSequentialDataBlock.
564-
565- :returns: list of strings generated with shlex.split,
566- passable to subprocess.Popen object
567- """
556+ tags = (20 , 20 , 20 , 20 ), mode = 1 ):
557+ """Build a subprocess.Popen cmd string for pycomm server."""
568558
569559 if sys .platform .startswith ('linux' ):
570560 SHELL = '/bin/bash -c '
0 commit comments