コード例 #1
0
 /**
  * @param beacon the beacon whose fields we should copy to this beacon builder
  * @return
  */
 public Builder copyBeaconFields(Beacon beacon) {
   setIdentifiers(beacon.getIdentifiers());
   setBeaconTypeCode(beacon.getBeaconTypeCode());
   setDataFields(beacon.getDataFields());
   setBluetoothAddress(beacon.getBluetoothAddress());
   setBluetoothName(beacon.getBluetoothName());
   setExtraDataFields(beacon.getExtraDataFields());
   setManufacturer(beacon.getManufacturer());
   setTxPower(beacon.getTxPower());
   setRssi(beacon.getRssi());
   setServiceUuid(beacon.getServiceUuid());
   return this;
 }
コード例 #2
0
 /**
  * Copy constructor
  *
  * @param otherBeacon
  */
 protected Beacon(Beacon otherBeacon) {
   super();
   mIdentifiers = new ArrayList<Identifier>(otherBeacon.mIdentifiers.size());
   mDataFields = new ArrayList<Long>(otherBeacon.mDataFields.size());
   mExtraDataFields = new ArrayList<Long>(otherBeacon.mExtraDataFields.size());
   for (int i = 0; i < otherBeacon.mIdentifiers.size(); i++) {
     mIdentifiers.add(otherBeacon.mIdentifiers.get(i));
   }
   for (int i = 0; i < otherBeacon.mDataFields.size(); i++) {
     mDataFields.add(otherBeacon.mDataFields.get(i));
   }
   for (int i = 0; i < otherBeacon.mExtraDataFields.size(); i++) {
     mExtraDataFields.add(otherBeacon.mExtraDataFields.get(i));
   }
   this.mDistance = otherBeacon.mDistance;
   this.mRunningAverageRssi = otherBeacon.mRunningAverageRssi;
   this.mRssi = otherBeacon.mRssi;
   this.mTxPower = otherBeacon.mTxPower;
   this.mBluetoothAddress = otherBeacon.mBluetoothAddress;
   this.mBeaconTypeCode = otherBeacon.getBeaconTypeCode();
   this.mServiceUuid = otherBeacon.getServiceUuid();
   this.mBluetoothName = otherBeacon.mBluetoothName;
 }