/*
 * Copyright (c) 2019 - 2026 AB Circle Limited. All rights reserved
 */

package com.abc.bluetoothdemo;

import android.content.Context;
import android.widget.ArrayAdapter;

import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;

import java.util.List;

import javax.smartcardio.CardTerminal;

class TerminalAdapter extends ArrayAdapter<String>
{

    private List<CardTerminal> mTerminals;

    public TerminalAdapter(@NonNull Context context, @LayoutRes int resource)
    {
        super(context, resource);
    }

    public void updateTerminals(List<CardTerminal> mTerminals)
    {
        clear();
        this.mTerminals = mTerminals;
        for (CardTerminal terminal : mTerminals)
        {
            add(terminal.getName());
        }
    }

    public CardTerminal getTerminal(int index)
    {
        return mTerminals.get(index);
    }

}
