bool CameraArea::areAreasDifferent(android::Vector< android::sp<CameraArea> > &area1,
                                    android::Vector< android::sp<CameraArea> > &area2) {
    if (area1.size() != area2.size()) {
        return true;
    }

    // not going to care about sorting order for now
    for (int i = 0; i < area1.size(); i++) {
        if (!area1.itemAt(i)->compare(area2.itemAt(i))) {
            return true;
        }
    }

    return false;
}
void assert_serialized_data(void* original, size_t length, android::Vector<char>& serialized) {
  ASSERT_EQ(length, serialized.size());
  for (size_t i = 0; i < length; i++) {
    auto actual = *((char*) original + i);
    ASSERT_EQ(actual, serialized[i]);
  }
}
Beispiel #3
0
MBOOL
FeatureStream::
queryGroupMember(
    MINT32 portIdx,
    MBOOL& beforeCRZ,
    android::Vector<MINT32>& vGroupPortIdx)
{
    FUNCTION_LOG_START;
    bool isGet=false;
    //default set the dma is before crz
    beforeCRZ=true;

    //parsing data
    for(int i=0;i<mCropPaths.size();i++)
    {
        //[1] check there is vipi in this scenario or not
        isGet=false;
        for(int j=0;j<mCropPaths[i].PortIdxVec.size();j++)
        {
            if(mCropPaths[i].PortIdxVec[j]== portIdx)
            {
                isGet=true;
            }
            else
            {}
            if(isGet)
            {
                break;
            }
        }

        //[2]add index of port in the same group
        if(isGet)
        {
            //update the dma position before/after crz
            if(mCropPaths[i].u4CropGroup != ECropGroupIndex_NONE)
            {
                beforeCRZ=false;
            }
            for(int j=0;j<mCropPaths[i].PortIdxVec.size();j++)
            {

                if((mCropPaths[i].PortIdxVec[j]== portIdx) || (portIdx == -1))
                {}
                else
                {
                    vGroupPortIdx.push_back(mCropPaths[i].PortIdxVec[j]);
                }
            }
            //suppose the dma should be only included in one group
            break;
        }
    }
    LOG_INF("return bcrz(%d)/size(%d)",beforeCRZ,vGroupPortIdx.size());
    FUNCTION_LOG_END;
    return true;
}
void CombinedModel::update(const android::Vector<android::ConfiguredStation>& update)
{
    QMutexLocker locker(&sWifiMutex);

    // Mark stations with a non-negative network id
    QListIterator<Station *> it(mStations);
    while (it.hasNext()) {
	Station *s = it.next();
	if (s->network_id != -1)
	    s->network_id = -2;
    }

    for (size_t i = 0 ; i < update.size() ; i++) {
	const android::ConfiguredStation& config(update[i]);
	Station *s = findBySsid(QString::fromLocal8Bit(config.ssid.string()));
	s->network_id = config.network_id;
	s->status     = static_cast<Station::Status>(config.status);
	s->key_mgmt   = Station::flagsToKeyMgmt(QString::fromLocal8Bit(config.key_mgmt.string()));
	s->pre_shared_key = config.pre_shared_key;
	int row = mStations.indexOf(s);
	emit dataChanged(createIndex(row, 0), createIndex(row, 0));
    }

    // Remove stations that didn't show up in the list and don't have scan results
    int row = 0;
    while (row < mStations.size()) {
	Station *s = mStations[row];
	if (s->network_id == -2) {
	    if (s->rssi != -9999) {
		s->network_id = -1;
		s->status = Station::UNKNOWN;
		row += 1;
	    }
	    else {
		beginRemoveRows(QModelIndex(), row, row);
		delete mStations.takeAt(row);
		endRemoveRows();
	    }
	}
	else {
	    row += 1;
	}
    }

    emit layoutAboutToBeChanged();
    QList<Station *> mOldList(mStations);
    qStableSort(mStations.begin(), mStations.end(), Station::lessThan);
    for (int row = 0 ; row < mStations.size() ; row++) {
	int old_row = mOldList.indexOf(mStations[row]);
	if (row != old_row)
	    changePersistentIndex(createIndex(old_row, 0), createIndex(row, 0));
    }
    emit layoutChanged();

    // qDebug() << " > After update, combined list is";
    // for (int row = 0 ; row < mStations.size() ; row++) {
    // 	Station *s = mStations[row];
    // 	qDebug("   id=%d ssid='%s' rssi=%d status=%d", s->network_id, 
    // 	       s->ssid.toLocal8Bit().constData(), s->rssi, s->status);
    // }
}
void CombinedModel::update(const android::Vector<android::ScannedStation>& update)
{
    // qDebug() << "[" << Q_FUNC_INFO;
    QMutexLocker locker(&sWifiMutex);

    // Remove all current RSSI values
    QListIterator<Station *> it(mStations);
    while (it.hasNext()) {
	Station *s = it.next();
	s->rssi = -9999;
	s->station_count = 0;
    }

    for (size_t i = 0 ; i < update.size() ; i++) {
	const android::ScannedStation& scanned(update[i]);
	Station *s = findBySsid(QString::fromLocal8Bit(scanned.ssid.string()));
	QSet<int> changed;
	changed << CombinedModel::RssiRole << CombinedModel::SignalLevelRole << CombinedModel::StationCountRole;

	if (scanned.rssi > s->rssi) 
	    s->rssi = scanned.rssi;  // Might be more than one station

	if (s->frequency != scanned.frequency) {
	    s->frequency = scanned.frequency;
	    changed << CombinedModel::FrequencyRole;
	}

	if (s->flags != scanned.flags) {
	    s->flags = scanned.flags;
	    s->key_mgmt = Station::flagsToKeyMgmt(QString::fromLocal8Bit(scanned.flags.string()));
	    changed << CombinedModel::FlagsRole << CombinedModel::KeyMgmtRole;
	}
	
	s->station_count += 1;
	int row = mStations.indexOf(s);
	// qDebug() << " ...data changed row" << row;
	emit dataChanged(createIndex(row, 0), createIndex(row, 0), changed);
    }

    // Remove stations that didn't show up on the scan
    int row = 0;
    while (row < mStations.size()) {
	Station *s = mStations[row];
	if (s->rssi == -9999 && s->network_id == -1) {
	    beginRemoveRows(QModelIndex(), row, row);
	    delete mStations.takeAt(row);
	    // qDebug() << " ...remove row" << row;
	    endRemoveRows();
	}
	else {
	    row += 1;
	}
    }

    emit layoutAboutToBeChanged();
    QList<Station *> mOldList(mStations);
    qStableSort(mStations.begin(), mStations.end(), Station::lessThan);
    for (int row = 0 ; row < mStations.size() ; row++) {
	int old_row = mOldList.indexOf(mStations[row]);
	if (row != old_row) {
	    changePersistentIndex(createIndex(old_row, 0), createIndex(row, 0));
	    // qDebug() << " ...move row" << old_row << "to" << row;
	}
    }
    emit layoutChanged();

    // qDebug() << " > After scan update, combined list is";
    // for (int row = 0 ; row < mStations.size() ; row++) {
    // 	Station *s = mStations[row];
    // 	qDebug("   id=%d ssid='%s' rssi=%d status=%d", s->network_id, 
    // 	       s->ssid.toLocal8Bit().constData(), s->rssi, s->status);
    // }
}