]> git.basschouten.com Git - openhab-addons.git/blob
4c95df957ab720246ac8f563c4721ba2dab618fb
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.binding.modbus.sunspec.internal.parser;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.io.transport.modbus.ModbusRegisterArray;
17
18 /**
19  * General interface for sunspec parsers
20  *
21  * Parsers are responsible to take the raw register array
22  * that was read from the device and to parse them into a SunSpecMessageBlock
23  * They should parse all reasonable fields into separate properties
24  * in the message block.
25  *
26  * Fields with unsupported values should be parsed as null values.
27  *
28  * In no way should a parser handle value scaling or device specific
29  * workarounds. These should be done in the handler.
30  *
31  * @author Nagy Attila Gabor - Initial contribution
32  *
33  */
34 @NonNullByDefault
35 public interface SunspecParser<T> {
36
37     /**
38      * This method should parser an incoming register array and
39      * return a not-null sunspec block
40      */
41     T parse(ModbusRegisterArray raw);
42 }