Index: trunk/CanGateway/driver/XLVectorCanDriver.cpp
===================================================================
--- trunk/CanGateway/driver/XLVectorCanDriver.cpp	(revision 150)
+++ trunk/CanGateway/driver/XLVectorCanDriver.cpp	(revision 1)
@@ -11,6 +11,5 @@
 #include <string>
 
-#include "Pacpus/kernel/Log.h"
-#include "../CanFrame.h"
+#include "kernel/Log.h"
 
 using namespace pacpus;
@@ -399,6 +398,6 @@
 short XLVectorCanDriver::sendFrame (struct CanFrame frame)
 {
-   
-	XLevent e;
+
+		XLevent e;
 	e.tag = XL_TRANSMIT_MSG;
 	e.tagData.msg.id = frame.id;
@@ -406,5 +405,5 @@
 	e.tagData.msg.dlc = frame.dlc;
 	memcpy(e.tagData.msg.data, frame.data, frame.dlc);
-	
+
 	unsigned int count = 1;
 	LOG_DEBUG(xlGetEventString(&e));
@@ -412,5 +411,64 @@
 		xlCanTransmit(this->port, this->accessMask, &count, &e));
 
-	
+	/*
+  Vstatus vErr;
+  Vevent event;
+  Vevent * pEvent = NULL;
+
+  // Create frame to send 
+  event.tag                 = V_TRANSMIT_MSG;
+  event.tagData.msg.id      = frame.id;
+  event.tagData.msg.flags   = 0;
+  event.tagData.msg.dlc     = frame.dlc;
+
+  for (int i = 0; i < frame.dlc; i++)
+    event.tagData.msg.data[i] = frame.data[i];
+
+  // Send the frame 
+  vErr = ncdTransmit (gPortHandle, gChannelMask, &event);
+
+  //printf("sendFrame ncdTransmit  --  vErr=%d, event=0x%x\n", vErr, event); 
+
+  if (vErr==VERR_QUEUE_IS_FULL)
+  {
+    printf("!");
+  }
+
+  else if (vErr)
+  {
+    printf ("ERROR:(send frame) %s!\n", ncdGetErrorString (vErr));		
+    //		ncdDeactivateChannel (gPortHandle, gChannelMask);
+    //		cleanUpPort ();
+    return vErr;
+  }
+
+  return VSUCCESS;
+
+  // Wait the acknowledgement frame 
+  waitReceivingFrame(); 
+
+  // Read the acknowledgement frame in the buffer 
+  vErr = ncdReceive1 (gPortHandle,&pEvent);
+  //printf("sendFrame ncdReceive1  --  vErr=%d, pEvent=0x%x\n", vErr, pEvent); 
+
+  if ( (pEvent==NULL) && (vErr==VERR_QUEUE_IS_EMPTY) )
+  {
+    printf ("%s\n",ncdGetErrorString (vErr));
+    printf ("%s!\n",ncdGetErrorString (vErr));
+    //		ncdDeactivateChannel (gPortHandle, gChannelMask);
+    //		cleanUpPort ();
+    return vErr;
+  }
+
+  // If frame is well acknoledged 
+  if (pEvent->tagData.msg.flags & 0x40)  
+    return VSUCCESS;
+  else
+  {
+   //printf("%x ",pEvent->tagData.msg.flags);
+   //printf (" no acknolegement of frame!\n");
+   
+    return VERROR;
+  }*/
 
 	return 1;
@@ -438,5 +496,13 @@
 
 	int queueSize;
-
+	//bool found = false;
+	//DWORD begin = timeGetTime();
+	//while ( !found ) {
+		/*DWORD now = timeGetTime();
+		/DEBUG("begin: %ld, now: %ld", begin, now);
+		if ( now - begin >= timeout ) {
+			return NULL;
+		}
+*/
 		traceXLCommand("xlGetReceiveQueueLevel",
 			xlGetReceiveQueueLevel(this->port, &queueSize));
@@ -459,5 +525,48 @@
 			return 1;
 		}
-	
+	//}
+
+	//return new CanMessage(e);
+
+
+	/*
+  int L ;
+  Vstatus vErr;
+  Vevent * pEvent = NULL;
+
+  do {
+    // Read frame in the buffer 
+    ncdGetReceiveQueueLevel( gPortHandle , &L );
+    if( L <= 0 )
+    {
+      if (WaitForSingleObject (gEventHandle,WAIT_RECEIVING_FRAME_TIMEOUT) == WAIT_TIMEOUT)
+      {
+        //printf("no frame receiving in the %d last seconds\n", WAIT_RECEIVING_FRAME_TIMEOUT/1000); 
+        return VERR_QUEUE_IS_EMPTY;
+      }
+    }
+
+    vErr = ncdReceive1 (gPortHandle,&pEvent);
+    if( vErr == VERROR )
+    {
+      printf ("receiveframe ERROR  - ERROR: %s\n", ncdGetErrorString (vErr));		
+      //		ncdDeactivateChannel (gPortHandle, gChannelMask);
+      //		cleanUpPort ();
+
+      return vErr;
+    }
+
+  } while((( pEvent==NULL ) && ( vErr==VERR_QUEUE_IS_EMPTY )) || ( vErr == VERROR ));
+
+  // Return the flags field, dlc field and data field of the sent frame 
+  //frame.flags = pEvent->tagData.msg.flags;
+  frame.dlc = pEvent->tagData.msg.dlc;
+  frame.id =  pEvent->tagData.msg.id;
+  if( ( frame.dlc > 8 ) || ( frame.dlc < 0 ))     
+    frame.dlc = 8; 
+
+  memcpy(frame.data,pEvent->tagData.msg.data, frame.dlc);
+
+  return VSUCCESS;*/
 	
 }
