/**
 * 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.BrickletLCD128x64;

/**
 * Passes through actions of the LCD 128x64 Bricklet.
 * @author Erik Fleckstein - Initial contribution
 */
@ThingActionsScope(name = "tinkerforge")
@NonNullByDefault
public class BrickletLCD128x64Actions implements ThingActions, IBrickletLCD128x64Actions {

    private @Nullable DeviceHandler handler;

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

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

    private static IBrickletLCD128x64Actions invokeMethodOf(@Nullable ThingActions actions) {
        if (actions == null) {
            throw new IllegalArgumentException("actions cannot be null");
        }
        if (actions.getClass().getName().equals(BrickletLCD128x64Actions.class.getName())) {
            if (actions instanceof IBrickletLCD128x64Actions) {
                return (IBrickletLCD128x64Actions) actions;
            } else {
                return (IBrickletLCD128x64Actions) Proxy.newProxyInstance(IBrickletLCD128x64Actions.class.getClassLoader(),
                        new Class[] { IBrickletLCD128x64Actions.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 BrickletLCD128x64Actions");
    }

        @Override
    @RuleAction(label = "Write Pixels")
    public void brickletLCD128x64WritePixels(
            @ActionInput(name = "xStart") int xStart,
            @ActionInput(name = "yStart") int yStart,
            @ActionInput(name = "xEnd") int xEnd,
            @ActionInput(name = "yEnd") int yEnd,
            @ActionInput(name = "pixels") boolean[] pixels) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.writePixels(xStart, yStart, xEnd, yEnd, pixels);
        
    }

    public static void brickletLCD128x64WritePixels(@Nullable ThingActions actions, int xStart, int yStart, int xEnd, int yEnd, boolean[] pixels) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64WritePixels(xStart, yStart, xEnd, yEnd, pixels);
    }


    @Override
    @RuleAction(label = "Read Pixels")
    public @ActionOutput(name = "pixels", type="boolean[]")
           Map<String, Object> brickletLCD128x64ReadPixels(
            @ActionInput(name = "xStart") int xStart,
            @ActionInput(name = "yStart") int yStart,
            @ActionInput(name = "xEnd") int xEnd,
            @ActionInput(name = "yEnd") int yEnd) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean[] value = dev.readPixels(xStart, yStart, xEnd, yEnd);
        
        result.put("pixels", value);
        return result;
    }

    public static Map<String, Object> brickletLCD128x64ReadPixels(@Nullable ThingActions actions, int xStart, int yStart, int xEnd, int yEnd) throws TinkerforgeException {
        return invokeMethodOf(actions).brickletLCD128x64ReadPixels(xStart, yStart, xEnd, yEnd);
    }

    @Override
    @RuleAction(label = "Clear Display")
    public void brickletLCD128x64ClearDisplay(
            ) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.clearDisplay();
        
    }

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

