Re: P25 North America reflector


Steve N4IRS
 

I have not yet forked and patched Jonathan's code. Here is the change to P25Network.cpp Let me know results.

void CP25Network::clock(unsigned int ms)
{
    unsigned char buffer[BUFFER_LENGTH];

    sockaddr_storage address;
    unsigned int addrLen;
    int length = m_socket.read(buffer, BUFFER_LENGTH, address, addrLen);
    if (length <= 0)
        return;

    if (!CUDPSocket::match(m_addr, address)) {
        LogMessage("P25, packet received from an invalid source");
        return;
    }

    if (!m_enabled)
        return;

    if (m_debug)
        CUtils::dump(1U, "P25 Network Data Received", buffer, length);

    unsigned char c = length;
    m_buffer.addData(&c, 1U);

    m_buffer.addData(buffer, length);
}

becomes......

void CP25Network::clock(unsigned int ms)
{
    unsigned char buffer[BUFFER_LENGTH];

    sockaddr_storage address;
    unsigned int addrLen;
    int length = m_socket.read(buffer, BUFFER_LENGTH, address, addrLen);
    if (length <= 0)
        return;

    if (!CUDPSocket::match(m_addr, address)) {
        LogMessage("P25, packet received from an invalid source");
        return;
    }

    if (!m_enabled)
        return;

    if (m_debug)
        CUtils::dump(1U, "P25 Network Data Received", buffer, length);

    while (length > 0) {
        unsigned char addBytes = 0;
        int recSize[] = {22, 14, 17, 17, 17, 17, 17, 17, 16, 22, 14, 17, 17, 17, 17, 17, 17, 16};
        unsigned char recType = buffer[0];
        if ((recType >= 0x62) && (recType <= 0x73))
            addBytes = recSize[recType - 0x62];
        else if (recType == 0x80)
            addBytes = 17;
        else
            LogMessage("Got a network byte I did not expect %0X, %d", buffer[0], length);
        if ((addBytes > 0) && (addBytes <= length)) {
            m_buffer.addData(&addBytes, 1U);
            m_buffer.addData(buffer, addBytes);
           
        }
        length -= addBytes;
    }
}
 

On 9/18/21 10:18 AM, Miguel wrote:

What is the change? Have a github branch?

thx


Join {main@DVSwitch.groups.io to automatically receive all group messages.