Skip to content

Commit

Permalink
fix TX power propery on Eddystone-UID & Eddytone-URL + bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-makarov committed Jul 25, 2017
1 parent 12a5a4a commit 44f3a25
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion BeaconKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ filename = File.basename(__FILE__, '.podspec')
Pod::Spec.new do |s|

s.name = "#{filename}"
s.version = '1.0.0'
s.version = '1.0.1'
s.summary = 'Beacon detection framework using CoreBluetooth'

s.description = <<~DESC
Expand Down
4 changes: 2 additions & 2 deletions BeaconKitTests/EddystoneUidParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class EddystoneUidParserTests: XCTestCase {
}

func testParsingValidBeacon() {
let data = Data.from(hex: "00e70001020304050607080901020304050A")
let data = Data.from(hex: "00010001020304050607080901020304050A")
let rssi = -25
let identifier = UUID()
let advertisement = BluetoothAdvertisement.service(CBUUID(string: "FEAA"), data)
Expand All @@ -30,7 +30,7 @@ class EddystoneUidParserTests: XCTestCase {
let beacon = beacons[0] as! EddystoneUidBeacon
XCTAssertEqual(beacon.rssi, rssi)
XCTAssertEqual(beacon.identifier, identifier)
XCTAssertEqual(beacon.txPower, -25)
XCTAssertEqual(beacon.txPower, -40)
XCTAssertEqual(beacon.beaconType, 0)
XCTAssertEqual(beacon.namespace, "00010203040506070809")
XCTAssertEqual(beacon.instance, "01020304050A")
Expand Down
4 changes: 2 additions & 2 deletions BeaconKitTests/EddystoneUrlParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class EddystoneUrlParserTests: XCTestCase {
}

func testParsingValidBeacon() {
let data = Data.from(hex: "10E703636F636F61636173747300")
let data = Data.from(hex: "100203636F636F61636173747300")
let rssi = -25
let identifier = UUID()
let advertisement = BluetoothAdvertisement.service(CBUUID(string: "FEAA"), data)
Expand All @@ -30,7 +30,7 @@ class EddystoneUrlParserTests: XCTestCase {
let beacon = beacons[0] as! EddystoneUrlBeacon
XCTAssertEqual(beacon.rssi, rssi)
XCTAssertEqual(beacon.identifier, identifier)
XCTAssertEqual(beacon.txPower, -25)
XCTAssertEqual(beacon.txPower, -39)
XCTAssertEqual(beacon.beaconType, 0x10)
XCTAssertEqual(beacon.url, URL(string: "https://cocoacasts.com/"))
XCTAssertEqual(beacon.beaconData.fields, [])
Expand Down
4 changes: 4 additions & 0 deletions Sources/Core/Classes/Beacon Implementations/Eddystone.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import CoreBluetooth
public class EddystoneBeacon: Beacon {
override open class var serviceUuid: CBUUID? { return CBUUID(string: "FEAA") }
override open class var advertisementType: AdvertisementType { return .service }
// Eddystone TX value is zeroed at 0m so need to subtract 41dB
// to get 1m TX power
// [reference]: https://github.com/google/eddystone/tree/master/eddystone-uid#tx-power
override public var txPower: Int { return super.txPower - 41 }
}

public class EddystoneUidBeacon: EddystoneBeacon {
Expand Down

0 comments on commit 44f3a25

Please sign in to comment.