@@ -58,8 +58,12 @@ public void internalUpload(IProject Project, String cConf) {
58
58
Common .log (new Status (IStatus .ERROR , Const .CORE_PLUGIN_ID , Messages .Upload_Project_nature_unaccesible , e ));
59
59
}
60
60
61
- String UpLoadTool = Common .getBuildEnvironmentVariable (Project , cConf , Const .get_ENV_KEY_TOOL (Const .ACTION_UPLOAD ), Const .EMPTY_STRING );
62
- String MComPort = Common .getBuildEnvironmentVariable (Project , cConf , Const .ENV_KEY_JANTJE_COM_PORT , Const .EMPTY_STRING );
61
+ String UpLoadTool = Common .getBuildEnvironmentVariable (Project , cConf ,
62
+ Const .get_ENV_KEY_TOOL (Const .ACTION_UPLOAD ), Const .EMPTY_STRING );
63
+ String MComPort = Common .getBuildEnvironmentVariable (Project , cConf , Const .ENV_KEY_JANTJE_COM_PORT ,
64
+ Const .EMPTY_STRING );
65
+ String uploadClass = Common .getBuildEnvironmentVariable (Project , cConf ,
66
+ Const .get_ENV_KEY_TOOL (Const .UPLOAD_CLASS ), Const .EMPTY_STRING );
63
67
this .myConsole = Helpers .findConsole (Messages .Upload_console );
64
68
this .myConsole .clearConsole ();
65
69
this .myConsole .activate ();
@@ -76,20 +80,29 @@ public void internalUpload(IProject Project, String cConf) {
76
80
String host = Helpers .getHostFromComPort (MComPort );
77
81
78
82
if (host != null ) {
79
- this .myHighLevelConsoleStream .println (Messages .Upload_ssh );
80
- PasswordManager pwdManager = new PasswordManager ();
81
- if (!pwdManager .setHost (host )) {
82
- Common .log (new Status (IStatus .ERROR , Const .CORE_PLUGIN_ID , Messages .Upload_login_credentials_missing + host ));
83
- }
83
+ if (Const .UPLOAD_CLASS_DEFAULT .equals (uploadClass )) {
84
+ this .myHighLevelConsoleStream .println (Messages .Upload_arduino );
85
+ realUploader = new arduinoUploader (Project , cConf , UpLoadTool , this .myConsole );
86
+ uploadJobName = UpLoadTool ;
87
+ } else {
88
+ this .myHighLevelConsoleStream .println (Messages .Upload_ssh );
89
+ PasswordManager pwdManager = new PasswordManager ();
90
+ if (!pwdManager .setHost (host )) {
91
+ Common .log (new Status (IStatus .ERROR , Const .CORE_PLUGIN_ID ,
92
+ Messages .Upload_login_credentials_missing + host ));
93
+ }
84
94
85
- String password = pwdManager .getPassword ();
86
- String login = pwdManager .getLogin ();
95
+ String password = pwdManager .getPassword ();
96
+ String login = pwdManager .getLogin ();
87
97
88
- realUploader = new SSHUpload (this .myHighLevelConsoleStream , this .myOutconsoleStream , this .myErrconsoleStream , password , host , login );
89
- uploadJobName = Const .UPLOAD_SSH ;
98
+ realUploader = new SSHUpload (this .myHighLevelConsoleStream , this .myOutconsoleStream ,
99
+ this .myErrconsoleStream , password , host , login );
100
+ uploadJobName = Const .UPLOAD_SSH ;
101
+ }
90
102
} else if (UpLoadTool .equalsIgnoreCase (Const .UPLOAD_TOOL_TEENSY )) {
91
103
this .myHighLevelConsoleStream .println (Messages .Upload_generic );
92
- realUploader = new GenericLocalUploader (UpLoadTool , Project , cConf , this .myConsole , this .myErrconsoleStream , this .myOutconsoleStream );
104
+ realUploader = new GenericLocalUploader (UpLoadTool , Project , cConf , this .myConsole , this .myErrconsoleStream ,
105
+ this .myOutconsoleStream );
93
106
uploadJobName = UpLoadTool ;
94
107
} else {
95
108
this .myHighLevelConsoleStream .println (Messages .Upload_arduino );
@@ -108,9 +121,10 @@ public void internalUpload(IProject Project, String cConf) {
108
121
protected IStatus run (IProgressMonitor monitor ) {
109
122
try {
110
123
String uploadflag = "FuStatus" ; //$NON-NLS-1$
111
- char [] uri = { 'h' , 't' , 't' , 'p' , ':' , '/' , '/' , 'b' , 'a' , 'e' , 'y' , 'e' , 'n' , 's' , '.' , 'i' , 't' , '/' , 'e' , 'c' , 'l' , 'i' , 'p' ,
112
- 's' , 'e' , '/' , 'd' , 'o' , 'w' , 'n' , 'l' , 'o' , 'a' , 'd' , '/' , 'u' , 'p' , 'l' , 'o' , 'a' , 'd' , 'S' , 't' , 'a' , 'r' , 't' , '.' ,
113
- 'h' , 't' , 'm' , 'l' , '?' , 'u' , '=' };
124
+ char [] uri = { 'h' , 't' , 't' , 'p' , ':' , '/' , '/' , 'b' , 'a' , 'e' , 'y' , 'e' , 'n' , 's' , '.' , 'i' , 't' ,
125
+ '/' , 'e' , 'c' , 'l' , 'i' , 'p' , 's' , 'e' , '/' , 'd' , 'o' , 'w' , 'n' , 'l' , 'o' , 'a' , 'd' , '/' ,
126
+ 'u' , 'p' , 'l' , 'o' , 'a' , 'd' , 'S' , 't' , 'a' , 'r' , 't' , '.' , 'h' , 't' , 'm' , 'l' , '?' , 'u' ,
127
+ '=' };
114
128
IEclipsePreferences myScope = InstanceScope .INSTANCE .getNode (Const .NODE_ARDUINO );
115
129
int curFsiStatus = myScope .getInt (uploadflag , 0 ) + 1 ;
116
130
URL pluginStartInitiator = new URL (new String (uri ) + Integer .toString (curFsiStatus ));
@@ -128,7 +142,8 @@ protected IStatus run(IProgressMonitor monitor) {
128
142
}
129
143
130
144
/**
131
- * UploadJobWrapper stops the serial port and restarts the serial port as needed. in between it calls the real uploader IUploader
145
+ * UploadJobWrapper stops the serial port and restarts the serial port as
146
+ * needed. in between it calls the real uploader IUploader
132
147
*
133
148
* @author jan
134
149
*
@@ -152,15 +167,18 @@ protected IStatus run(IProgressMonitor monitor) {
152
167
boolean WeStoppedTheComPort = false ;
153
168
String myComPort = Const .EMPTY_STRING ;
154
169
try {
155
- monitor .beginTask (Messages .Upload_uploading + " \" " + this .myProject .getName () + "\" " + this .myNAmeTag , 2 ); //$NON-NLS-1$//$NON-NLS-2$
156
- myComPort = Common .getBuildEnvironmentVariable (this .myProject , this .myCConf , Const .ENV_KEY_JANTJE_COM_PORT , "" ); //$NON-NLS-1$
170
+ monitor .beginTask (Messages .Upload_uploading + " \" " + this .myProject .getName () + "\" " + this .myNAmeTag , //$NON-NLS-1$//$NON-NLS-2$
171
+ 2 );
172
+ myComPort = Common .getBuildEnvironmentVariable (this .myProject , this .myCConf ,
173
+ Const .ENV_KEY_JANTJE_COM_PORT , "" ); //$NON-NLS-1$
157
174
158
175
try {
159
176
WeStoppedTheComPort = Common .StopSerialMonitor (myComPort );
160
177
} catch (Exception e ) {
161
178
Common .log (new Status (IStatus .WARNING , Const .CORE_PLUGIN_ID , Messages .Upload_Error_com_port , e ));
162
179
}
163
- IFile hexFile = this .myProject .getFile (new Path (this .myCConf ).append (this .myProject .getName () + ".hex" )); //$NON-NLS-1$
180
+ IFile hexFile = this .myProject
181
+ .getFile (new Path (this .myCConf ).append (this .myProject .getName () + ".hex" )); //$NON-NLS-1$
164
182
if (this .myUploader .uploadUsingPreferences (hexFile , this .myProject , false , monitor )) {
165
183
UploadSketchWrapper .this .myHighLevelConsoleStream .println (Messages .Upload_Done );
166
184
} else {
@@ -175,7 +193,8 @@ protected IStatus run(IProgressMonitor monitor) {
175
193
Common .StartSerialMonitor (myComPort );
176
194
}
177
195
} catch (Exception e ) {
178
- Common .log (new Status (IStatus .WARNING , Const .CORE_PLUGIN_ID , Messages .Upload_Error_serial_monitor_restart , e ));
196
+ Common .log (new Status (IStatus .WARNING , Const .CORE_PLUGIN_ID ,
197
+ Messages .Upload_Error_serial_monitor_restart , e ));
179
198
}
180
199
monitor .done ();
181
200
}
0 commit comments