Interactions

public class Interactions : SensorDelegateLogger

Log of interactions for recording encounters (time, proximity, and identity). This is can be used as basis for maintaining a persistent log of encounters for on-device or centralised matching.

  • Undocumented

    Declaration

    Swift

    public override init()
  • Undocumented

    Declaration

    Swift

    public init(filename: String, retention: TimeInterval = TimeInterval.fortnight)
  • Undocumented

    Declaration

    Swift

    public override func reset()
  • Undocumented

    Declaration

    Swift

    public func append(_ encounter: Encounter)
  • Get encounters from start date (inclusive) to end date (exclusive)

    Declaration

    Swift

    public func subdata(start: Date, end: Date) -> [Encounter]
  • Get all encounters from start date (inclusive)

    Declaration

    Swift

    public func subdata(start: Date) -> [Encounter]
  • Remove all log records before date (exclusive). Use this function to implement data retention policy.

    Declaration

    Swift

    public func remove(before: Date)
  • Undocumented

    Declaration

    Swift

    public override func sensor(_ sensor: SensorType, didMeasure: Proximity, fromTarget: TargetIdentifier, withPayload: PayloadData)
  • Herald achieves > 93% continuity for 30 second windows, thus quantising encounter timestamps into 60 second windows will offer a reasonable estimate of the different number of devices within detection range over time. The result is a timeseries of different payloads acquired during each 60 second window, along with the proximity data for each payload.

    Declaration

    Swift

    public func reduceByTime(_ encounters: [Encounter], duration: TimeInterval = 60) -> [(time: Date, context: [PayloadData : [Proximity]])]
  • Get all target devices, duration and proximity distribution. The result is a table of payload data and summary information, including last seen at time, total duration of exposure, and distribution of proximity (RSSI) values.

    Declaration

    Swift

    public func reduceByTarget(_ encounters: [Encounter]) -> [PayloadData : (lastSeenAt: Date, duration: TimeInterval, proximity: SampleStatistics)]
  • Histogram of exposure offers an esimate of exposure, while avoiding resolution of actual payload identity.

    Declaration

    Swift

    public func reduceByProximity(_ encounters: [Encounter], unit: ProximityMeasurementUnit = .RSSI, bin: Double = 1) -> [Double : TimeInterval]