Hi Peter,

Your handshake looks correct except it is in the middle of the read loop. You only need to handshake once before receiving messages so I would handshake prior to the read loop. Having said that, you should get at last some response using your code, so something else is likely incorrect.

I would try the following:

1) Try an outputstream.flush() after outputStream.write(acknowledge). Your acknowledgement could be stuck in a socket buffer.

2) Trace process_packet in the serialForwarder to make sure that it is receiving messages from the mote. You read loop will block if there are no incoming messages.

3) Trace init_sf_source in the serialForwarder to make sure the connection is correctly negotiated.

4) Trace write_sf_packet in serialForwarder to make sure packets are going on the socket.

The handshake is pretty simple: you send 6 bytes ( 'T' , ' ', 0x1,0x0,0x0,0x0) and receive a similar byte stream back. Subsequently, each packet starts with a length byte, a sync byte (0x7e), then the message bytes. The length byte should be the length of the packet + the sync byte.

                                                          Chuck


At 10:38 AM 3/8/2006, Peter Burke wrote:
Dear Dr Kring,
        thank you for your help. I've had some more luck this afternoon &
believe I'm on the right track but I hoped I could trouble you again if you
have time. I've included a copy of my class here that's trying to access the
SF, perhaps there's something I'm missing, but the fact I'm not yet using
NIO shouldn't be a problem.

I've got to the point where I execute your code to acknowledge the SF server
and I assume I should then start to receive TOS message bytes as they are
packetized & forwarded. I've debugged the app & everything seems to be going
fine until I attempt
to read from the socket (having completed the handshake with SF) where
read() then blocks: SF indicates I'm connected but isn't forwarding anything
:

                // read another set of bytes
                numBytesReturned =
inputStream.read(packet,numBytesRead,PACKET_SIZE - numBytesRead); // blocks
indefinitely
                System.err.println("< VALUE FROM STREAM: " +
numBytesReturned + ">");

I've looked at SFProtocol.java & this doesn't really give a clear idea of
what to expect next (Ethereal will be my next shot I think to see if
anything's being relayed on the connection).

What interaction is expected between the server & client? I assume that once
the handshake is complete I am then a 'valid' client who should receive
forwarded messages. Appreciate it if you could explain the message sequence
:)



I'm suprised I've not come across your firm in the embedded networks
community previously: I'm familiar with Arched Rock & Tendril Networks from
the TinyOS Tech Exchange this year, did you attend at all? Its good to see
more firms trying to accelerate application development as I felt this is an
area that few in the WSN community have begun to address. Our programme is
very much in the concept stage at the moment but I'd appreciate it if I
could come back to you at a later stage regarding your products if I may -
do have any white papers or further information that I could read?

Once again thanks for your help.

All the best,
Peter.

Peter Burke
General Dynamics UK
Research & Development





-----Original Message-----
From: Chuck Kring [mailto:[EMAIL PROTECTED]
Sent: 08 March 2006 04:47
To: Peter Burke
Subject: Fwd: [Tinyos-help] Connecting custom apps to SerialForwarder


Peter,

This is Chuck Kring.  I responded to your question to the newsgroup.   I
like the fact that tinyos-help is non-commercial so this is going direct to
you.

I own a small consulting firm called Finishline Systems that focuses on
consulting for wireless sensor networks.    We have a Java Gateway product
that can provide SOAP and XML over HTTP bidirectional messaging feeds and
we do consulting and training on TinyOS firmware.    If you are interested,
our web site is www.finishlinesystems.com.  We might be able to save you a
lot of time on your project.

Regards,

                                                                 Chuck Kring



Chuck Kring  Ph.D.
Finishline Systems

[EMAIL PROTECTED]
www.finishlinesystems.com

307 Orchard City Drive Ste 106
Campbell, CA 95008
408.718.3886
This email and any files attached are intended for the addressee and may
contain information of a confidential nature.  If you are not the intended
recipient, be aware that this email was sent to you in error and you should
not disclose, distribute, print, copy or make other use of this email or its
attachments.  Such actions, in fact, may be unlawful.  In compliance with
the various Regulations and Acts, General Dynamics UK Limited reserves the
right to monitor (and examine for viruses) all emails and email attachments,
both inbound and outbound.  Email communications and their attachments may
not be secure or error- or virus-free and the company does not accept
liability or responsibility for such matters or the consequences thereof.
Registered Office: 100 New Bridge Street, London EC4V 6JA.  Registered in
England and Wales No: 1911653.


_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to