package com.endovectors.uta.presentation.button;

import com.endovectors.uta.presentation.button.button_one.ButtonOne;
import com.endovectors.uta.presentation.button.button_three.ButtonThree;
import com.endovectors.uta.presentation.button.button_two.ButtonTwo;
import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.PinPullResistance;
import com.pi4j.io.gpio.RaspiPin;
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;
import com.pi4j.io.gpio.event.GpioPinListenerDigital;


public class Decoder {

    private ButtonOne buttonOne;
    private ButtonTwo buttonTwo;
    private ButtonThree buttonThree;

    private GpioPinDigitalInput button1;
    private GpioPinDigitalInput button2;
    private GpioPinDigitalInput button3;

    final GpioController gpio = GpioFactory.getInstance();

    public Decoder (ButtonOne buttonOne, ButtonTwo buttonTwo, ButtonThree buttonThree){
        this.buttonOne = buttonOne;
        this.buttonTwo = buttonTwo;
        this.buttonThree = buttonThree;

        button1 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_01, PinPullResistance.PULL_DOWN);
        button2 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
        button3 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_03, PinPullResistance.PULL_DOWN);


        button1.addListener(new GpioPinListenerDigital() {
            @Override
            public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
                buttonOne.doClick();
            }
        });

        button2.addListener(new GpioPinListenerDigital() {
            @Override
            public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
                buttonTwo.doClick();
            }
        });

        button3.addListener(new GpioPinListenerDigital() {
            @Override
            public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
                buttonThree.doClick();
            }
        });
    }
}

@@ -595,31 +595,29 @@
 oder %7B%0A%0A    
-private
+final
  ButtonOne b
@@ -626,31 +626,29 @@
 tonOne;%0A    
-private
+final
  ButtonTwo b
@@ -661,23 +661,22 @@
 wo;%0A    
-private
+final 
  ButtonT
@@ -694,31 +694,29 @@
 Three;%0A%0A    
-private
+final
  GpioPinDigi
@@ -733,31 +733,29 @@
 utton1;%0A    
-private
+final
  GpioPinDigi
@@ -780,15 +780,13 @@
     
-private
+final
  Gpi

fix decoder