1
0
Fork 0

Fix DN mode bugs and rename DTMF methods.

ycs232-kbc
Jonathan Naylor 7 years ago
parent 11d56992be
commit 6a81990b48

@ -54,14 +54,14 @@ CDTMF::~CDTMF()
{ {
} }
WX_STATUS CDTMF::decodeVW(const unsigned char* payload) WX_STATUS CDTMF::decodeVoiceFRMode(const unsigned char* payload)
{ {
assert(payload != NULL); assert(payload != NULL);
payload += YSF_SYNC_LENGTH_BYTES + YSF_FICH_LENGTH_BYTES; payload += YSF_SYNC_LENGTH_BYTES + YSF_FICH_LENGTH_BYTES;
for (unsigned int offset = 0U; offset < 90U; offset += 18U) { for (unsigned int offset = 0U; offset < 90U; offset += 18U) {
WX_STATUS status = decodeVWSlice(payload + offset); WX_STATUS status = decodeVoiceFRModeSlice(payload + offset);
if (status != WXS_NONE) if (status != WXS_NONE)
return status; return status;
} }
@ -69,14 +69,14 @@ WX_STATUS CDTMF::decodeVW(const unsigned char* payload)
return WXS_NONE; return WXS_NONE;
} }
WX_STATUS CDTMF::decodeDN1(const unsigned char* payload) WX_STATUS CDTMF::decodeVDMode1(const unsigned char* payload)
{ {
assert(payload != NULL); assert(payload != NULL);
payload += YSF_SYNC_LENGTH_BYTES + YSF_FICH_LENGTH_BYTES; payload += YSF_SYNC_LENGTH_BYTES + YSF_FICH_LENGTH_BYTES;
for (unsigned int offset = 5U; offset < 90U; offset += 18U) { for (unsigned int offset = 9U; offset < 90U; offset += 18U) {
WX_STATUS status = decodeDN1Slice(payload + offset); WX_STATUS status = decodeVDMode1Slice(payload + offset);
if (status != WXS_NONE) if (status != WXS_NONE)
return status; return status;
} }
@ -84,14 +84,14 @@ WX_STATUS CDTMF::decodeDN1(const unsigned char* payload)
return WXS_NONE; return WXS_NONE;
} }
WX_STATUS CDTMF::decodeDN2(const unsigned char* payload) WX_STATUS CDTMF::decodeVDMode2(const unsigned char* payload)
{ {
assert(payload != NULL); assert(payload != NULL);
payload += YSF_SYNC_LENGTH_BYTES + YSF_FICH_LENGTH_BYTES; payload += YSF_SYNC_LENGTH_BYTES + YSF_FICH_LENGTH_BYTES;
for (unsigned int offset = 9U; offset < 90U; offset += 18U) { for (unsigned int offset = 5U; offset < 90U; offset += 18U) {
WX_STATUS status = decodeDN2Slice(payload + offset); WX_STATUS status = decodeVDMode2Slice(payload + offset);
if (status != WXS_NONE) if (status != WXS_NONE)
return status; return status;
} }
@ -99,7 +99,7 @@ WX_STATUS CDTMF::decodeDN2(const unsigned char* payload)
return WXS_NONE; return WXS_NONE;
} }
WX_STATUS CDTMF::decodeVWSlice(const unsigned char* ambe) WX_STATUS CDTMF::decodeVoiceFRModeSlice(const unsigned char* ambe)
{ {
// DTMF begins with these byte values // DTMF begins with these byte values
if ((ambe[0] & DTMF_MASK[0]) == DTMF_SIG[0] && (ambe[1] & DTMF_MASK[1]) == DTMF_SIG[1] && if ((ambe[0] & DTMF_MASK[0]) == DTMF_SIG[0] && (ambe[1] & DTMF_MASK[1]) == DTMF_SIG[1] &&
@ -177,7 +177,7 @@ WX_STATUS CDTMF::decodeVWSlice(const unsigned char* ambe)
} }
} }
WX_STATUS CDTMF::decodeDN1Slice(const unsigned char* ambe) WX_STATUS CDTMF::decodeVDMode1Slice(const unsigned char* ambe)
{ {
// DTMF begins with these byte values // DTMF begins with these byte values
if ((ambe[0] & DTMF_MASK[0]) == DTMF_SIG[0] && (ambe[1] & DTMF_MASK[1]) == DTMF_SIG[1] && if ((ambe[0] & DTMF_MASK[0]) == DTMF_SIG[0] && (ambe[1] & DTMF_MASK[1]) == DTMF_SIG[1] &&
@ -255,7 +255,7 @@ WX_STATUS CDTMF::decodeDN1Slice(const unsigned char* ambe)
} }
} }
WX_STATUS CDTMF::decodeDN2Slice(const unsigned char* ambe) WX_STATUS CDTMF::decodeVDMode2Slice(const unsigned char* ambe)
{ {
// DTMF begins with these byte values // DTMF begins with these byte values
if ((ambe[0] & DTMF_MASK[0]) == DTMF_SIG[0] && (ambe[1] & DTMF_MASK[1]) == DTMF_SIG[1] && if ((ambe[0] & DTMF_MASK[0]) == DTMF_SIG[0] && (ambe[1] & DTMF_MASK[1]) == DTMF_SIG[1] &&

@ -28,9 +28,9 @@ public:
CDTMF(); CDTMF();
~CDTMF(); ~CDTMF();
WX_STATUS decodeVW(const unsigned char* payload); WX_STATUS decodeVoiceFRMode(const unsigned char* payload);
WX_STATUS decodeDN1(const unsigned char* payload); WX_STATUS decodeVDMode1(const unsigned char* payload);
WX_STATUS decodeDN2(const unsigned char* payload); WX_STATUS decodeVDMode2(const unsigned char* payload);
std::string getReflector(); std::string getReflector();
@ -44,9 +44,9 @@ private:
unsigned int m_pressCount; unsigned int m_pressCount;
char m_lastChar; char m_lastChar;
WX_STATUS decodeVWSlice(const unsigned char* ambe); WX_STATUS decodeVoiceFRModeSlice(const unsigned char* ambe);
WX_STATUS decodeDN1Slice(const unsigned char* ambe); WX_STATUS decodeVDMode1Slice(const unsigned char* ambe);
WX_STATUS decodeDN2Slice(const unsigned char* ambe); WX_STATUS decodeVDMode2Slice(const unsigned char* ambe);
WX_STATUS validate() const; WX_STATUS validate() const;
}; };

@ -310,13 +310,13 @@ int CYSFGateway::run()
status = WXS_NONE; status = WXS_NONE;
switch (dt) { switch (dt) {
case YSF_DT_VOICE_FR_MODE: case YSF_DT_VOICE_FR_MODE:
status = m_dtmf->decodeVW(buffer + 35U); status = m_dtmf->decodeVoiceFRMode(buffer + 35U);
break; break;
case YSF_DT_VD_MODE1: case YSF_DT_VD_MODE1:
status = m_dtmf->decodeDN1(buffer + 35U); status = m_dtmf->decodeVDMode1(buffer + 35U);
break; break;
case YSF_DT_VD_MODE2: case YSF_DT_VD_MODE2:
status = m_dtmf->decodeDN2(buffer + 35U); status = m_dtmf->decodeVDMode2(buffer + 35U);
break; break;
default: default:
break; break;
@ -324,8 +324,8 @@ int CYSFGateway::run()
switch (status) { switch (status) {
case WXS_CONNECT: { case WXS_CONNECT: {
std::string refl = m_dtmf->getReflector(); std::string id = m_dtmf->getReflector();
CYSFReflector* reflector = m_wiresX->getReflector(refl); CYSFReflector* reflector = m_wiresX->getReflector(id);
if (reflector != NULL) { if (reflector != NULL) {
m_wiresX->processConnect(reflector); m_wiresX->processConnect(reflector);

Loading…
Cancel
Save