From: Kelvin P. <k.p...@st...> - 2001-10-20 23:49:43
|
Dieter, I'm still working through things but here are some of the initial comments about how some of the code may need to be modified. Overall however I really like the look of things. Cheers, Kelvin --- IO Package --- The Modbus TCP Transport is not as fully robust as it might possibly be. The only thing you can really assume about a packet is that you can read 6 bytes to give the complete header. If that fails you close the socket. You are not able to assume that you will receive a unit ID or a function code, which I do not believe should be part of the transport. The transport should have the responsibility for framing and deframing a packet and should not be concerned with it's contents in any way. I will modify this to behave like my original package which has all these protections and checks. I'm also of the opinion that the interaction between the transport classes and the message classes should be done in terms of byte arrays. (We should also user the System.arrayCopy function where required as it is implemented locally in a fast manner). Where the rest of the application desires streams based communications this should be done through the use ByteArray streams. This would be done as it means that *only* the frame data needs to be transferred to the messaging classes, leaving all the other rubbish to do with the differences between the transport in the transport objects. (Things like frame delimnating breaks in the RTU modes and CR LF and : breaks in the ASCII would stuff things up and the whole situation would not work for ASCII as the data is not binary encoded.) I'll have a go a modifying these classes and we'll see what you think. --- Process Image Package --- I also like the way you have made all the registers etc.. interfaces as this can provide a means by which an event/listener interface as I has proposed can be avoided completely. If you want to trigger on certain types of changes to a register values then you implement the register yourself so that so write the set command and get put whatever trigger code in there that you desire. |