Skip to content

Commit

Permalink
add UserDB-based NXDN display interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jg1uaa committed Mar 9, 2020
1 parent d275189 commit 36414ac
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
37 changes: 29 additions & 8 deletions Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,13 @@ void CDisplay::writeDMR(unsigned int slotNo, const class CUserDBentry& src, bool
m_mode2 = MODE_IDLE;
}

if (writeDMRIntEx(slotNo, src, group, dst, type) < 0) {
std::string src_str;

src_str = src.get(keyCALLSIGN);
if (!src.get(keyFIRST_NAME).empty())
if (int err = writeDMRIntEx(slotNo, src, group, dst, type)) {
std::string src_str = src.get(keyCALLSIGN);
if (err < 0 && !src.get(keyFIRST_NAME).empty()) {
// emulate the result of old CDMRLookup::findWithName()
// (it returned callsign and firstname)
src_str += " " + src.get(keyFIRST_NAME);
}
writeDMRInt(slotNo, src_str, group, dst, type);
}
}
Expand Down Expand Up @@ -289,6 +290,17 @@ void CDisplay::writeNXDN(const char* source, bool group, unsigned int dest, cons
writeNXDNInt(source, group, dest, type);
}

void CDisplay::writeNXDN(const class CUserDBentry& source, bool group, unsigned int dest, const char* type)
{
assert(type != NULL);

m_timer1.start();
m_mode1 = MODE_IDLE;

if (writeNXDNIntEx(source, group, dest, type))
writeNXDNInt(source.get(keyCALLSIGN).c_str(), group, dest, type);
}

void CDisplay::writeNXDNRSSI(unsigned char rssi)
{
if (rssi != 0U)
Expand Down Expand Up @@ -413,9 +425,11 @@ int CDisplay::writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src,
/*
* return value:
* < 0 error condition (i.e. not supported)
* -> call writeDMRInt() to display
* = 0 no error, writeDMRIntEx() displayed whole status
* > 0 reserved for future use
* -> call writeXXXXInt() to display
* = 0 no error, writeXXXXIntEx() displayed whole status
* = 1 no error, writeXXXXIntEx() displayed partial status
* -> call writeXXXXInt() to display remain part
* > 1 reserved for future use
*/
return -1; // not supported
}
Expand Down Expand Up @@ -455,6 +469,13 @@ void CDisplay::writeNXDNRSSIInt(unsigned char rssi)
void CDisplay::writeNXDNBERInt(float ber)
{
}

int CDisplay::writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type)
{
/* return value definition is same as writeDMRIntEx() */
return -1; // not supported
}


/* Factory method extracted from MMDVMHost.cpp - BG5HHP */
CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)
Expand Down
2 changes: 2 additions & 0 deletions Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class CDisplay
void clearP25();

void writeNXDN(const char* source, bool group, unsigned int dest, const char* type);
void writeNXDN(const class CUserDBentry& source, bool group, unsigned int dest, const char* type);
void writeNXDNRSSI(unsigned char rssi);
void writeNXDNBER(float ber);
void clearNXDN();
Expand Down Expand Up @@ -110,6 +111,7 @@ class CDisplay
virtual void clearP25Int() = 0;

virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type) = 0;
virtual int writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type);
virtual void writeNXDNRSSIInt(unsigned char rssi);
virtual void writeNXDNBERInt(float ber);
virtual void clearNXDNInt() = 0;
Expand Down

0 comments on commit 36414ac

Please sign in to comment.