Commit 67924e18 authored by Locatelli's avatar Locatelli
Browse files

Add token stuff in ploty2

parent 45cdc9f3
* Add token stuff in ploty2
4.0.27 06/07/2020
------
* Change updateImageData message for ploty version 1: give all the path of the image
......
......@@ -61,7 +61,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem-messages</artifactId>
<version>0.0.11</version>
<version>0.0.12</version>
</dependency>
<dependency>
<groupId>fr.ill.ics</groupId>
......
......@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Set;
import fr.ill.ics.bridge.command.CommandZoneWrapper;
import fr.ill.ics.bridge.events.TokenEvent.RemoteControlServerState;
import fr.ill.ics.cameo.Application;
import fr.ill.ics.cameo.Application.Info;
import fr.ill.ics.cameo.ConnectionTimeout;
......@@ -35,6 +36,7 @@ import fr.ill.ics.cameo.Server;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.nscclient.sessionmanagement.SessionManager;
import fr.ill.ics.ploty.DataPlotMessages;
import fr.ill.ics.ploty.DataPlotMessages.ClientInfo;
import fr.ill.ics.ploty.DataPlotMessages.Message;
import fr.ill.ics.ploty.DataPlotMessages.PlotPropertyDataMessage;
import fr.ill.ics.util.ConfigManager;
......@@ -175,11 +177,24 @@ public class PlotyInstance {
System.out.println("Unsubscribed from the spy plot change");
}
public void restorePlots() {
public void restorePlots( RemoteControlServerState remoteaccess, boolean tokenfree, boolean tokenownebyme) {
Message messageFirst = DataPlotMessages.Message.newBuilder().
setType(DataPlotMessages.Message.Type.RestorePlots).
build();
plotRequester.send(messageFirst.toByteArray());
int remotecontrolstate = 0;
if (remoteaccess == RemoteControlServerState.DISABLED) {
remotecontrolstate = 1;
} else if (remoteaccess == RemoteControlServerState.ENABLED) {
remotecontrolstate = 2;
}
ClientInfo messageSecond = DataPlotMessages.ClientInfo.newBuilder().
setClientType(ConfigManager.getInstance().getClientType()).
setClientId(SessionManager.getInstance(CommandZoneWrapper.SERVER_ID).getClientId()).
setRemoteControlState(remotecontrolstate).
setTokenfree(tokenfree).
setTokenownbyme(tokenownebyme).
build();
plotRequester.sendTwoParts(messageFirst.toByteArray(), messageSecond.toByteArray());
}
public void closePlots() {
......@@ -205,8 +220,14 @@ public class PlotyInstance {
List<String> roiY0_parentPropName, List<String> roiX1_parentPropName, List<String> roiY1_parentPropName,
List<String> roiSum_parentPropName, String roiSelectedPlot_prop_name, String roiSelectedRoi_prop_name,
String roiSelectedX0_prop_name, String roiSelectedY0_prop_name, String roiSelectedX1_prop_name, String roiSelectedY1_prop_name,
String roiCommandAdd_prop_name, String roiCommandRaz_prop_name, String countActivated_prop_name) {
String roiCommandAdd_prop_name, String roiCommandRaz_prop_name, String countActivated_prop_name, RemoteControlServerState remoteaccess, boolean tokenfree, boolean tokenownebyme) {
int remotecontrolstate = 0;
if (remoteaccess == RemoteControlServerState.DISABLED) {
remotecontrolstate = 1;
} else if (remoteaccess == RemoteControlServerState.ENABLED) {
remotecontrolstate = 2;
}
if (initOk == false) return;
String title_prop_name = "";
......@@ -227,6 +248,14 @@ public class PlotyInstance {
setType(DataPlotMessages.Message.Type.PlotPropertyData).
build();
ClientInfo clientinfo = DataPlotMessages.ClientInfo.newBuilder().
setClientType(ConfigManager.getInstance().getClientType()).
setClientId(SessionManager.getInstance(CommandZoneWrapper.SERVER_ID).getClientId()).
setRemoteControlState(remotecontrolstate).
setTokenfree(tokenfree).
setTokenownbyme(tokenownebyme).
build();
PlotPropertyDataMessage messageSecond = DataPlotMessages.PlotPropertyDataMessage.newBuilder().
setControllerName(controllerName).
setPlotkey(plotkey).
......@@ -281,6 +310,7 @@ public class PlotyInstance {
setCommandRoiAddPropName(roiCommandAdd_prop_name).
setCommandRoiRazPropName(roiCommandRaz_prop_name).
setCountActivatedPropName(countActivated_prop_name).
setClientinfo(clientinfo).
build();
plotRequester.sendTwoParts(messageFirst.toByteArray(), messageSecond.toByteArray());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment