]> git.basschouten.com Git - openhab-addons.git/blob
888f9806d40c2cb8d9166e0db6cb0060ee59c042
[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.homematic.internal.communicator.parser;
14
15 import java.io.IOException;
16 import java.util.Map;
17
18 import org.openhab.binding.homematic.internal.model.HmDatapoint;
19
20 /**
21  * Parses a getValue message from a Homematic gateway.
22  *
23  * @author Gerhard Riegler - Initial contribution
24  */
25 public class GetValueParser extends CommonRpcParser<Object[], Void> {
26     private HmDatapoint dp;
27
28     public GetValueParser(HmDatapoint dp) {
29         this.dp = dp;
30     }
31
32     @Override
33     public Void parse(Object[] message) throws IOException {
34         if (message != null && message.length > 0 && !(message[0] instanceof Map)) {
35             dp.setValue(convertToType(dp, message[0]));
36             adjustRssiValue(dp);
37         }
38         return null;
39     }
40 }