Skip to content

Commit 7088916

Browse files
author
jantje
committed
#1394 more refactor renames and added comments
1 parent ee1a245 commit 7088916

File tree

5 files changed

+44
-13
lines changed

5 files changed

+44
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,40 @@
11
package io.sloeber.core.api;
22

3+
/*
4+
* this interface allows none gui core classes to control the gui driven serial communication
5+
*
6+
* You should not use this class directly but use the static methods in SerialManager
7+
* as the serial monitor registers on the serialManager and as sutch allowing for gui
8+
* actions from the core
9+
*
10+
*
11+
*/
312
public interface ISerialUser {
4-
public boolean PauzePort(String PortName);
513

6-
public void ResumePort(String PortName);
14+
/**
15+
* Pause the serial monitor
16+
* This is used for uploads before the upload is started.
17+
* After the pause a resumePort call is expected
18+
*
19+
* @param PortName
20+
* @return true if the pause was executed correctly
21+
*/
22+
public boolean pausePort(String PortName);
723

24+
/**
25+
* Resume the serial monitor
26+
* This is used for uploads after the upload is done.
27+
* A pausePort should have been called before calling this method
28+
*
29+
* @param PortName
30+
*/
31+
public void resumePort(String PortName);
32+
33+
/**
34+
* Remove the serial connection from the serial monitor
35+
*
36+
* @param mComPort
37+
* @return
38+
*/
839
public boolean stopPort(String mComPort);
940
}

io.sloeber.core/src/io/sloeber/core/api/SerialManager.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public static void UnRegisterSerialUser() {
3636
otherSerialUser = null;
3737
}
3838

39-
public static boolean pauzeSerialMonitor(String mComPort) {
39+
public static boolean pauseSerialMonitor(String mComPort) {
4040
if (otherSerialUser != null) {
41-
return otherSerialUser.PauzePort(mComPort);
41+
return otherSerialUser.pausePort(mComPort);
4242
}
4343
return false;
4444
}
@@ -52,7 +52,7 @@ public static boolean stopSerialMonitor(String mComPort) {
5252

5353
public static void resumeSerialMonitor(String mComPort) {
5454
if (otherSerialUser != null) {
55-
otherSerialUser.ResumePort(mComPort);
55+
otherSerialUser.resumePort(mComPort);
5656
}
5757

5858
}

io.sloeber.core/src/io/sloeber/core/toolchain/SloeberBuildRunner.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public boolean invokeBuild(int kind, IProject project, IConfiguration configurat
5454
}
5555
}
5656

57-
boolean theComPortIsPauzed = false;
57+
boolean theComPortIsPaused = false;
5858
if (!actualUploadPort.isBlank()) {
5959
try {
60-
theComPortIsPauzed = SerialManager.pauzeSerialMonitor(actualUploadPort);
60+
theComPortIsPaused = SerialManager.pauseSerialMonitor(actualUploadPort);
6161
} catch (Exception e) {
6262
Status ret = new Status(IStatus.WARNING, Const.CORE_PLUGIN_ID, Messages.Upload_Error_com_port, e);
6363
Common.log(ret);
@@ -93,7 +93,7 @@ protected IStatus run(IProgressMonitor _monitor) {
9393
boolean ret = super.invokeBuild(kind, project, configuration, builder, console, markerGenerator, projectBuilder,
9494
monitor);
9595

96-
if (theComPortIsPauzed) {
96+
if (theComPortIsPaused) {
9797
try {
9898
SerialManager.resumeSerialMonitor(actualUploadPort);
9999
} catch (Exception e) {

io.sloeber.core/src/io/sloeber/core/tools/uploaders/UploadSketchWrapper.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public UploadJobWrapper(String name, SloeberProject project, ICConfigurationDesc
134134
@Override
135135
protected IStatus run(IProgressMonitor monitor) {
136136
IStatus ret = Status.OK_STATUS;
137-
boolean theComPortIsPauzed = false;
137+
boolean theComPortIsPaused = false;
138138

139139
String projectName = myProject.getName();
140140
BoardDescription boardDescriptor = mySProject.getBoardDescription(myConfDes.getName(), true);
@@ -168,7 +168,7 @@ public void run() {
168168
highLevelStream.println(message);
169169
monitor.beginTask(message, 2);
170170
try {
171-
theComPortIsPauzed = SerialManager.pauzeSerialMonitor(myProvidedUploadPort);
171+
theComPortIsPaused = SerialManager.pauseSerialMonitor(myProvidedUploadPort);
172172
} catch (Exception e) {
173173
ret = new Status(IStatus.WARNING, CORE_PLUGIN_ID, Upload_Error_com_port, e);
174174
log(ret);
@@ -185,7 +185,7 @@ public void run() {
185185
log(new Status(IStatus.ERROR, CORE_PLUGIN_ID, error, e));
186186
} finally {
187187
try {
188-
if (theComPortIsPauzed) {
188+
if (theComPortIsPaused) {
189189
// wait for the port to reappear
190190
boolean portFound = false;
191191
int counter = 0;

io.sloeber.ui/src/io/sloeber/ui/monitor/views/SerialMonitor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ public void ComboSerialChanged() {
673673
* done ResumePort will be called
674674
*/
675675
@Override
676-
public boolean PauzePort(String portName) {
676+
public boolean pausePort(String portName) {
677677
Serial theSerial = GetSerial(portName);
678678
if (theSerial != null) {
679679
theSerial.disconnect();
@@ -686,7 +686,7 @@ public boolean PauzePort(String portName) {
686686
* see PauzePort
687687
*/
688688
@Override
689-
public void ResumePort(String portName) {
689+
public void resumePort(String portName) {
690690
Serial theSerial = GetSerial(portName);
691691
if (theSerial != null) {
692692
if (MyPreferences.getCleanSerialMonitorAfterUpload()) {

0 commit comments

Comments
 (0)