ITransport.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include <stdint.h>
00004 #include <fstream>
00005 
00006 class ITransport
00007 {
00008 public:
00009   struct Ack
00010   {
00011     Ack()
00012       : ack(0)
00013       , size(0)
00014     {}
00015 
00016     uint8_t ack:1;
00017     uint8_t powerDet:1;
00018     uint8_t retry:4;
00019     uint8_t data[32];
00020 
00021     uint8_t size;
00022   }__attribute__((packed));
00023 
00024 public:
00025   ITransport()
00026     : m_enableLogging(false)
00027   {
00028   }
00029 
00030   virtual ~ITransport() {}
00031 
00032   virtual void sendPacket(
00033     const uint8_t* data,
00034     uint32_t length,
00035     Ack& result) = 0;
00036 
00037   virtual void sendPacketNoAck(
00038     const uint8_t* data,
00039     uint32_t length) = 0;
00040 
00041 
00042   void enableLogging(
00043     bool enable);
00044 
00045 protected:
00046   void logPacket(
00047     const uint8_t* data,
00048     uint32_t length);
00049 
00050   void logAck(
00051     const Ack& ack);
00052 
00053 protected:
00054   bool m_enableLogging;
00055   std::ofstream m_file;
00056 };


crazyflie_cpp
Author(s): Wolfgang Hoenig
autogenerated on Wed Jun 12 2019 19:20:44