Problem with project structure | Thales IoT Developer Community
May 21, 2015 - 3:53pm, 3343 views
I have quite big project, so I had split my content of source package to multiple packages. You can see the structure on attached image.
There is quite a lot of connections between all of this classes and all works like it should, except ModbusManager. Which works but there is something wrong with RS232 communication. So I tried creating new project, where I had just 1 thread to test ModbusManager which was again in separate package. It wouldn’t work.
So solution was that I had put ModbusManager in the same package as the thread from which I was calling it and communication between slave and master(Gemalto) worked it should. Can somebody tell me what the reason behind this is? Because all other classes works indifferent of that in which package they are located.
Regards,
Jure
Hello Jure,
Your image is not visible.
I don't know if there is a compilation problem or the application compiles and builds correctly but is not working as expected. Is there any exception thrown or the execution hangs?
This is probably some programming problem. You would have to share some code and write more details what exactly is happening. Maybe then somebody would be able to give you some hints.
Regards,
Bartłomiej
Can you see it now? It's visible for me.
There is no exception or errors, diffrence is just that slave gives no response when I have structured program, but if all files are in the same package it works ok.
Here is part of the code, whole project would be to big.
We have CommunicationManager, which on recived sms reads slave state.
1. CommunicationManager calls method inside ModBusManager:
2.updateData method is currently just one line:
3. Read temperatures also currently just have one line:
4.ReadRegisters:
Only diffrence when MIDlet is working and when is not working. That in working situation all files are together in one package. I hope that code is understandable.
EDIT:
You are right. It's probably something else, not the project structure. But I can't hunt down the problem. Some other project works fine, with the implementing modubs class, but the other one mentioned in first post, will not get any response from slave.Even though that slave registers tje call. I will try to find the problem with trying diffrent thigs, becuse it's probably hard for others to help, if they don't have experience with MODbus.
Regards
Jure
Hello Jure,
I can see the image now.
Still it's hard to say what the reason could be. If everything compiles and runs there should not be the problem with methods or variables visibility. It should work if it really is the same code and there are no exceptions thrown.
Please try to think what you had to change to make the class working after moving it to the other package. Maybe you don't initialize some object or use some other object than before. There would be no answer without code analysis.
I think that the debugging could be helpful here. Please try to add the debug printouts where it's possible in ModbusManager and serial connection or use the 'on device debugging' from NetBeans. This should answer the question what is happening - if the data is sent to the other device and if the answer is really empty or something else.
Best regards,
Bartłomiej
Hi Bartłomiej,
it has to be something with the project. Because now I created new project. Made same structure like in the picture and just copyed in the files.
I don't know what is diffrent now, but the project that I want it to work, works now :)
Best regards,
Jure
Hello,
Great that it's working!
You can compare the projects configurations - maybe you'll find something..
Best regards,
Bartłomiej