본문 바로가기

Windows/MFC

LIP 구분을 PC 에서 하기

extern SDL_Boolean IsLIPData (d_sds_data_s *Source)
{
    edbit_s         edbit;
    edbit_rc_e     rc;
    char tmpData[256] = {0};
    int nValue = 0;

    //
    // The User Defined Data-4 information element shall enable
    // the user applications to determine their own interpretation of
    // the SDS message as defined in table 14.90. The first 8 bits of
    // the user defined data-4 element shall contain a protocol
    // identifier as defined in clause 29.
    //
    if (Source->ShortDataTypeID == USER_DEFINED_DATA_4)
    {
        memcpy(tmpData, Source->UserDefinedData4.A, 255);

        // 전체 길이에서 8bit만 사용한다고 예약
        rc = edbit_dec_init (&edbit, tmpData, 0, 8);
        rc = edbit_dibits (&edbit, &nValue, 8);

        /*Location information protocol*/
        if(nValue == 0x0A)
        {
            return 1;
        }
    }

    return 0;
}