Last active
August 20, 2020 20:51
-
-
Save brien-crean/1c5e89c065c79ad11140f389b5bcf9d7 to your computer and use it in GitHub Desktop.
Objective C flight controller singleton
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
@import DJISDK; | |
@interface RCTBridgeDJIFlightController : RCTEventEmitter<DJIFlightControllerDelegate> { | |
DJIFlightControllerState *flightControllerState; | |
NSString *testString; | |
} | |
@property(nonatomic, readonly) DJIFlightControllerState *flightControllerState; | |
@property(nonatomic, readonly) NSString *testString; | |
+ (id)sharedFlightController; | |
@end | |
@implementation RCTBridgeDJIFlightController | |
DJIFlightControllerState *flightControllerState; | |
NSString *testString; | |
@synthesize flightControllerState; | |
@synthesize testString; | |
+ (id)sharedFlightController { | |
static RCTBridgeDJIFlightController *sharedFlightControllerInstance = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedFlightControllerInstance = [[self alloc] init]; | |
}); | |
return sharedFlightControllerInstance; | |
} | |
- (id)init { | |
if (self = [super init]) { | |
flightControllerState = nil; | |
testString = @"TEST STRING"; | |
} | |
return self; | |
} | |
-(void)flightController:(DJIFlightController *)fc didUpdateState:(DJIFlightControllerState *)state { | |
flightControllerState = state; | |
} | |
@end |
Author
brien-crean
commented
Aug 20, 2020
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment