Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: agrawal-git/react-native-beacons-manager
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: levepic/react-native-beacons-manager
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Dec 9, 2019

  1. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    1d98f3f View commit details
  2. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    e93ba9c View commit details
  3. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    e05928d View commit details
  4. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    47c6cca View commit details
  5. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    7d0df40 View commit details
  6. 1.2.6

    levepic committed Dec 9, 2019
    Copy the full SHA
    3cd0351 View commit details
  7. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    6092306 View commit details
  8. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    1eda75a View commit details
  9. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    cdf54a1 View commit details
  10. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    947d9c4 View commit details
  11. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    31f6b18 View commit details
  12. test

    levepic committed Dec 9, 2019
    Copy the full SHA
    b293d34 View commit details
  13. Update README.md

    levepic authored Dec 9, 2019
    Copy the full SHA
    57cd3d9 View commit details
  14. Update README.md

    levepic authored Dec 9, 2019
    Copy the full SHA
    5934606 View commit details
  15. remove log messages

    levepic committed Dec 9, 2019
    Copy the full SHA
    80a4e8e View commit details

Commits on Dec 10, 2019

  1. Update package.json

    levepic authored Dec 10, 2019
    Copy the full SHA
    f6c9ea0 View commit details
  2. Update build.gradle

    levepic authored Dec 10, 2019
    Copy the full SHA
    5110dbf View commit details
  3. Update README.md

    levepic authored Dec 10, 2019
    Copy the full SHA
    be0f61a View commit details
  4. android eddystone instance id

    levepic committed Dec 10, 2019
    Copy the full SHA
    e040323 View commit details
  5. Copy the full SHA
    5ff6fce View commit details
  6. Copy the full SHA
    1b413be View commit details
  7. Update README.md

    levepic authored Dec 10, 2019
    Copy the full SHA
    d2dc9d2 View commit details
  8. Update README.md

    levepic authored Dec 10, 2019
    Copy the full SHA
    da9c2f4 View commit details

Commits on Dec 13, 2019

  1. que yes

    levepic committed Dec 13, 2019
    Copy the full SHA
    702f7a7 View commit details
  2. Copy the full SHA
    d80d84d View commit details
  3. log rssi

    levepic committed Dec 13, 2019
    Copy the full SHA
    a196ade View commit details
  4. log rssi

    levepic committed Dec 13, 2019
    Copy the full SHA
    ebcd532 View commit details
  5. t

    levepic committed Dec 13, 2019
    Copy the full SHA
    802e25d View commit details
  6. x

    levepic committed Dec 13, 2019
    Copy the full SHA
    cdffdcc View commit details

