1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
/***************************************************************************
*
* Project: OpenCPN
*
***************************************************************************
* Copyright (C) 2013 by David S. Register *
* *
* 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 2 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. *
**************************************************************************/
#ifndef __DSPORTTYPE_H__
#include <dsPortType.h>
#endif
#ifndef __CONNECTIONPARAMS_H__
#define __CONNECTIONPARAMS_H__
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif //precompiled headers
class ConnectionParams;
class options;
typedef enum
{
SERIAL = 0,
NETWORK = 1,
INTERNAL_GPS = 2,
INTERNAL_BT = 3
} ConnectionType;
typedef enum
{
TCP = 0,
UDP = 1,
GPSD = 2,
SIGNALK = 3,
PROTO_UNDEFINED = 4
} NetworkProtocol;
typedef enum
{
WHITELIST = 0,
BLACKLIST = 1
} ListType;
typedef enum
{
FILTER_INPUT = 0,
FILTER_OUTPUT = 1
} FilterDirection;
typedef enum
{
PROTO_NMEA0183 = 0,
PROTO_SEATALK = 1,
PROTO_NMEA2000 = 2
} DataProtocol;
#define CONN_ENABLE_ID 47621
class ConnectionParamsPanel: public wxPanel
{
public:
ConnectionParamsPanel( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size,
ConnectionParams *p_itemConnectionParams, options *pContainer );
~ConnectionParamsPanel();
void OnSelected( wxMouseEvent &event );
void SetSelected( bool selected );
void OnPaint( wxPaintEvent &event );
void OnEraseBackground( wxEraseEvent &event );
void CreateControls( void );
void OnEnableCBClick(wxCommandEvent &event);
void Update( ConnectionParams *ConnectionParams);
bool GetSelected(){ return m_bSelected; }
int GetUnselectedHeight(){ return m_unselectedHeight; }
ConnectionParams *m_pConnectionParams;
private:
options *m_pContainer;
bool m_bSelected;
wxStaticText *m_pName;
wxColour m_boxColour;
int m_unselectedHeight;
wxCheckBox *m_cbEnable;
wxStaticText *t2;
wxStaticText *t4;
wxStaticText *t6;
wxStaticText *t12;
wxStaticText *t14;
wxStaticText *t16;
wxStaticText *t18;
wxStaticText *t21;
DECLARE_EVENT_TABLE()
};
class ConnectionParams
{
public:
ConnectionParams();
~ConnectionParams();
ConnectionParams(const wxString &configStr);
ConnectionType Type;
NetworkProtocol NetProtocol;
wxString NetworkAddress;
int NetworkPort;
wxString LastNetworkAddress;
int LastNetworkPort;
NetworkProtocol LastNetProtocol;
DataProtocol Protocol;
wxString Port;
int Baudrate;
bool ChecksumCheck;
bool Garmin;
bool GarminUpload;
bool FurunoGP3X;
bool AutoSKDiscover;
dsPortType IOSelect;
ListType InputSentenceListType;
wxArrayString InputSentenceList;
ListType OutputSentenceListType;
wxArrayString OutputSentenceList;
int Priority;
bool bEnabled;
wxString UserComment;
wxString Serialize() const;
void Deserialize(const wxString &configStr);
wxString GetSourceTypeStr() const;
wxString GetAddressStr() const;
wxString GetParametersStr() const;
wxString GetIOTypeValueStr() const;
wxString GetFiltersStr() const;
wxString GetDSPort() const;
wxString GetLastDSPort() const;
wxString GetPortStr() const { return Port; }
void SetPortStr( wxString str ){ Port = str; }
bool Valid;
bool b_IsSetup;
ConnectionParamsPanel *m_optionsPanel;
private:
wxString FilterTypeToStr(ListType type, FilterDirection dir) const;
};
WX_DEFINE_ARRAY(ConnectionParams *, wxArrayOfConnPrm);
#endif
|