multihop protocol

Dependencies:   mbed

Committer:
mfrede
Date:
Tue Nov 10 21:12:58 2015 +0000
Revision:
2:9365aaf34637
Child:
4:024e613151a5
add packet file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mfrede 2:9365aaf34637 1 #ifndef LAB5PACKET
mfrede 2:9365aaf34637 2 #define LAB5PACKET
mfrede 2:9365aaf34637 3
mfrede 2:9365aaf34637 4
mfrede 2:9365aaf34637 5 class packet
mfrede 2:9365aaf34637 6 {
mfrede 2:9365aaf34637 7 #define HELLO_TYPE 1
mfrede 2:9365aaf34637 8 #define ROUTE_REQ_TYPE 2
mfrede 2:9365aaf34637 9 #define ROUTE_ACK_TYPE 3
mfrede 2:9365aaf34637 10 #define DATA_TYPE 4
mfrede 2:9365aaf34637 11 public:
mfrede 2:9365aaf34637 12 packet(unsigned short from, unsigned short to, unsigned short TYPE, float data1, float data2) {
mfrede 2:9365aaf34637 13 TTL = 4;
mfrede 2:9365aaf34637 14 from = from;
mfrede 2:9365aaf34637 15 to = to;
mfrede 2:9365aaf34637 16 TYPE = TYPE;
mfrede 2:9365aaf34637 17 data1 = data1;
mfrede 2:9365aaf34637 18 data2 = data2;
mfrede 2:9365aaf34637 19 };
mfrede 2:9365aaf34637 20
mfrede 2:9365aaf34637 21 unsigned short from;
mfrede 2:9365aaf34637 22 unsigned short to;
mfrede 2:9365aaf34637 23 unsigned short TTL;
mfrede 2:9365aaf34637 24 unsigned short TYPE;
mfrede 2:9365aaf34637 25 float data1;
mfrede 2:9365aaf34637 26 float data2;
mfrede 2:9365aaf34637 27
mfrede 2:9365aaf34637 28 };
mfrede 2:9365aaf34637 29
mfrede 2:9365aaf34637 30 #endif