/**
 * Copyright (c) 2010-2020 Contributors to the openHAB project
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 */

 /* ***********************************************************
 * This file was automatically generated on 2022-01-03.      *
 *                                                           *
 * openHAB Bindings Version 2.0.0                            *
 *                                                           *
 * If you have a bugfix for this file and want to commit it, *
 * please fix the bug in the generator. You can find a link  *
 * to the generators git repository on tinkerforge.com       *
 *************************************************************/

package org.openhab.binding.tinkerforge.internal.device;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jdt.annotation.NonNull;
import org.openhab.binding.tinkerforge.internal.handler.DeviceHandler;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.binding.ThingActions;
import org.eclipse.smarthome.core.thing.binding.ThingActionsScope;
import org.eclipse.smarthome.core.thing.binding.ThingHandler;
import org.eclipse.smarthome.core.types.RefreshType;
import org.eclipse.smarthome.core.thing.ChannelUID;
import org.openhab.core.automation.annotation.ActionInput;
import org.openhab.core.automation.annotation.ActionOutput;
import org.openhab.core.automation.annotation.RuleAction;

import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import java.util.Map;
import java.util.HashMap;

import com.tinkerforge.TinkerforgeException;
import com.tinkerforge.BrickMaster;

/**
 * Passes through actions of the Master Brick.
 * @author Erik Fleckstein - Initial contribution
 */
@ThingActionsScope(name = "tinkerforge")
@NonNullByDefault
public class BrickMasterActions implements ThingActions, IBrickMasterActions {

    private @Nullable DeviceHandler handler;

    @Override
    public void setThingHandler(@Nullable ThingHandler handler) { this.handler = (DeviceHandler) handler; }

    @Override
    public @Nullable ThingHandler getThingHandler() { return handler; }

