Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Beacon data copy #630

Merged
merged 6 commits into from
Dec 16, 2017
Merged

Improve Beacon data copy #630

merged 6 commits into from
Dec 16, 2017

Commits on Dec 12, 2017

  1. Include running average in Parcel data

    This fixes a minor issue where the running average is not set after
    restoring a beacon from a parcel. Looking at the history it seems that
    the running average was an internal detail until #479 where support was
    added for running the service in a separate process.
    
    Part of the reason this needs to be included is that on Android 8.0 the
    running average _is_ restored and available for access. The reason the
    behavior is different across Android versions is in the way a service
    intent versus local notification handles the data `Bundle` (i.e. which
    [`Callback`](https://github.com/AltBeacon/android-beacon-library/blob/2.12.3/src/main/java/org/altbeacon/beacon/service/Callback.java#L58-L86)
    branch runs). Explicitly setting the `BeaconManager` to use scheduled
    scan jobs, forcing the first conditional code path using local
    notifications, allows the running average to be available on older
    versions.
    cupakromer committed Dec 12, 2017
    Configuration menu
    Copy the full SHA
    1f02531 View commit details
    Browse the repository at this point in the history
  2. Add omitted fields in copy beacon constructor

    It's unclear why `mManufacturer` wasn't included with the copy
    constructor originally. However, as it's an internal field which is also
    included in the serialization and parceling it probably should be copied
    here too.
    
    The `mMultiFrameBeacon` field was added later to provide better support
    for beacons with extra data packets (#387). It's likely this was just
    overlooked as most of the "copying" of beacons occurred through
    parceling at the time.
    cupakromer committed Dec 12, 2017
    Configuration menu
    Copy the full SHA
    ec07eb4 View commit details
    Browse the repository at this point in the history
  3. Whitespace only update

    cupakromer committed Dec 12, 2017
    Configuration menu
    Copy the full SHA
    29fd2ac View commit details
    Browse the repository at this point in the history
  4. Delegate AltBeacon constructors to parent

    It's unclear from the history why only some of the fields are part of
    the `AltBeacon` constructor. When initially implemented the constructor
    omitted copying `mRunningAverageRssi` and `mManufacturer`. Since then
    several additional data fields were added which are also not in the
    `AltBeacon` constructor:
    
      - `mExtraDataFields`
      - `mServiceUuid`
      - `mBluetoothName`
      - `mParserIdentifier`
      - `mMultiFrameBeacon`
    
    The only real change in this subclass seems to be the additional custom
    getter `getMfgReserved`. Based on the fact that the parceling logic and
    the builder all delegate to `Beacon` it seems reasonable that the
    general intended logic was to wrap the parent class.
    
    This fixes the two constructors so that all setup is based on the
    `Beacon` implementation. This ensures that any changes in `Beacon` are
    reflected by `AltBeacon` as well.
    cupakromer committed Dec 12, 2017
    Configuration menu
    Copy the full SHA
    49df8a7 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2017

  1. Configuration menu
    Copy the full SHA
    d956b84 View commit details
    Browse the repository at this point in the history
  2. Update tests with new fields

    These fields were added in #621.
    cupakromer committed Dec 15, 2017
    Configuration menu
    Copy the full SHA
    deaa42d View commit details
    Browse the repository at this point in the history