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

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

import java.io.IOException;
import java.net.PortUnreachableException;
import java.nio.channels.IllegalBlockingModeException;

/**
 * 

* The callback that is run on any occurring exceptions while reading incoming packets from sma speedwire. *


* If you want to listen for specific types of exceptions, check the type with {@code instanceof}. *


* Likely exceptions are:
* {@link InvalidTelegramException} - if an incoming packet can't be parsed as valid speedwire telegram * {@link IOException} – if an I/O error occurs.
* {@link PortUnreachableException} – may be thrown if the socket is connected to a currently unreachable destination. * Note, there is no guarantee that the exception will be thrown.
* {@link IllegalBlockingModeException} – if the socket has an associated channel, * and the channel is in non-blocking mode.
*


* Example: *

{@code
 * speedwire.onError(e -> {
 *    if (e instanceof IOException) {
 *        //io error
 *        // ...
 *    } else if (e instanceof InvalidTelegramException) {
 *        //packet parsing error
 *        // ...
 *    }
 * });
 * }
*/ public interface SpeedwireErrorHandler { /** * method called upon any exception while receiving or parsing data * * @param e exception that was thrown */ void onError(Exception e); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy