diff --git a/src/main/java/org/myrobotlab/framework/Outbox.java b/src/main/java/org/myrobotlab/framework/Outbox.java index 01921add9f..fba799613a 100644 --- a/src/main/java/org/myrobotlab/framework/Outbox.java +++ b/src/main/java/org/myrobotlab/framework/Outbox.java @@ -358,7 +358,7 @@ public void reset() { /** * Safe detach for single subscriber * - * @param name + * @param service * the name of the listener to detach * */ diff --git a/src/main/java/org/myrobotlab/image/Util.java b/src/main/java/org/myrobotlab/image/Util.java index ff79c78387..2af64df713 100644 --- a/src/main/java/org/myrobotlab/image/Util.java +++ b/src/main/java/org/myrobotlab/image/Util.java @@ -609,11 +609,7 @@ public static FloatPointer arrayListToFloatPointer(ArrayList confidences) * for display inline in html. * * @param bytes - * input bytes - * @return a string - * @throws IOException - * boom - * + * @return */ public static String bytesToBase64Jpg(byte[] bytes) { // diff --git a/src/main/java/org/myrobotlab/math/MapperSimple.java b/src/main/java/org/myrobotlab/math/MapperSimple.java index 3d5ff80960..a25d983c08 100644 --- a/src/main/java/org/myrobotlab/math/MapperSimple.java +++ b/src/main/java/org/myrobotlab/math/MapperSimple.java @@ -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 diff --git a/src/main/java/org/myrobotlab/net/Mail.java b/src/main/java/org/myrobotlab/net/Mail.java index 74be1a3955..fa1384fe2a 100644 --- a/src/main/java/org/myrobotlab/net/Mail.java +++ b/src/main/java/org/myrobotlab/net/Mail.java @@ -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 diff --git a/src/main/java/org/myrobotlab/net/SslUtil.java b/src/main/java/org/myrobotlab/net/SslUtil.java index d0c3cf6bd2..368fe77c49 100644 --- a/src/main/java/org/myrobotlab/net/SslUtil.java +++ b/src/main/java/org/myrobotlab/net/SslUtil.java @@ -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 { diff --git a/src/main/java/org/myrobotlab/programab/PredicateEvent.java b/src/main/java/org/myrobotlab/programab/PredicateEvent.java index bf256fa143..ef4a36d8ef 100644 --- a/src/main/java/org/myrobotlab/programab/PredicateEvent.java +++ b/src/main/java/org/myrobotlab/programab/PredicateEvent.java @@ -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; /** diff --git a/src/main/java/org/myrobotlab/service/Adafruit16CServoDriver.java b/src/main/java/org/myrobotlab/service/Adafruit16CServoDriver.java index e47e8dce3e..cf804f607c 100644 --- a/src/main/java/org/myrobotlab/service/Adafruit16CServoDriver.java +++ b/src/main/java/org/myrobotlab/service/Adafruit16CServoDriver.java @@ -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!"); + } } /** diff --git a/src/main/java/org/myrobotlab/service/ImageDisplay.java b/src/main/java/org/myrobotlab/service/ImageDisplay.java index d115227158..d921e2f270 100644 --- a/src/main/java/org/myrobotlab/service/ImageDisplay.java +++ b/src/main/java/org/myrobotlab/service/ImageDisplay.java @@ -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; } } diff --git a/src/main/java/org/myrobotlab/service/Intro.java b/src/main/java/org/myrobotlab/service/Intro.java index ad64524e3c..012a6882a8 100644 --- a/src/main/java/org/myrobotlab/service/Intro.java +++ b/src/main/java/org/myrobotlab/service/Intro.java @@ -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 { @@ -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 @@ -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"); diff --git a/src/main/java/org/myrobotlab/service/LocalSpeech.java b/src/main/java/org/myrobotlab/service/LocalSpeech.java index 292198f3f6..3d2194c896 100644 --- a/src/main/java/org/myrobotlab/service/LocalSpeech.java +++ b/src/main/java/org/myrobotlab/service/LocalSpeech.java @@ -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; diff --git a/src/main/java/org/myrobotlab/service/Log.java b/src/main/java/org/myrobotlab/service/Log.java index bdef4384cb..b550cbf651 100644 --- a/src/main/java/org/myrobotlab/service/Log.java +++ b/src/main/java/org/myrobotlab/service/Log.java @@ -105,6 +105,8 @@ public String toString() { */ long minIntervalMs = 1000; + private String previousLogLevel; + public Log(String n, String id) { super(n, id); getLogLevel(); @@ -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); } @@ -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) { diff --git a/src/main/java/org/myrobotlab/service/NeoPixel.java b/src/main/java/org/myrobotlab/service/NeoPixel.java index 61c15e1f64..21a05cbdc5 100644 --- a/src/main/java/org/myrobotlab/service/NeoPixel.java +++ b/src/main/java/org/myrobotlab/service/NeoPixel.java @@ -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 diff --git a/src/main/java/org/myrobotlab/service/NovelAI.java b/src/main/java/org/myrobotlab/service/NovelAI.java index e7581d980a..6ebddb9038 100644 --- a/src/main/java/org/myrobotlab/service/NovelAI.java +++ b/src/main/java/org/myrobotlab/service/NovelAI.java @@ -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. - * - *
-  @Override
-  public ServiceConfig apply(ServiceConfig c) {
-    super.apply(c)
-    return c;
-  }
-  
-  @Override
-  public ServiceConfig getConfig() {
-    super.getConfig()
-    return config;
-  }
-   * 
- **/ - public static void main(String[] args) { try { diff --git a/src/main/java/org/myrobotlab/service/Pir.java b/src/main/java/org/myrobotlab/service/Pir.java index eea710f585..5cb6a80a95 100644 --- a/src/main/java/org/myrobotlab/service/Pir.java +++ b/src/main/java/org/myrobotlab/service/Pir.java @@ -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 getPinList(String pinArrayControl) { diff --git a/src/main/java/org/myrobotlab/service/Py4j.java b/src/main/java/org/myrobotlab/service/Py4j.java index 909270e77c..e9cd8c4259 100644 --- a/src/main/java/org/myrobotlab/service/Py4j.java +++ b/src/main/java/org/myrobotlab/service/Py4j.java @@ -566,7 +566,6 @@ public void stopService() { * * @param scriptName * @param code - * @return */ public void updateScript(String scriptName, String code) { if (openedScripts.containsKey(scriptName)) { diff --git a/src/main/java/org/myrobotlab/service/Python.java b/src/main/java/org/myrobotlab/service/Python.java index e8c2fee02e..b1c1ed5d9c 100644 --- a/src/main/java/org/myrobotlab/service/Python.java +++ b/src/main/java/org/myrobotlab/service/Python.java @@ -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 */ @@ -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)) { diff --git a/src/main/java/org/myrobotlab/service/RasPi.java b/src/main/java/org/myrobotlab/service/RasPi.java index ea6e33444f..7ce96ce599 100644 --- a/src/main/java/org/myrobotlab/service/RasPi.java +++ b/src/main/java/org/myrobotlab/service/RasPi.java @@ -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 diff --git a/src/main/java/org/myrobotlab/service/Runtime.java b/src/main/java/org/myrobotlab/service/Runtime.java index 5a86472a6b..6e3778a9fb 100644 --- a/src/main/java/org/myrobotlab/service/Runtime.java +++ b/src/main/java/org/myrobotlab/service/Runtime.java @@ -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); diff --git a/src/main/java/org/myrobotlab/service/ServoMixer.java b/src/main/java/org/myrobotlab/service/ServoMixer.java index dc6c3f7127..40628d9d86 100755 --- a/src/main/java/org/myrobotlab/service/ServoMixer.java +++ b/src/main/java/org/myrobotlab/service/ServoMixer.java @@ -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 { diff --git a/src/main/java/org/myrobotlab/service/Vertx.java b/src/main/java/org/myrobotlab/service/Vertx.java index 09cd1132ad..bcd7f38637 100644 --- a/src/main/java/org/myrobotlab/service/Vertx.java +++ b/src/main/java/org/myrobotlab/service/Vertx.java @@ -22,12 +22,16 @@ /** * Vertx gateway - used to support a http and websocket gateway for myrobotlab. - * Write business logic in Verticles. Also, try not to write any logic besides initialization inside start() method. + * Write business logic in Verticles. Also, try not to write any logic besides + * initialization inside start() method. * - * It currently does not utilize the Vertx event bus - which is pretty much the most important part of Vertx. - * TODO: take advantage of publishing on the event bus + * It currently does not utilize the Vertx event bus - which is pretty much the + * most important part of Vertx. TODO: take advantage of publishing on the event + * bus * - * @see https://medium.com/@pvub/https-medium-com-pvub-vert-x-workers-6a8df9b2b9ee + * {@link vertx + * worker} * * @author GroG * @@ -45,7 +49,8 @@ public Vertx(String n, String id) { } /** - * deploys a http and websocket verticle on a secure TLS channel with self signed certificate + * deploys a http and websocket verticle on a secure TLS channel with self + * signed certificate */ public void start() { log.info("starting driver"); @@ -73,13 +78,13 @@ public void start() { vertx.deployVerticle(new ApiVerticle(this)); } - + @Override public void startService() { super.startService(); start(); } - + @Override public void stopService() { super.stopService(); @@ -111,16 +116,16 @@ public static void main(String[] args) { Vertx vertx = (Vertx) Runtime.start("vertx", "Vertx"); vertx.start(); - InMoov2 i01 = (InMoov2)Runtime.start("i01", "InMoov2"); - // i01.startSimulator(); - JMonkeyEngine jme = (JMonkeyEngine)i01.startPeer("simulator"); -// Runtime.start("python", "Python"); -// - WebGui webgui = (WebGui) Runtime.create("webgui", "WebGui"); - // webgui.setSsl(true); - webgui.autoStartBrowser(false); - webgui.setPort(8888); - webgui.startService(); + InMoov2 i01 = (InMoov2) Runtime.start("i01", "InMoov2"); + // i01.startSimulator(); + JMonkeyEngine jme = (JMonkeyEngine) i01.startPeer("simulator"); + // Runtime.start("python", "Python"); + // + WebGui webgui = (WebGui) Runtime.create("webgui", "WebGui"); + // webgui.setSsl(true); + webgui.autoStartBrowser(false); + webgui.setPort(8888); + webgui.startService(); } catch (Exception e) { log.error("main threw", e); @@ -128,36 +133,47 @@ public static void main(String[] args) { } // FIXME - refactor for bare minimum - - @Override /* FIXME "Gateway" is server/service oriented not connecting thing - remove this */ + + @Override /* + * FIXME "Gateway" is server/service oriented not connecting thing - + * remove this + */ public void connect(String uri) throws URISyntaxException { // TODO Auto-generated method stub } - - @Override /* FIXME not much point of these - as they are all consistently using Runtime's centralized connection info */ + + @Override /* + * FIXME not much point of these - as they are all consistently + * using Runtime's centralized connection info + */ public List getClientIds() { return Runtime.getInstance().getConnectionUuids(getName()); } - @Override /* FIXME not much point of these - as they are all consistently using Runtime's centralized connection info */ + @Override /* + * FIXME not much point of these - as they are all consistently + * using Runtime's centralized connection info + */ public Map getClients() { return Runtime.getInstance().getConnections(getName()); } - - @Override /* FIXME this is the one and probably "only" relevant method for Gateway - perhaps a handle(Connection c) */ + @Override /* + * FIXME this is the one and probably "only" relevant method for + * Gateway - perhaps a handle(Connection c) + */ public void sendRemote(Message msg) throws Exception { log.info("sendRemote {}", msg.toString()); // FIXME MUST BE DIRECT THREAD FROM BROADCAST NOT OUTBOX !!! msg.addHop(getId()); Map clients = getClients(); - for(Connection c: clients.values()) { + for (Connection c : clients.values()) { try { - ServerWebSocket socket = (ServerWebSocket)c.get("websocket"); - String json = CodecUtils.toJsonMsg(msg); - socket.writeTextMessage(json); - } catch(Exception e) { + ServerWebSocket socket = (ServerWebSocket) c.get("websocket"); + String json = CodecUtils.toJsonMsg(msg); + socket.writeTextMessage(json); + } catch (Exception e) { error(e); } } @@ -166,8 +182,9 @@ public void sendRemote(Message msg) throws Exception { @Override public boolean isLocal(Message msg) { - return Runtime.getInstance().isLocal(msg); } - + return Runtime.getInstance().isLocal(msg); + } + public io.vertx.core.Vertx getVertx() { return vertx; } diff --git a/src/main/java/org/myrobotlab/service/WebGui.java b/src/main/java/org/myrobotlab/service/WebGui.java index d007befe6e..5c38492c3f 100644 --- a/src/main/java/org/myrobotlab/service/WebGui.java +++ b/src/main/java/org/myrobotlab/service/WebGui.java @@ -1072,7 +1072,7 @@ public void startService() { public void stop() { if (nettosphere != null) { - log.warn("==== nettosphere STOPPING ===="); + log.info("==== nettosphere STOPPING ===="); // done so a thread "from" webgui can stop itself :P // Must not be called from a I/O-Thread to prevent deadlocks! new Thread() { @@ -1081,7 +1081,7 @@ public void run() { nettosphere.framework().removeAllAtmosphereHandler(); nettosphere.stop(); nettosphere = null; - log.warn("==== nettosphere STOPPED ===="); + log.info("==== nettosphere STOPPED ===="); } }.start(); } @@ -1177,15 +1177,16 @@ public static void main(String[] args) { try { - // Platform.setVirtual(true); - - Runtime.startConfig("dev"); + Runtime.main(new String[] { "--log-level", "info", "-s", "webgui", "WebGui", "intro", "Intro", "python", "Python" }); boolean done = true; if (done) { return; } - + + // Platform.setVirtual(true); + // Runtime.main(new String[] { "--log-level", "info", "-s", "webgui", "WebGui", "intro", "Intro", "python", "Python", "-c", "dev" }); + // Runtime.startConfig("dev"); // Runtime.start("python", "Python"); // Arduino arduino = (Arduino)Runtime.start("arduino", "Arduino"); @@ -1196,6 +1197,8 @@ public static void main(String[] args) { // webgui.setSsl(true); webgui.startService(); + + Runtime.start("python", "Python"); // Runtime.start("intro", "Intro"); // Runtime.start("i01", "InMoov2"); diff --git a/src/main/java/org/myrobotlab/service/_TemplateService.java b/src/main/java/org/myrobotlab/service/_TemplateService.java index 61798b307e..fd9c5d5d5c 100644 --- a/src/main/java/org/myrobotlab/service/_TemplateService.java +++ b/src/main/java/org/myrobotlab/service/_TemplateService.java @@ -17,24 +17,6 @@ public _TemplateService(String n, String id) { super(n, id); } - /** - * 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. - *
-  @Override
-  public ServiceConfig apply(ServiceConfig c) {
-    super.apply(c)
-    return c;
-  }
-
-  @Override
-  public ServiceConfig getConfig() {
-    super.getConfig()
-    return config;
-  }
-  
- **/ - public static void main(String[] args) { try { diff --git a/src/main/java/org/myrobotlab/service/abstracts/AbstractServo.java b/src/main/java/org/myrobotlab/service/abstracts/AbstractServo.java index 5c57cef155..3378d5e56d 100644 --- a/src/main/java/org/myrobotlab/service/abstracts/AbstractServo.java +++ b/src/main/java/org/myrobotlab/service/abstracts/AbstractServo.java @@ -6,7 +6,6 @@ import java.util.Set; import org.myrobotlab.codec.CodecUtils; -import org.myrobotlab.framework.Config; import org.myrobotlab.framework.Registration; import org.myrobotlab.framework.Service; import org.myrobotlab.framework.interfaces.Attachable; @@ -861,7 +860,6 @@ public void setMinMax(double minXY, double maxXY) { } @Override - @Config // default - if pin is different - output servo.setPin() public void setPin(Integer pin) { if (pin == null) { log.info("{}.setPin(null) as pin is not a valid pin value", pin); @@ -1160,7 +1158,7 @@ public C apply(C c) { if (c.synced != null) { syncedServos.clear(); - Collections.addAll(syncedServos, c.synced); + Collections.addAll(syncedServos, c.synced); } // rest = c.rest; diff --git a/src/main/java/org/myrobotlab/service/config/RasPiConfig.java b/src/main/java/org/myrobotlab/service/config/RasPiConfig.java index f10c2a1fc3..e676dc474b 100644 --- a/src/main/java/org/myrobotlab/service/config/RasPiConfig.java +++ b/src/main/java/org/myrobotlab/service/config/RasPiConfig.java @@ -8,6 +8,8 @@ public class RasPiConfig extends ServiceConfig { */ public int pollRateHz = 1; + public boolean pollOnStart = false; + // TODO - config which starts pins in a mode (read/write) and if write a value 0/1 } diff --git a/src/main/java/org/myrobotlab/service/interfaces/MotorControl.java b/src/main/java/org/myrobotlab/service/interfaces/MotorControl.java index d965d847a3..ddbae382f7 100644 --- a/src/main/java/org/myrobotlab/service/interfaces/MotorControl.java +++ b/src/main/java/org/myrobotlab/service/interfaces/MotorControl.java @@ -28,7 +28,6 @@ import org.myrobotlab.framework.interfaces.Attachable; import org.myrobotlab.logging.LoggerFactory; import org.myrobotlab.sensor.EncoderPublisher; -import org.myrobotlab.service.abstracts.AbstractMotor; import org.slf4j.Logger; public interface MotorControl extends RelativePositionControl, AnalogListener, Attachable { @@ -67,7 +66,6 @@ default void attachMotorController(MotorController controller) throws Exception * the need of typed references * * @param controller - * @throws Exception */ default void detachMotorController(MotorController controller){ if (controller == null) { @@ -81,7 +79,6 @@ default void detachMotorController(MotorController controller){ /** * Implementation of detachMotorController * @param controller - * @throws Exception */ void detachMotorController(String controller); diff --git a/src/main/java/org/myrobotlab/service/interfaces/ServoControl.java b/src/main/java/org/myrobotlab/service/interfaces/ServoControl.java index 1a38dcaaf0..1e140ce167 100644 --- a/src/main/java/org/myrobotlab/service/interfaces/ServoControl.java +++ b/src/main/java/org/myrobotlab/service/interfaces/ServoControl.java @@ -25,7 +25,6 @@ package org.myrobotlab.service.interfaces; -import org.myrobotlab.framework.Config; import org.myrobotlab.framework.interfaces.Attachable; import org.myrobotlab.framework.interfaces.StateSaver; import org.myrobotlab.math.interfaces.Mapper; @@ -55,7 +54,6 @@ public interface ServoControl extends AbsolutePositionControl, EncoderListener, /** * enable the PWM pulses/power to the servo */ - @Config void enable(); /** @@ -351,7 +349,7 @@ public interface ServoControl extends AbsolutePositionControl, EncoderListener, /** * synchronizing servos together e.g. leftEye.sync("rightEye") * - * @param servo + * @param name * name that's being synched e.g. master.synch("slave") */ void sync(String name); diff --git a/src/main/java/org/myrobotlab/service/interfaces/StateChangeListener.java b/src/main/java/org/myrobotlab/service/interfaces/StateChangeListener.java new file mode 100644 index 0000000000..9003350343 --- /dev/null +++ b/src/main/java/org/myrobotlab/service/interfaces/StateChangeListener.java @@ -0,0 +1,9 @@ +package org.myrobotlab.service.interfaces; + +import org.myrobotlab.service.FiniteStateMachine.StateChange; + +public interface StateChangeListener { + + public void onStateChange(StateChange event); + +} diff --git a/src/main/java/org/myrobotlab/service/meta/JoystickMeta.java b/src/main/java/org/myrobotlab/service/meta/JoystickMeta.java index 9a8d6107a8..ca544c8523 100644 --- a/src/main/java/org/myrobotlab/service/meta/JoystickMeta.java +++ b/src/main/java/org/myrobotlab/service/meta/JoystickMeta.java @@ -28,11 +28,6 @@ public JoystickMeta() { log.info("adding jinput native dependencies"); addDependency("jinput-natives", "jinput-natives", "2.0.7", "zip"); } - // addDependency("net.java.jinput", "jinput-platform", "2.0.7"); - // addArtifact("net.java.jinput", "natives-windows"); - // addArtifact("net.java.jinput", "natives-linux"); - // addArtifact("") - } } diff --git a/src/test/java/org/myrobotlab/service/ArduinoTest.java b/src/test/java/org/myrobotlab/service/ArduinoTest.java index 5dff17f399..7a6422d29d 100644 --- a/src/test/java/org/myrobotlab/service/ArduinoTest.java +++ b/src/test/java/org/myrobotlab/service/ArduinoTest.java @@ -20,7 +20,6 @@ import org.myrobotlab.service.data.DeviceMapping; import org.myrobotlab.service.interfaces.PinArrayListener; import org.myrobotlab.service.interfaces.PinDefinition; -import org.myrobotlab.service.interfaces.PinListener; import org.myrobotlab.service.interfaces.SerialDevice; import org.myrobotlab.test.AbstractTest; import org.slf4j.Logger; @@ -218,7 +217,7 @@ public final void pinArrayTest() { sleep(200); arduino01.reset(); // Wait for reset to complete - sleep(100); + sleep(200); assertTrue("did not get pin array data D10", catcher.containsPinArrayFromPin(arduino01.getPin(10).getPinName())); assertTrue("did not get pin array data D12", catcher.containsPinArrayFromPin(arduino01.getPin(12).getPinName())); @@ -471,8 +470,10 @@ public void testPin() throws Exception { arduino01.attachPinListener(catcher); arduino01.enablePin(pin.getAddress()); - sleep(100); + sleep(200); arduino01.disablePin(pin.getAddress()); + assertNotNull("should not be null", catcher.pinData); + assertNotNull("should not be null2", catcher.pinData.pin); assertTrue("did not receive pin data int", catcher.pinData.pin.equals(analogPin)); catcher.pinData = null; diff --git a/src/test/java/org/myrobotlab/service/ClockTest.java b/src/test/java/org/myrobotlab/service/ClockTest.java index 83de45d7fa..5a229ef89f 100644 --- a/src/test/java/org/myrobotlab/service/ClockTest.java +++ b/src/test/java/org/myrobotlab/service/ClockTest.java @@ -91,7 +91,7 @@ public void testService() throws Exception { clock.restartClock(); // wait now for the event - Service.sleep(1100); + Service.sleep(1500); assertNotNull("should have event now", gateway.getMsg("mocker", "onEpoch")); clock.restartClock(); Service.sleep(500); diff --git a/src/test/java/org/myrobotlab/service/ServiceInterfaceTest.java b/src/test/java/org/myrobotlab/service/ServiceInterfaceTest.java index 440ebeb59e..806985daa6 100644 --- a/src/test/java/org/myrobotlab/service/ServiceInterfaceTest.java +++ b/src/test/java/org/myrobotlab/service/ServiceInterfaceTest.java @@ -122,7 +122,7 @@ public final void testAllServices() throws ClassNotFoundException, IOException { blacklist.add("Solr"); blacklist.add("Proxy"); // interesting idea - but no worky blacklist.add("Sphinx"); - blacklist.add("SwingGui"); + // This one just takes so darn long. blacklist.add("Deeplearning4j"); blacklist.add("OculusDiy"); diff --git a/src/test/java/org/myrobotlab/service/ServiceSmokeTest.java b/src/test/java/org/myrobotlab/service/ServiceSmokeTest.java index 13d1529570..55089cb620 100755 --- a/src/test/java/org/myrobotlab/service/ServiceSmokeTest.java +++ b/src/test/java/org/myrobotlab/service/ServiceSmokeTest.java @@ -95,7 +95,12 @@ public void testAllServiceSerialization() { } - Runtime.releaseAll(); + // releases all service including runtime + Runtime.releaseAll(true, true); + + // starts new service + Runtime.start("clock", "Clock"); + Runtime.setAllVirtual(true); log.info("Done with tests.."); diff --git a/src/test/java/org/myrobotlab/service/UltrasonicSensorTest.java b/src/test/java/org/myrobotlab/service/UltrasonicSensorTest.java index 9dfe3b0dce..dbe063d5fa 100644 --- a/src/test/java/org/myrobotlab/service/UltrasonicSensorTest.java +++ b/src/test/java/org/myrobotlab/service/UltrasonicSensorTest.java @@ -56,7 +56,7 @@ public void testUltrasonicSensor() throws TimeoutException { // 1 hz ultra.setRate(1); ultra.startRanging(); - Message msg = gateway.waitForMsg("mocker@mockId", "onRange", 1000); + Message msg = gateway.waitForMsg("mocker@mockId", "onRange", 1500); Double r = (Double)msg.data[0]; assertNotNull(r); ultra.stopRanging();