AdvancedClimateSystems / uModbus

Python implementation of the Modbus protocol.
Mozilla Public License 2.0
211 stars 82 forks source link

function_code is missing in route signature. #36

Closed OrangeTux closed 8 years ago

OrangeTux commented 8 years ago

Image a route like this:

@app.route(slave_ids=[1], function_codes=[1, 2], addresses=[1, 2, 3, 4])
def read_coil(slave_id, address):
    """ Return value of digital input.  """
    return address % 2

The route cannot know the Modbus function code of the request. Routes should be called with function_code so the signature for read functions becomes this:

def read_route(slave_id, address, function_code)

And for write functions:

def write_rout(slave_id, address, value, function_code)