예제 #1
0
파일: query.py 프로젝트: amjadm61/ichnaea
    def cell(self, values):
        if not values:
            values = []
        values = list(values)
        self._cell_unvalidated = values

        filtered_areas = OrderedDict()
        filtered_cells = OrderedDict()
        for value in values:
            valid_area = CellAreaLookup.create(**value)
            if valid_area:
                areaid = valid_area.areaid
                existing = filtered_areas.get(areaid)
                if existing is not None and existing.better(valid_area):
                    pass
                else:
                    filtered_areas[areaid] = valid_area
            valid_cell = CellLookup.create(**value)
            if valid_cell:
                cellid = valid_cell.cellid
                existing = filtered_cells.get(cellid)
                if existing is not None and existing.better(valid_cell):
                    pass
                else:
                    filtered_cells[cellid] = valid_cell
        self._cell_area = list(filtered_areas.values())
        self._cell = list(filtered_cells.values())
예제 #2
0
    def cell(self, values):
        if not values:
            values = []
        values = list(values)
        self._cell_unvalidated = values

        filtered_areas = OrderedDict()
        filtered_cells = OrderedDict()
        for value in values:
            valid_area = CellAreaLookup.create(**value)
            if valid_area:
                areaid = valid_area.areaid
                existing = filtered_areas.get(areaid)
                if existing is not None and existing.better(valid_area):
                    pass
                else:
                    filtered_areas[areaid] = valid_area
            valid_cell = CellLookup.create(**value)
            if valid_cell:
                cellid = valid_cell.cellid
                existing = filtered_cells.get(cellid)
                if existing is not None and existing.better(valid_cell):
                    pass
                else:
                    filtered_cells[cellid] = valid_cell
        self._cell_area = list(filtered_areas.values())
        self._cell = list(filtered_cells.values())
예제 #3
0
    def _prepare_cell(self, cell):
        validated_cell = CellLookup.validate(cell)
        if validated_cell is None:
            return None

        radio = validated_cell.get('radio', None)
        if radio is not None:
            radio = radio.name
            if radio == 'umts':
                radio = 'wcdma'

        result = {}
        cell_map = {
            'mcc': 'mobileCountryCode',
            'mnc': 'mobileNetworkCode',
            'lac': 'locationAreaCode',
            'cid': 'cellId',
            'signal': 'signalStrength',
            'ta': 'timingAdvance',
        }
        if radio:
            result['radioType'] = radio
        for source, target in cell_map.items():
            if validated_cell.get(source):
                result[target] = validated_cell[source]

        return result
예제 #4
0
파일: query.py 프로젝트: SOFTowaha/ichnaea
    def cell(self, values):
        if not values:
            values = []
        values = list(values)
        self._cell_unvalidated = values

        filtered_areas = []
        filtered_cells = []
        for value in values:
            valid_area = CellAreaLookup.validate(value)
            if valid_area:
                filtered_areas.append(valid_area)
            valid_cell = CellLookup.validate(value)
            if valid_cell:
                filtered_cells.append(valid_cell)
        self._cell_area = filtered_areas
        self._cell = filtered_cells