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

io.github.joblo2213.sma.speedwire.SpeedwireCallback 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;

import io.github.joblo2213.sma.speedwire.protocol.telegrams.*;

/**
 * 

* The callback that is run on any received data packets over sma speedwire. *


* If you want to listen for specific telegrams or parse special data, check if the provided data is of a * specific subclass of telegram. *


* Currently implemented telegrams:
* {@link DiscoveryResponse}, {@link EnergyMeterTelegram} *


* Example: *

{@code
 * speedwire.onData(data -> {
 *    if (data instanceof DiscoveryResponse) {
 *        //incoming data is a discovery response. Log the ip.
 *        System.out.println("Found device on " + data.getOrigin().getHostAddress());
 *    } else if (data instanceof EnergyMeterTelegram) {
 *        EnergyMeterTelegram emData = (EnergyMeterTelegram) data;
 *        //handle energy meter data
 *        // ...
 *    }
 * });
 * }
*/ public interface SpeedwireCallback { /** * method called upon received data * * @param data data parsed as valid telegram */ void onDataReceived(Telegram data); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy