46 lines
989 B
C++
46 lines
989 B
C++
/*
|
|
* LogCore.cpp
|
|
*
|
|
* Created on: 17 May 2016
|
|
* Author: wentzelc
|
|
*/
|
|
|
|
// redA Libraries
|
|
#include "LogCore.h"
|
|
|
|
// Standard C/C++ Libraries
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
void ShowOutput( const char * Name, const char * Buffer, const int Len, const long Duration )
|
|
{
|
|
// Show Duration delay
|
|
if (Duration) {
|
|
printf( "Delay: %ld", Duration );
|
|
}
|
|
|
|
// Show Hex output
|
|
if (ShowOutBytes) {
|
|
printf( "%s in (hex): ", Name );
|
|
for (int i=0; i<Len; i++) {
|
|
printf( "%02X ", Buffer[i] );
|
|
}
|
|
printf( "\n" );
|
|
}
|
|
|
|
// Show normal output
|
|
if (ShowOutHex) {
|
|
printf( "%s in [%d]: %s", Name, Len, Buffer );
|
|
if (Buffer[Len-1] != '\n') {
|
|
printf( "\n" );
|
|
}
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|