المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : What is happening is info from one child form is being received or listen to by the wrong child form.



C# Programming
07-08-2009, 12:00 AM
What is happening is info from one child form is being received or listen to by the wrong child form.

The situ is one parent form and any number of child forms. Specifically this is a truck control system, all the the truck/child forms are the same. But the monitoring and controls for each are to be independent of the other's actions. Example one truck could be in neutral with a rpm speed of 800, while another truck is in 3rd gear with rpm of 1000. So the situation has to be contained within the logical confines of the individual childform/truck.

I've tried using access modifiers to there extent. Making things 'private' as much as possible, getting rid of as much 'static' as possible.

What is first sent is the info packet. Defined as: !!!780;125;1400;0;5000&&&
The truck sends back a string of data for processing, and as confirmation of what's wanted by the operator. The string looks like this:
I5000R0780G02O099C060V23.3W2440F099L4S01400P00000X126Y057B27.08H65253E01T01D0000_99!

Within the program I'm using a ID_Parser to strip/read out the identifier at the beginning of the string to make sure it gets sent to the right form. Actually creating a instance of the truck/chilform that the info belongs to. I had to do this because sometimes the sending form would receive info string from another truck. This routine does put the port_in into the proper truck and its accompanying array:
public static string[] Trux_Info = new string[20];

The letters designate different pieces of information 'I ' designates id of the truck in this case truck5000, the 'R' is rpm, 780, followed by gear and so on.

The transmission is by RS-232, on the parent form, constantly open. Each truck sends/ reads through this, and the buffers, in and output, is flushed after each use. I've tried individual comports per childform, but had unaccessible issues.

As I have ran out of ideas and test methods I asking if anyone sees what I'm missing.

Further definitions, test methods, and results are provided as an attachment.

Is there way to attach attachments, I have them already zipped.?

Thanks