2 * Copyright (c) 2010-2020 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.io.transport.modbus;
15 import java.util.Objects;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * Encapsulates result of modbus write operations
22 * @author Sami Salonen - Initial contribution
25 public class AsyncModbusWriteResult {
27 private final ModbusWriteRequestBlueprint request;
29 private final ModbusResponse response;
31 public AsyncModbusWriteResult(ModbusWriteRequestBlueprint request, ModbusResponse response) {
32 Objects.requireNonNull(request, "Request must not be null!");
33 Objects.requireNonNull(response, "Response must not be null!");
34 this.request = request;
35 this.response = response;
39 * Get request matching this response
41 * @return request object
43 public ModbusWriteRequestBlueprint getRequest() {
52 public ModbusResponse getResponse() {
57 public String toString() {
58 StringBuilder builder = new StringBuilder("AsyncModbusWriteResult(");
59 builder.append("request = ");
60 builder.append(request);
61 builder.append(", response = ");
62 builder.append(response);
64 return builder.toString();