Mote Serial Message Interface

 

The mote network will produce the packets described below for the serial interface for Day 0. Each data packet contains the sensor information from a single mote that is uniquely identified by the original_mote_address. The data from all four sensors are placed in the sens_data array using run length encoding. The data from each sensor is separated by a terminator. 

 

Packet Length = 76 bytes

 

#define MAX_READINGS_IN_PACKET 35

 

Data Packets

  char addr;                                                                  // can ignore

  char type;                                                                  // type of packet

  unsigned char group;                                                // group number

  char original_mote_address;                                    // mote where packet originated from

  char send_num;                                                        // the number of times this packet has been sent

  char seq_num;                                                          // the sequence numbers

  sens_reading sens_data[MAX_READINGS_IN_PACKET];             // sensor readings

 

typedef struct{

  unsigned char reading;

  unsigned char frequency;

} sens_reading;

 

If type = 4 normal data packet

Else if type = 6 getting low on power need charging soon or will be dead

Else if type = 7 the robot is currently present and charging me

 

Data is ordered:

Photo Data

Terminator

Temperature Data

Terminator

Moisture Data

Terminator

Power Data

Terminators fill in any extra bytes

 

A terminator is equal to a reading = 0 and frequency = 0.

 

Notes:

1)       The “seq_num” is a sequence number that ranges from 0-15. All packets should be delievered in order.

2)       The “send_num” is the the amount of times the packet had to be resent