Projet Drone de surveillance du labo TRSE (INGESUP)

Dependencies:   mbed PID ADXL345 Camera_LS_Y201 ITG3200 RangeFinder mbos xbee_lib Motor Servo

Revision:
24:3462a304f9a0
Parent:
19:a05cd42f8e91
Child:
28:8b5ccd2f837e
--- a/Module_Communication/Module_Communication.cpp	Wed Apr 03 10:36:21 2013 +0000
+++ b/Module_Communication/Module_Communication.cpp	Wed Apr 03 12:16:14 2013 +0000
@@ -28,20 +28,56 @@
  C_ModuleCommunication::C_ModuleCommunication()
  {
     m_xbee = new xbee(p9, p10, p11);
+    m_trameRxBuffer = C_FrameBuffer();
+    m_trameTxBuffer = C_FrameBuffer();
+    m_charRxBuffer = new char[9];
+    m_charTxBuffer = new char[9];
  }
  
  /* DESTRUCTEUR */
  C_ModuleCommunication::~C_ModuleCommunication()
  {
- 
+    delete [] m_charRxBuffer;
+    delete [] m_charTxBuffer;
+    delete m_xbee;
  }
  
  /* Point d'entrée de la tache Module Video */
- void C_ModuleCommunication::receptionDeTrame(void)
+ void C_ModuleCommunication::moduleCommunicationTask(void)
  {
     while(1){
     // Code
     }
  }
  
- 
\ No newline at end of file
+ void C_ModuleCommunication::envoiDeTrame(void)
+ {
+    pc.scanf("%s",m_charTxBuffer); //Read data from serial console
+    m_xbee->SendData(m_charTxBuffer);
+    /*
+    frame newFrame = m_trameTxBuffer->frameBuffer();
+    m_charTxBuffer[0] = newFrame.identifier;
+    
+    for(int i = 0; i < 8; i++) {
+        m_charTxBuffer[i+1] = newFrame.data[i];
+    }
+    
+    m_xbee->SendData(m_charTxBuffer);
+    */
+ }
+ 
+ void C_ModuleCommunication::receptionDeTrame(void)
+ {
+    m_xbee->RecieveData(m_charRxBuffer, 0);
+    pc.printf("You said:%s",m_charRxBuffer);
+    /*
+    frame newFrame;
+    newFrame.identifier = m_charRxBuffer[0];
+    
+    for(int i = 0; i < 8; i++) {
+        newFrame.data[0] = m_charRxBuffer[i+1];
+    }
+    
+    m_trameRxBuffer->frameBuffer(newFrame);
+    */
+ }
\ No newline at end of file