]> git.basschouten.com Git - openhab-addons.git/blob
163b88745a2712e4bd2b0b9cd4d7c83a04106fbb
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.io.transport.modbus;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.io.transport.modbus.endpoint.EndpointPoolConfiguration;
18 import org.openhab.io.transport.modbus.endpoint.ModbusSlaveEndpoint;
19
20 /**
21  * ModbusManager is the main interface for interacting with Modbus slaves
22  *
23  * @author Sami Salonen - Initial contribution
24  */
25 @NonNullByDefault
26 public interface ModbusManager {
27
28     /**
29      * Open communication interface to endpoint
30      *
31      * @param endpoint endpoint pointing to modbus slave
32      * @param configuration configuration for the endpoint
33      * @return Communication interface for interacting with the slave
34      * @throws IllegalArgumentException if there is already open communication interface with same endpoint but
35      *             differing configuration
36      */
37     public ModbusCommunicationInterface newModbusCommunicationInterface(ModbusSlaveEndpoint endpoint,
38             @Nullable EndpointPoolConfiguration configuration) throws IllegalArgumentException;
39
40     /**
41      * Get general configuration settings applied to a given endpoint
42      *
43      * Note that default configuration settings are returned in case the endpoint has not been configured.
44      *
45      * @param endpoint endpoint to query
46      * @return general connection settings of the given endpoint
47      */
48     public @Nullable EndpointPoolConfiguration getEndpointPoolConfiguration(ModbusSlaveEndpoint endpoint);
49 }