routeur done

Dependencies:   mbed

Fork of APP4 by S5info_H14

Files at this revision

API Documentation at this revision

Comitter:
joGenie
Date:
Mon Feb 24 14:08:10 2014 +0000
Parent:
0:71df0feee697
Child:
3:350f07072089
Commit message:
Add file;

Changed in this revision

coordianteur.cpp Show annotated file Show diff for this revision Revisions of this file
coordinateur.hpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
readfile.cpp Show annotated file Show diff for this revision Revisions of this file
routeur.cpp Show annotated file Show diff for this revision Revisions of this file
routeur.hpp Show annotated file Show diff for this revision Revisions of this file
trame.cpp Show annotated file Show diff for this revision Revisions of this file
trame.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/coordianteur.cpp	Sun Feb 23 23:32:09 2014 +0000
+++ b/coordianteur.cpp	Mon Feb 24 14:08:10 2014 +0000
@@ -1,5 +1,6 @@
 #include "coordinateur.hpp"
 
-Coordinateur::Coordinateur()
+Coordinateur::Coordinateur(PinName _tx, PinName _rx) :
+    trame(_tx, _rx)
 {
-}
\ No newline at end of file
+}
--- a/coordinateur.hpp	Sun Feb 23 23:32:09 2014 +0000
+++ b/coordinateur.hpp	Mon Feb 24 14:08:10 2014 +0000
@@ -2,6 +2,7 @@
 #define COORDINATEUR_HPP
 
 #include <string>
+#include "trame.hpp"
 
 using namespace std;
 
@@ -9,9 +10,10 @@
 {
 public:
     // Constructeur
-    Coordinateur();
+    Coordinateur(PinName _tx, PinName _rx);
     
 private:
+    Trame trame;
     string pan;
 };
 
--- a/main.cpp	Sun Feb 23 23:32:09 2014 +0000
+++ b/main.cpp	Mon Feb 24 14:08:10 2014 +0000
@@ -1,11 +1,12 @@
 #include "mbed.h"
 #include "readfile.hpp"
 
+DigitalOut reset(p8);
+Serial pc(USBTX, USBRX);
+Serial DATA(p13, p14);
 LocalFileSystem local("local");
 
 int main()
 {
-    
-    
-    return 0;
+    while(true);
 }
--- a/readfile.cpp	Sun Feb 23 23:32:09 2014 +0000
+++ b/readfile.cpp	Mon Feb 24 14:08:10 2014 +0000
@@ -15,4 +15,18 @@
         
         myfile.close(); 
     }    
+}
+
+void ReadFile::setConfigRouteur(Routeur *rout, const string filename)
+{
+    string line;
+    ifstream myfile(filename.c_str());
+    if (myfile.is_open())
+    {
+        while (getline(myfile,line))
+        {
+        }
+        
+        myfile.close(); 
+    } 
 }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/routeur.cpp	Mon Feb 24 14:08:10 2014 +0000
@@ -0,0 +1,6 @@
+#include "routeur.hpp"
+
+Routeur::Routeur(PinName _tx, PinName _rx) :
+    trame(_tx, _rx)
+{
+}
\ No newline at end of file
--- a/routeur.hpp	Sun Feb 23 23:32:09 2014 +0000
+++ b/routeur.hpp	Mon Feb 24 14:08:10 2014 +0000
@@ -2,6 +2,7 @@
 #define ROUTEUR_HPP
 
 #include <string>
+#include "trame.hpp"
 
 using namespace std;
 
@@ -9,9 +10,10 @@
 {
 public:
     // Constructeur
-    Routeur();
+    Routeur(PinName _tx, PinName _rx);
     
 private:
+    Trame trame;
 };
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trame.cpp	Mon Feb 24 14:08:10 2014 +0000
@@ -0,0 +1,13 @@
+#include "trame.hpp"
+
+Trame::Trame(PinName _tx, PinName _rx) :
+    tx(_tx),
+    rx(_rx)
+{
+}
+
+void Trame::sendATCommand(const char* command, int data)
+{
+    Serial xbee(tx, rx);
+    xbee.putc(0x10);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trame.hpp	Mon Feb 24 14:08:10 2014 +0000
@@ -0,0 +1,21 @@
+#ifndef TRAME_HPP
+#define TRAME_HPP
+
+#include "mbed.h"
+
+using namespace std;
+
+class Trame
+{
+public:
+    // Constructeur
+    Trame(PinName _tx, PinName _rx);
+    
+    void sendATCommand(const char* command, int data = 0);
+    
+    unsigned int checksum();
+private:
+    PinName tx, rx;
+};
+
+#endif
\ No newline at end of file