• September 29, 2023, 04:53:59 PM

Login with username, password and session length

Author Topic: getting there...  (Read 5206 times)


  • Jr. Member
  • **
  • Posts: 11
getting there...
« on: April 17, 2007, 02: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


  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5922
  • Yes Pinky, Do-more will control the world!
Re: getting there...
« Reply #1 on: April 17, 2007, 10: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.  :)
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO


  • Jr. Member
  • **
  • Posts: 11
Re: getting there...
« Reply #2 on: April 18, 2007, 12:39:50 PM »
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