Commits on Dec 17, 2019

  1. log rem

    levepic committed Dec 17, 2019
    Copy the full SHA
    fe96625 View commit details
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
[![npm](https://img.shields.io/npm/l/@hkpuits/react-native-beacons-manager.svg)](https://github.com/benlui/react-native-beacons-manager)
[![npm](https://img.shields.io/npm/v/@hkpuits/react-native-beacons-manager.svg)](https://www.npmjs.com/package/@hkpuits/react-native-beacons-manager)

# @hkpuits/react-native-beacons-manager
# fork of @hkpuits/react-native-beacons-manager

---
eddystone (kontakt io) support
---
fork descreption:original plugin was unable to handle kontakt io (eddystone) beacons.
for ios:added 6 byte instance id to eddystone uuid to be able to recognize kontaktio frames 100ms (by default recognizes only 1000ms ibeacon and recognizes eddystone without instance id) use EDDY_STONE_REGION_ID to start scan

for android: added instanceId key to beacon array to recognize eddystone unique ids. use Beacons.addEddystoneUIDDetection();


![logo](./images/RN-iBeacon.png)

@@ -232,4 +241,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ repositories {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.react:react-native:+'
implementation 'com.facebook.react:react-native:0.61.+'
implementation 'org.altbeacon:android-beacon-library:2.15.2'
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
Original file line number Diff line number Diff line change
@@ -456,7 +456,12 @@ private WritableMap createRangingResponse(Collection<Beacon> beacons, Region reg
for (Beacon beacon : beacons) {
WritableMap b = new WritableNativeMap();
b.putString("uuid", beacon.getId1().toString());
if (beacon.getIdentifiers().size() > 2) {
if (beacon.getServiceUuid() == 0xfeaa && beacon.getBeaconTypeCode() == 0x00) {
// This is a Eddystone-UID frame
b.putString("namespaceId", beacon.getId1().toString());
b.putString("instanceId", beacon.getId2().toString());
}
else if (beacon.getIdentifiers().size() > 2) {
b.putInt("major", beacon.getId2().toInt());
b.putInt("minor", beacon.getId3().toInt());
}
27 changes: 24 additions & 3 deletions ios/RNiBeacon/RNiBeacon/ESSBeaconScanner.m
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ - (instancetype)init {
}

- (void)startScanning {
NSLog(@"Startscan");
dispatch_async(_beaconOperationsQueue, ^{
if (_centralManager.state != CBCentralManagerStatePoweredOn) {
NSLog(@"CBCentralManager state is %ld, cannot start or stop scanning",
@@ -108,14 +109,28 @@ - (void)centralManager:(CBCentralManager *)central
RSSI:(NSNumber *)RSSI {
NSDictionary *serviceData = advertisementData[CBAdvertisementDataServiceDataKey];
NSData *beaconServiceData = serviceData[[ESSBeaconInfo eddystoneServiceID]];


//NSString* localName = advertisementData[CBAdvertisementDataLocalNameKey];
//NSLog(@"Name: (%s)", localName);
/*
NSMutableDictionary* advertisement = [NSMutableDictionary dictionary];
[advertisement setValue:[advertisementData valueForKey:CBAdvertisementDataLocalNameKey] forKey:@"localName"];
NSData* data = [advertisementData valueForKey:CBAdvertisementDataManufacturerDataKey];
NSString* dataString = [data base64EncodedStringWithOptions:0];
[advertisement setValue:dataString forKey:@"manufacturerData"];
*/

ESSFrameType frameType = [ESSBeaconInfo frameTypeForFrame:beaconServiceData];

// If it's a telemetry (TLM) frame, then save it into our cache so that the next time we get a
// UID frame (i.e. an Eddystone "sighting"), we can include the telemetry with it.
if (frameType == kESSEddystoneTelemetryFrameType) {
//NSLog(@"Frame type telemetry (%d).", (int)frameType);
_tlmCache[peripheral.identifier] = beaconServiceData;
//NSLog(@"Telemetry frame type (%d) detected.", (int)frameType);
//[self notifyDidRangeBeacon:_eddystoneBeaconsCache];
} else if (frameType == kESSEddystoneURLFrameType) {
//NSLog(@"Frame type kESSEddystoneURLFrameType (%d).", (int)frameType);
NSURL *url = [ESSBeaconInfo parseURLFromFrameData:beaconServiceData];

// Report the sighted URL frame.
@@ -124,6 +139,7 @@ - (void)centralManager:(CBCentralManager *)central
}
} else if (frameType == kESSEddystoneUIDFrameType
|| frameType == kESSEddystoneEIDFrameType) {
//NSLog(@"rssi (%f).", RSSI);
CBUUID *eddystoneServiceUUID = [ESSBeaconInfo eddystoneServiceID];
NSData *eddystoneServiceData = serviceData[eddystoneServiceUUID];

@@ -166,16 +182,21 @@ - (void)centralManager:(CBCentralManager *)central

_eddystoneBeaconsCache[beaconInfo.beaconID] = @{
kSeenCacheBeaconInfo: beaconInfo,
kSeenCacheOnLostTimer: onLostTimer,
//kSeenCacheOnLostTimer: onLostTimer,
};
[self notifyDidRangeBeacon:_eddystoneBeaconsCache];
} else {
// Reset the onLost timer.
[_eddystoneBeaconsCache[beaconInfo.beaconID][kSeenCacheOnLostTimer] reschedule];
_eddystoneBeaconsCache[beaconInfo.beaconID] = @{
kSeenCacheBeaconInfo: beaconInfo,
//kSeenCacheOnLostTimer: onLostTimer,
};
//[_eddystoneBeaconsCache[beaconInfo.beaconID][kSeenCacheOnLostTimer] reschedule];
[self notifyDidRangeBeacon:_eddystoneBeaconsCache];
}
}
} else {
//[self notifyDidRangeBeacon:_eddystoneBeaconsCache];
NSLog(@"Unsupported frame type (%d) detected. Ignorning.", (int)frameType);
}
}
6 changes: 3 additions & 3 deletions ios/RNiBeacon/RNiBeacon/RNiBeacon.m
Original file line number Diff line number Diff line change
@@ -406,7 +406,7 @@ -(void) locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)
}

if (self.dropEmptyRanges && beacons.count == 0) {
return;
//return;
}
NSMutableArray *beaconArray = [[NSMutableArray alloc] init];

@@ -431,7 +431,7 @@ -(void) locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)
@"beacons": beaconArray
};

NSLog(@"[Beacon][Native] beaconsDidRange %lu", [beaconArray count]);
NSLog(@"[Beacon][Native] ..beaconsDidRange %lu", [beaconArray count]);

[self sendEventWithName:@"beaconsDidRange" body:event];
}
@@ -543,7 +543,7 @@ - (NSNumber*)calculateDistance:(NSNumber*)txPower rssi:(NSNumber*) rssi {

- (NSString *)getEddyStoneUUID:(NSData*)data {
const unsigned char *dataBuffer = (const unsigned char *)[data bytes];
const int EDDYSTONE_UUID_LENGTH = 10;
const int EDDYSTONE_UUID_LENGTH = 16;
if (!dataBuffer) {
return [NSString string];
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hkpuits/react-native-beacons-manager",
"version": "1.2.5",
"version": "1.2.6",
"description": "React-Native library for detecting beacons (iOS and Android)",
"keywords": [
"react-native",
@@ -18,7 +18,7 @@
],
"repository": {
"type": "git",
"url": "https://github.com/benlui/react-native-beacons-manager.git"
"url": "https://github.com/levepic/react-native-beacons-manager.git"
},
"typescript": {
"definition": "typings/react-native-beacons-manager.d.ts"