File: e2app.h

package info (click to toggle)
ponyprog 3.1.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,904 kB
  • sloc: cpp: 35,932; python: 981; sh: 565; xml: 67; makefile: 45; ansic: 38
file content (241 lines) | stat: -rw-r--r-- 6,202 bytes parent folder | download
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
//=========================================================================//
//                                                                         //
//  PonyProg - Serial Device Programmer                                    //
//                                                                         //
//  Copyright (C) 1997-2025   Claudio Lanconelli                           //
//                                                                         //
//  https://github.com/lancos/ponyprog                                        //
//                                                                         //
//-------------------------------------------------------------------------//
//                                                                         //
// 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 version2 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 (see LICENSE);     if not, write to the         //
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
//                                                                         //
//=========================================================================//

#ifndef e2APP_H
#define e2APP_H


#include <QApplication>
#include <QCoreApplication>

#include "Translator.h"
// #include "busio.h"

//Include Bus Classes
#include "i2cbus.h"
#include "at90sbus.h"
#include "at93cbus.h"
#include "at250bus.h"
#include "at250bus2.h"
#include "picbus.h"
#include "pic12bus.h"
//#include "sxbus.h"
#include "sdebus.h"
#include "at89sbus.h"
//#include "atmegabus.h"
//#include "avr1200bus.h"
#include "picbusnew.h"
#include "imbus.h"
#include "x2444bus.h"

//Include Interface Classes
#include "pgminter.h"
#include "ponyioint.h"
#include "easyi2c_interf.h"
#include "ispinterf.h"
#include "jdminter.h"
//#include "jdmiointer.h"
#include "dt006interf.h"
#include "linuxsysfsint.h"
#include "mpsse_interf.h"

#include "e2profil.h"

class e2AppWinInfo;

enum AppStatus
{
	AppReady,
	AppBusy
};

class e2App : public cTranslator
{
  public:

	e2App();
	virtual ~e2App();

	// Routines from vApp that are normally overridden

	//      virtual vWindow* NewAppWin(vWindow* win, char* name, int w, int h,
	//                                 vAppWinInfo* winInfo = 0);

	// replace about signal - slots
	//      virtual void AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType);

	//      virtual void KeyIn(vWindow*, vKey, unsigned int);

	// New routines for this particular app
	//      int GetCounter() const
	//      {
	//              return winCounter;
	//      }
	int TestPort(int port = -1, bool open_only = false);
	int OpenPort(int port = -1);
	void SetInitialBus(BusIO *p)
	{
		if (p)
		{
			iniBus = p;
		}
	}
	BusInterface *GetInterfPtr()
	{
		return busIntp;
	}
	BusIO **GetBusVectorPtr()
	{
		return busvetp;
	}
	void ClosePort();
	int OpenBus(BusIO *p);
	void SleepBus();


	void SetInterfaceType(HInterfaceType type = SIPROG_API);
	HInterfaceType GetInterfaceType() const
	{
		return iType;
	}

	int Calibration();

	QString GetHelpFile() const
	{
		return helpfile;
	}
	QString GetOkSound() const
	{
		return ok_soundfile;
	}
	QString GetErrSound() const
	{
		return err_soundfile;
	}

	unsigned int GetPolarity() const
	{
		return polarity_control;
	}
	void SetPolarity(unsigned int val)
	{
		polarity_control = val;
	}
	int GetPort() const
	{
		return port_number;
	}
	void SetPort(int port)
	{
		if (port >= 0)
		{
			port_number = port;
		}
	}

	int LoadDriver(int start);

	void SetAWInfo(e2AppWinInfo *awi)
	{
		Q_CHECK_PTR(awi);
		awip = awi;
	}
	e2AppWinInfo *GetAWInfo() const
	{
		return awip;
	}

	bool scriptMode;        //Script Mode
	int returnValue;        //return value in Command Line mode

  protected:
	// AppWinInfo associated with this window
	e2AppWinInfo *awip;

	QString script_name;

  private:
	void initSettings();
	void LookForBogoMips(); //should get bogomips

	// EK 2017
	// we can fork the process
	//      int winCounter;         //open windows (child) counter

	//      int abortFlag;          //True if we have to abort current op
	//      int ignoreFlag;         //True if we have to ignore probe errors (usually false)

	HInterfaceType iType;   //current interface type

	BusInterface *busIntp;  //pointer to current interface type

	unsigned int polarity_control; //polarity for control lines

	//AutoTag
	//List of available interface types
	SIProgInterface siprog_apiI;
	PonyIOInterface siprog_ioI;
	EasyI2CInterface easyi2c_apiI;
	EasyI2CInterface easyi2c_ioI;
	AvrISPInterface avrisp_apiI;
	AvrISPInterface avrisp_ioI;
	Dt006Interface dt006_apiI;
	Dt006Interface dt006_ioI;
	JdmInterface jdm_apiI;
	//      JdmIOInterface jdm_ioI;
	LinuxSysFsInterface linuxsysfs_ioI;
	MpsseInterface jtagkeyI;
	MpsseInterface ponyprog_ftI;
	MpsseInterface egglink_v3I;

	int port_number;        //port number used
	BusIO *iniBus;                           //pointer to current Bus
	BusIO *busvetp[NO_OF_BUSTYPE];  //array of pointers to available Bus
	//AutoTag
	//List of available bus types
	I2CBus iicB;
	At90sBus at90sB;
	At93cBus at93cB;
	At250Bus at250B;
	At250BigBus at250BigB;
	PicBus picB;
	Pic12Bus pic12B;
	//SxBus sxB;
	Sde2506Bus sdeB;
	At89sBus at89sB;
	//      AtMegaBus atMegaB;
	//      Avr1200Bus at1200B;
	PicBusNew picNewB;
	IMBus imB;
	X2444Bus x2444B;
	X2444Bus s2430B;

	QString helpfile;
	QString ok_soundfile;
	QString err_soundfile;
};
#endif