    private static IBrickMasterActions invokeMethodOf(@Nullable ThingActions actions) {
        if (actions == null) {
            throw new IllegalArgumentException("actions cannot be null");
        }
        if (actions.getClass().getName().equals(BrickMasterActions.class.getName())) {
            if (actions instanceof IBrickMasterActions) {
                return (IBrickMasterActions) actions;
            } else {
                return (IBrickMasterActions) Proxy.newProxyInstance(IBrickMasterActions.class.getClassLoader(),
                        new Class[] { IBrickMasterActions.class }, (Object proxy, Method method, Object[] args) -> {
                            Method m = actions.getClass().getDeclaredMethod(method.getName(),
                                    method.getParameterTypes());
                            return m.invoke(actions, args);
                        });
            }
        }
        throw new IllegalArgumentException("Actions is not an instance of BrickMasterActions");
    }

    
    @Override
    @RuleAction(label = "Get Stack Voltage")
    public @ActionOutput(name = "voltage", type="int")
           Map<String, Object> brickMasterGetStackVoltage(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int value = dev.getStackVoltage();
        
        result.put("voltage", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetStackVoltage(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetStackVoltage();
    }


    @Override
    @RuleAction(label = "Get Stack Current")
    public @ActionOutput(name = "current", type="int")
           Map<String, Object> brickMasterGetStackCurrent(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int value = dev.getStackCurrent();
        
        result.put("current", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetStackCurrent(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetStackCurrent();
    }


    @Override
    @RuleAction(label = "Get Extension Type")
    public @ActionOutput(name = "exttype", type="long")
           Map<String, Object> brickMasterGetExtensionType(
            @ActionInput(name = "extension") short extension) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        long value = dev.getExtensionType(extension);
        
        result.put("exttype", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetExtensionType(@Nullable ThingActions actions, short extension) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetExtensionType(extension);
    }


    @Override
    @RuleAction(label = "Is Chibi Present")
    public @ActionOutput(name = "present", type="boolean")
           Map<String, Object> brickMasterIsChibiPresent(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.isChibiPresent();
        
        result.put("present", value);
        return result;
    }

    public static Map<String, Object> brickMasterIsChibiPresent(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterIsChibiPresent();
    }


    @Override
    @RuleAction(label = "Get Chibi Address")
    public @ActionOutput(name = "address", type="short")
           Map<String, Object> brickMasterGetChibiAddress(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getChibiAddress();
        
        result.put("address", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetChibiAddress(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetChibiAddress();
    }


    @Override
    @RuleAction(label = "Get Chibi Master Address")
    public @ActionOutput(name = "address", type="short")
           Map<String, Object> brickMasterGetChibiMasterAddress(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getChibiMasterAddress();
        
        result.put("address", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetChibiMasterAddress(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetChibiMasterAddress();
    }


    @Override
    @RuleAction(label = "Get Chibi Slave Address")
    public @ActionOutput(name = "address", type="short")
           Map<String, Object> brickMasterGetChibiSlaveAddress(
            @ActionInput(name = "num") short num) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getChibiSlaveAddress(num);
        
        result.put("address", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetChibiSlaveAddress(@Nullable ThingActions actions, short num) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetChibiSlaveAddress(num);
    }


    @Override
    @RuleAction(label = "Get Chibi Signal Strength")
    public @ActionOutput(name = "signalStrength", type="short")
           Map<String, Object> brickMasterGetChibiSignalStrength(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getChibiSignalStrength();
        
        result.put("signalStrength", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetChibiSignalStrength(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetChibiSignalStrength();
    }


    @Override
    @RuleAction(label = "Get Chibi Error Log")
    public @ActionOutput(name = "underrun", type="int")
           @ActionOutput(name = "crcError", type="int")
           @ActionOutput(name = "noAck", type="int")
           @ActionOutput(name = "overflow", type="int")
           Map<String, Object> brickMasterGetChibiErrorLog(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.ChibiErrorLog value = dev.getChibiErrorLog();
        
        result.put("underrun", value.underrun);
        result.put("crcError", value.crcError);
        result.put("noAck", value.noAck);
        result.put("overflow", value.overflow);
        return result;
    }

    public static Map<String, Object> brickMasterGetChibiErrorLog(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetChibiErrorLog();
    }


    @Override
    @RuleAction(label = "Get Chibi Frequency")
    public @ActionOutput(name = "frequency", type="short")
           Map<String, Object> brickMasterGetChibiFrequency(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getChibiFrequency();
        
        result.put("frequency", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetChibiFrequency(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetChibiFrequency();
    }


    @Override
    @RuleAction(label = "Get Chibi Channel")
    public @ActionOutput(name = "channel", type="short")
           Map<String, Object> brickMasterGetChibiChannel(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getChibiChannel();
        
        result.put("channel", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetChibiChannel(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetChibiChannel();
    }


    @Override
    @RuleAction(label = "Is RS485 Present")
    public @ActionOutput(name = "present", type="boolean")
           Map<String, Object> brickMasterIsRS485Present(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.isRS485Present();
        
        result.put("present", value);
        return result;
    }

    public static Map<String, Object> brickMasterIsRS485Present(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterIsRS485Present();
    }


    @Override
    @RuleAction(label = "Get RS485 Address")
    public @ActionOutput(name = "address", type="short")
           Map<String, Object> brickMasterGetRS485Address(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getRS485Address();
        
        result.put("address", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetRS485Address(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetRS485Address();
    }


    @Override
    @RuleAction(label = "Get RS485 Slave Address")
    public @ActionOutput(name = "address", type="short")
           Map<String, Object> brickMasterGetRS485SlaveAddress(
            @ActionInput(name = "num") short num) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getRS485SlaveAddress(num);
        
        result.put("address", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetRS485SlaveAddress(@Nullable ThingActions actions, short num) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetRS485SlaveAddress(num);
    }


    @Override
    @RuleAction(label = "Get RS485 Error Log")
    public @ActionOutput(name = "crcError", type="int")
           Map<String, Object> brickMasterGetRS485ErrorLog(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int value = dev.getRS485ErrorLog();
        
        result.put("crcError", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetRS485ErrorLog(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetRS485ErrorLog();
    }


    @Override
    @RuleAction(label = "Get RS485 Configuration")
    public @ActionOutput(name = "speed", type="long")
           @ActionOutput(name = "parity", type="char")
           @ActionOutput(name = "stopbits", type="short")
           Map<String, Object> brickMasterGetRS485Configuration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.RS485Configuration value = dev.getRS485Configuration();
        
        result.put("speed", value.speed);
        result.put("parity", value.parity);
        result.put("stopbits", value.stopbits);
        return result;
    }

    public static Map<String, Object> brickMasterGetRS485Configuration(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetRS485Configuration();
    }


    @Override
    @RuleAction(label = "Is Wifi Present")
    public @ActionOutput(name = "present", type="boolean")
           Map<String, Object> brickMasterIsWifiPresent(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.isWifiPresent();
        
        result.put("present", value);
        return result;
    }

    public static Map<String, Object> brickMasterIsWifiPresent(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterIsWifiPresent();
    }


    @Override
    @RuleAction(label = "Get Wifi Configuration")
    public @ActionOutput(name = "ssid", type="String")
           @ActionOutput(name = "connection", type="short")
           @ActionOutput(name = "ip", type="short[]")
           @ActionOutput(name = "subnetMask", type="short[]")
           @ActionOutput(name = "gateway", type="short[]")
           @ActionOutput(name = "port", type="int")
           Map<String, Object> brickMasterGetWifiConfiguration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.WifiConfiguration value = dev.getWifiConfiguration();
        
        result.put("ssid", value.ssid);
        result.put("connection", value.connection);
        result.put("ip", value.ip);
        result.put("subnetMask", value.subnetMask);
        result.put("gateway", value.gateway);
        result.put("port", value.port);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiConfiguration(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiConfiguration();
    }


    @Override
    @RuleAction(label = "Get Wifi Encryption")
    public @ActionOutput(name = "encryption", type="short")
           @ActionOutput(name = "key", type="String")
           @ActionOutput(name = "keyIndex", type="short")
           @ActionOutput(name = "eapOptions", type="short")
           @ActionOutput(name = "caCertificateLength", type="int")
           @ActionOutput(name = "clientCertificateLength", type="int")
           @ActionOutput(name = "privateKeyLength", type="int")
           Map<String, Object> brickMasterGetWifiEncryption(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.WifiEncryption value = dev.getWifiEncryption();
        
        result.put("encryption", value.encryption);
        result.put("key", value.key);
        result.put("keyIndex", value.keyIndex);
        result.put("eapOptions", value.eapOptions);
        result.put("caCertificateLength", value.caCertificateLength);
        result.put("clientCertificateLength", value.clientCertificateLength);
        result.put("privateKeyLength", value.privateKeyLength);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiEncryption(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiEncryption();
    }


    @Override
    @RuleAction(label = "Get Wifi Status")
    public @ActionOutput(name = "macAddress", type="short[]")
           @ActionOutput(name = "bssid", type="short[]")
           @ActionOutput(name = "channel", type="short")
           @ActionOutput(name = "rssi", type="short")
           @ActionOutput(name = "ip", type="short[]")
           @ActionOutput(name = "subnetMask", type="short[]")
           @ActionOutput(name = "gateway", type="short[]")
           @ActionOutput(name = "rxCount", type="long")
           @ActionOutput(name = "txCount", type="long")
           @ActionOutput(name = "state", type="short")
           Map<String, Object> brickMasterGetWifiStatus(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.WifiStatus value = dev.getWifiStatus();
        
        result.put("macAddress", value.macAddress);
        result.put("bssid", value.bssid);
        result.put("channel", value.channel);
        result.put("rssi", value.rssi);
        result.put("ip", value.ip);
        result.put("subnetMask", value.subnetMask);
        result.put("gateway", value.gateway);
        result.put("rxCount", value.rxCount);
        result.put("txCount", value.txCount);
        result.put("state", value.state);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiStatus(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiStatus();
    }

    @Override
    @RuleAction(label = "Refresh Wifi Status")
    public void brickMasterRefreshWifiStatus(
            ) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.refreshWifiStatus();
        
    }

    public static void brickMasterRefreshWifiStatus(@Nullable ThingActions actions) throws TinkerforgeException {
        invokeMethodOf(actions).brickMasterRefreshWifiStatus();
    }


    @Override
    @RuleAction(label = "Get Wifi Certificate")
    public @ActionOutput(name = "data", type="short[]")
           @ActionOutput(name = "dataLength", type="short")
           Map<String, Object> brickMasterGetWifiCertificate(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.WifiCertificate value = dev.getWifiCertificate(index);
        
        result.put("data", value.data);
        result.put("dataLength", value.dataLength);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiCertificate(@Nullable ThingActions actions, int index) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiCertificate(index);
    }


    @Override
    @RuleAction(label = "Get Wifi Power Mode")
    public @ActionOutput(name = "mode", type="short")
           Map<String, Object> brickMasterGetWifiPowerMode(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getWifiPowerMode();
        
        result.put("mode", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiPowerMode(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiPowerMode();
    }


    @Override
    @RuleAction(label = "Get Wifi Buffer Info")
    public @ActionOutput(name = "overflow", type="long")
           @ActionOutput(name = "lowWatermark", type="int")
           @ActionOutput(name = "used", type="int")
           Map<String, Object> brickMasterGetWifiBufferInfo(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.WifiBufferInfo value = dev.getWifiBufferInfo();
        
        result.put("overflow", value.overflow);
        result.put("lowWatermark", value.lowWatermark);
        result.put("used", value.used);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiBufferInfo(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiBufferInfo();
    }


    @Override
    @RuleAction(label = "Get Wifi Regulatory Domain")
    public @ActionOutput(name = "domain", type="short")
           Map<String, Object> brickMasterGetWifiRegulatoryDomain(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getWifiRegulatoryDomain();
        
        result.put("domain", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiRegulatoryDomain(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiRegulatoryDomain();
    }


    @Override
    @RuleAction(label = "Get Long Wifi Key")
    public @ActionOutput(name = "key", type="String")
           Map<String, Object> brickMasterGetLongWifiKey(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        String value = dev.getLongWifiKey();
        
        result.put("key", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetLongWifiKey(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetLongWifiKey();
    }


    @Override
    @RuleAction(label = "Get Wifi Hostname")
    public @ActionOutput(name = "hostname", type="String")
           Map<String, Object> brickMasterGetWifiHostname(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        String value = dev.getWifiHostname();
        
        result.put("hostname", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiHostname(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiHostname();
    }


    @Override
    @RuleAction(label = "Get Wifi Authentication Secret")
    public @ActionOutput(name = "secret", type="String")
           Map<String, Object> brickMasterGetWifiAuthenticationSecret(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        String value = dev.getWifiAuthenticationSecret();
        
        result.put("secret", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifiAuthenticationSecret(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifiAuthenticationSecret();
    }


    @Override
    @RuleAction(label = "Get USB Voltage")
    public @ActionOutput(name = "voltage", type="int")
           Map<String, Object> brickMasterGetUSBVoltage(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int value = dev.getUSBVoltage();
        
        result.put("voltage", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetUSBVoltage(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetUSBVoltage();
    }


    @Override
    @RuleAction(label = "Is Ethernet Present")
    public @ActionOutput(name = "present", type="boolean")
           Map<String, Object> brickMasterIsEthernetPresent(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.isEthernetPresent();
        
        result.put("present", value);
        return result;
    }

    public static Map<String, Object> brickMasterIsEthernetPresent(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterIsEthernetPresent();
    }


    @Override
    @RuleAction(label = "Get Ethernet Configuration")
    public @ActionOutput(name = "connection", type="short")
           @ActionOutput(name = "ip", type="short[]")
           @ActionOutput(name = "subnetMask", type="short[]")
           @ActionOutput(name = "gateway", type="short[]")
           @ActionOutput(name = "port", type="int")
           Map<String, Object> brickMasterGetEthernetConfiguration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.EthernetConfiguration value = dev.getEthernetConfiguration();
        
        result.put("connection", value.connection);
        result.put("ip", value.ip);
        result.put("subnetMask", value.subnetMask);
        result.put("gateway", value.gateway);
        result.put("port", value.port);
        return result;
    }

    public static Map<String, Object> brickMasterGetEthernetConfiguration(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetEthernetConfiguration();
    }


    @Override
    @RuleAction(label = "Get Ethernet Status")
    public @ActionOutput(name = "macAddress", type="short[]")
           @ActionOutput(name = "ip", type="short[]")
           @ActionOutput(name = "subnetMask", type="short[]")
           @ActionOutput(name = "gateway", type="short[]")
           @ActionOutput(name = "rxCount", type="long")
           @ActionOutput(name = "txCount", type="long")
           @ActionOutput(name = "hostname", type="String")
           Map<String, Object> brickMasterGetEthernetStatus(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.EthernetStatus value = dev.getEthernetStatus();
        
        result.put("macAddress", value.macAddress);
        result.put("ip", value.ip);
        result.put("subnetMask", value.subnetMask);
        result.put("gateway", value.gateway);
        result.put("rxCount", value.rxCount);
        result.put("txCount", value.txCount);
        result.put("hostname", value.hostname);
        return result;
    }

    public static Map<String, Object> brickMasterGetEthernetStatus(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetEthernetStatus();
    }


    @Override
    @RuleAction(label = "Get Ethernet Websocket Configuration")
    public @ActionOutput(name = "sockets", type="short")
           @ActionOutput(name = "port", type="int")
           Map<String, Object> brickMasterGetEthernetWebsocketConfiguration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.EthernetWebsocketConfiguration value = dev.getEthernetWebsocketConfiguration();
        
        result.put("sockets", value.sockets);
        result.put("port", value.port);
        return result;
    }

    public static Map<String, Object> brickMasterGetEthernetWebsocketConfiguration(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetEthernetWebsocketConfiguration();
    }


    @Override
    @RuleAction(label = "Get Ethernet Authentication Secret")
    public @ActionOutput(name = "secret", type="String")
           Map<String, Object> brickMasterGetEthernetAuthenticationSecret(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        String value = dev.getEthernetAuthenticationSecret();
        
        result.put("secret", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetEthernetAuthenticationSecret(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetEthernetAuthenticationSecret();
    }


    @Override
    @RuleAction(label = "Get Connection Type")
    public @ActionOutput(name = "connectionType", type="short")
           Map<String, Object> brickMasterGetConnectionType(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getConnectionType();
        
        result.put("connectionType", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetConnectionType(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetConnectionType();
    }


    @Override
    @RuleAction(label = "Is Wifi2 Present")
    public @ActionOutput(name = "present", type="boolean")
           Map<String, Object> brickMasterIsWifi2Present(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.isWifi2Present();
        
        result.put("present", value);
        return result;
    }

    public static Map<String, Object> brickMasterIsWifi2Present(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterIsWifi2Present();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Authentication Secret")
    public @ActionOutput(name = "secret", type="String")
           Map<String, Object> brickMasterGetWifi2AuthenticationSecret(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        String value = dev.getWifi2AuthenticationSecret();
        
        result.put("secret", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2AuthenticationSecret(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2AuthenticationSecret();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Configuration")
    public @ActionOutput(name = "port", type="int")
           @ActionOutput(name = "websocketPort", type="int")
           @ActionOutput(name = "websitePort", type="int")
           @ActionOutput(name = "phyMode", type="short")
           @ActionOutput(name = "sleepMode", type="short")
           @ActionOutput(name = "website", type="short")
           Map<String, Object> brickMasterGetWifi2Configuration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Wifi2Configuration value = dev.getWifi2Configuration();
        
        result.put("port", value.port);
        result.put("websocketPort", value.websocketPort);
        result.put("websitePort", value.websitePort);
        result.put("phyMode", value.phyMode);
        result.put("sleepMode", value.sleepMode);
        result.put("website", value.website);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2Configuration(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2Configuration();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Status")
    public @ActionOutput(name = "clientEnabled", type="boolean")
           @ActionOutput(name = "clientStatus", type="short")
           @ActionOutput(name = "clientIP", type="short[]")
           @ActionOutput(name = "clientSubnetMask", type="short[]")
           @ActionOutput(name = "clientGateway", type="short[]")
           @ActionOutput(name = "clientMACAddress", type="short[]")
           @ActionOutput(name = "clientRXCount", type="long")
           @ActionOutput(name = "clientTXCount", type="long")
           @ActionOutput(name = "clientRSSI", type="byte")
           @ActionOutput(name = "apEnabled", type="boolean")
           @ActionOutput(name = "apIP", type="short[]")
           @ActionOutput(name = "apSubnetMask", type="short[]")
           @ActionOutput(name = "apGateway", type="short[]")
           @ActionOutput(name = "apMACAddress", type="short[]")
           @ActionOutput(name = "apRXCount", type="long")
           @ActionOutput(name = "apTXCount", type="long")
           @ActionOutput(name = "apConnectedCount", type="short")
           Map<String, Object> brickMasterGetWifi2Status(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Wifi2Status value = dev.getWifi2Status();
        
        result.put("clientEnabled", value.clientEnabled);
        result.put("clientStatus", value.clientStatus);
        result.put("clientIP", value.clientIP);
        result.put("clientSubnetMask", value.clientSubnetMask);
        result.put("clientGateway", value.clientGateway);
        result.put("clientMACAddress", value.clientMACAddress);
        result.put("clientRXCount", value.clientRXCount);
        result.put("clientTXCount", value.clientTXCount);
        result.put("clientRSSI", value.clientRSSI);
        result.put("apEnabled", value.apEnabled);
        result.put("apIP", value.apIP);
        result.put("apSubnetMask", value.apSubnetMask);
        result.put("apGateway", value.apGateway);
        result.put("apMACAddress", value.apMACAddress);
        result.put("apRXCount", value.apRXCount);
        result.put("apTXCount", value.apTXCount);
        result.put("apConnectedCount", value.apConnectedCount);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2Status(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2Status();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Client Configuration")
    public @ActionOutput(name = "enable", type="boolean")
           @ActionOutput(name = "ssid", type="String")
           @ActionOutput(name = "ip", type="short[]")
           @ActionOutput(name = "subnetMask", type="short[]")
           @ActionOutput(name = "gateway", type="short[]")
           @ActionOutput(name = "macAddress", type="short[]")
           @ActionOutput(name = "bssid", type="short[]")
           Map<String, Object> brickMasterGetWifi2ClientConfiguration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Wifi2ClientConfiguration value = dev.getWifi2ClientConfiguration();
        
        result.put("enable", value.enable);
        result.put("ssid", value.ssid);
        result.put("ip", value.ip);
        result.put("subnetMask", value.subnetMask);
        result.put("gateway", value.gateway);
        result.put("macAddress", value.macAddress);
        result.put("bssid", value.bssid);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2ClientConfiguration(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2ClientConfiguration();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Client Hostname")
    public @ActionOutput(name = "hostname", type="String")
           Map<String, Object> brickMasterGetWifi2ClientHostname(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        String value = dev.getWifi2ClientHostname();
        
        result.put("hostname", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2ClientHostname(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2ClientHostname();
    }


    @Override
    @RuleAction(label = "Get Wifi2 AP Configuration")
    public @ActionOutput(name = "enable", type="boolean")
           @ActionOutput(name = "ssid", type="String")
           @ActionOutput(name = "ip", type="short[]")
           @ActionOutput(name = "subnetMask", type="short[]")
           @ActionOutput(name = "gateway", type="short[]")
           @ActionOutput(name = "encryption", type="short")
           @ActionOutput(name = "hidden", type="boolean")
           @ActionOutput(name = "channel", type="short")
           @ActionOutput(name = "macAddress", type="short[]")
           Map<String, Object> brickMasterGetWifi2APConfiguration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Wifi2APConfiguration value = dev.getWifi2APConfiguration();
        
        result.put("enable", value.enable);
        result.put("ssid", value.ssid);
        result.put("ip", value.ip);
        result.put("subnetMask", value.subnetMask);
        result.put("gateway", value.gateway);
        result.put("encryption", value.encryption);
        result.put("hidden", value.hidden);
        result.put("channel", value.channel);
        result.put("macAddress", value.macAddress);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2APConfiguration(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2APConfiguration();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Firmware Version")
    public @ActionOutput(name = "firmwareVersion", type="short[]")
           Map<String, Object> brickMasterGetWifi2FirmwareVersion(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short[] value = dev.getWifi2FirmwareVersion();
        
        result.put("firmwareVersion", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2FirmwareVersion(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2FirmwareVersion();
    }

    @Override
    @RuleAction(label = "Enable Wifi2 Status LED")
    public void brickMasterEnableWifi2StatusLED(
            ) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.enableWifi2StatusLED();
        
    }

    public static void brickMasterEnableWifi2StatusLED(@Nullable ThingActions actions) throws TinkerforgeException {
        invokeMethodOf(actions).brickMasterEnableWifi2StatusLED();
    }

    @Override
    @RuleAction(label = "Disable Wifi2 Status LED")
    public void brickMasterDisableWifi2StatusLED(
            ) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.disableWifi2StatusLED();
        
    }

    public static void brickMasterDisableWifi2StatusLED(@Nullable ThingActions actions) throws TinkerforgeException {
        invokeMethodOf(actions).brickMasterDisableWifi2StatusLED();
    }


    @Override
    @RuleAction(label = "Is Wifi2 Status LED Enabled")
    public @ActionOutput(name = "enabled", type="boolean")
           Map<String, Object> brickMasterIsWifi2StatusLEDEnabled(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.isWifi2StatusLEDEnabled();
        
        result.put("enabled", value);
        return result;
    }

    public static Map<String, Object> brickMasterIsWifi2StatusLEDEnabled(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterIsWifi2StatusLEDEnabled();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Mesh Configuration")
    public @ActionOutput(name = "enable", type="boolean")
           @ActionOutput(name = "rootIP", type="short[]")
           @ActionOutput(name = "rootSubnetMask", type="short[]")
           @ActionOutput(name = "rootGateway", type="short[]")
           @ActionOutput(name = "routerBSSID", type="short[]")
           @ActionOutput(name = "groupID", type="short[]")
           @ActionOutput(name = "groupSSIDPrefix", type="String")
           @ActionOutput(name = "gatewayIP", type="short[]")
           @ActionOutput(name = "gatewayPort", type="int")
           Map<String, Object> brickMasterGetWifi2MeshConfiguration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Wifi2MeshConfiguration value = dev.getWifi2MeshConfiguration();
        
        result.put("enable", value.enable);
        result.put("rootIP", value.rootIP);
        result.put("rootSubnetMask", value.rootSubnetMask);
        result.put("rootGateway", value.rootGateway);
        result.put("routerBSSID", value.routerBSSID);
        result.put("groupID", value.groupID);
        result.put("groupSSIDPrefix", value.groupSSIDPrefix);
        result.put("gatewayIP", value.gatewayIP);
        result.put("gatewayPort", value.gatewayPort);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2MeshConfiguration(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2MeshConfiguration();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Mesh Router SSID")
    public @ActionOutput(name = "ssid", type="String")
           Map<String, Object> brickMasterGetWifi2MeshRouterSSID(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        String value = dev.getWifi2MeshRouterSSID();
        
        result.put("ssid", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2MeshRouterSSID(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2MeshRouterSSID();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Mesh Common Status")
    public @ActionOutput(name = "status", type="short")
           @ActionOutput(name = "rootNode", type="boolean")
           @ActionOutput(name = "rootCandidate", type="boolean")
           @ActionOutput(name = "connectedNodes", type="int")
           @ActionOutput(name = "rxCount", type="long")
           @ActionOutput(name = "txCount", type="long")
           Map<String, Object> brickMasterGetWifi2MeshCommonStatus(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Wifi2MeshCommonStatus value = dev.getWifi2MeshCommonStatus();
        
        result.put("status", value.status);
        result.put("rootNode", value.rootNode);
        result.put("rootCandidate", value.rootCandidate);
        result.put("connectedNodes", value.connectedNodes);
        result.put("rxCount", value.rxCount);
        result.put("txCount", value.txCount);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2MeshCommonStatus(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2MeshCommonStatus();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Mesh Client Status")
    public @ActionOutput(name = "hostname", type="String")
           @ActionOutput(name = "ip", type="short[]")
           @ActionOutput(name = "subnetMask", type="short[]")
           @ActionOutput(name = "gateway", type="short[]")
           @ActionOutput(name = "macAddress", type="short[]")
           Map<String, Object> brickMasterGetWifi2MeshClientStatus(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Wifi2MeshClientStatus value = dev.getWifi2MeshClientStatus();
        
        result.put("hostname", value.hostname);
        result.put("ip", value.ip);
        result.put("subnetMask", value.subnetMask);
        result.put("gateway", value.gateway);
        result.put("macAddress", value.macAddress);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2MeshClientStatus(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2MeshClientStatus();
    }


    @Override
    @RuleAction(label = "Get Wifi2 Mesh AP Status")
    public @ActionOutput(name = "ssid", type="String")
           @ActionOutput(name = "ip", type="short[]")
           @ActionOutput(name = "subnetMask", type="short[]")
           @ActionOutput(name = "gateway", type="short[]")
           @ActionOutput(name = "macAddress", type="short[]")
           Map<String, Object> brickMasterGetWifi2MeshAPStatus(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Wifi2MeshAPStatus value = dev.getWifi2MeshAPStatus();
        
        result.put("ssid", value.ssid);
        result.put("ip", value.ip);
        result.put("subnetMask", value.subnetMask);
        result.put("gateway", value.gateway);
        result.put("macAddress", value.macAddress);
        return result;
    }

    public static Map<String, Object> brickMasterGetWifi2MeshAPStatus(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetWifi2MeshAPStatus();
    }

    @Override
    @RuleAction(label = "Set Bricklets Enabled")
    public void brickMasterSetBrickletsEnabled(
            @ActionInput(name = "brickletsEnabled") boolean brickletsEnabled) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        Thing t = h.getThing();
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setBrickletsEnabled(brickletsEnabled);
        if(t.getChannel(new ChannelUID(t.getUID(), "BrickMasterBrickletsEnabled")) != null){
	h.handleCommand(new ChannelUID(t.getUID(), "BrickMasterBrickletsEnabled"), RefreshType.REFRESH);
}
    }

    public static void brickMasterSetBrickletsEnabled(@Nullable ThingActions actions, boolean brickletsEnabled) throws TinkerforgeException {
        invokeMethodOf(actions).brickMasterSetBrickletsEnabled(brickletsEnabled);
    }


    @Override
    @RuleAction(label = "Get Bricklets Enabled")
    public @ActionOutput(name = "brickletsEnabled", type="boolean")
           Map<String, Object> brickMasterGetBrickletsEnabled(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.getBrickletsEnabled();
        
        result.put("brickletsEnabled", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetBrickletsEnabled(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetBrickletsEnabled();
    }


    @Override
    @RuleAction(label = "Get Identity")
    public @ActionOutput(name = "uid", type="String")
           @ActionOutput(name = "connectedUid", type="String")
           @ActionOutput(name = "position", type="char")
           @ActionOutput(name = "hardwareVersion", type="short[]")
           @ActionOutput(name = "firmwareVersion", type="short[]")
           @ActionOutput(name = "deviceIdentifier", type="int")
           Map<String, Object> brickMasterGetIdentity(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.Identity value = dev.getIdentity();
        
        result.put("uid", value.uid);
        result.put("connectedUid", value.connectedUid);
        result.put("position", value.position);
        result.put("hardwareVersion", value.hardwareVersion);
        result.put("firmwareVersion", value.firmwareVersion);
        result.put("deviceIdentifier", value.deviceIdentifier);
        return result;
    }

    public static Map<String, Object> brickMasterGetIdentity(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetIdentity();
    }


    @Override
    @RuleAction(label = "Is Status LED Enabled")
    public @ActionOutput(name = "enabled", type="boolean")
           Map<String, Object> brickMasterIsStatusLEDEnabled(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.isStatusLEDEnabled();
        
        result.put("enabled", value);
        return result;
    }

    public static Map<String, Object> brickMasterIsStatusLEDEnabled(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterIsStatusLEDEnabled();
    }


    @Override
    @RuleAction(label = "Get Chip Temperature")
    public @ActionOutput(name = "temperature", type="short")
           Map<String, Object> brickMasterGetChipTemperature(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        short value = dev.getChipTemperature();
        
        result.put("temperature", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetChipTemperature(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetChipTemperature();
    }


    @Override
    @RuleAction(label = "Get Send Timeout Count")
    public @ActionOutput(name = "timeoutCount", type="long")
           Map<String, Object> brickMasterGetSendTimeoutCount(
            @ActionInput(name = "communicationMethod") short communicationMethod) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        long value = dev.getSendTimeoutCount(communicationMethod);
        
        result.put("timeoutCount", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetSendTimeoutCount(@Nullable ThingActions actions, short communicationMethod) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetSendTimeoutCount(communicationMethod);
    }


    @Override
    @RuleAction(label = "Get SPITFP Baudrate Config")
    public @ActionOutput(name = "enableDynamicBaudrate", type="boolean")
           @ActionOutput(name = "minimumDynamicBaudrate", type="long")
           Map<String, Object> brickMasterGetSPITFPBaudrateConfig(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.SPITFPBaudrateConfig value = dev.getSPITFPBaudrateConfig();
        
        result.put("enableDynamicBaudrate", value.enableDynamicBaudrate);
        result.put("minimumDynamicBaudrate", value.minimumDynamicBaudrate);
        return result;
    }

    public static Map<String, Object> brickMasterGetSPITFPBaudrateConfig(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetSPITFPBaudrateConfig();
    }


    @Override
    @RuleAction(label = "Get SPITFP Error Count")
    public @ActionOutput(name = "errorCountACKChecksum", type="long")
           @ActionOutput(name = "errorCountMessageChecksum", type="long")
           @ActionOutput(name = "errorCountFrame", type="long")
           @ActionOutput(name = "errorCountOverflow", type="long")
           Map<String, Object> brickMasterGetSPITFPErrorCount(
            @ActionInput(name = "brickletPort") char brickletPort) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickMaster.SPITFPErrorCount value = dev.getSPITFPErrorCount(brickletPort);
        
        result.put("errorCountACKChecksum", value.errorCountACKChecksum);
        result.put("errorCountMessageChecksum", value.errorCountMessageChecksum);
        result.put("errorCountFrame", value.errorCountFrame);
        result.put("errorCountOverflow", value.errorCountOverflow);
        return result;
    }

    public static Map<String, Object> brickMasterGetSPITFPErrorCount(@Nullable ThingActions actions, char brickletPort) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetSPITFPErrorCount(brickletPort);
    }


    @Override
    @RuleAction(label = "Get SPITFP Baudrate")
    public @ActionOutput(name = "baudrate", type="long")
           Map<String, Object> brickMasterGetSPITFPBaudrate(
            @ActionInput(name = "brickletPort") char brickletPort) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickMasterWrapper dev = ((@Nullable BrickMasterWrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        long value = dev.getSPITFPBaudrate(brickletPort);
        
        result.put("baudrate", value);
        return result;
    }

    public static Map<String, Object> brickMasterGetSPITFPBaudrate(@Nullable ThingActions actions, char brickletPort) throws TinkerforgeException {
        return invokeMethodOf(actions).brickMasterGetSPITFPBaudrate(brickletPort);
    }
}
