Skip to content

Commit

Permalink
Merge pull request #1384 from MyRobotLab/javadoc-1
Browse files Browse the repository at this point in the history
javadoc and small fixes 1
  • Loading branch information
kwatters authored Dec 16, 2023
2 parents 183981d + 750a595 commit 8123f58
Show file tree
Hide file tree
Showing 33 changed files with 122 additions and 135 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/myrobotlab/framework/Outbox.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public void reset() {
/**
* Safe detach for single subscriber
*
* @param name
* @param service
* the name of the listener to detach
*
*/
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/org/myrobotlab/image/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -609,11 +609,7 @@ public static FloatPointer arrayListToFloatPointer(ArrayList<Float> confidences)
* for display inline in html.
*
* @param bytes
* input bytes
* @return a string
* @throws IOException
* boom
*
* @return
*/
public static String bytesToBase64Jpg(byte[] bytes) {
//
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/myrobotlab/math/MapperSimple.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* The original Arduino map() method this was inspired from has no such values.
* This was an attempt to "clean up" exposing the map to config. Otherwise,
* users setting config would be asking the same questions regarding the useless
* fields Inverted & Clip
* fields Inverted and Clip
*
*
* @author GroG
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/myrobotlab/net/Mail.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void setEmailServer(String host, Integer port) {
* This will work with gmail but an "app password" will need to be set up on
* the sending account.
*
* "Create & use App Passwords"
* "Create and use App Passwords"
* https://support.google.com/mail/answer/185833?hl=en
*
* @param host
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/org/myrobotlab/net/SslUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,14 @@ public class SslUtil {
* Returns a SSLSocketFactory if provided with a x509 cert, and key file. The
* caCrtFile is the certificate authority root and inpassword is the protected
* password of the cert "if suppied". If unprotected leave null or empty "".
* @param sslCaFilePath - ca root
* @param sslCertFilePath - certificate file (pem)
* @param sslKeyFilePath - private key
* @param sslPassword - password if key/cert are protected by a password
*
* @param caCrtFile
* - ca root
* @param crtFile
* - certificate file (pem)
* @param keyFile
* - private key
* @param inpassword
* - password if key/cert are protected by a password
* @return the ssl socket factory
* @throws Exception
* boom
*
*/

public static SSLSocketFactory getSocketFactory(String sslCaFilePath, String sslCertFilePath, String sslKeyFilePath, String sslPassword) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/myrobotlab/programab/PredicateEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
public class PredicateEvent {
/**
* unique identifier for the session user & bot
* unique identifier for the session user and bot
*/
public String id;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,11 @@ public void setPWM(String pinLabel, Integer pulseWidthOn, Integer pulseWidthOff)
byte[] buffer = { (byte) (PCA9685_LED0_ON_L + (pin * 4)), (byte) (pulseWidthOn & 0xff), (byte) (pulseWidthOn >> 8), (byte) (pulseWidthOff & 0xff),
(byte) (pulseWidthOff >> 8) };
log.debug("Writing pin {}, pulesWidthOn {}, pulseWidthOff {}", pin, pulseWidthOn, pulseWidthOff);
controller.i2cWrite(this, Integer.parseInt(deviceBus), Integer.decode(deviceAddress), buffer, buffer.length);
if (controller != null) {
controller.i2cWrite(this, Integer.parseInt(deviceBus), Integer.decode(deviceAddress), buffer, buffer.length);
} else {
error("controller not set!");
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/myrobotlab/service/ImageDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ public void run() {
public void startService() {
super.startService();
if (GraphicsEnvironment.isHeadless()) {
log.warn("in headless mode - %s will not display images", getName());
log.info("in headless mode - {} will not display images", getName());
return;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/myrobotlab/service/Intro.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public Object get(String key) {

/**
* @param introScriptName
* execute an Intro resource script
* execute an Intro resource script
*/
public void execScript(String introScriptName) {
try {
Expand All @@ -78,7 +78,7 @@ public void execScript(String introScriptName) {
* This method will load a python file into the python interpreter.
*
* @param file
* the python file to load
* the python file to load
* @return true/false
*/
@Deprecated
Expand Down Expand Up @@ -127,7 +127,6 @@ public static void main(String[] args) {
// Runtime.start("intro", "Intro");

// Runtime.release("python");
// Runtime.releaseAll();
Runtime.start("python", "Python");
// Runtime.start("mega", "Arduino");
// Runtime.start("ada", "Adafruit16CServoDriver");
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/myrobotlab/service/LocalSpeech.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,8 @@ public boolean setPico2Wav() {
* Typically double quotes should be filtered out of the command as creating
* the text to speech process command can be broken by double quotes
*
* @param filter
* chars to filter.
*
* @param target
* @param replace
*/
public void addFilter(String target, String replace) {
LocalSpeechConfig c = (LocalSpeechConfig) config;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/myrobotlab/service/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public String toString() {
*/
long minIntervalMs = 1000;

private String previousLogLevel;

public Log(String n, String id) {
super(n, id);
getLogLevel();
Expand Down Expand Up @@ -265,6 +267,7 @@ public void setRootLogLevel(String level) {

public LogConfig apply(LogConfig c) {
super.apply(c);
previousLogLevel = getLogLevel();
if (c.level != null) {
setRootLogLevel(c.level);
}
Expand Down Expand Up @@ -317,6 +320,9 @@ public void stopLogging() {
public void stopService() {
super.stopService();
stopLogging();
if (previousLogLevel != null) {
Runtime.setLogLevel(previousLogLevel);
}
}

public static void main(String[] args) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/myrobotlab/service/NeoPixel.java
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,6 @@ public void setPixel(int address, int red, int green, int blue, int white) {
* @param green
* @param blue
* @param white
* @param delayMs
*/
public void setPixel(String matrixName, Integer pixelSetIndex, int address, int red, int green, int blue, int white) {
// get and update memory cache
Expand Down
20 changes: 0 additions & 20 deletions src/main/java/org/myrobotlab/service/NovelAI.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,6 @@ public NovelAI(String n, String id) {
client = new OkHttpClient();
}

/**
* The methods apply and getConfig can be used, if more complex configuration
* handling is needed. By default, the framework takes care of most of it,
* including subscription handling.
*
* <pre>
&#64;Override
public ServiceConfig apply(ServiceConfig c) {
super.apply(c)
return c;
}
@Override
public ServiceConfig getConfig() {
super.getConfig()
return config;
}
* </pre>
**/

public static void main(String[] args) {
try {

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/myrobotlab/service/Pir.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@ public Long getLastChangeTs() {
* "selecting" the controller's name, returns the possible list of pins to
* attach.
*
* @param pinArrayControl
* @return
* @throws InterruptedException
* @throws TimeoutException
*/
@SuppressWarnings("unchecked")
public List<PinDefinition> getPinList(String pinArrayControl) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/myrobotlab/service/Py4j.java
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ public void stopService() {
*
* @param scriptName
* @param code
* @return
*/
public void updateScript(String scriptName, String code) {
if (openedScripts.containsKey(scriptName)) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/myrobotlab/service/Python.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public void closeScript(String file) {
/**
* append more Python to the current script
*
* @param data
* @param code
* the code to append
* @return the resulting concatenation
*/
Expand Down Expand Up @@ -759,7 +759,6 @@ public void saveScript(String scriptName, String code) throws IOException {
* upserts a script in memory
* @param file
* @param code
* @return
*/
public void updateScript(String file, String code) {
if (openedScripts.containsKey(file)) {
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/org/myrobotlab/service/RasPi.java
Original file line number Diff line number Diff line change
Expand Up @@ -709,14 +709,19 @@ public void startService() {

log.info("Initiating i2c");
I2CFactory.getInstance(Integer.parseInt(bus));
log.info("i2c initiated on bus {}", bus);
addTask(1000, "scan");

log.info("read task initialized");
addTask(1000, "read");
if (config.pollOnStart) {
log.info("i2c initiated on bus {}", bus);
addTask(1000, "scan");

log.info("read task initialized");
addTask(1000, "read");
}

} catch (IOException e) {
log.error("i2c initiation failed", e);
} catch (UnsupportedOperationException er) {
log.warn("invalid operation initializing i2c - is platform not raspberry pi?");
} catch (Exception e) {
// an error in the constructor won't get broadcast - so we need Runtime to
// do it
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/myrobotlab/service/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -2579,7 +2579,6 @@ public void addRoute(String remoteId, String uuid, int metric) {
*
* @param configName
* The name of the config file
* @return The Runtime singleton
*/
static public void startConfig(String configName) {
setConfig(configName);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/myrobotlab/service/ServoMixer.java
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,8 @@ public void rest() {
*
* @param filename
* the filename to save the gesture as
* @param json
* the json to save
* @param gesture
* the gesture to save
*/
public void saveGesture(String filename, Gesture gesture) {
try {
Expand Down
Loading

0 comments on commit 8123f58

Please sign in to comment.