Page 1 of 1

RocNet Protocol

Posted: 10.11.2015, 21:44
by DavidH
I am using an Arduino as a UDP server to send/receive UDP packets to RocNet on a RaspberryPi.

There is no other hardware connected to the Pi

I get the following packet from Pi:

In decimal bytes
The ip address is that of the pi

Received packet of size 15
From 192.168.1.64, port 59536
Contents:
0:0:0:-1:-1:3:40:7:1:70:30:75:-128:1:64:

I cant decode this against the published Rocket Protocol - is this part of a 'initialising' handshake? If so how does the server respond?

If not ????

Thank-you for reading

DavidH

Re: RocNet Protocol

Posted: 11.11.2015, 10:44
by SmileyVie
Hello David,

it looks like you use signed char variables. If you use unsigned char then the values should be in the expected range.
Range for signed char is -128 to 128 (if bit 7 is set then it's a negative number)
Range for unsigned char is 0 to 255.

With respecting this then the message you posted is:
Header:
Network: 0
Recipient idH: 0
Recipient idL: 0
Sender idH: 255
Sender idL: 255
Group: 3 = Stationary Decoders
Action: 40 = binary 0010 1000 = Type (Bit 5 and 6) 2 Reply and Code (Bit 0 to 4) = 8 = identify
Datalen: 7
Data:
Class: 1
manuID: 70
versionH: 30
versionL: 75
nr I/O: 255
subIPH: 1
subIPL: 64

Regards
Walter

Re: RocNet Protocol

Posted: 11.11.2015, 12:55
by DavidH
Hello Walter,

Thank-you for your reply,

So, my understanding, is that RocNetNode is broadcasting a reply to an (assumed) request to Identify itself.

I cannot find definitions in the Protocol for (amongst many other data elements):
Class:1 (is this the Group code for a Command Station?)
manuID: 70
nrI/O:255

How does the server respond - or can it simply start sending commands/requests to the RocNetNode?

regards,

David

Re: RocNet Protocol

Posted: 11.11.2015, 14:53
by SmileyVie
Hello David,

The Class specifies the options available on the RocNetNode. see: http://wiki.rocrail.net/doku.php?id=roc ... p-en#class
The Mapping between the numbers of the Protocol and the meaning I don't know.
But if I understand well this message should be sended from the RocNetNode to the Rocrail Server to tell the Server "Hello I'm here - and this is my Address". But there I'm not shure.....
To see something about the communication you can use an UDP sniffer to see what is send between Rocrail and RocNetNode.

Should your Arduino act like a Server or a Node?

Regards
Walter

Re: RocNet Protocol

Posted: 11.11.2015, 18:49
by DavidH
Hello Walter,

As the Arduino is intended to replace the RocRail Server - I assume it will be a Server.

Your reference to rocnetnode-setup made me realise that I can use Rocview to setup/look at the Pi.

Also this set up dialog should automatically pop up when a new node is detected - this does not happen - the Arduino can see the Pi, Rocview cannot! I just moved the connection from Arduino to the Mac (some sort of firewall?)

But this leads me ask when the Pi (and its nodes) are initialised - is it when roc view detects the pi - or are the setting stored in the Pi and used when the rocnetnode is started?

I do apologise if this thread is going out of control

Thank-you for your help!

Re: RocNet Protocol

Posted: 11.11.2015, 23:28
by SmileyVie
Hello David,

the firewall have to be configured that on the given UDP port a communication of the devices is possible.
The setting are stored on the RocNetNode. In the Doku it's well described.
Look on the page I send you the link in my previous post. If you scroll down you see "Backup Configuration". There you see where it is stored on the RPI.
I would suggest you to read the whole Doku for the RocNetNode also the parts that seems not 100% related to your project. Because it gives you a good overview of the implemented things and the functions. With that knowledge it should be easy to implement the protocol. If you read only the RocNet Protocol doku it's too few to understand the whole function.

Regards
Walter