-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add monitoring beacons, add default constructor to Beacon class
- Loading branch information
1 parent
43d44bf
commit 4595a2c
Showing
17 changed files
with
708 additions
and
325 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// FBMonitoringStreamHandler.h | ||
// flutter_beacon | ||
// | ||
// Created by Alann Maulana on 23/01/19. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <Flutter/Flutter.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class FlutterBeaconPlugin; | ||
@interface FBMonitoringStreamHandler : NSObject<FlutterStreamHandler> | ||
|
||
@property (strong, nonatomic) FlutterBeaconPlugin* instance; | ||
|
||
- (instancetype) initWithFlutterBeaconPlugin:(FlutterBeaconPlugin*) instance; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// FBMonitoringStreamHandler.m | ||
// flutter_beacon | ||
// | ||
// Created by Alann Maulana on 23/01/19. | ||
// | ||
|
||
#import "FBMonitoringStreamHandler.h" | ||
#import <FlutterBeaconPlugin.h> | ||
|
||
@implementation FBMonitoringStreamHandler | ||
|
||
- (instancetype) initWithFlutterBeaconPlugin:(FlutterBeaconPlugin*) instance { | ||
if (self = [super init]) { | ||
_instance = instance; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
///------------------------------------------------------------ | ||
#pragma mark - Flutter Stream Handler | ||
///------------------------------------------------------------ | ||
|
||
- (FlutterError * _Nullable)onCancelWithArguments:(id _Nullable)arguments { | ||
if (self.instance) { | ||
[self.instance stopMonitoringBeacon]; | ||
} | ||
return nil; | ||
} | ||
|
||
- (FlutterError * _Nullable)onListenWithArguments:(id _Nullable)arguments eventSink:(nonnull FlutterEventSink)events { | ||
if (self.instance) { | ||
self.instance.flutterEventSinkMonitoring = events; | ||
[self.instance startMonitoringBeaconWithCall:arguments]; | ||
} | ||
return nil; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// FBRangingStreamHandler.h | ||
// flutter_beacon | ||
// | ||
// Created by Alann Maulana on 23/01/19. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <Flutter/Flutter.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class FlutterBeaconPlugin; | ||
@interface FBRangingStreamHandler : NSObject<FlutterStreamHandler> | ||
|
||
@property (strong, nonatomic) FlutterBeaconPlugin* instance; | ||
|
||
- (instancetype) initWithFlutterBeaconPlugin:(FlutterBeaconPlugin*) instance; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// FBRangingStreamHandler.m | ||
// flutter_beacon | ||
// | ||
// Created by Alann Maulana on 23/01/19. | ||
// | ||
|
||
#import "FBRangingStreamHandler.h" | ||
#import <FlutterBeaconPlugin.h> | ||
|
||
@implementation FBRangingStreamHandler | ||
|
||
- (instancetype) initWithFlutterBeaconPlugin:(FlutterBeaconPlugin*) instance { | ||
if (self = [super init]) { | ||
_instance = instance; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
///------------------------------------------------------------ | ||
#pragma mark - Flutter Stream Handler | ||
///------------------------------------------------------------ | ||
|
||
- (FlutterError * _Nullable)onCancelWithArguments:(id _Nullable)arguments { | ||
if (self.instance) { | ||
[self.instance stopRangingBeacon]; | ||
} | ||
return nil; | ||
} | ||
|
||
- (FlutterError * _Nullable)onListenWithArguments:(id _Nullable)arguments eventSink:(nonnull FlutterEventSink)events { | ||
if (self.instance) { | ||
self.instance.flutterEventSinkRanging = events; | ||
[self.instance startRangingBeaconWithCall:arguments]; | ||
} | ||
return nil; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
#import <Flutter/Flutter.h> | ||
|
||
@interface FlutterBeaconPlugin : NSObject<FlutterPlugin> | ||
|
||
@property FlutterEventSink flutterEventSinkRanging; | ||
@property FlutterEventSink flutterEventSinkMonitoring; | ||
|
||
- (void) startRangingBeaconWithCall:(id)arguments; | ||
- (void) stopRangingBeacon; | ||
- (void) startMonitoringBeaconWithCall:(id)arguments; | ||
- (void) stopMonitoringBeacon; | ||
|
||
@end |
Oops, something went wrong.