]> git.basschouten.com Git - openhab-addons.git/blob
ef36691d37c400ad905b9b5b70aed51a79c64564
[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.openhab.io.transport.modbus.endpoint.ModbusSlaveEndpoint;
17
18 /**
19  * Common base interface for read and write tasks.
20  *
21  * @author Sami Salonen - Initial contribution
22  *
23  * @param <R> request type
24  * @param <C> callback type
25  */
26 @NonNullByDefault
27 public interface TaskWithEndpoint<R, C extends ModbusResultCallback, F extends ModbusFailureCallback<R>> {
28     /**
29      * Gets endpoint associated with this task
30      *
31      * @return
32      */
33     ModbusSlaveEndpoint getEndpoint();
34
35     /**
36      * Gets request associated with this task
37      *
38      * @return
39      */
40     R getRequest();
41
42     /**
43      * Gets the result callback associated with this task, will be called with response
44      *
45      * @return
46      */
47     C getResultCallback();
48
49     /**
50      * Gets the failure callback associated with this task, will be called in case of an error
51      *
52      * @return
53      */
54     F getFailureCallback();
55
56     int getMaxTries();
57 }