    @Override
    @RuleAction(label = "Write Line")
    public void brickletLCD128x64WriteLine(
            @ActionInput(name = "line") int line,
            @ActionInput(name = "position") int position,
            @ActionInput(name = "text") String text) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.writeLine(line, position, text);
        
    }

    public static void brickletLCD128x64WriteLine(@Nullable ThingActions actions, int line, int position, String text) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64WriteLine(line, position, text);
    }

    @Override
    @RuleAction(label = "Draw Buffered Frame")
    public void brickletLCD128x64DrawBufferedFrame(
            @ActionInput(name = "forceCompleteRedraw") boolean forceCompleteRedraw) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.drawBufferedFrame(forceCompleteRedraw);
        
    }

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


    @Override
    @RuleAction(label = "Get Touch Position")
    public @ActionOutput(name = "pressure", type="int")
           @ActionOutput(name = "x", type="int")
           @ActionOutput(name = "y", type="int")
           @ActionOutput(name = "age", type="long")
           Map<String, Object> brickletLCD128x64GetTouchPosition(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.TouchPosition value = dev.getTouchPosition();
        
        result.put("pressure", value.pressure);
        result.put("x", value.x);
        result.put("y", value.y);
        result.put("age", value.age);
        return result;
    }

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


    @Override
    @RuleAction(label = "Get Touch Gesture")
    public @ActionOutput(name = "gesture", type="int")
           @ActionOutput(name = "duration", type="long")
           @ActionOutput(name = "pressureMax", type="int")
           @ActionOutput(name = "xStart", type="int")
           @ActionOutput(name = "yStart", type="int")
           @ActionOutput(name = "xEnd", type="int")
           @ActionOutput(name = "yEnd", type="int")
           @ActionOutput(name = "age", type="long")
           Map<String, Object> brickletLCD128x64GetTouchGesture(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.TouchGesture value = dev.getTouchGesture();
        
        result.put("gesture", value.gesture);
        result.put("duration", value.duration);
        result.put("pressureMax", value.pressureMax);
        result.put("xStart", value.xStart);
        result.put("yStart", value.yStart);
        result.put("xEnd", value.xEnd);
        result.put("yEnd", value.yEnd);
        result.put("age", value.age);
        return result;
    }

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

    @Override
    @RuleAction(label = "Draw Line")
    public void brickletLCD128x64DrawLine(
            @ActionInput(name = "positionXStart") int positionXStart,
            @ActionInput(name = "positionYStart") int positionYStart,
            @ActionInput(name = "positionXEnd") int positionXEnd,
            @ActionInput(name = "positionYEnd") int positionYEnd,
            @ActionInput(name = "color") boolean color) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.drawLine(positionXStart, positionYStart, positionXEnd, positionYEnd, color);
        
    }

    public static void brickletLCD128x64DrawLine(@Nullable ThingActions actions, int positionXStart, int positionYStart, int positionXEnd, int positionYEnd, boolean color) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64DrawLine(positionXStart, positionYStart, positionXEnd, positionYEnd, color);
    }

    @Override
    @RuleAction(label = "Draw Box")
    public void brickletLCD128x64DrawBox(
            @ActionInput(name = "positionXStart") int positionXStart,
            @ActionInput(name = "positionYStart") int positionYStart,
            @ActionInput(name = "positionXEnd") int positionXEnd,
            @ActionInput(name = "positionYEnd") int positionYEnd,
            @ActionInput(name = "fill") boolean fill,
            @ActionInput(name = "color") boolean color) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.drawBox(positionXStart, positionYStart, positionXEnd, positionYEnd, fill, color);
        
    }

    public static void brickletLCD128x64DrawBox(@Nullable ThingActions actions, int positionXStart, int positionYStart, int positionXEnd, int positionYEnd, boolean fill, boolean color) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64DrawBox(positionXStart, positionYStart, positionXEnd, positionYEnd, fill, color);
    }

    @Override
    @RuleAction(label = "Draw Text")
    public void brickletLCD128x64DrawText(
            @ActionInput(name = "positionX") int positionX,
            @ActionInput(name = "positionY") int positionY,
            @ActionInput(name = "font") int font,
            @ActionInput(name = "color") boolean color,
            @ActionInput(name = "text") String text) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.drawText(positionX, positionY, font, color, text);
        
    }

    public static void brickletLCD128x64DrawText(@Nullable ThingActions actions, int positionX, int positionY, int font, boolean color, String text) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64DrawText(positionX, positionY, font, color, text);
    }

    @Override
    @RuleAction(label = "Set GUI Button")
    public void brickletLCD128x64SetGUIButton(
            @ActionInput(name = "index") int index,
            @ActionInput(name = "positionX") int positionX,
            @ActionInput(name = "positionY") int positionY,
            @ActionInput(name = "width") int width,
            @ActionInput(name = "height") int height,
            @ActionInput(name = "text") String text) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setGUIButton(index, positionX, positionY, width, height, text);
        
    }

    public static void brickletLCD128x64SetGUIButton(@Nullable ThingActions actions, int index, int positionX, int positionY, int width, int height, String text) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64SetGUIButton(index, positionX, positionY, width, height, text);
    }


    @Override
    @RuleAction(label = "Get GUI Button")
    public @ActionOutput(name = "active", type="boolean")
           @ActionOutput(name = "positionX", type="int")
           @ActionOutput(name = "positionY", type="int")
           @ActionOutput(name = "width", type="int")
           @ActionOutput(name = "height", type="int")
           @ActionOutput(name = "text", type="String")
           Map<String, Object> brickletLCD128x64GetGUIButton(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.GUIButton value = dev.getGUIButton(index);
        
        result.put("active", value.active);
        result.put("positionX", value.positionX);
        result.put("positionY", value.positionY);
        result.put("width", value.width);
        result.put("height", value.height);
        result.put("text", value.text);
        return result;
    }

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

    @Override
    @RuleAction(label = "Remove GUI Button")
    public void brickletLCD128x64RemoveGUIButton(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.removeGUIButton(index);
        
    }

    public static void brickletLCD128x64RemoveGUIButton(@Nullable ThingActions actions, int index) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64RemoveGUIButton(index);
    }


    @Override
    @RuleAction(label = "Get GUI Button Pressed")
    public @ActionOutput(name = "pressed", type="boolean")
           Map<String, Object> brickletLCD128x64GetGUIButtonPressed(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        boolean value = dev.getGUIButtonPressed(index);
        
        result.put("pressed", value);
        return result;
    }

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

    @Override
    @RuleAction(label = "Set GUI Slider")
    public void brickletLCD128x64SetGUISlider(
            @ActionInput(name = "index") int index,
            @ActionInput(name = "positionX") int positionX,
            @ActionInput(name = "positionY") int positionY,
            @ActionInput(name = "length") int length,
            @ActionInput(name = "direction") int direction,
            @ActionInput(name = "value") int value) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setGUISlider(index, positionX, positionY, length, direction, value);
        
    }

    public static void brickletLCD128x64SetGUISlider(@Nullable ThingActions actions, int index, int positionX, int positionY, int length, int direction, int value) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64SetGUISlider(index, positionX, positionY, length, direction, value);
    }


    @Override
    @RuleAction(label = "Get GUI Slider")
    public @ActionOutput(name = "active", type="boolean")
           @ActionOutput(name = "positionX", type="int")
           @ActionOutput(name = "positionY", type="int")
           @ActionOutput(name = "length", type="int")
           @ActionOutput(name = "direction", type="int")
           @ActionOutput(name = "value", type="int")
           Map<String, Object> brickletLCD128x64GetGUISlider(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.GUISlider value = dev.getGUISlider(index);
        
        result.put("active", value.active);
        result.put("positionX", value.positionX);
        result.put("positionY", value.positionY);
        result.put("length", value.length);
        result.put("direction", value.direction);
        result.put("value", value.value);
        return result;
    }

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

    @Override
    @RuleAction(label = "Remove GUI Slider")
    public void brickletLCD128x64RemoveGUISlider(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.removeGUISlider(index);
        
    }

    public static void brickletLCD128x64RemoveGUISlider(@Nullable ThingActions actions, int index) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64RemoveGUISlider(index);
    }


    @Override
    @RuleAction(label = "Get GUI Slider Value")
    public @ActionOutput(name = "value", type="int")
           Map<String, Object> brickletLCD128x64GetGUISliderValue(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int value = dev.getGUISliderValue(index);
        
        result.put("value", value);
        return result;
    }

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

    @Override
    @RuleAction(label = "Set GUI Tab Configuration")
    public void brickletLCD128x64SetGUITabConfiguration(
            @ActionInput(name = "changeTabConfig") int changeTabConfig,
            @ActionInput(name = "clearGUI") boolean clearGUI) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setGUITabConfiguration(changeTabConfig, clearGUI);
        
    }

    public static void brickletLCD128x64SetGUITabConfiguration(@Nullable ThingActions actions, int changeTabConfig, boolean clearGUI) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64SetGUITabConfiguration(changeTabConfig, clearGUI);
    }


    @Override
    @RuleAction(label = "Get GUI Tab Configuration")
    public @ActionOutput(name = "changeTabConfig", type="int")
           @ActionOutput(name = "clearGUI", type="boolean")
           Map<String, Object> brickletLCD128x64GetGUITabConfiguration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.GUITabConfiguration value = dev.getGUITabConfiguration();
        
        result.put("changeTabConfig", value.changeTabConfig);
        result.put("clearGUI", value.clearGUI);
        return result;
    }

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

    @Override
    @RuleAction(label = "Set GUI Tab Text")
    public void brickletLCD128x64SetGUITabText(
            @ActionInput(name = "index") int index,
            @ActionInput(name = "text") String text) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setGUITabText(index, text);
        
    }

    public static void brickletLCD128x64SetGUITabText(@Nullable ThingActions actions, int index, String text) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64SetGUITabText(index, text);
    }


    @Override
    @RuleAction(label = "Get GUI Tab Text")
    public @ActionOutput(name = "active", type="boolean")
           @ActionOutput(name = "text", type="String")
           Map<String, Object> brickletLCD128x64GetGUITabText(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.GUITabText value = dev.getGUITabText(index);
        
        result.put("active", value.active);
        result.put("text", value.text);
        return result;
    }

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

    @Override
    @RuleAction(label = "Set GUI Tab Icon")
    public void brickletLCD128x64SetGUITabIcon(
            @ActionInput(name = "index") int index,
            @ActionInput(name = "icon") boolean[] icon) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setGUITabIcon(index, icon);
        
    }

    public static void brickletLCD128x64SetGUITabIcon(@Nullable ThingActions actions, int index, boolean[] icon) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64SetGUITabIcon(index, icon);
    }


    @Override
    @RuleAction(label = "Get GUI Tab Icon")
    public @ActionOutput(name = "active", type="boolean")
           @ActionOutput(name = "icon", type="boolean[]")
           Map<String, Object> brickletLCD128x64GetGUITabIcon(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.GUITabIcon value = dev.getGUITabIcon(index);
        
        result.put("active", value.active);
        result.put("icon", value.icon);
        return result;
    }

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

    @Override
    @RuleAction(label = "Remove GUI Tab")
    public void brickletLCD128x64RemoveGUITab(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.removeGUITab(index);
        
    }

    public static void brickletLCD128x64RemoveGUITab(@Nullable ThingActions actions, int index) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64RemoveGUITab(index);
    }

    @Override
    @RuleAction(label = "Set GUI Tab Selected")
    public void brickletLCD128x64SetGUITabSelected(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setGUITabSelected(index);
        
    }

    public static void brickletLCD128x64SetGUITabSelected(@Nullable ThingActions actions, int index) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64SetGUITabSelected(index);
    }


    @Override
    @RuleAction(label = "Get GUI Tab Selected")
    public @ActionOutput(name = "index", type="int")
           Map<String, Object> brickletLCD128x64GetGUITabSelected(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int value = dev.getGUITabSelected();
        
        result.put("index", value);
        return result;
    }

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

    @Override
    @RuleAction(label = "Set GUI Graph Configuration")
    public void brickletLCD128x64SetGUIGraphConfiguration(
            @ActionInput(name = "index") int index,
            @ActionInput(name = "graphType") int graphType,
            @ActionInput(name = "positionX") int positionX,
            @ActionInput(name = "positionY") int positionY,
            @ActionInput(name = "width") int width,
            @ActionInput(name = "height") int height,
            @ActionInput(name = "textX") String textX,
            @ActionInput(name = "textY") String textY) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setGUIGraphConfiguration(index, graphType, positionX, positionY, width, height, textX, textY);
        
    }

    public static void brickletLCD128x64SetGUIGraphConfiguration(@Nullable ThingActions actions, int index, int graphType, int positionX, int positionY, int width, int height, String textX, String textY) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64SetGUIGraphConfiguration(index, graphType, positionX, positionY, width, height, textX, textY);
    }


    @Override
    @RuleAction(label = "Get GUI Graph Configuration")
    public @ActionOutput(name = "active", type="boolean")
           @ActionOutput(name = "graphType", type="int")
           @ActionOutput(name = "positionX", type="int")
           @ActionOutput(name = "positionY", type="int")
           @ActionOutput(name = "width", type="int")
           @ActionOutput(name = "height", type="int")
           @ActionOutput(name = "textX", type="String")
           @ActionOutput(name = "textY", type="String")
           Map<String, Object> brickletLCD128x64GetGUIGraphConfiguration(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.GUIGraphConfiguration value = dev.getGUIGraphConfiguration(index);
        
        result.put("active", value.active);
        result.put("graphType", value.graphType);
        result.put("positionX", value.positionX);
        result.put("positionY", value.positionY);
        result.put("width", value.width);
        result.put("height", value.height);
        result.put("textX", value.textX);
        result.put("textY", value.textY);
        return result;
    }

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

    @Override
    @RuleAction(label = "Set GUI Graph Data")
    public void brickletLCD128x64SetGUIGraphData(
            @ActionInput(name = "index") int index,
            @ActionInput(name = "data") int[] data) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.setGUIGraphData(index, data);
        
    }

    public static void brickletLCD128x64SetGUIGraphData(@Nullable ThingActions actions, int index, int[] data) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64SetGUIGraphData(index, data);
    }


    @Override
    @RuleAction(label = "Get GUI Graph Data")
    public @ActionOutput(name = "data", type="int[]")
           Map<String, Object> brickletLCD128x64GetGUIGraphData(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int[] value = dev.getGUIGraphData(index);
        
        result.put("data", value);
        return result;
    }

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

    @Override
    @RuleAction(label = "Remove GUI Graph")
    public void brickletLCD128x64RemoveGUIGraph(
            @ActionInput(name = "index") int index) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.removeGUIGraph(index);
        
    }

    public static void brickletLCD128x64RemoveGUIGraph(@Nullable ThingActions actions, int index) throws TinkerforgeException {
        invokeMethodOf(actions).brickletLCD128x64RemoveGUIGraph(index);
    }

    @Override
    @RuleAction(label = "Remove All GUI")
    public void brickletLCD128x64RemoveAllGUI(
            ) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.removeAllGUI();
        
    }

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


    @Override
    @RuleAction(label = "Get Display Configuration")
    public @ActionOutput(name = "contrast", type="int")
           @ActionOutput(name = "backlight", type="int")
           @ActionOutput(name = "invert", type="boolean")
           @ActionOutput(name = "automaticDraw", type="boolean")
           Map<String, Object> brickletLCD128x64GetDisplayConfiguration(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.DisplayConfiguration value = dev.getDisplayConfiguration();
        
        result.put("contrast", value.contrast);
        result.put("backlight", value.backlight);
        result.put("invert", value.invert);
        result.put("automaticDraw", value.automaticDraw);
        return result;
    }

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


    @Override
    @RuleAction(label = "Get Touch LED Config")
    public @ActionOutput(name = "config", type="int")
           Map<String, Object> brickletLCD128x64GetTouchLEDConfig(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int value = dev.getTouchLEDConfig();
        
        result.put("config", value);
        return result;
    }

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


    @Override
    @RuleAction(label = "Read UID")
    public @ActionOutput(name = "uid", type="long")
           Map<String, Object> brickletLCD128x64ReadUID(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        long value = dev.readUID();
        
        result.put("uid", value);
        return result;
    }

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


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

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

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


    @Override
    @RuleAction(label = "Get Status LED Config")
    public @ActionOutput(name = "config", type="int")
           Map<String, Object> brickletLCD128x64GetStatusLEDConfig(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        int value = dev.getStatusLEDConfig();
        
        result.put("config", value);
        return result;
    }

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


    @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> brickletLCD128x64GetSPITFPErrorCount(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.SPITFPErrorCount value = dev.getSPITFPErrorCount();
        
        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> brickletLCD128x64GetSPITFPErrorCount(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickletLCD128x64GetSPITFPErrorCount();
    }

    @Override
    @RuleAction(label = "Reset")
    public void brickletLCD128x64Reset(
            ) throws TinkerforgeException {
        DeviceHandler h = handler;
        if(h == null) {
            return;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return;
        }
        dev.reset();
        
    }

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


    @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> brickletLCD128x64GetIdentity(
            ) throws TinkerforgeException {
        Map<String, Object> result = new HashMap<>();
        DeviceHandler h = handler;
        if(h == null) {
            return result;
        }
        
        @Nullable BrickletLCD128x64Wrapper dev = ((@Nullable BrickletLCD128x64Wrapper)h.getDevice());
        if(dev == null) {
            return result;
        }

        BrickletLCD128x64.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> brickletLCD128x64GetIdentity(@Nullable ThingActions actions) throws TinkerforgeException {
        return invokeMethodOf(actions).brickletLCD128x64GetIdentity();
    }
}
