/******************************************************************************
 *
 * Project:  OpenCPN
 * Purpose:  pypilot Plugin
 * Author:   Sean D'Epagnier
 *
 ***************************************************************************
 *   Copyright (C) 2018 by Sean D'Epagnier                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,  USA.         *
 ***************************************************************************
 */

#include "pypilot_pi.h"

pypilot_SignalKClient::pypilot_SignalKClient( pypilot_pi &_pypilot_pi )
        : SignalKClient(false), m_pypilot_pi(_pypilot_pi) {}
    
void pypilot_SignalKClient::OnConnected()
{
    m_pypilot_pi.OnConnected();
}

void pypilot_SignalKClient::OnDisconnected()
{
    m_pypilot_pi.OnDisconnected();
}

void pypilot_SignalKClient::GetGains(std::list<wxString> &gains)
{
    if(m_list.IsNull())
        return;
    wxArrayString names = m_list.GetMemberNames();
    for(unsigned int i=0; i<names.Count(); i++) {
        wxString name = names[i];
        wxJSONValue value = m_list[name];
        if(value.HasMember("AutopilotGain"))
            gains.push_back(name);
    }
}
