All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.joblo2213.sma.speedwire.protocol.telegrams.DiscoveryResponse Maven / Gradle / Ivy

Go to download

SMA-Speedwire is an api for communicating with SMA products over Ethernet using the speedwire interface. It allows listening for exchanged data between your devices and logging meter readings.

There is a newer version: 1.0.2
Show newest version
package io.github.joblo2213.sma.speedwire.protocol.telegrams;

import io.github.joblo2213.sma.speedwire.Speedwire;
import io.github.joblo2213.sma.speedwire.protocol.InvalidTelegramException;

import java.net.InetAddress;
import java.util.Arrays;

/**
 * This telegram is send by all SMA devices that support the speedwire protocol if they receive a discovery request.
* For sending discovery requests, use {@link Speedwire#sendDiscoveryRequest()} */ public class DiscoveryResponse extends Telegram { private static final byte[] SUBARRAY = new byte[]{ (byte) 0x53, (byte) 0x4d, (byte) 0x41, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x02, (byte) 0xA0, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 }; DiscoveryResponse(InetAddress origin, byte[] data) throws InvalidTelegramException { super(origin, data); } @Override protected void validate() throws InvalidTelegramException { super.validate(); if (!Arrays.equals(getBytes(0, 18), SUBARRAY)) throw new InvalidTelegramException("Not a discovery response"); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy