Skip to content

Commit

Permalink
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
Browse files Browse the repository at this point in the history
… into inmoov2-heart
  • Loading branch information
supertick committed Feb 29, 2024
2 parents df72ce3 + b06a0b7 commit 1e1143d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
13 changes: 11 additions & 2 deletions src/main/java/org/myrobotlab/framework/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,11 @@ synchronized public void startPeers(String[] peerKeys) {
}

for (String peerKey: peerKeys) {
startPeer(peerKey);
try {
startPeer(peerKey);
} catch(Exception e) {
error(e);
}
}
}

Expand Down Expand Up @@ -2043,7 +2047,12 @@ synchronized public void releasePeers(String[] peerKeys) {
}

for (String peerKey: peerKeys) {
releasePeer(peerKey);
try {
releasePeer(peerKey);
} catch(Exception e) {
error(e);
}

}
}

Expand Down
35 changes: 21 additions & 14 deletions src/main/java/org/myrobotlab/service/WebGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
* services are already APIs - perhaps a data API - same as service without the
* message wrapper
*/
public class WebGui extends Service<WebGuiConfig> implements AuthorizationProvider, Gateway, Handler, ServiceLifeCycleListener {
public class WebGui extends Service<WebGuiConfig>
implements AuthorizationProvider, Gateway, Handler, ServiceLifeCycleListener {

public static class LiveVideoStreamHandler implements Handler {

Expand Down Expand Up @@ -126,7 +127,7 @@ public Panel(String name, int x, int y, int z) {
* needed to get the api key to select the appropriate api processor
*
* @param uri
* u
* u
* @return api key
*
*/
Expand Down Expand Up @@ -269,9 +270,9 @@ public boolean getAutoStartBrowser() {
* String broadcast to specific client
*
* @param uuid
* u
* u
* @param str
* s
* s
*
*/
public void broadcast(String uuid, String str) {
Expand Down Expand Up @@ -313,7 +314,9 @@ public Config.Builder getNettosphereConfig() {
// cert.privateKey()).build();

SelfSignedCertificate selfSignedCertificate = new SelfSignedCertificate();
SslContext context = SslContextBuilder.forServer(selfSignedCertificate.certificate(), selfSignedCertificate.privateKey()).sslProvider(SslProvider.JDK)
SslContext context = SslContextBuilder
.forServer(selfSignedCertificate.certificate(), selfSignedCertificate.privateKey())
.sslProvider(SslProvider.JDK)
.clientAuth(ClientAuth.NONE).build();

configBuilder.sslContext(context);
Expand Down Expand Up @@ -492,7 +495,8 @@ public void handle(AtmosphereResource r) {
} else if ((bodyData != null) && log.isDebugEnabled()) {
logData = bodyData;
}
log.debug("-->{} {} {} - [{}] from connection {}", (newPersistentConnection) ? "new" : "", request.getMethod(), request.getRequestURI(), logData, uuid);
log.debug("-->{} {} {} - [{}] from connection {}", (newPersistentConnection) ? "new" : "", request.getMethod(),
request.getRequestURI(), logData, uuid);
}

// important persistent connections will have associated routes ...
Expand Down Expand Up @@ -570,7 +574,8 @@ public void handle(AtmosphereResource r) {
}

if (msg.containsHop(getId())) {
log.error("{} dumping duplicate hop msg to avoid cyclical from {} --to--> {}.{}", getName(), msg.sender, msg.name, msg.method);
log.error("{} dumping duplicate hop msg to avoid cyclical from {} --to--> {}.{}", getName(), msg.sender,
msg.name, msg.method);
return;
}

Expand All @@ -592,7 +597,9 @@ public void handle(AtmosphereResource r) {
serviceName = msg.getFullName();
Class<?> clazz = Runtime.getClass(serviceName);
if (clazz == null) {
log.error("cannot derive local type from service {}", serviceName);
// can occur if target service is no longer running
log.warn("cannot derive local type from service {}", serviceName);
return;
}

// do not decode unless needed
Expand Down Expand Up @@ -914,7 +921,7 @@ public void run() {
* remotely control UI
*
* @param panel
* - the panel which has been moved or resized
* - the panel which has been moved or resized
*/
public void savePanel(Panel panel) {
if (panel.name == null) {
Expand Down Expand Up @@ -1101,7 +1108,7 @@ public void releaseService() {
* Default (false) is to use the CDN
*
* @param useLocalResources
* - true uses local resources fals uses cdn
* - true uses local resources fals uses cdn
*/
public void useLocalResources(boolean useLocalResources) {
this.useLocalResources = useLocalResources;
Expand Down Expand Up @@ -1177,9 +1184,8 @@ public static void main(String[] args) {

try {

// Runtime.main(new String[] { "--log-level", "warn", "-s", "log", "Log",
// "webgui", "WebGui", "intro", "Intro", "python", "Python" });
Runtime.main(new String[] { "-c", "worky" });
Runtime.main(new String[] { "--log-level", "info", "-s", "log", "Log", "webgui", "WebGui", "intro", "Intro",
"python", "Python" });
// Runtime.main(new String[] { "--install" });

boolean done = true;
Expand Down Expand Up @@ -1244,7 +1250,8 @@ public static void main(String[] args) {
arduino.connect("/dev/ttyACM0");

for (int i = 0; i < 1000; ++i) {
webgui.display("https://i.kinja-img.com/gawker-media/image/upload/c_scale,f_auto,fl_progressive,q_80,w_800/pytutcxcrfjvuhz2jipa.jpg");
webgui.display(
"https://i.kinja-img.com/gawker-media/image/upload/c_scale,f_auto,fl_progressive,q_80,w_800/pytutcxcrfjvuhz2jipa.jpg");
}

// Runtime.setLogLevel("ERROR");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,9 @@ public void startRecording() {
@Override
public void stopListening() {
log.debug("stopListening()");

config.listening = false;
if (config != null) {
config.listening = false;
}
broadcastState();
}

Expand Down

0 comments on commit 1e1143d

Please sign in to comment.