Search in sources :

Example 1 with CellInfoLte

use of android.hardware.radio.V1_0.CellInfoLte in project android_frameworks_opt_telephony by LineageOS.

the class RIL method convertHalCellInfoList.

static ArrayList<CellInfo> convertHalCellInfoList(ArrayList<android.hardware.radio.V1_0.CellInfo> records) {
    ArrayList<CellInfo> response = new ArrayList<CellInfo>(records.size());
    for (android.hardware.radio.V1_0.CellInfo record : records) {
        // first convert RIL CellInfo to Parcel
        Parcel p = Parcel.obtain();
        p.writeInt(record.cellInfoType);
        p.writeInt(record.registered ? 1 : 0);
        p.writeInt(record.timeStampType);
        p.writeLong(record.timeStamp);
        switch(record.cellInfoType) {
            case CellInfoType.GSM:
                {
                    CellInfoGsm cellInfoGsm = record.gsm.get(0);
                    p.writeInt(Integer.parseInt(cellInfoGsm.cellIdentityGsm.mcc));
                    p.writeInt(Integer.parseInt(cellInfoGsm.cellIdentityGsm.mnc));
                    p.writeInt(cellInfoGsm.cellIdentityGsm.lac);
                    p.writeInt(cellInfoGsm.cellIdentityGsm.cid);
                    p.writeInt(cellInfoGsm.cellIdentityGsm.arfcn);
                    p.writeInt(Byte.toUnsignedInt(cellInfoGsm.cellIdentityGsm.bsic));
                    p.writeInt(cellInfoGsm.signalStrengthGsm.signalStrength);
                    p.writeInt(cellInfoGsm.signalStrengthGsm.bitErrorRate);
                    p.writeInt(cellInfoGsm.signalStrengthGsm.timingAdvance);
                    break;
                }
            case CellInfoType.CDMA:
                {
                    CellInfoCdma cellInfoCdma = record.cdma.get(0);
                    p.writeInt(cellInfoCdma.cellIdentityCdma.networkId);
                    p.writeInt(cellInfoCdma.cellIdentityCdma.systemId);
                    p.writeInt(cellInfoCdma.cellIdentityCdma.baseStationId);
                    p.writeInt(cellInfoCdma.cellIdentityCdma.longitude);
                    p.writeInt(cellInfoCdma.cellIdentityCdma.latitude);
                    p.writeInt(cellInfoCdma.signalStrengthCdma.dbm);
                    p.writeInt(cellInfoCdma.signalStrengthCdma.ecio);
                    p.writeInt(cellInfoCdma.signalStrengthEvdo.dbm);
                    p.writeInt(cellInfoCdma.signalStrengthEvdo.ecio);
                    p.writeInt(cellInfoCdma.signalStrengthEvdo.signalNoiseRatio);
                    break;
                }
            case CellInfoType.LTE:
                {
                    CellInfoLte cellInfoLte = record.lte.get(0);
                    p.writeInt(Integer.parseInt(cellInfoLte.cellIdentityLte.mcc));
                    p.writeInt(Integer.parseInt(cellInfoLte.cellIdentityLte.mnc));
                    p.writeInt(cellInfoLte.cellIdentityLte.ci);
                    p.writeInt(cellInfoLte.cellIdentityLte.pci);
                    p.writeInt(cellInfoLte.cellIdentityLte.tac);
                    p.writeInt(cellInfoLte.cellIdentityLte.earfcn);
                    p.writeInt(cellInfoLte.signalStrengthLte.signalStrength);
                    p.writeInt(cellInfoLte.signalStrengthLte.rsrp);
                    p.writeInt(cellInfoLte.signalStrengthLte.rsrq);
                    p.writeInt(cellInfoLte.signalStrengthLte.rssnr);
                    p.writeInt(cellInfoLte.signalStrengthLte.cqi);
                    p.writeInt(cellInfoLte.signalStrengthLte.timingAdvance);
                    break;
                }
            case CellInfoType.WCDMA:
                {
                    CellInfoWcdma cellInfoWcdma = record.wcdma.get(0);
                    p.writeInt(Integer.parseInt(cellInfoWcdma.cellIdentityWcdma.mcc));
                    p.writeInt(Integer.parseInt(cellInfoWcdma.cellIdentityWcdma.mnc));
                    p.writeInt(cellInfoWcdma.cellIdentityWcdma.lac);
                    p.writeInt(cellInfoWcdma.cellIdentityWcdma.cid);
                    p.writeInt(cellInfoWcdma.cellIdentityWcdma.psc);
                    p.writeInt(cellInfoWcdma.cellIdentityWcdma.uarfcn);
                    p.writeInt(cellInfoWcdma.signalStrengthWcdma.signalStrength);
                    p.writeInt(cellInfoWcdma.signalStrengthWcdma.bitErrorRate);
                    break;
                }
            default:
                throw new RuntimeException("unexpected cellinfotype: " + record.cellInfoType);
        }
        p.setDataPosition(0);
        CellInfo InfoRec = CellInfo.CREATOR.createFromParcel(p);
        p.recycle();
        response.add(InfoRec);
    }
    return response;
}
Also used : CellInfoLte(android.hardware.radio.V1_0.CellInfoLte) CellInfo(android.telephony.CellInfo) NeighboringCellInfo(android.telephony.NeighboringCellInfo) CellInfoCdma(android.hardware.radio.V1_0.CellInfoCdma) Parcel(android.os.Parcel) CellInfoWcdma(android.hardware.radio.V1_0.CellInfoWcdma) ArrayList(java.util.ArrayList) CellInfoGsm(android.hardware.radio.V1_0.CellInfoGsm)

Aggregations

CellInfoCdma (android.hardware.radio.V1_0.CellInfoCdma)1 CellInfoGsm (android.hardware.radio.V1_0.CellInfoGsm)1 CellInfoLte (android.hardware.radio.V1_0.CellInfoLte)1 CellInfoWcdma (android.hardware.radio.V1_0.CellInfoWcdma)1 Parcel (android.os.Parcel)1 CellInfo (android.telephony.CellInfo)1 NeighboringCellInfo (android.telephony.NeighboringCellInfo)1 ArrayList (java.util.ArrayList)1