I know this is a common issue and I have already read some of the posts but could not figure out the root cause for the error yet.
I have devices which get parameters from a json file and the code generate topologies for that devices. I have a list of piconets (small master-slave groups) and the problem is the code works pretty well up to 45 number of device. When I increase the number of devices I get the error below;
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at KTHBleMesh.BleMeshDevice.construct(BleMeshDevice.java:508)
at KTHBleMesh.BleMeshDevice$2.run(BleMeshDevice.java:468)
at KTHBleMesh.Event.run(l2.java:21)
at KTHBleMesh.Simulator.doAllEvents(l2.java:50)
at KTHBleMesh.IteratorEngine.main(IteratorEngine.java:85)
and where the pops up is ;
List<BleMeshDevice> neighboringDevices =this.getTxManager().getNeighbouringDevices(this);
for (BleMeshDevice neighDevice : neighboringDevices) {
if (neighDevice.devMiddleware.getTopologyCtrlBlock().getDevPiconet().get(0).getDevRole()==1)
` getDevPiconet().get(0) is giving the error and here is the class code,
public BleMeshTopologyCtrlBlock() {
devPiconet = new ArrayList<BleMeshDevicePiconet>(2);
private void AddMastertoSlave(BleMeshDevice linkMaster,
BleMeshDevice linkSlave, int devRole) {
devPiconet.add(new BleMeshDevicePiconet(devRole, linkSlave));
devPiconet.get(devPiconet.size() -1).getDevSlaves().add(linkMaster);
for (BleMeshDevGatewayTable aRow : getDevPiconet().get(0)
.getGatewaytable()) {
if (aRow.getPicRemoteMaster().equals(aNeighPiconetMaster)
&& aRow.getPicLocalGatewayDev().getDevMiddleware()
.getTopologyCtrlBlock().getCapacity() > 0
&& aRow.getPicRemoteGatewayDev().getDevMiddleware()
.getTopologyCtrlBlock().getCapacity() > 0
It looks like it fails because the DevPiconet is empty but it works for other number of devices...I do not understand why it does not working when its increased number of devices.
Please let me know if you have any clue or suggestion,
Thanks in advance,
BR