// Path: matrixkeypad/src/main/java/com/google/android/things/contrib/driver/matrixkeypad/MatrixKeypad.java
// public interface OnKeyEventListener {
//     void onKeyEvent(MatrixKey matrixKey);
// }


import android.os.Handler;
import android.view.InputDevice;
import android.view.KeyEvent;
import com.google.android.things.contrib.driver.matrixkeypad.MatrixKeypad.OnKeyEventListener;
import com.google.android.things.pio.Gpio;
import com.google.android.things.userdriver.input.InputDriver;
import com.google.android.things.userdriver.UserDriverManager;
import com.google.android.things.userdriver.input.InputDriverEvent;
import java.io.IOException;
/*
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.android.things.contrib.driver.matrixkeypad;


/**
 * Driver class for a {@link MatrixKeypad} which registers an {@link InputDriver} to send key events
 * to the system.
 */
public class MatrixKeypadInputDriver implements AutoCloseable {
    private static final String DEVICE_NAME = "Matrix Keypad";

    private MatrixKeypad mMatrixKeypad;
    private InputDriver mInputDriver;
    private int[] mKeyCodes;
    private InputDriverEvent mInputEvent = new InputDriverEvent();
// Path: matrixkeypad/src/main/java/com/google/android/things/contrib/driver/matrixkeypad/MatrixKeypad.java
// public interface OnKeyEventListener {
//     void onKeyEvent(MatrixKey matrixKey);
// }


// Path: matrixkeypad/src/main/java/com/google/android/things/contrib/driver/matrixkeypad/MatrixKeypadInputDriver.java
import android.os.Handler;
import android.view.InputDevice;
import android.view.KeyEvent;
import com.google.android.things.contrib.driver.matrixkeypad.MatrixKeypad.OnKeyEventListener;
import com.google.android.things.pio.Gpio;
import com.google.android.things.userdriver.input.InputDriver;
import com.google.android.things.userdriver.UserDriverManager;
import com.google.android.things.userdriver.input.InputDriverEvent;
import java.io.IOException;

/*
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.android.things.contrib.driver.matrixkeypad;


/**
 * Driver class for a {@link MatrixKeypad} which registers an {@link InputDriver} to send key events
 * to the system.
 */
public class MatrixKeypadInputDriver implements AutoCloseable {
    private static final String DEVICE_NAME = "Matrix Keypad";

    private MatrixKeypad mMatrixKeypad;
    private InputDriver mInputDriver;
    private int[] mKeyCodes;
    private InputDriverEvent mInputEvent = new InputDriverEvent();
    private OnKeyEventListener mMatrixKeyCallback = new OnKeyEventListener() {