add UserDB-based NXDN display interface

This commit is contained in:
SASANO Takayoshi 2020-03-10 05:46:24 +09:00
parent d2751897fb
commit 36414acc6a
2 changed files with 31 additions and 8 deletions

View file

@ -163,12 +163,13 @@ void CDisplay::writeDMR(unsigned int slotNo, const class CUserDBentry& src, bool
m_mode2 = MODE_IDLE; m_mode2 = MODE_IDLE;
} }
if (writeDMRIntEx(slotNo, src, group, dst, type) < 0) { if (int err = writeDMRIntEx(slotNo, src, group, dst, type)) {
std::string src_str; std::string src_str = src.get(keyCALLSIGN);
if (err < 0 && !src.get(keyFIRST_NAME).empty()) {
src_str = src.get(keyCALLSIGN); // emulate the result of old CDMRLookup::findWithName()
if (!src.get(keyFIRST_NAME).empty()) // (it returned callsign and firstname)
src_str += " " + src.get(keyFIRST_NAME); src_str += " " + src.get(keyFIRST_NAME);
}
writeDMRInt(slotNo, src_str, group, dst, type); writeDMRInt(slotNo, src_str, group, dst, type);
} }
} }
@ -289,6 +290,17 @@ void CDisplay::writeNXDN(const char* source, bool group, unsigned int dest, cons
writeNXDNInt(source, group, dest, type); 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) void CDisplay::writeNXDNRSSI(unsigned char rssi)
{ {
if (rssi != 0U) if (rssi != 0U)
@ -413,9 +425,11 @@ int CDisplay::writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src,
/* /*
* return value: * return value:
* < 0 error condition (i.e. not supported) * < 0 error condition (i.e. not supported)
* -> call writeDMRInt() to display * -> call writeXXXXInt() to display
* = 0 no error, writeDMRIntEx() displayed whole status * = 0 no error, writeXXXXIntEx() displayed whole status
* > 0 reserved for future use * = 1 no error, writeXXXXIntEx() displayed partial status
* -> call writeXXXXInt() to display remain part
* > 1 reserved for future use
*/ */
return -1; // not supported return -1; // not supported
} }
@ -455,6 +469,13 @@ void CDisplay::writeNXDNRSSIInt(unsigned char rssi)
void CDisplay::writeNXDNBERInt(float ber) 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 */ /* Factory method extracted from MMDVMHost.cpp - BG5HHP */
CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem) CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)

View file

@ -66,6 +66,7 @@ public:
void clearP25(); void clearP25();
void writeNXDN(const char* source, bool group, unsigned int dest, const char* type); 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 writeNXDNRSSI(unsigned char rssi);
void writeNXDNBER(float ber); void writeNXDNBER(float ber);
void clearNXDN(); void clearNXDN();
@ -110,6 +111,7 @@ protected:
virtual void clearP25Int() = 0; virtual void clearP25Int() = 0;
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type) = 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 writeNXDNRSSIInt(unsigned char rssi);
virtual void writeNXDNBERInt(float ber); virtual void writeNXDNBERInt(float ber);
virtual void clearNXDNInt() = 0; virtual void clearNXDNInt() = 0;