-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi, I encountered a few problems while using v1.2.0. Since you are working on next release, Some of them may have been fixed already. If they are fixed, please ignore this issue.
-
In
CodeGenerator.java
, line 144:primaryServerGrp = device.nodesGroup;
It seems like
"interfaces"
is missing. It causes an error such as when choosing node 1 and then choosing node 0. -
In
CodeGenerator.java
, lines 226 and 229
theipConfigCode
Repeatedly generate xaddress.SetBase("NetID","NetMask")
.I think it might be a good idea to change the return value of
device.getIPConfCode()
to apair
to storefirstLine
andsecondLine
, then use a map to generate the code.Here's my code, maybe it can help you:
In
CodeGenerator.java
:LoggingHelper.LogLogic("CodeGenerator : generating ip configuration code!"); Map<String,String> ipConfigMap = new HashMap<String,String>(); for (Device device : this.dialogConnection.devices) { Pair<String,String> tmp= device.getIPConfCode(); if(ipConfigMap.get(tmp.getKey())!=null) { ipConfigMap.put(tmp.getKey(), ipConfigMap.get(tmp.getKey())+tmp.getValue()+"\n"); } else { ipConfigMap.put(tmp.getKey(), tmp.getValue()+"\n"); } } for (Device device : this.dialogConnection.devices_csma) { Pair<String,String> tmp=device.getIPConfCode(); if(ipConfigMap.get(tmp.getKey())!=null) { ipConfigMap.put(tmp.getKey(), ipConfigMap.get(tmp.getKey())+tmp.getValue()+"\n"); } else { ipConfigMap.put(tmp.getKey(), tmp.getValue()+"\n"); } }
In
Device.java
public Pair<String,String> getIPConfCode() { String firstLine = "", secondLine = ""; firstLine = "address.SetBase(\""+this.networkSettings.netId+"\",\""+this.networkSettings.netMask+"\");"; if (this.linkSettings.getLinkType() == LinkType.LINK_CSMA) { secondLine = "Ipv4InterfaceContainer csmaInterfaces"+CSMA_INDEX+" = "+"address.Assign(csmaDevices"+CSMA_INDEX+");"; } else if (this.linkSettings.getLinkType() == LinkType.LINK_WIFI) { secondLine = """ Ipv4InterfaceContainer interfacesSta_""" + this.linkSettings.getName() + """ = address.Assign(staDev_""" + this.linkSettings.getName() + """ ); Ipv4InterfaceContainer interfacesAp_""" + this.linkSettings.getName() + """ = address.Assign(apDev_""" + this.linkSettings.getName() + """ ); """; } else { secondLine = "Ipv4InterfaceContainer interfaces"+this.nodesGroup+" = "+"address.Assign(devices"+this.nodesGroup+");"; } return new Pair<>(firstLine, secondLine); }
-
In both
Dialog_ConfigureClient.java
andDialog_ConfigureServer.java
,
Node ID may get added repeatedly. I suggest clearing thecomboBox_serverIndex
before the for loop of adding items in the functionsetVisible
:for (int i=0; i<this.totalNodes; i++) { this.comboBox_clientIndex.addItem("Node "+i); }