UTRAN Cell Identity returned by getCid()

后端 未结 4 1444
南笙
南笙 2021-02-02 04:09

In UMTS I get a large number returned by getCid() (larger than the allowed value). Is this the UTRAN Cell Identity (UC-ID)?

UC-Id = RNC-Id + C-Id
         


        
4条回答
  •  [愿得一人]
    2021-02-02 04:47

    The RNC id is the first 2 bytes of the 4 byte Cell Id (3GPP 25.401, section 6.1.5), if the network type is UMTS/HSxPA/HSPA+."
    I have access to an operator network and I checked in the system and it's true and correct.
    Based on that please see my code how you can easily get RNCID + CID:
    Convert CID to ByteArray:

        public static byte[] convertByteArray__p(int p_int){
        byte[] l_byte_array = new byte[4];
        int MASK_c = 0xFF;
        for (short i=0; i<=3; i++){
            l_byte_array[i] = (byte) ((p_int >> (8*i)) & MASK_c);
        }
        return l_byte_array;
    } 
    


    Get the RNCID and CID:

        public int getRNCID_or_CID__p(byte[] p_bytes, short p_which){
        int MASK_c = 0xFF;
        int l_result = 0;   
        if (p_which == Constants.CID_C) {
            l_result = p_bytes[0] & MASK_c ;
            l_result = l_result + ((p_bytes[1] & MASK_c ) << 8);
        } else if (p_which == Constants.RNCID_C){
            l_result = p_bytes[2] & MASK_c ;
            l_result = l_result + ((p_bytes[3] & MASK_c ) << 8);
        } else { 
            g_FileHandler.putLog__p('E', "getRNCID_or_CID__p invalid parameter");
        }
        return l_result;     
    }
    


    Than you can easily call like this:

            byte[] l_byte_array = new byte[4];
            l_byte_array = convertByteArray__p(l_cid);
            int l_RNC_ID   = getRNCID_or_CID__p(l_byte_array,Constants.RNCID_C);
            int l_real_CID = getRNCID_or_CID__p(l_byte_array,Constants.CID_C);
    


    Constants RNCID_C(1) and CID_C(2) are only contants just for me to seperate which parameter will be passed through.

提交回复
热议问题