Group 3_ESE519 / Mbed 2 deprecated lab5-gateway

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mfrede
Date:
Tue Nov 10 21:13:21 2015 +0000
Parent:
1:9de46f7e559e
Child:
3:646a628b8656
Commit message:
add packet

Changed in this revision

gateway.cpp Show annotated file Show diff for this revision Revisions of this file
packet.h Show annotated file Show diff for this revision Revisions of this file
--- a/gateway.cpp	Tue Nov 10 20:42:23 2015 +0000
+++ b/gateway.cpp	Tue Nov 10 21:13:21 2015 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "MRF24J40.h"
 #include <string>
+#include "packet.h"
 
 
 // RF tranceiver to link with handheld.
@@ -70,6 +71,7 @@
 }
 
 int main() {
+    mrf.SetChannel(15);
     int nodes = 6;
     char buffer[128];
     while(1) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/packet.h	Tue Nov 10 21:13:21 2015 +0000
@@ -0,0 +1,30 @@
+#ifndef LAB5PACKET
+#define LAB5PACKET
+
+
+class packet
+{
+    #define HELLO_TYPE 1
+    #define ROUTE_REQ_TYPE 2
+    #define ROUTE_ACK_TYPE 3
+    #define DATA_TYPE 4
+    public:
+    packet(unsigned short from, unsigned short to, unsigned short TYPE, float data1, float data2) {
+        TTL = 4;
+        from = from;
+        to = to;
+        TYPE = TYPE;
+        data1 = data1;
+        data2 = data2;
+    };
+    
+    unsigned short from;
+    unsigned short to;
+    unsigned short TTL;
+    unsigned short TYPE;
+    float data1;
+    float data2;
+    
+};
+
+#endif
\ No newline at end of file