revert change from 0ea6ee0 that changed the RingBuffer const char* to std::string to correct issue where the RingBuffer name is being copied incorrectly; change method for copying name std::string passed to AffiliationLookup; remove accidentally committed debug code;

pull/51/head
Bryan Biedenkapp 2 years ago
parent f000639c7f
commit 86d736b0bb

@ -32,7 +32,7 @@ public:
/// <summary>Initializes a new instance of the RingBuffer class.</summary> /// <summary>Initializes a new instance of the RingBuffer class.</summary>
/// <param name="length">Length of ring buffer.</param> /// <param name="length">Length of ring buffer.</param>
/// <param name="name">Name of buffer.</param> /// <param name="name">Name of buffer.</param>
RingBuffer(uint32_t length, const std::string name) : RingBuffer(uint32_t length, const char* name) :
m_length(length), m_length(length),
m_name(name), m_name(name),
m_buffer(nullptr), m_buffer(nullptr),
@ -42,7 +42,6 @@ public:
assert(length > 0U); assert(length > 0U);
m_buffer = new T[length]; m_buffer = new T[length];
::memset(m_buffer, 0x00, m_length * sizeof(T)); ::memset(m_buffer, 0x00, m_length * sizeof(T));
} }
@ -59,7 +58,7 @@ public:
bool addData(const T* buffer, uint32_t length) bool addData(const T* buffer, uint32_t length)
{ {
if (length > freeSpace()) { if (length > freeSpace()) {
LogError(LOG_HOST, "**** Overflow in %s ring buffer, %u > %u, clearing the buffer", m_name.c_str(), length, freeSpace()); LogError(LOG_HOST, "**** Overflow in %s ring buffer, %u > %u, clearing the buffer", m_name, length, freeSpace());
clear(); clear();
return false; return false;
} }
@ -73,7 +72,7 @@ public:
m_iPtr = 0U; m_iPtr = 0U;
} }
#if DEBUG_RINGBUFFER #if DEBUG_RINGBUFFER
LogDebug(LOG_HOST, "RingBuffer::addData(%s): iPtr_Before = %u, iPtr_After = %u, oPtr = %u, len = %u, len_Written = %u", m_name.c_str(), iPtr_BeforeWrite, m_iPtr, m_oPtr, m_length, (m_iPtr - iPtr_BeforeWrite)); LogDebug(LOG_HOST, "RingBuffer::addData(%s): iPtr_Before = %u, iPtr_After = %u, oPtr = %u, len = %u, len_Written = %u", m_name, iPtr_BeforeWrite, m_iPtr, m_oPtr, m_length, (m_iPtr - iPtr_BeforeWrite));
#endif #endif
return true; return true;
} }
@ -85,7 +84,7 @@ public:
bool get(T* buffer, uint32_t length) bool get(T* buffer, uint32_t length)
{ {
if (dataSize() < length) { if (dataSize() < length) {
LogError(LOG_HOST, "**** Underflow get in %s ring buffer, %u < %u", m_name.c_str(), dataSize(), length); LogError(LOG_HOST, "**** Underflow get in %s ring buffer, %u < %u", m_name, dataSize(), length);
return false; return false;
} }
#if DEBUG_RINGBUFFER #if DEBUG_RINGBUFFER
@ -98,7 +97,7 @@ public:
m_oPtr = 0U; m_oPtr = 0U;
} }
#if DEBUG_RINGBUFFER #if DEBUG_RINGBUFFER
LogDebug(LOG_HOST, "RingBuffer::getData(%s): iPtr = %u, oPtr_Before = %u, oPtr_After = %u, len = %u, len_Read = %u", m_name.c_str(), m_iPtr, oPtr_BeforeRead, m_oPtr, m_length, (m_oPtr - oPtr_BeforeRead)); LogDebug(LOG_HOST, "RingBuffer::getData(%s): iPtr = %u, oPtr_Before = %u, oPtr_After = %u, len = %u, len_Read = %u", m_name, m_iPtr, oPtr_BeforeRead, m_oPtr, m_length, (m_oPtr - oPtr_BeforeRead));
#endif #endif
return true; return true;
} }
@ -110,7 +109,7 @@ public:
bool peek(T* buffer, uint32_t length) bool peek(T* buffer, uint32_t length)
{ {
if (dataSize() < length) { if (dataSize() < length) {
LogError(LOG_HOST, "**** Underflow peek in %s ring buffer, %u < %u", m_name.c_str(), dataSize(), length); LogError(LOG_HOST, "**** Underflow peek in %s ring buffer, %u < %u", m_name, dataSize(), length);
return false; return false;
} }
@ -203,7 +202,7 @@ public:
private: private:
uint32_t m_length; uint32_t m_length;
const std::string m_name; const char* m_name;
T* m_buffer; T* m_buffer;

@ -36,9 +36,11 @@ AffiliationLookup::AffiliationLookup(const std::string name, bool verbose) :
m_netGrantedTable(), m_netGrantedTable(),
m_grantTimers(), m_grantTimers(),
m_releaseGrant(nullptr), m_releaseGrant(nullptr),
m_name(name), m_name(),
m_verbose(verbose) m_verbose(verbose)
{ {
m_name = name;
m_rfChTable.clear(); m_rfChTable.clear();
m_unitRegTable.clear(); m_unitRegTable.clear();

@ -202,7 +202,7 @@ namespace lookups
// chNo dstId slot // chNo dstId slot
std::function<void(uint32_t, uint32_t, uint8_t)> m_releaseGrant; std::function<void(uint32_t, uint32_t, uint8_t)> m_releaseGrant;
const std::string m_name; std::string m_name;
bool m_verbose; bool m_verbose;
}; };

@ -440,14 +440,9 @@ bool HostSetup::portModemHandler(Modem* modem, uint32_t ms, RESP_TYPE_DVM rspTyp
case CMD_GET_STATUS: case CMD_GET_STATUS:
{ {
Utils::dump(1U, "status buffer", buffer, len);
m_isHotspot = (buffer[3U] & 0x01U) == 0x01U; m_isHotspot = (buffer[3U] & 0x01U) == 0x01U;
m_modem->m_isHotspot = (buffer[3U] & 0x01U) == 0x01U; m_modem->m_isHotspot = (buffer[3U] & 0x01U) == 0x01U;
LogDebug(LOG_CAL, "buffer[3] = %u, len = %u, m_isHotSpot = %u, m_modem->m_isHotspot = %u", buffer[3U], len, m_isHotspot, m_modem->m_isHotspot);
LogDebug(LOG_CAL, "m_modem->m_forceHotspot = %u", m_modem->m_forceHotspot);
// override hotspot flag if we're forcing hotspot // override hotspot flag if we're forcing hotspot
if (m_modem->m_forceHotspot) { if (m_modem->m_forceHotspot) {
m_isHotspot = m_modem->m_forceHotspot; m_isHotspot = m_modem->m_forceHotspot;

Loading…
Cancel
Save

Powered by TurnKey Linux.