Home/Support/Support Forum/xbee wifi module no way to control sockets?

xbee wifi module no way to control sockets?

0 votes
I am trying to replace my Arduino wifi shield with digi's xbee wifi modules. I am working through my code to use the xbee wifi module.

So far I have found no way to initiate a connection to a remote server other than just sending data to serial port in transparent mode, or use one of the two API send headers. Also I found no way to check the status of the socket created by such methods above. That layer of details seems to be all handled inside the firmware.

What I wanted to do is to have functions that parallel arduino wifi library, such as client.connect(server_address,port) to report success and failure in the connection, BEFORE I send anything out. Then I also want a method to test the status of socket with client.connected() so I can decide whether to wait for more response characters or consider response is complete.

With arduino library, I can start a connection, test it has started, send in my HTTP header with connection-type:close, send the request, and wait on response and test client.connected() to return false and stop waiting around. With xbee wifi, the only safe way I find to not miss any characters is to set a long TCP timeout and just wait for that long before considering I received a complete response. Maybe it works on bench top not in the field.

I can understand all the xbee module cross compatibility issues here that forced xbee wifi to have such simple mode of operation but not being able to initiate connection and test socket status is a serious problem.
asked Aug 22, 2014 in RF Solutions and XBee by liudr New to the Community (41 points)

Please log in or register to answer this question.

1 Answer

0 votes
 
Best answer
I think thee is a little bit of some confusion. The XBee WIFI module was designed for applications where a serial device such as a Sensor, PLC Etc. may want to send data to the Cloud or to a PC or Server via a WIFI connection that otherwise would have used an RS232 or RS485 connection to do so. Typically these types of devices don't have the ability to issue commands as you are describing. All they can do is send or receive data. That is exactly the type of applications the XBee WIFI was designed for. The functions you are referring to are what you would find in a devices or application that was written for a WIFI connection and as such, would offer though types of functions.
answered Aug 22, 2014 by mvut Veteran of the Digi Community (11,450 points)
selected Aug 22, 2014 by liudr
Thank you mvut. Your answer was to the point! A serial connection replacement. I re-read the xbee-wifi manual entirely (almost) last night and found this that might be useful:

TCP Connection Indicator
In transparent mode, only one TCP connection is allowed and DIO12 (aka CD) can be configured to indicate whether or not that TCP socket is connected. This is enabled by configuring P2 to 6. When so configured, DIO12 will output a low signal when the TCP socket is connected and it will output a high signal when the TCP socket is disconnected. Obviously, the signal will stay high when operating in UDP mode because there will never be a TCP connection.

So I wonder if I read DIO12 to see if the connection is broken. On xbee modules, does reading on a digital pin return its current value or status of pull-up or pull-down resistor?
You don't read the line. The line is an output so you connect an Input to that line and see if the line is either high or low.
Thanks. I'll do some more research of reading an output line. Some microcontroller outputs behave in such a way that reading an output pin returns the output register value. I can connect another line to it and read as well. I've not read in details all the digital lines on the xbee wifi. Which pins are generic I/O? Like pin 11, which is the only pin not marked as having other functions such as uart or spi?
At a risk, I am going to suggest reading over the first 10 pages of the manual as all of the lines are well documented in the manual.  Keep in mind that there are commands for each of the pins and it is dependent upon  the setting of the corresponding pin on what that line does.
Thank. Will do it tonight. I glanced at the command sets. There might be alternative SPI pins cause I saw two set of SPI pins. I'll read more.
...