Host Engineering Forum
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 12, 2017, 05:00:26 pm


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: getting there...  (Read 3924 times)
BretB
Jr. Member
**
Posts: 11


« on: April 17, 2007, 01:55:18 pm »

Thanks Greg,

We got pretty far with that - and with a little help from WireShark, reading what your program actually sends over to the EBC.

We managed to put the same bitstream that your program sends into a Java DatagramSocket and send it over to the EBC's IP Address and port and get a response that contains the hex values of the switch statuses, when you convert the hex values to Binary, on the 13th, 14th, 17th and 18th packets (bytes) that come back in the response from the EBC to my PC.

So for a little application, we are basically set.  It's just a matter of converting those bytes in those locations in the return message from hex to binary, reversing the sequence (because they go from switches 7 to 0, and we need them in 0 to 7 sequence) and then using them.

But here is my next question that hopefully you can assist me on.

I only bought two 16 input modules.  What if someone a few years down the road gets a 32 input module, or even an 64 input module?  What then happens to the positions of these bytes on the response?  Do they expand and take more bytes and shove all the others down in sequence?

Also, I noticed that for each set of eight switches, there is a byte that gets returned; and that each slot that contains inputs seems to have four bytes returned.  Because when I remove the second 16 input module, I get four less bytes returned than if I have the second 16 input module in there.  I assume that if I added another 16 input module to my 4 slot base, I would get another four bytes, with the two middle bytes in that set of four being the first and second set of eight bits, each containing a status of one of the rooms, just like I get now with the first two input modules.

We do have your Ethernet Interface Specification Version 3.0 of 23 Feb 07.  That was helpful, but it does not seem to answer the above questions.

Thank you for your help on this.

- Bret B
Logged
BobO
Host Moderator
*****
Posts: 3797


Yes Pinky, Do-more will control the world!


« Reply #1 on: April 17, 2007, 09:22:42 pm »

As we talked about on the phone today, just look through the EtherIO.cpp file to see an example of how to parse the data returned from HEIReadIO. If you have any other questions, we'll be here.  Smiley
Logged

"We would rather apologize to 20% for what we chose not to do, than to apologize to 100% for what we did poorly." -BobO
BretB
Jr. Member
**
Posts: 11


« Reply #2 on: April 18, 2007, 11:39:50 am »

Mr O,

Thank you very much for your help yesterday.

We were able to go in and figure it all out and read the bits and bytes of the response from the EBC we need to and these are being saved.  Now we're just working out the actual decoding of them into binary (which is where the actual useful data is) and then mapping those bits to their "switch number", which will give us what we need.

I think we've got it figured out.

For anyone else who comes across the same problem as we did, here's a short explanation of how we worked this out:

After setting the IP address, a message is sent to the EBC which then elicits a response.  This response has a byte or bytes that come back that have a "3" in the first four bits of a byte.  The remaining four bits in that byte give the number of eight inputs that are in that slot of the EBC.  If there are more than one instance (after the first ten or so bytes) of a "3" in the first half of the bit, that means there is more than one slot with inputs on the EBC.  So the loop to read the bits of that input needs to be run that many times.

We just run the loop and get all the bits exported to an array.

We are then going to get the binary values of the bytes in that array, which will give us the status of each switch in our EBCs.

Thanks again for taking the time to help me out yesterday - I certainly didn't expect that from the Pres, but I sure appreciate it.

- Bret B
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM