00001 #include "ITransport.h" 00002 00003 void ITransport::enableLogging( 00004 bool enable) 00005 { 00006 m_enableLogging = enable; 00007 if (m_enableLogging) { 00008 m_file.open("transport.log"); 00009 } else { 00010 m_file.close(); 00011 } 00012 } 00013 00014 void ITransport::logPacket( 00015 const uint8_t* data, 00016 uint32_t length) 00017 { 00018 m_file << "sendPacket: "; 00019 for (size_t i = 0; i < length; ++i) { 00020 m_file << std::hex << (int)data[i] << " "; 00021 } 00022 m_file << std::endl; 00023 } 00024 00025 void ITransport::logAck( 00026 const Ack& ack) 00027 { 00028 m_file << "received: "; 00029 for (size_t i = 0; i < ack.size; ++i) { 00030 m_file << std::hex << (int)ack.data[i] << " "; 00031 } 00032 m_file << std::endl; 00033 }