RocNet Protocol documentation

http://wiki.rocrail.net/doku.php?id=roc ... netnode-en

RocNet Protocol documentation

Postby Dagnall » 20.09.2016, 14:05

Rob,
Can I suggest an update for the http://wiki.rocrail.net/doku.php?id=rocnet:rocnet-prot-en ?
In
Code: Select all
18   set channel   channel#   valueH   valueL   

When I use the (excellent) "Fine Tune" tab, I am seeing a 4th data byte, with the value (0: Set offPos , 1: Set onPos)..
I'm not sure if there other settings for offsteps, on steps or options elsewhere.

Also, a note here for anyone else doing their own RocNet:
Where the documentation says (as an example..
Code: Select all
(write port event)   port#    idH   idL   port

This means in effect that you can have many more than just the 4 data bytes shown.. as you will actually get multiple ports data sent in a single message : port1, idH(port1) , idl(port1) port(port1), port2, idH(port2) , idl(port2) port(port2),
Its really obvious when you see it ! :wink:

All the best
Dagnall
Dagnall
 

Re: RocNet Protocol documentation

Postby Dagnall » 18.02.2017, 17:36

Rob,
An question about the protocol..And specifically the rocnet response to Identify.

Is there somewhere where "class" ( data1 of the "group 3, code 8" byte in the identify response) is documented. ?
I think "bit 0= accessory"" bit 1= dcc" "Bit 3=RFID", but what do the other bits represent??

I would also like to better understand the group 7 code 5 data format,
I cannot find any precise documentation for "iotype; flags; cstype; or csdevice" and It also seems to need a 5th data byte that is not shown in the documentation...?

At the moment i have built up my response message with the following code, which shows what these variables mean, based on the github info... But I am afraid I am still confused :oops: .. ..
Can you give a simple explanation of what each bit of the variables means... :)

Code: Select all
 
          sendMessage[8] = RN[15]; //    iotype      0=GPIO, 1=I2c-0, 2=I2C-1not pi
          sendMessage[9] = RN[16]; //    flags bit    0 = ack (data->sack ? 0x01:0x00) | (data->rfid ? 0x02:0x00) | (data->usepb ? 0x04:0x00) | (data->adcsensor ? 0x08:0x00);
          sendMessage[10] = RN[17]; //   cstype     :0=none, 1=dcc232, 2=sprog //(  for [9]...data->tl_info ? 0x10:0x00) | (data->tl_monitor ? 0x20:0x00) | (data->ismobile ? 0x40:0x00);
          sendMessage[11] = RN[18]; //  csdevice usb 0/1
          sendMessage[12] = RN[19];


is there somewhere where these variables are clearly defined??

Many thanks
Dagnall
Dagnall
 

Re: RocNet Protocol documentation

Postby rjversluis » 18.02.2017, 17:47

Hi Dagnall,

Code: Select all
#define RN_CLASS_IO      0x01
#define RN_CLASS_DCC     0x02
#define RN_CLASS_RFID    0x04


Those bits are saved in the class member variable:
Code: Select all
  case RN_STATIONARY_IDENTIFY:
    TraceOp.trc( name, TRCLEVEL_INFO, __LINE__, 9999, "queryids request from %d to %d", sndr, rcpt );
    msg = allocMem(128);
    msg[RN_PACKET_NETID] = data->location;
    msg[RN_PACKET_GROUP] = RN_GROUP_STATIONARY;
    rnReceipientAddresToPacket( sndr, msg, 0 );
    rnSenderAddresToPacket( data->id, msg, 0 );
    msg[RN_PACKET_ACTION] = RN_STATIONARY_IDENTIFY;
    msg[RN_PACKET_ACTION] |= (RN_ACTIONTYPE_EVENT << 5);
    msg[RN_PACKET_LEN] = 7 + StrOp.len(data->nickname);
    msg[RN_PACKET_DATA+0] = data->class;
    msg[RN_PACKET_DATA+1] = 70;
    msg[RN_PACKET_DATA+2] = revisionnr/256;
    msg[RN_PACKET_DATA+3] = revisionnr%256;
    msg[RN_PACKET_DATA+4] = 128;
    msg[RN_PACKET_DATA+5] = data->ip[data->ipsize-2];
    msg[RN_PACKET_DATA+6] = data->ip[data->ipsize-1];
    StrOp.copy((char*)&msg[RN_PACKET_DATA+7], data->nickname);
    break;

Best Regards, Rob.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 


Return to RocNetNode