Skip to content

Commit

Permalink
DbgTrace_Port constr.: out port name optional, default: "trConOut"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieter Niklaus committed May 23, 2016
1 parent 1997d37 commit 8b39b96
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
32 changes: 29 additions & 3 deletions DbgTracePort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,24 @@ class DbgCli_Command_ChangeLevel : public DbgCli_Command
// Class DbgTrace_Port
//-----------------------------------------------------------------------------

DbgTrace_Port::DbgTrace_Port(const char* tag, const char* outName, DbgTrace_Level::Level level)
DbgTrace_Port::DbgTrace_Port(const char* tag, DbgTrace_Level::Level level, const char* outName)
: m_out(DbgTrace_Context::getContext()->getTraceOut(outName))
, m_level(level)
, m_nextPort(0)
, m_tag(tag)
, m_tag(reinterpret_cast<const char*>(tag))
{
DbgTrace_Context* context = DbgTrace_Context::getContext();
if(0 != context)
{
context->addTracePort(this);
}
}

DbgTrace_Port::DbgTrace_Port(const char* tag, DbgTrace_Level::Level level)
: m_out(DbgTrace_Context::getContext()->getTraceOut(reinterpret_cast<const char*>("trConOut")))
, m_level(level)
, m_nextPort(0)
, m_tag(reinterpret_cast<const char*>(tag))
{
DbgTrace_Context* context = DbgTrace_Context::getContext();
if(0 != context)
Expand All @@ -244,7 +257,7 @@ DbgTrace_Port::DbgTrace_Port(const char* tag, const char* outName, DbgTrace_Leve
}

#ifdef ARDUINO
DbgTrace_Port::DbgTrace_Port(const __FlashStringHelper* tag, const __FlashStringHelper* outName, DbgTrace_Level::Level level)
DbgTrace_Port::DbgTrace_Port(const __FlashStringHelper* tag, DbgTrace_Level::Level level, const __FlashStringHelper* outName)
: m_out(DbgTrace_Context::getContext()->getTraceOut(reinterpret_cast<const char*>(outName)))
, m_level(level)
, m_nextPort(0)
Expand All @@ -256,6 +269,19 @@ DbgTrace_Port::DbgTrace_Port(const __FlashStringHelper* tag, const __FlashString
context->addTracePort(this);
}
}

DbgTrace_Port::DbgTrace_Port(const __FlashStringHelper* tag, DbgTrace_Level::Level level)
: m_out(DbgTrace_Context::getContext()->getTraceOut(reinterpret_cast<const char*>(F("trConOut"))))
, m_level(level)
, m_nextPort(0)
, m_tag(reinterpret_cast<const char*>(tag))
{
DbgTrace_Context* context = DbgTrace_Context::getContext();
if(0 != context)
{
context->addTracePort(this);
}
}
#endif

DbgTrace_Port::~DbgTrace_Port()
Expand Down
10 changes: 6 additions & 4 deletions DbgTracePort.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@ class DbgTrace_Port
* @brief Constructor to create a new port instance. The port will be automatically assigned to the mentioned debug trace context.
* @param tag The tag name of the port, which should be unique and and not longer than the specified max size.
* The port can afterwards globally accessed by its content and tag.
* @param out Pointer to an output, for printing the traces.
* @param level Trace level of the port. All traces with a similar or higher trace level will be printed.
* @param out Name of an output, for printing the traces (optional, default: "trConOut").
*/
DbgTrace_Port(const char* tag, const char* outName, DbgTrace_Level::Level level);
DbgTrace_Port(const char* tag, DbgTrace_Level::Level level, const char* outName);
DbgTrace_Port(const char* tag, DbgTrace_Level::Level level);
#ifdef ARDUINO
/**
* @brief Constructor to create a new port instance. With a tag stored in flash (ram optimized version for embedded controllers)
* @param tag The tag name of the port, which should be unique and and not longer than the specified max size.
* The port can afterwards globally accessed by its content and tag.
* @param out Pointer to an output, for printing the traces.
* @param level Trace level of the port. All traces with a similar or higher trace level will be printed.
* @param out Name of an output, for printing the traces (optional, default: "trConOut").
*/
DbgTrace_Port(const __FlashStringHelper* tag, const __FlashStringHelper* outName, DbgTrace_Level::Level level);
DbgTrace_Port(const __FlashStringHelper* tag, DbgTrace_Level::Level level, const __FlashStringHelper* outName);
DbgTrace_Port(const __FlashStringHelper* tag, DbgTrace_Level::Level level);
#endif

/**
Expand Down

0 comments on commit 8b39b96

Please sign in to comment.