├── .gitignore ├── Core ├── EstimoteMirrorCore.podspec └── MirrorCoreSDK.framework │ ├── Headers │ ├── ECODataParserUtilities.h │ ├── EMSConfig.h │ ├── EMSDefinitions.h │ ├── EMSDevice.h │ ├── EMSDeviceConnectable.h │ ├── EMSDeviceFilter.h │ ├── EMSDeviceFilterMirror.h │ ├── EMSDeviceManager.h │ ├── EMSDeviceMirror.h │ ├── EMSLogger.h │ └── MirrorCoreSDK.h │ ├── Info.plist │ ├── MirrorCoreSDK │ └── Modules │ └── module.modulemap ├── EstimoteMirror.podspec ├── Examples ├── ObjectiveC │ ├── ObjC.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── DisplayExamples-ObjC.xcscheme │ ├── ObjC │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ └── main.m │ └── Podfile └── Swift │ ├── Podfile │ ├── Swift.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── DisplayExamples-Swift.xcscheme │ └── Swift │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── LICENSE.txt ├── MirrorDisplay.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── xcshareddata │ └── xcschemes │ ├── MirrorDisplay.xcscheme │ └── MirrorDisplayTests.xcscheme ├── README.md ├── Sources ├── DisplayRequest.swift ├── Info.plist ├── MirrorClient.swift ├── MirrorDisplay.h ├── ViewHelpers.swift └── Views │ └── Poster.swift ├── Tests ├── Info.plist └── ViewHelpersTests.swift └── Tools └── Mirrorator ├── .babelrc ├── .buckconfig ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── Preview.PNG ├── README.md ├── __tests__ ├── index.android.js └── index.ios.js ├── android ├── app │ ├── BUCK │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── mirrorator │ │ │ ├── MainActivity.java │ │ │ └── MainApplication.java │ │ └── res │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── keystores │ ├── BUCK │ └── debug.keystore.properties └── settings.gradle ├── app.json ├── index.android.js ├── index.ios.js ├── ios ├── Helpers │ ├── EventEmitter.swift │ ├── Func.swift │ ├── Log.swift │ ├── Logger.swift │ ├── MirrorHelper.m │ ├── MirrorHelper.swift │ ├── ReactNativeEventEmitter.m │ └── ReactNativeEventEmitter.swift ├── Mirrorator-Bridging-Header.h ├── Mirrorator-tvOS │ └── Info.plist ├── Mirrorator-tvOSTests │ └── Info.plist ├── Mirrorator.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── Mirrorator-tvOS.xcscheme │ │ └── Mirrorator.xcscheme ├── Mirrorator.xcworkspace │ └── contents.xcworkspacedata ├── Mirrorator │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Helpers │ │ ├── EventEmitter.swift │ │ ├── Func.swift │ │ ├── Log.swift │ │ ├── Logger.swift │ │ ├── MirrorHelper.swift │ │ ├── MirrorHelperBridgeManager.m │ │ ├── ReactNativeEventEmitter.m │ │ └── ReactNativeEventEmitter.swift │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-57x57@1x.png │ │ │ ├── Icon-App-57x57@2x.png │ │ │ ├── Icon-App-60x60@1x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-72x72@1x.png │ │ │ ├── Icon-App-72x72@2x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-76x76@3x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ ├── Icon-Small-50x50@1x.png │ │ │ └── Icon-Small-50x50@2x.png │ ├── Info.plist │ └── main.m ├── MirroratorTests │ ├── Info.plist │ └── MirroratorTests.m ├── Podfile └── Podfile.lock ├── jsconfig.json ├── package-lock.json ├── package.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | Core/MirrorCoreSDK.framework/eco_obfuscation_commit_sha.txt 2 | -------------------------------------------------------------------------------- /Core/EstimoteMirrorCore.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'EstimoteMirrorCore' 3 | s.version = '0.1.7' 4 | s.summary = 'Estimote MirrorCore SDK is responsible for the communication between the phone and Mirror.' 5 | 6 | s.description = <<-DESC 7 | Estimote MirrorCore SDK is responsible for the communication between the phone and Mirror. 8 | DESC 9 | 10 | s.homepage = 'https://github.com/Estimote/iOS-Mirror-SDK' 11 | s.license = { :type => 'Apache 2.0', :file => 'LICENSE.txt' } 12 | s.author = { 'Estimote' => 'contact@estimote.com' } 13 | s.source = { :git => 'https://github.com/Estimote/iOS-Mirror-SDK.git', :tag => s.version.to_s } 14 | s.social_media_url = 'https://twitter.com/estimote' 15 | 16 | s.ios.deployment_target = '8.0' 17 | s.vendored_frameworks = 'Core/MirrorCoreSDK.framework' 18 | end 19 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/ECODataParserUtilities.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Estimote. All rights reserved. 2 | 3 | #import 4 | 5 | typedef NS_ENUM(NSInteger, ECOByteDirection) 6 | { 7 | ECOByteDirectionOldYoung, 8 | ECOByteDirectionYoungOld, 9 | }; 10 | 11 | @interface ECODataParserUtilities : NSObject 12 | 13 | + (NSData *)combineByte:(char)one and:(char)two and:(char)three and:(char)four; 14 | 15 | + (NSString *)removeAngleBracketsAndSpacesFromString:(NSString *)string; 16 | 17 | + (NSString *)stringFromHex:(NSString *)hexString 18 | withHexOffset:(int)offset 19 | withLengthInBytes:(int)length 20 | withDirection:(ECOByteDirection)byteDirection; 21 | 22 | + (unsigned)unsignedFromHex:(NSString *)hexString 23 | withHexOffset:(int)offset 24 | withLengthInBytes:(int)length 25 | withDirection:(ECOByteDirection)byteDirection; 26 | 27 | + (NSString *)stringFromDeviceData:(NSData *)data 28 | withOffset:(int)byteOffset 29 | withLenght:(int)bytesLength 30 | withDirection:(ECOByteDirection)dir; 31 | 32 | + (NSData *)bytesFromHexString:(NSString *)hexString; 33 | + (NSData *)bytesFromHexString:(NSString *)hexString withDirection:(ECOByteDirection)dir; 34 | 35 | + (NSString *)revertHexString:(NSString *)hexString; 36 | 37 | + (NSData *)reverseDataForData:(NSData *)data; 38 | 39 | + (NSData *)swapBytesInData:(NSData *)data; 40 | 41 | + (BOOL)isValidHexString:(NSString *)string; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // ______ _ _ _ _____ _____ _ __ 3 | // | ____| | | (_) | | / ____| __ \| |/ / 4 | // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / 5 | // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < 6 | // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ 7 | // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ 8 | // 9 | // 10 | // Copyright (c) 2015 Estimote. All rights reserved. 11 | 12 | #import 13 | #import "EMSDefinitions.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /** 18 | * EMSConfig is used to configure Estimote Cloud API. It allows to authorize app using AppID and AppToken 19 | * and configure Estimote Analytics settings. 20 | */ 21 | 22 | @interface EMSConfig : NSObject 23 | 24 | #pragma mark - Estimote API Credentials 25 | 26 | /** 27 | * Sets App ID and App Token, enabling communication with the Estimote Cloud API. 28 | * 29 | * You can find your API App ID and API App Token in the Account Settings section of the Estimote Cloud. 30 | * 31 | * @param appID The API App ID. 32 | * @param appToken The API App Token. 33 | */ 34 | + (void)setupAppID:(NSString *)appID andAppToken:(NSString *)appToken; 35 | 36 | /** 37 | * Returns currently used App ID. 38 | * 39 | * @return currently used App ID. 40 | */ 41 | + (NSString * _Nullable)appID; 42 | 43 | /** 44 | * Returns currently used App Token. 45 | * 46 | * @return currently used App Token. 47 | */ 48 | + (NSString * _Nullable)appToken; 49 | 50 | /** 51 | * Checks if App ID and App Token were set. 52 | */ 53 | + (BOOL)isAuthorized; 54 | 55 | @end 56 | 57 | NS_ASSUME_NONNULL_END 58 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSDefinitions.h: -------------------------------------------------------------------------------- 1 | // 2 | // ______ _ _ _ _____ _____ _ __ 3 | // | ____| | | (_) | | / ____| __ \| |/ / 4 | // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / 5 | // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < 6 | // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ 7 | // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ 8 | // 9 | // 10 | // Copyright (c) 2016 Estimote. All rights reserved. 11 | 12 | typedef NS_ENUM(int, EMSConnectionStatus) 13 | { 14 | EMSConnectionStatusDisconnected, 15 | EMSConnectionStatusConnecting, 16 | EMSConnectionStatusConnected, 17 | EMSConnectionStatusUpdating 18 | }; 19 | 20 | typedef void(^EMSCompletionBlock)(NSError * _Nullable error); 21 | typedef void(^EMSObjectCompletionBlock)(id _Nullable result, NSError * _Nullable error); 22 | typedef void(^EMSDataCompletionBlock)(NSData * _Nullable result, NSError * _Nullable error); 23 | typedef void(^EMSNumberCompletionBlock)(NSNumber * _Nullable value, NSError * _Nullable error); 24 | typedef void(^EMSUnsignedShortCompletionBlock)(unsigned short value, NSError * _Nullable error); 25 | typedef void(^EMSBoolCompletionBlock)(BOOL value, NSError * _Nullable error); 26 | typedef void(^EMSStringCompletionBlock)(NSString * _Nullable value, NSError * _Nullable error); 27 | typedef void(^EMSProgressBlock)(NSInteger value, NSString * _Nullable description, NSError * _Nullable error); 28 | typedef void(^EMSArrayCompletionBlock)(NSArray * _Nullable value, NSError * _Nullable error); 29 | typedef void(^EMSDictionaryCompletionBlock)(NSDictionary * _Nullable value, NSError * _Nullable error); 30 | typedef void(^EMSCsRegisterCompletonBlock)(NSError * _Nullable error); 31 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSDevice.h: -------------------------------------------------------------------------------- 1 | // 2 | // EMSDevice.h 3 | // EstimoteMirrorCoreSDK 4 | // 5 | // Created by Estimote on 05.12.2016. 6 | // Copyright © 2016 Estimote. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface EMSDevice : NSObject 14 | 15 | @property (nonatomic, strong, readonly) NSString *identifier; 16 | @property (nonatomic, strong, readonly) NSUUID *peripheralIdentifier; 17 | @property (nonatomic, assign, readonly) NSInteger rssi; 18 | 19 | /** 20 | * Measured power of the beacon (with what RSSI [dBm] device can be heard at exactly 1 m). 21 | */ 22 | @property (nonatomic, readonly) NSInteger measuredPower; 23 | 24 | @property (nonatomic, strong, readonly) NSDate *discoveryDate; 25 | 26 | /** 27 | * Method allows to initialize object. 28 | * 29 | * @param identifier device identifier 30 | * @param peripheralIdentifier CBPeripheral object's identifier 31 | * @param rssi CBPeripheral object's RSSI 32 | * @param measuredPower Measured power of discovered device. 33 | * @param discoveryDate date of discovery 34 | * 35 | * @return Initialized object. 36 | */ 37 | - (instancetype)initWithDeviceIdentifier:(NSString *)identifier 38 | peripheralIdentifier:(NSUUID *)peripheralIdentifier 39 | rssi:(NSInteger)rssi 40 | measuredPower:(NSInteger)measuredPower 41 | discoveryDate:(NSDate *)discoveryDate; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSDeviceConnectable.h: -------------------------------------------------------------------------------- 1 | // 2 | // EMSDeviceConnectable.h 3 | // EstimoteMirrorCoreSDK 4 | // 5 | // Created by Estimote on 05.12.2016. 6 | // Copyright © 2016 Estimote. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EMSDevice.h" 11 | #import "EMSDefinitions.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @class EMSDeviceConnectable; 16 | 17 | /** 18 | * EMSDeviceConnectableDelegate defines protocol for EMSDeviceConnectable delegate object. 19 | */ 20 | @protocol EMSDeviceConnectableDelegate 21 | 22 | @optional 23 | 24 | /** 25 | * Method invoked when connection to device was successful. 26 | * 27 | * @param device Device connection was established with. 28 | */ 29 | - (void)emsDeviceConnectionDidSucceed:(EMSDeviceConnectable *)device; 30 | 31 | /** 32 | * Method invoked when device disconnect event occurred. 33 | * 34 | * @param device Disconnected device. 35 | * @param error Error representing reason of disconnect. 36 | */ 37 | - (void)emsDevice:(EMSDeviceConnectable *)device didDisconnectWithError:(NSError * _Nullable)error; 38 | 39 | /** 40 | * Method invoked when connection to device failed. 41 | * 42 | * @param device Device connection failed for. 43 | * @param error Error representing reason of failure. 44 | */ 45 | - (void)emsDevice:(EMSDeviceConnectable *)device didFailConnectionWithError:(NSError *)error; 46 | 47 | /** 48 | * Method invoked when connected peripheral is reading RSSI. 49 | * 50 | * @param device Peripheral's device. 51 | * @param RSSI RSSI of the connected peripheral. 52 | * @param error Error returned from reading peripheral's RSSI. 53 | */ 54 | - (void)emsDevice:(EMSDeviceConnectable *)device didUpdateRSSI:(NSNumber *)RSSI withError:(NSError * _Nullable)error; 55 | 56 | /** 57 | * Method invoked when connected peripheral receives data. 58 | * 59 | * @param data Received data from connected device. Data is nil in case of decoding error. 60 | */ 61 | - (void)didReceiveData:(NSDictionary * _Nullable)data; 62 | 63 | @end 64 | 65 | /** 66 | * EMSDeviceConnectable is a superclass for connectable Estimote devices. 67 | */ 68 | @interface EMSDeviceConnectable : EMSDevice 69 | 70 | /** 71 | * Delegate object that will get callbacks realted to connection. 72 | */ 73 | @property (nonatomic, weak) id _Nullable delegate; 74 | 75 | /** 76 | * Status of device connection. 77 | */ 78 | @property (nonatomic, assign, readonly) EMSConnectionStatus connectionStatus; 79 | 80 | #pragma mark Connectivity 81 | ///-------------------------------------------------------------------- 82 | /// @name Connectivity 83 | ///-------------------------------------------------------------------- 84 | 85 | /** 86 | * Perform connection to the device. 87 | */ 88 | - (void)connect; 89 | 90 | /** 91 | * Cancel connection to the device. 92 | */ 93 | - (void)disconnect; 94 | 95 | @end 96 | 97 | NS_ASSUME_NONNULL_END 98 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSDeviceFilter.h: -------------------------------------------------------------------------------- 1 | // 2 | // ______ _ _ _ _____ _____ _ __ 3 | // | ____| | | (_) | | / ____| __ \| |/ / 4 | // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / 5 | // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < 6 | // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ 7 | // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ 8 | // 9 | // 10 | // Copyright (c) 2016 Estimote. All rights reserved. 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | 17 | /** 18 | * Protocol that every filter class used by EMSDeviceManager should conform to. 19 | * 20 | * Defines predicate to be evaluated on EMSDevice subclass objects resulting from scanning 21 | * and scan classes to be used by a bluetooth scanner underneath the EMSDeviceManager. 22 | * 23 | * @see EMSDeviceManager, ECOScanInfoIBeacon. 24 | */ 25 | @protocol EMSDeviceFilter 26 | 27 | /** 28 | * Predicate that EMSDeviceManager evaluates on scan result objects to execute filtering by attribute (i.e. identifier). 29 | */ 30 | @property (nonatomic, strong, readonly) NSPredicate *devicesPredicate; 31 | 32 | /** 33 | * Method returns array of packet classes needed by bluetooth scanner. 34 | * 35 | * @return Array of ECOScanInfo subclasses. 36 | */ 37 | - (NSArray *)getScanInfoClasses; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSDeviceFilterMirror.h: -------------------------------------------------------------------------------- 1 | // 2 | // ______ _ _ _ _____ _____ _ __ 3 | // | ____| | | (_) | | / ____| __ \| |/ / 4 | // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / 5 | // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < 6 | // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ 7 | // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ 8 | // 9 | // 10 | // Copyright (c) 2016 Estimote. All rights reserved. 11 | 12 | #import 13 | #import "EMSDeviceFilter.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /** 18 | * Filter class enabling EMSDeviceManager class to scan for devices broadcasting 19 | * Estimote Mirror bluetooth packet. 20 | * 21 | * Class cane be initialised by providing 16-byte long identifiers defining directly 22 | * set of mirror devices we want to work with. 23 | * 24 | * @see EMSDeviceManager. 25 | */ 26 | @interface EMSDeviceFilterMirror : NSObject 27 | 28 | 29 | /** 30 | * Method allows to initialise filter accepting any devices broadcasting 31 | * Estimote Mirror bluetooth packet. 32 | * 33 | * @return Initialised filter. 34 | */ 35 | - (instancetype)init; 36 | 37 | /** 38 | * Method allows to initialise filter accepting devices broadcasting 39 | * Estimote Mirror bluetooth packet containing provided identifier. 40 | * 41 | * @param identifier 16-byte identifier of Mirror device. 42 | * 43 | * @return Initialised filter. 44 | */ 45 | - (instancetype)initWithIdentifier:(nullable NSString *)identifier; 46 | 47 | /** 48 | * Method allows to initialise filter accepting devices broadcasting 49 | * Estimote Mirror bluetooth packet containing one of provided identifiers. 50 | * 51 | * @param identifierArray Array containing 16-byte identifiers of Mirror devices. 52 | * 53 | * @return Initialised filter. 54 | */ 55 | - (instancetype)initWithIdentifierArray:(nullable NSArray *)identifierArray; 56 | 57 | @end 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSDeviceManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // ______ _ _ _ _____ _____ _ __ 3 | // | ____| | | (_) | | / ____| __ \| |/ / 4 | // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / 5 | // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < 6 | // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ 7 | // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ 8 | // 9 | // 10 | // Copyright (c) 2016 Estimote. All rights reserved. 11 | 12 | #import 13 | 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | 18 | @class EMSDeviceManager; 19 | 20 | @protocol EMSDeviceManagerDelegate 21 | 22 | @optional 23 | 24 | /** 25 | * Tells the delegate that one or more Estimote devices were discovered in the vicinity of the iOS device. 26 | * Actual class of objects depend on filter used to start the manager. 27 | * 28 | * @param manager The utility manager object reporting the event. 29 | * @param devices An array of EMSDevice subclass objects representing the discovered devices. 30 | * 31 | * @see EMSDeviceFilterMirror 32 | */ 33 | - (void)deviceManager:(EMSDeviceManager *)manager didDiscoverDevices:(NSArray *)devices; 34 | 35 | /** 36 | * Tells the delegate that a discovery error occurred. 37 | * 38 | * @param manager The utility manager object reporting the event. 39 | */ 40 | - (void)deviceManagerDidFailDiscovery:(EMSDeviceManager *)manager; 41 | 42 | @end 43 | 44 | @protocol EMSDeviceFilter; 45 | 46 | /** 47 | * The `EMSDeviceManager` class defines the interface for utility methods related to Estimote devices. 48 | * The main functionality allows to discover CoreBluetooth based representation of Estimote Beacon devices. 49 | * 50 | * One device manager instance can discover devices only with one filter at a time. 51 | */ 52 | 53 | @interface EMSDeviceManager : NSObject 54 | 55 | /** 56 | * Informs if a filtered or telemetry scan is in progress. 57 | */ 58 | @property (nonatomic, assign, readonly) BOOL isScanning; 59 | 60 | /** 61 | * Delegate to be informed about scan results every 1 sec. 62 | */ 63 | @property (nonatomic, weak) id delegate; 64 | 65 | /** 66 | * Start discovering Estimote devices determined by the filter, using CoreBluetooth. 67 | * One filter can be active per a EMSDeviceManager instance. 68 | * If called multiple times only the last provided filter is active. 69 | * 70 | * Causes the delegate to be called with -[EMSDeviceManagerDelegate deviceManager:didDiscoverDevices:] every 1 sec (default interval value). 71 | * 72 | * @param filter Object conforming to EMSDeviceFilter protocol. 73 | */ 74 | - (void)startDeviceDiscoveryWithFilter:(id)filter; 75 | 76 | /** 77 | * Start discovering Estimote devices determined by the filter, using CoreBluetooth. 78 | * One filter can be active per a EMSDeviceManager instance. 79 | * If called multiple times only the last provided filter is active. 80 | * 81 | * Causes the delegate to be called with -[EMSDeviceManagerDelegate deviceManager:didDiscoverDevices:] every `interval` seconds. 82 | * 83 | * @param filter Object conforming to EMSDeviceFilter protocol. 84 | * @param interval Device discovery interval in seconds. Interval's value cannot be smaller than 100 ms. Providing smaller value will be overriden with default 1 second interval. 85 | */ 86 | - (void)startDeviceDiscoveryWithFilter:(id)filter withInterval:(NSTimeInterval)interval; 87 | 88 | /** 89 | * Stops Estimote device discovery. 90 | */ 91 | - (void)stopDeviceDiscovery; 92 | 93 | 94 | @end 95 | 96 | NS_ASSUME_NONNULL_END 97 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSDeviceMirror.h: -------------------------------------------------------------------------------- 1 | // 2 | // ______ _ _ _ _____ _____ _ __ 3 | // | ____| | | (_) | | / ____| __ \| |/ / 4 | // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / 5 | // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < 6 | // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ 7 | // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ 8 | // 9 | // 10 | // Copyright © 2016 Estimote. All rights reserved. 11 | 12 | #import 13 | #import "EMSDeviceConnectable.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | #define EMSDeviceMirrorErrorDomain @"EMSDeviceMirrorErrorDomain" 18 | 19 | /** 20 | * Possible errors reported by this class. 21 | */ 22 | typedef NS_ENUM(NSInteger, EMSDeviceMirrorError) { 23 | /** 24 | * Bluetooth connection during connection failed. 25 | */ 26 | EMSDeviceMirrorErrorBluetoothConnectionFailed, 27 | /** 28 | * Bluetooth services discovery during connection failed. 29 | */ 30 | EMSDeviceMirrorErrorServicesDiscoveryFailed, 31 | /** 32 | * Estimote Cloud Authorization during connection failed. 33 | */ 34 | EMSDeviceMirrorErrorAuthorizationFailed, 35 | /** 36 | * Synchronizing settings from Cloud failed. 37 | */ 38 | EMSDeviceMirrorErrorSynchronizationFailed, 39 | /** 40 | * No such template on Mirror. 41 | */ 42 | EMSDeviceMirrorErrorTemplateMissing, 43 | /** 44 | * Specified template is not active. 45 | */ 46 | EMSDeviceMirrorErrorTemplateNotActive, 47 | /** 48 | * Mirror has template lock. 49 | */ 50 | EMSDeviceMirrorErrorTemplateLocked 51 | }; 52 | 53 | @interface EMSDeviceMirror : EMSDeviceConnectable 54 | 55 | /** 56 | * Flag indicates encryption is enabled. 57 | */ 58 | @property (nonatomic, readonly) BOOL displayAccessControlEnabled; 59 | 60 | /** 61 | * One sigma horizontal accuracy in meters. 62 | */ 63 | @property (nonatomic, readonly) double accuracy; 64 | 65 | /** 66 | * Designated initlizer. 67 | * 68 | * @param identifier Device's identifier. 69 | * @param peripheralIdentifier Identifier of Mirror's device peripheral. 70 | * @param rssi RSSI of scanned peripheral. 71 | * @param measuredPower Measured power of discovered device. 72 | * @param discoveryDate Date of discovery. 73 | * 74 | * @return Initilized EMSDeviceMirror object. 75 | */ 76 | - (instancetype)initWithDeviceIdentifier:(NSString *)identifier 77 | peripheralIdentifier:(NSUUID *)peripheralIdentifier 78 | rssi:(NSInteger)rssi 79 | measuredPower:(NSInteger)measuredPower 80 | discoveryDate:(NSDate *)discoveryDate 81 | displayAccessControlEnabled:(BOOL)displayAccessControlEnabled; 82 | 83 | /** 84 | * This method is responsbile for passing encrypted message to the Mirror device. 85 | * 86 | * @param message Data that will be sent to the Mirror device. 87 | * @param completion Completion block invoked after sending message to the device. Nil error value means success. 88 | */ 89 | - (void)display:(NSDictionary *)message completion:(EMSCompletionBlock)completion; 90 | 91 | /** 92 | * Method responsible for fetching and applying Cloud settings to Mirror device. 93 | */ 94 | - (void)synchronizeSettingsWithCompletion:(EMSCompletionBlock)completion; 95 | 96 | @end 97 | 98 | NS_ASSUME_NONNULL_END 99 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/EMSLogger.h: -------------------------------------------------------------------------------- 1 | // 2 | // ______ _ _ _ _____ _____ _ __ 3 | // | ____| | | (_) | | / ____| __ \| |/ / 4 | // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / 5 | // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < 6 | // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ 7 | // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ 8 | // 9 | // 10 | // Copyright (c) 2016 Estimote. All rights reserved. 11 | 12 | #import 13 | #include 14 | 15 | /** 16 | * User friendly ready to use macros for logging with each `EMSLogLevel`. 17 | */ 18 | #define EMSVerboseLog(fmt, ...) [EMSLogger log:[NSString stringWithFormat:(@"%s:%d " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__] withLevel:EMSLogLevelVerbose] 19 | #define EMSInfoLog(fmt, ...) [EMSLogger log:[NSString stringWithFormat:(@"%s:%d " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__] withLevel:EMSLogLevelInfo] 20 | #define EMSErrorLog(fmt, ...) [EMSLogger log:[NSString stringWithFormat:(@"%s:%d " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__] withLevel:EMSLogLevelError] 21 | #define EMSWarningLog(fmt, ...) [EMSLogger log:[NSString stringWithFormat:(@"%s:%d " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__] withLevel:EMSLogLevelWarning] 22 | #define EMSDebugLog(fmt, ...) [EMSLogger log:[NSString stringWithFormat:(@"%s:%d " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__] withLevel:EMSLogLevelDebug] 23 | 24 | /** 25 | * Log levels are used to filter out logs to print and cache. 26 | */ 27 | typedef enum : int 28 | { 29 | /** 30 | * No logs. 31 | */ 32 | EMSLogLevelNone, 33 | /** 34 | * Error logs only. 35 | */ 36 | EMSLogLevelError, 37 | /** 38 | * Error and warnings logs only. 39 | */ 40 | EMSLogLevelWarning, 41 | /** 42 | * This level is for printing all errors, warnings and debug related information. Should be used for current developement. 43 | * @warning When finished developing/enhancing code please turn logs from EMSLogLevelDebug to EMSLogLevelInfo. 44 | */ 45 | EMSLogLevelDebug, 46 | /** 47 | * This level is for printing all errors, warnings, debug related and informative logs. 48 | * @warning Not the same as EMSLogLevelDebug 49 | * @sa EMSLogLevelDebug 50 | */ 51 | EMSLogLevelInfo, 52 | /** 53 | * Level for all possible logs you want to print. Should be used for lowest possible level of information, e.g. printing CoreBluetooth data. 54 | * @warning *Important*: Keep in mind EMSLogLevelVerbose will produce a lot of logs. 55 | */ 56 | EMSLogLevelVerbose 57 | 58 | } EMSLogLevel; 59 | 60 | /** 61 | * EMSLogger is a helper class to faciliate handling logs and debugging. Class is compatible with KZLinkedConsole. 62 | */ 63 | 64 | @interface EMSLogger : NSObject 65 | 66 | /** 67 | * Method allows to set `EMSLogLevel` for console. Logs above given level will not be printed to console. 68 | */ 69 | + (void)setConsoleLogLevel:(EMSLogLevel)level; 70 | 71 | /** 72 | * Method allows to set `EMSLogLevel` for cache. Logs above given level will not be cached by logger. 73 | */ 74 | + (void)setCacheLogLevel:(EMSLogLevel)level; 75 | 76 | /** 77 | * Method retrieves logs from cache. 78 | */ 79 | + (NSString *)getLogCache; 80 | 81 | /** 82 | * Method clears cached logs. 83 | */ 84 | + (void)clearLogCache; 85 | 86 | /** 87 | * Method logs given string with specific level. @warning *Warning:* Using this method with `EMSLoglevel` higher than currently 88 | * set with `enableLogger:withLevel:` or `setConsoleLogLevel:` will not print message. 89 | */ 90 | + (void)log:(NSString *)message 91 | withLevel:(EMSLogLevel)level; 92 | 93 | /** 94 | * Write cached logs to document file. To retrieve it use iTunes File Sharing. For more info visit: https://support.apple.com/en-us/HT201301 . 95 | * 96 | * Remember to set UIFileSharingEnabled to YES (also known as "Application supports iTunes file sharing") in your app's Info.plist. 97 | */ 98 | + (void)dumpLogCacheToFile; 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Headers/MirrorCoreSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // ______ _ _ _ _____ _____ _ __ 3 | // | ____| | | (_) | | / ____| __ \| |/ / 4 | // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / 5 | // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < 6 | // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ 7 | // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ 8 | // 9 | // 10 | // Copyright (c) 2017 Estimote. All rights reserved. 11 | 12 | #import 13 | 14 | //! Project version number for MirrorCoreSDK. 15 | FOUNDATION_EXPORT double MirrorCoreSDKVersionNumber; 16 | 17 | //! Project version string for MirrorCoreSDK. 18 | FOUNDATION_EXPORT const unsigned char MirrorCoreSDKVersionString[]; 19 | 20 | // In this header, you should import all the public headers of your framework using statements like #import 21 | 22 | /** 23 | * Estimote Mirror SDK 24 | */ 25 | #import "EMSDefinitions.h" 26 | #import "EMSDeviceManager.h" 27 | #import "EMSDeviceMirror.h" 28 | #import "EMSDeviceFilterMirror.h" 29 | #import "EMSLogger.h" 30 | 31 | /** 32 | * Cloud API handling 33 | */ 34 | #import "EMSConfig.h" 35 | -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Estimote/iOS-Mirror-SDK/f0d9522e85d7c61d486fdbea00df800ae5592d1b/Core/MirrorCoreSDK.framework/Info.plist -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/MirrorCoreSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Estimote/iOS-Mirror-SDK/f0d9522e85d7c61d486fdbea00df800ae5592d1b/Core/MirrorCoreSDK.framework/MirrorCoreSDK -------------------------------------------------------------------------------- /Core/MirrorCoreSDK.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module MirrorCoreSDK { 2 | umbrella header "MirrorCoreSDK.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /EstimoteMirror.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'EstimoteMirror' 3 | s.version = '0.2.0' 4 | s.summary = 'Take control of the TV screen from your iOS app with Estimote Mirror SDK' 5 | s.description = <<-DESC 6 | The Mirror SDK is an addition to the Estimote Mirror Core SDK that enables easy interaction with built-in and custom templates. 7 | DESC 8 | 9 | s.homepage = 'https://github.com/Estimote/iOS-Mirror-SDK' 10 | s.license = { :type => 'Apache 2.0', :file => 'LICENSE.txt' } 11 | s.author = { 'Estimote' => 'contact@estimote.com' } 12 | s.source = { :git => 'https://github.com/Estimote/iOS-Mirror-SDK.git', :tag => s.version.to_s } 13 | s.social_media_url = 'https://twitter.com/estimote' 14 | 15 | s.ios.deployment_target = '10.0' 16 | s.swift_version = '4.1' 17 | 18 | s.source_files = 'Sources/**/*.{swift,h}' 19 | s.module_name = 'MirrorDisplay' 20 | 21 | s.dependency 'EstimoteMirrorCore' 22 | 23 | end 24 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC.xcodeproj/xcshareddata/xcschemes/DisplayExamples-ObjC.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AppDelegate : UIResponder 4 | 5 | 6 | @property (strong, nonatomic) UIWindow *window; 7 | 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | @interface AppDelegate () 4 | 5 | 6 | @end 7 | 8 | 9 | 10 | @implementation AppDelegate 11 | 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 14 | // Override point for customization after application launch. 15 | return YES; 16 | } 17 | 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application { 20 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 21 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 22 | } 23 | 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application { 26 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 27 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 28 | } 29 | 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application { 32 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 33 | } 34 | 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSLocationAlwaysAndWhenInUseUsageDescription 24 | This app uses location services to find Mirrors in your proximity. 25 | NSLocationWhenInUseUsageDescription 26 | This app uses location services to find Mirrors in your proximity. 27 | UIBackgroundModes 28 | 29 | bluetooth-central 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UIRequiredDeviceCapabilities 36 | 37 | armv7 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | 43 | UISupportedInterfaceOrientations~ipad 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationPortraitUpsideDown 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/ViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ViewController : UIViewController 4 | 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/ViewController.m: -------------------------------------------------------------------------------- 1 | #import "ViewController.h" 2 | 3 | @import MirrorDisplay; 4 | @import EstimoteProximitySDK; 5 | 6 | 7 | @interface ViewController () 8 | 9 | @property (strong, nonatomic) MirrorClient *mirrorClient; 10 | @property (strong, nonatomic) EPXProximityObserver *proximityObserver; 11 | 12 | @end 13 | 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | Poster *sneakersBanner = [[Poster alloc] init:^(PosterBuilder *p) { 21 | 22 | p.header = @"Exceptional traction\nfrom your first to final mile"; 23 | p.body = @"Now 20% off!"; 24 | p.image = [Image preloadedImageWithPath:@"shoe_big.jpg"]; 25 | 26 | p.style = [[PosterStyle alloc] init:^(PosterStyleBuilder *ps) { 27 | ps.imagePosition = 28 | [[Position alloc] initWithHorizontal:[HorizontalPosition center] 29 | vertical:[VerticalPosition topWithOffset:80]]; 30 | ps.textPosition = 31 | [[Position alloc] initWithHorizontal:[HorizontalPosition center] 32 | vertical:[VerticalPosition bottomWithOffset:80]]; 33 | ps.textAlign = TextAlignCenter; 34 | ps.headerFontSize = [FontSize fontSizeWithPercent:130]; 35 | }]; 36 | }]; 37 | 38 | self.mirrorClient = [[MirrorClient alloc] initWithAppID:@"" appToken:@""]; 39 | 40 | EPXCloudCredentials *credentials = [[EPXCloudCredentials alloc] initWithAppID:@"" appToken:@""]; 41 | 42 | self.proximityObserver = [[EPXProximityObserver alloc] initWithCredentials:credentials onError:^(NSError * _Nonnull error) { 43 | 44 | NSLog(@"%@", error); 45 | }]; 46 | 47 | 48 | EPXProximityZone *mirrorZone = [[EPXProximityZone alloc] initWithTag:@"mirror" range:[EPXProximityRange customRangeWithDesiredMeanTriggerDistance:1.0]]; 49 | 50 | mirrorZone.onEnter = ^(EPXProximityZoneContext * _Nonnull zoneContext) { 51 | NSLog(@"Enter mirror"); 52 | [self.mirrorClient displayView:sneakersBanner onMirrorWithIdentifier:zoneContext.deviceIdentifier]; 53 | }; 54 | 55 | mirrorZone.onExit = ^(EPXProximityZoneContext * _Nonnull zoneContext) { 56 | NSLog(@"Exit mirror"); 57 | }; 58 | 59 | [self.proximityObserver startObservingZones:@[mirrorZone]]; 60 | } 61 | 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/ObjC/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DisplayExamples-ObjC 4 | // 5 | // Created by Piotr Krawiec on 24/04/2017. 6 | // Copyright © 2017 Estimote. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Examples/ObjectiveC/Podfile: -------------------------------------------------------------------------------- 1 | target 'DisplayExamples-ObjC' do 2 | use_frameworks! 3 | pod 'EstimoteMirror' 4 | pod 'EstimoteBluetoothScanning' 5 | pod 'EstimoteProximitySDK' 6 | end -------------------------------------------------------------------------------- /Examples/Swift/Podfile: -------------------------------------------------------------------------------- 1 | target 'DisplayExamples-Swift' do 2 | use_frameworks! 3 | pod 'EstimoteMirror' 4 | pod 'EstimoteBluetoothScanning' 5 | pod 'EstimoteProximitySDK' 6 | end -------------------------------------------------------------------------------- /Examples/Swift/Swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Swift/Swift.xcodeproj/xcshareddata/xcschemes/DisplayExamples-Swift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Examples/Swift/Swift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | @UIApplicationMain 4 | class AppDelegate: UIResponder, UIApplicationDelegate { 5 | 6 | var window: UIWindow? 7 | 8 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 9 | // Override point for customization after application launch. 10 | return true 11 | } 12 | 13 | func applicationWillResignActive(_ application: UIApplication) { 14 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 15 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 16 | } 17 | 18 | func applicationDidEnterBackground(_ application: UIApplication) { 19 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 20 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 21 | } 22 | 23 | func applicationWillEnterForeground(_ application: UIApplication) { 24 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 25 | } 26 | 27 | func applicationDidBecomeActive(_ application: UIApplication) { 28 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 29 | } 30 | 31 | func applicationWillTerminate(_ application: UIApplication) { 32 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Examples/Swift/Swift/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /Examples/Swift/Swift/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Examples/Swift/Swift/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Examples/Swift/Swift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSLocationAlwaysAndWhenInUseUsageDescription 24 | This app uses location services to find Mirrors in your proximity. 25 | NSLocationWhenInUseUsageDescription 26 | This app uses location services to find Mirrors in your proximity. 27 | UIBackgroundModes 28 | 29 | bluetooth-central 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UIRequiredDeviceCapabilities 36 | 37 | armv7 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | 43 | UISupportedInterfaceOrientations~ipad 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationPortraitUpsideDown 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Examples/Swift/Swift/ViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | import MirrorDisplay 4 | import EstimoteProximitySDK 5 | 6 | class ViewController: UIViewController { 7 | 8 | let mirrorClient = MirrorClient(appID: "", appToken: "") 9 | var proximityObserver: EPXProximityObserver! 10 | 11 | 12 | override func viewDidLoad() { 13 | super.viewDidLoad() 14 | 15 | let sneakersBanner = Poster() { p in 16 | 17 | p.header = "Exceptional traction\nfrom your first to final mile" 18 | p.body = "Now 20% off!" 19 | p.image = .preloaded(path: "shoe_big.jpg") 20 | 21 | p.style = PosterStyle() { ps in 22 | ps.imagePosition = Position(horizontal: .center, vertical: .top(offset: 80)) 23 | ps.textPosition = Position(horizontal: .center, vertical: .bottom(offset: 80)) 24 | ps.textAlign = .center 25 | ps.headerFontSize = .percent(130) 26 | } 27 | } 28 | 29 | let credentials = CloudCredentials(appID: "", appToken: "") 30 | self.proximityObserver = ProximityObserver(credentials: credentials, onError: { error in 31 | print("\(error)") 32 | }) 33 | 34 | let mirrorZone = ProximityZone(tag: "mirror", range: ProximityRange.near) 35 | mirrorZone.onEnter = { zoneContext in 36 | print("Enter mirror") 37 | self.mirrorClient.display(sneakersBanner, onMirror: zoneContext.deviceIdentifier) 38 | } 39 | mirrorZone.onExit = { zoneContext in 40 | print("Exit mirror") 41 | } 42 | 43 | self.proximityObserver.startObserving([mirrorZone]) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | -------------------------------------------------------------------------------- /MirrorDisplay.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MirrorDisplay.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MirrorDisplay.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MirrorDisplay.xcodeproj/xcshareddata/xcschemes/MirrorDisplay.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /MirrorDisplay.xcodeproj/xcshareddata/xcschemes/MirrorDisplayTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | 41 | 42 | 48 | 49 | 51 | 52 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Estimote Mirror iOS SDK 2 | 3 | [Estimote Mirror]: http://blog.estimote.com/post/150398268230/launching-estimote-mirror-the-worlds-first 4 | 5 | [![CocoaPod Version](https://cocoapod-badges.herokuapp.com/v/EstimoteMirror/badge.png)](http://cocoapods.org/pods/estimotemirror) 6 | [![Apache License 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)) 7 | 8 | *This SDK allows you to take control of the big screen from your iOS app with [Estimote Mirror][]*. 9 | 10 | **Main features:** 11 | 12 | * *Building Mirror experience based on mobile SDKs* - you can start prototyping your first Mirror application, using only mobile Display SDK. There is no need to upload any code or resources upfront to the Mirror. 13 | 14 | * *Pre-defined views* - No need to design your first Mirror app view. iOS Mirror SDK lets you define customized screens based on pre-defined views; All you need to do is to declare basic styling and data. 15 | 16 | * *Feedback from Mirror screen to mobile* - Whenever any display action is triggered, your mobile app gets notified about it. You can handle successful screen change and perform further actions inside your mobile app. 17 | 18 | Please check the rest of README to get further details. 19 | 20 | We really appreciate your [feedback about our SDKs](#your-feedback-and-questions), thank you! 21 | 22 | # Table of Contents 23 | 24 | * [Installation](#installation) 25 | * [Quick start](#quick-start) 26 | * [Your feedback and questions](#your-feedback-and-questions) 27 | * [Changelog](#changelog) 28 | * [License](#license) 29 | 30 | # Installation 31 | 32 | ## Prerequisities 33 | * 1 [Estimote Mirror][] w/ **1.0.15+** firmware version. 34 | * An account in [Estimote Cloud](https://cloud.estimote.com/). 35 | * An iOS device with Bluetooth Low Energy support. We suggest using iOS 10.0+ (on iPhone 5s or newer). 36 | 37 | ## Pod 38 | 39 | Install via [CocoaPods](https://cocoapods.org/): 40 | - `$ pod init` in the project root directory 41 | - Edit your Podfile to include the following repositories under your project target 42 | ~~~ 43 | pod 'EstimoteMirror' 44 | pod 'EstimoteBluetoothScanning' 45 | pod 'EstimoteProximitySDK' 46 | ~~~ 47 | - `$ pod install` 48 | 49 | ## Obtain app credentials from Estimote Cloud 50 | 51 | To obtain Estimote Cloud credentials for your mobile application: 52 | 53 | 1. Log in to your [Estimote Cloud](https://cloud.estimote.com/) account. 54 | 2. Go to *Apps* section and click `Add new app` option. 55 | 3. Select `Your own app` option. 56 | 4. Save your *App Id/App Token* credentials. 57 | 58 | # Quick start 59 | 60 | Here is simple example for showing Poster View on the screen, when user appears in Mirror nearby range. 61 | 62 | ```Swift 63 | // Declare mirrorClient and proximityObserver as class properties 64 | let mirrorClient = MirrorClient(appID: "", appToken: "") 65 | var proximityObserver: EPXProximityObserver! 66 | 67 | // Inside you class implementation 68 | // Prepare your customized Poster View 69 | let sneakersBanner = Poster() { p in 70 | 71 | p.header = "Exceptional traction\nfrom your first to final mile" 72 | p.body = "Now 20% off!" 73 | p.image = .preloaded(path: "shoe_big.jpg") 74 | 75 | p.style = PosterStyle() { ps in 76 | 77 | ps.imagePosition = Position(horizontal: .center, vertical: .top(offset: 80)) 78 | ps.textPosition = Position(horizontal: .center, vertical: .bottom(offset: 80)) 79 | ps.textAlign = .center 80 | ps.headerFontSize = .percent(130) 81 | } 82 | } 83 | 84 | // Initialize your Estimote Cloud credentials 85 | let credentials = CloudCredentials(appID: "", appToken: "") 86 | 87 | // Build ProximityObserver with Cloud credentials 88 | self.proximityObserver = ProximityObserver(credentials: credentials, onError: { error in 89 | 90 | print("\(error)") 91 | }) 92 | 93 | // Define near proximity zone 94 | let mirrorZone = ProximityZone(tag: "mirror", range: ProximityRange.near) 95 | mirrorZone.onEnter = { zoneContext in 96 | 97 | print("Enter mirror") 98 | self.mirrorClient.display(sneakersBanner, onMirror: zoneContext.deviceIdentifier) 99 | } 100 | mirrorZone.onExit = { zoneContext in 101 | 102 | print("Exit mirror") 103 | } 104 | 105 | // Start proximity observation 106 | self.proximityObserver.startObserving([mirrorZone]) 107 | ``` 108 | 109 | Zone monitoring is based on Estimote Proximity SDK - the most reliable signal-processing technology. 110 | 111 | To get more details, you can check out README for [iOS-Proximity-SDK](https://github.com/Estimote/iOS-Proximity-SDK). 112 | 113 | # Your feedback and questions 114 | 115 | At Estimote we believe in open feedback! Here are some common ways to share your thoughts with us: 116 | 117 | * Posting issue/question/enhancement on [our issues page](../../../issues). 118 | * Asking our community managers on our [Estimote SDK for Android forum](https://forums.estimote.com). 119 | 120 | # Changelog 121 | 122 | To see what has changed in recent versions of our SDK, please visit [our releases page](../../../releases). 123 | 124 | # License 125 | 126 | [Apache 2.0](../license.txt) 127 | 128 | -------------------------------------------------------------------------------- /Sources/DisplayRequest.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | struct DisplayRequest { 4 | let id:UUID 5 | let mirrorIdentifier:String 6 | let dictionary:[String:Any] 7 | let completionBlock:((Error?) -> Void)? 8 | 9 | init(mirrorIdentifier:String, dictionary:[String:Any], completion:((_ error:Error?) -> Void)? = nil) { 10 | self.id = UUID() 11 | self.mirrorIdentifier = mirrorIdentifier 12 | self.dictionary = dictionary 13 | self.completionBlock = completion 14 | } 15 | 16 | init(mirrorIdentifier:String, view:View, completion:((_ error:Error?) -> Void)? = nil) { 17 | self.id = UUID() 18 | self.mirrorIdentifier = mirrorIdentifier 19 | self.dictionary = [ 20 | "template": "estimote/__built-in_views", 21 | "actions": [[ 22 | "showView": [ 23 | "id": self.id.uuidString, 24 | "type": view.typeName, 25 | "data": view.dataDict 26 | ]] 27 | ] 28 | ] 29 | self.completionBlock = completion 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.7 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/MirrorClient.swift: -------------------------------------------------------------------------------- 1 | import MirrorCoreSDK 2 | 3 | @objc 4 | public class MirrorClient: NSObject { 5 | 6 | fileprivate let mirrorDeviceManager = EMSDeviceManager() 7 | fileprivate var connectedMirrors = Set() 8 | fileprivate var displayRequests = Dictionary() 9 | 10 | @objc 11 | public convenience init(appID: String, appToken: String) { 12 | self.init() 13 | 14 | EMSConfig.setupAppID(appID, andAppToken: appToken) 15 | mirrorDeviceManager.delegate = self 16 | } 17 | 18 | @objc (displayView:onMirrorWithIdentifier:) 19 | public func display(_ view: View, onMirror identifier:String) { 20 | 21 | let displayRequest = DisplayRequest(mirrorIdentifier: identifier, view: view) 22 | self.display(displayRequest, onMirror: identifier) 23 | } 24 | 25 | @objc (displayDictionary:onMirrorWithIdentifier:) 26 | public func display(_ dictionary:Dictionary, onMirror identifier:String) { 27 | 28 | let displayRequest = DisplayRequest(mirrorIdentifier: identifier, dictionary: dictionary) 29 | self.display(displayRequest, onMirror: identifier) 30 | } 31 | 32 | fileprivate func display(_ displayRequest:DisplayRequest, onMirror identifier:String) { 33 | 34 | self.displayRequests[identifier] = displayRequest 35 | self.executeDisplayRequests() 36 | self.startScan(basedOn: self.displayRequests.map({return $0.value})) 37 | } 38 | 39 | fileprivate func startScan(basedOn displayRequests:[DisplayRequest]) { 40 | 41 | let mirrorIdentifiers = displayRequests.map({return $0.mirrorIdentifier}) 42 | self.startScan(for: mirrorIdentifiers) 43 | } 44 | 45 | fileprivate func startScan(for identifiers:[String]) { 46 | 47 | self.mirrorDeviceManager.startDeviceDiscovery(with: EMSDeviceFilterMirror(identifierArray: identifiers)) 48 | } 49 | 50 | fileprivate func executeDisplayRequests() { 51 | 52 | for mirror in self.connectedMirrors { 53 | if let displayRequest = self.displayRequests[mirror.identifier] { 54 | 55 | mirror.display(displayRequest.dictionary) { (error) in 56 | self.executedDisplayRequest(onMirror: mirror.identifier, error: error) 57 | } 58 | } 59 | } 60 | } 61 | 62 | fileprivate func executedDisplayRequest(onMirror identifier:String, error:Error?) { 63 | if let completion = self.displayRequests[identifier]?.completionBlock { 64 | completion(error) 65 | } 66 | self.displayRequests.removeValue(forKey: identifier) 67 | } 68 | } 69 | 70 | extension MirrorClient: EMSDeviceManagerDelegate { 71 | 72 | public func deviceManager(_ manager: EMSDeviceManager, didDiscoverDevices devices: [Any]) { 73 | 74 | for mirror in devices as! [EMSDeviceMirror] { 75 | if !self.connectedMirrors.contains(mirror) { 76 | mirror.delegate = self 77 | mirror.connect() 78 | } 79 | } 80 | } 81 | 82 | public func deviceManagerDidFailDiscovery(_ manager: EMSDeviceManager) { 83 | 84 | } 85 | } 86 | 87 | extension MirrorClient: EMSDeviceConnectableDelegate { 88 | 89 | public func emsDeviceConnectionDidSucceed(_ device: EMSDeviceConnectable) { 90 | 91 | guard let mirror = device as? EMSDeviceMirror else { 92 | print("Something went wrong! Connected to device that is not Estimote Mirror.") 93 | device.disconnect() 94 | return 95 | } 96 | 97 | self.connectedMirrors.insert(mirror) 98 | self.executeDisplayRequests() 99 | } 100 | 101 | public func emsDevice(_ device: EMSDeviceConnectable, didFailConnectionWithError error: Error) { 102 | 103 | guard let mirror = device as? EMSDeviceMirror else { 104 | print("Something went wrong! App tried to establish connection with a device that was not an Estimote Mirror.") 105 | return 106 | } 107 | 108 | self.executedDisplayRequest(onMirror: mirror.identifier, error: error) 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Sources/MirrorDisplay.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | //! Project version number for MirrorDisplay. 4 | FOUNDATION_EXPORT double MirrorDisplayVersionNumber; 5 | 6 | //! Project version string for MirrorDisplay. 7 | FOUNDATION_EXPORT const unsigned char MirrorDisplayVersionString[]; 8 | 9 | -------------------------------------------------------------------------------- /Sources/ViewHelpers.swift: -------------------------------------------------------------------------------- 1 | @objc 2 | public class View: NSObject { 3 | 4 | var typeName: String { 5 | get { 6 | assertionFailure("Got a call to `typeName` on an abstract class View, did you forget to override it in a subclass?") 7 | 8 | return "__UnknownView" 9 | } 10 | } 11 | 12 | var dataDict: [String: Any] { 13 | get { 14 | assertionFailure("Got a call to `dataDict` on an abstract class View, did you forget to override it in a subclass?") 15 | 16 | return [String: Any]() 17 | } 18 | } 19 | } 20 | 21 | 22 | 23 | extension UIColor { 24 | 25 | var serialized: String? { 26 | get { 27 | func convert(_ val: CGFloat) -> UInt8 { 28 | var clampedVal: CGFloat = val 29 | if val > 1.0 { 30 | clampedVal = 1.0 31 | } else if val < 0.0 { 32 | clampedVal = 0.0 33 | } 34 | return UInt8(clampedVal * 255.0) 35 | } 36 | 37 | var r: CGFloat = 0.0 38 | var g: CGFloat = 0.0 39 | var b: CGFloat = 0.0 40 | var a: CGFloat = 0.0 41 | 42 | if getRed(&r, green: &g, blue: &b, alpha: &a) { 43 | return "rgba(\(convert(r)),\(convert(g)),\(convert(b)),\(a))" 44 | } 45 | 46 | return nil 47 | } 48 | } 49 | 50 | } 51 | 52 | 53 | 54 | @objc 55 | public enum TextAlign: UInt8 { 56 | 57 | case left 58 | case center 59 | case right 60 | 61 | var serialized: String { 62 | get { 63 | switch self { 64 | case .left: 65 | return "left" 66 | case .center: 67 | return "center" 68 | case .right: 69 | return "right" 70 | } 71 | } 72 | } 73 | 74 | } 75 | 76 | 77 | 78 | @objc 79 | public final class FontSize: NSObject { 80 | 81 | @objc(fontSizeWithPercent:) 82 | public static func percent(_ percent: UInt16) -> FontSize { 83 | return FontSize(serialized: "\(percent)%") 84 | } 85 | 86 | let serialized: String 87 | 88 | private init(serialized: String) { 89 | self.serialized = serialized; 90 | } 91 | 92 | } 93 | 94 | 95 | 96 | @objc 97 | public final class Image: NSObject { 98 | 99 | @objc(preloadedImageWithPath:) 100 | public static func preloaded(path: String) -> Image { 101 | return Image(serialized: "/shared/\(path)") 102 | } 103 | 104 | let serialized: String 105 | 106 | private init(serialized: String) { 107 | self.serialized = serialized; 108 | } 109 | 110 | } 111 | 112 | 113 | 114 | @objc 115 | public final class VerticalPosition: NSObject { 116 | 117 | @objc 118 | public static let top = VerticalPosition(serialized: "top") 119 | 120 | @objc 121 | public static func top(offset: Int16) -> VerticalPosition { 122 | return VerticalPosition(serialized: "top \(offset)px") 123 | } 124 | 125 | @objc 126 | public static let bottom = VerticalPosition(serialized: "bottom") 127 | 128 | @objc 129 | public static func bottom(offset: Int) -> VerticalPosition { 130 | return VerticalPosition(serialized: "bottom \(offset)px") 131 | } 132 | 133 | @objc 134 | public static let center = VerticalPosition(serialized: "center") 135 | 136 | let serialized: String 137 | 138 | private init(serialized: String) { 139 | self.serialized = serialized; 140 | } 141 | 142 | } 143 | 144 | 145 | 146 | @objc 147 | public final class HorizontalPosition: NSObject { 148 | 149 | @objc 150 | public static let left = HorizontalPosition(serialized: "left") 151 | 152 | @objc 153 | public static func left(offset: Int16) -> HorizontalPosition { 154 | return HorizontalPosition(serialized: "left \(offset)px") 155 | } 156 | 157 | @objc 158 | public static let right = HorizontalPosition(serialized: "right") 159 | 160 | @objc 161 | public static func right(offset: Int) -> HorizontalPosition { 162 | return HorizontalPosition(serialized: "right \(offset)px") 163 | } 164 | 165 | @objc 166 | public static let center = HorizontalPosition(serialized: "center") 167 | 168 | let serialized: String 169 | 170 | private init(serialized: String) { 171 | self.serialized = serialized; 172 | } 173 | 174 | } 175 | 176 | 177 | 178 | @objc 179 | public final class Position: NSObject { 180 | 181 | @objc 182 | public init(horizontal: HorizontalPosition, vertical: VerticalPosition) { 183 | serialized = "\(horizontal.serialized) \(vertical.serialized)" 184 | } 185 | 186 | let serialized: String 187 | 188 | } 189 | -------------------------------------------------------------------------------- /Sources/Views/Poster.swift: -------------------------------------------------------------------------------- 1 | @objc 2 | public class Poster: View { 3 | 4 | let header: String? 5 | let body: String? 6 | let image: Image? 7 | 8 | let style: PosterStyle? 9 | 10 | @objc 11 | public convenience init(_ block: (PosterBuilder) -> Void) { 12 | let builder = PosterBuilder() 13 | block(builder) 14 | self.init(builder: builder) 15 | } 16 | 17 | init(builder: PosterBuilder) { 18 | self.header = builder.header 19 | self.body = builder.body 20 | self.image = builder.image 21 | 22 | self.style = builder.style 23 | } 24 | 25 | override var typeName: String { 26 | get { 27 | return "ImageView" 28 | } 29 | } 30 | 31 | override var dataDict: [String: Any] { 32 | get { 33 | return [ 34 | "header": header as Any, 35 | "body": body as Any, 36 | "image": image?.serialized as Any, 37 | 38 | "style": style?.dataDict as Any 39 | ] 40 | } 41 | } 42 | 43 | } 44 | 45 | @objc 46 | public class PosterBuilder: NSObject { 47 | 48 | @objc public var header: String? 49 | @objc public var body: String? 50 | @objc public var image: Image? 51 | 52 | @objc public var style: PosterStyle? 53 | 54 | } 55 | 56 | 57 | 58 | @objc 59 | public class PosterStyle: NSObject { 60 | 61 | let imagePosition: Position? 62 | let textPosition: Position? 63 | let fontSize: FontSize? 64 | let fontColor: UIColor? 65 | let textAlign: TextAlign? 66 | let backgroundColor: UIColor? 67 | let backgroundImage: Image? 68 | 69 | let headerFontSize: FontSize? 70 | let headerFontColor: UIColor? 71 | 72 | @objc 73 | public convenience init(_ block: (PosterStyleBuilder) -> Void) { 74 | let builder = PosterStyleBuilder() 75 | block(builder) 76 | self.init(builder: builder) 77 | } 78 | 79 | init(builder: PosterStyleBuilder) { 80 | self.imagePosition = builder.imagePosition 81 | self.textPosition = builder.textPosition 82 | self.fontSize = builder.fontSize 83 | self.fontColor = builder.fontColor 84 | self.textAlign = builder.textAlign 85 | self.backgroundColor = builder.backgroundColor 86 | self.backgroundImage = builder.backgroundImage 87 | 88 | self.headerFontSize = builder.headerFontSize 89 | self.headerFontColor = builder.headerFontColor 90 | } 91 | 92 | var dataDict: [String: Any] { 93 | get { 94 | return [ 95 | "imagePosition": imagePosition?.serialized as Any, 96 | "textPosition": textPosition?.serialized as Any, 97 | "fontSize": fontSize?.serialized as Any, 98 | "fontColor": fontColor?.serialized as Any, 99 | "textAlign": textAlign?.serialized as Any, 100 | "backgroundColor": backgroundColor?.serialized as Any, 101 | "backgroundImage": backgroundImage?.serialized as Any, 102 | 103 | "header": [ 104 | "fontSize": headerFontSize?.serialized as Any, 105 | "fontColor": headerFontColor?.serialized as Any 106 | ] 107 | ] 108 | } 109 | } 110 | } 111 | 112 | @objc 113 | public class PosterStyleBuilder: NSObject { 114 | 115 | @objc public var imagePosition: Position? 116 | @objc public var textPosition: Position? 117 | @objc public var fontSize: FontSize? 118 | @objc public var fontColor: UIColor? 119 | @objc public var textAlign: TextAlign = .left 120 | @objc public var backgroundColor: UIColor? 121 | @objc public var backgroundImage: Image? 122 | 123 | @objc public var headerFontSize: FontSize? 124 | @objc public var headerFontColor: UIColor? 125 | 126 | } 127 | -------------------------------------------------------------------------------- /Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Tests/ViewHelpersTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import MirrorDisplay 4 | 5 | class ViewHelpersTests: XCTestCase { 6 | 7 | func testUIColorExtension() { 8 | XCTAssertEqual(UIColor.white.serialized, "rgba(255,255,255,1.0)") 9 | XCTAssertEqual(UIColor.black.serialized, "rgba(0,0,0,1.0)") 10 | 11 | XCTAssertEqual(UIColor(red: 231/255.0, green: 9/255.0, blue: 127/255.0, alpha: 0.34).serialized, "rgba(231,9,127,0.34)") 12 | 13 | XCTAssertEqual(UIColor(red: 1.1, green: 1.1, blue: 1.1, alpha: 1.0).serialized, "rgba(255,255,255,1.0)") 14 | } 15 | 16 | func testTextAlign() { 17 | XCTAssertEqual(TextAlign.left.serialized, "left") 18 | XCTAssertEqual(TextAlign.center.serialized, "center") 19 | XCTAssertEqual(TextAlign.right.serialized, "right") 20 | } 21 | 22 | func testFontSize() { 23 | XCTAssertEqual(FontSize.percent(125).serialized, "125%") 24 | } 25 | 26 | func testImage() { 27 | XCTAssertEqual(Image.preloaded(path: "sneakers_demo/big_shoe.png").serialized, "assets/sneakers_demo/big_shoe.png") 28 | } 29 | 30 | func testVerticalPosition() { 31 | XCTAssertEqual(VerticalPosition.top.serialized, "top") 32 | XCTAssertEqual(VerticalPosition.top(offset: 50).serialized, "top 50px") 33 | 34 | XCTAssertEqual(VerticalPosition.bottom.serialized, "bottom") 35 | XCTAssertEqual(VerticalPosition.bottom(offset: -50).serialized, "bottom -50px") 36 | 37 | XCTAssertEqual(VerticalPosition.center.serialized, "center") 38 | } 39 | 40 | func testHorizontalPosition() { 41 | XCTAssertEqual(HorizontalPosition.left.serialized, "left") 42 | XCTAssertEqual(HorizontalPosition.left(offset: 50).serialized, "left 50px") 43 | 44 | XCTAssertEqual(HorizontalPosition.right.serialized, "right") 45 | XCTAssertEqual(HorizontalPosition.right(offset: -50).serialized, "right -50px") 46 | 47 | XCTAssertEqual(HorizontalPosition.center.serialized, "center") 48 | } 49 | 50 | func testPosition() { 51 | XCTAssertEqual(Position(horizontal: .center, vertical: .center).serialized, "center center") 52 | XCTAssertEqual(Position(horizontal: .left(offset: 100), vertical: .bottom(offset: -100)).serialized, "left 100px bottom -100px") 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Tools/Mirrorator/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } 4 | -------------------------------------------------------------------------------- /Tools/Mirrorator/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Tools/Mirrorator/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | .*/Libraries/react-native/ReactNative.js 16 | 17 | [include] 18 | 19 | [libs] 20 | node_modules/react-native/Libraries/react-native/react-native-interface.js 21 | node_modules/react-native/flow 22 | flow/ 23 | 24 | [options] 25 | emoji=true 26 | 27 | module.system=haste 28 | 29 | munge_underscores=true 30 | 31 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 32 | 33 | suppress_type=$FlowIssue 34 | suppress_type=$FlowFixMe 35 | suppress_type=$FixMe 36 | 37 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 38 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 39 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 40 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 41 | 42 | unsafe.enable_getters_and_setters=true 43 | 44 | [version] 45 | ^0.47.0 46 | -------------------------------------------------------------------------------- /Tools/Mirrorator/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Tools/Mirrorator/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Cocoapods 6 | # 7 | ios/Pods/ 8 | 9 | # Xcode 10 | # 11 | ios/build/ 12 | *.pbxuser 13 | !default.pbxuser 14 | *.mode1v3 15 | !default.mode1v3 16 | *.mode2v3 17 | !default.mode2v3 18 | *.perspectivev3 19 | !default.perspectivev3 20 | xcuserdata 21 | *.xccheckout 22 | *.moved-aside 23 | DerivedData 24 | *.hmap 25 | *.ipa 26 | *.xcuserstate 27 | project.xcworkspace 28 | 29 | # Android/IntelliJ 30 | # 31 | build/ 32 | .idea 33 | .gradle 34 | local.properties 35 | *.iml 36 | 37 | # node.js 38 | # 39 | node_modules/ 40 | npm-debug.log 41 | yarn-error.log 42 | 43 | # BUCK 44 | buck-out/ 45 | \.buckd/ 46 | *.keystore 47 | 48 | # fastlane 49 | # 50 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 51 | # screenshots whenever they are needed. 52 | # For more information about the recommended setup visit: 53 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 54 | 55 | fastlane/report.xml 56 | fastlane/Preview.html 57 | fastlane/screenshots 58 | -------------------------------------------------------------------------------- /Tools/Mirrorator/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Tools/Mirrorator/Preview.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Estimote/iOS-Mirror-SDK/f0d9522e85d7c61d486fdbea00df800ae5592d1b/Tools/Mirrorator/Preview.PNG -------------------------------------------------------------------------------- /Tools/Mirrorator/README.md: -------------------------------------------------------------------------------- 1 | # iOS Mirrorator 2 | 3 | Mirrorator is a prototyping tool for developing custom templates on Mirror. Switch between templats and populate them with data in a breeze! Develop a custom template for Mirror by following the instructions in [the Estimote Dev Portal](http://developer.estimote.com/mirror/build-your-own-template/). 🤘 4 | 5 | ## Example 6 | 7 |

8 | 11 |

12 | 13 | Fill the key-value pairs just as in the image above. 14 | 15 | On tapping `send`, the Estimote `distance` template that is located on Mirror, will be launched with the specified configuration - in this case, the `zone` will be `far`. 16 | 17 | Inside the HTML template script we simply listen for user data events. 18 | 19 | ```js 20 | if (window.mirror) { 21 | mirror.init(); 22 | mirror.listen(Mirror.Events.USER_DATA, { 23 | ondata: function(ev) { 24 | // do something with the received data 25 | }, 26 | ondisconnect: function(ev) {} 27 | }) 28 | } 29 | ``` 30 | 31 | ## Build and run 🏃‍ 32 | 33 | You'll require the [react native cli](https://facebook.github.io/react-native/docs/getting-started.html) to build and run the project. 34 | Run: 35 | > `$ brew install node` 36 | 37 | > `$ brew install watchman` 38 | 39 | > `$ npm install -g react-native-cli` 40 | 41 | Lastly, from root of the project run: 42 | > `$ npm install` 43 | 44 | Now you can build and run the example project from Xcode on your iDevice! 45 | 46 | ## Authentication 47 | 48 | Sending messages to Mirror requires your authentication. 49 | 50 | Add your [`appID` and `appToken`](https://community.estimote.com/hc/en-us/articles/203607313-What-are-App-ID-and-App-Token-and-what-do-I-need-them-for-) to respecive fields [in the `AppDelegate.m`](https://github.com/Estimote/iOS-Mirror-SDK/blob/master/Examples/Mirrorator/ios/Mirrorator/AppDelegate.m#L20) in order to send messages to any Mirror that is in `Deployed and Protected` access mode. 51 | 52 | Mirrors that are in the `Development` access mode require no authentication. 53 | 54 | Find and edit your Mirror settings in the Estimote Cloud dashboard! 55 | 56 | ![mirror_settings](https://user-images.githubusercontent.com/5576161/29865304-812755a2-8d75-11e7-9e6a-f05d59e5ffe3.png) -------------------------------------------------------------------------------- /Tools/Mirrorator/__tests__/index.android.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.android.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /Tools/Mirrorator/__tests__/index.ios.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.ios.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.mirrorator", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.mirrorator", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 37 | * // for example: to disable dev mode in the staging build type (if configured) 38 | * devDisabledInStaging: true, 39 | * // The configuration property can be in the following formats 40 | * // 'devDisabledIn${productFlavor}${buildType}' 41 | * // 'devDisabledIn${buildType}' 42 | * 43 | * // the root of your project, i.e. where "package.json" lives 44 | * root: "../../", 45 | * 46 | * // where to put the JS bundle asset in debug mode 47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 48 | * 49 | * // where to put the JS bundle asset in release mode 50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 51 | * 52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 53 | * // require('./image.png')), in debug mode 54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 55 | * 56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 57 | * // require('./image.png')), in release mode 58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 59 | * 60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 64 | * // for example, you might want to remove it from here. 65 | * inputExcludes: ["android/**", "ios/**"], 66 | * 67 | * // override which node gets called and with what additional arguments 68 | * nodeExecutableAndArgs: ["node"], 69 | * 70 | * // supply additional arguments to the packager 71 | * extraPackagerArgs: [] 72 | * ] 73 | */ 74 | 75 | apply from: "../../node_modules/react-native/react.gradle" 76 | 77 | /** 78 | * Set this to true to create two separate APKs instead of one: 79 | * - An APK that only works on ARM devices 80 | * - An APK that only works on x86 devices 81 | * The advantage is the size of the APK is reduced by about 4MB. 82 | * Upload all the APKs to the Play Store and people will download 83 | * the correct one based on the CPU architecture of their device. 84 | */ 85 | def enableSeparateBuildPerCPUArchitecture = false 86 | 87 | /** 88 | * Run Proguard to shrink the Java bytecode in release builds. 89 | */ 90 | def enableProguardInReleaseBuilds = false 91 | 92 | android { 93 | compileSdkVersion 23 94 | buildToolsVersion "23.0.1" 95 | 96 | defaultConfig { 97 | applicationId "com.mirrorator" 98 | minSdkVersion 16 99 | targetSdkVersion 22 100 | versionCode 1 101 | versionName "1.0" 102 | ndk { 103 | abiFilters "armeabi-v7a", "x86" 104 | } 105 | } 106 | splits { 107 | abi { 108 | reset() 109 | enable enableSeparateBuildPerCPUArchitecture 110 | universalApk false // If true, also generate a universal APK 111 | include "armeabi-v7a", "x86" 112 | } 113 | } 114 | buildTypes { 115 | release { 116 | minifyEnabled enableProguardInReleaseBuilds 117 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 118 | } 119 | } 120 | // applicationVariants are e.g. debug, release 121 | applicationVariants.all { variant -> 122 | variant.outputs.each { output -> 123 | // For each separate APK per architecture, set a unique version code as described here: 124 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 125 | def versionCodes = ["armeabi-v7a":1, "x86":2] 126 | def abi = output.getFilter(OutputFile.ABI) 127 | if (abi != null) { // null for the universal-debug, universal-release variants 128 | output.versionCodeOverride = 129 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 130 | } 131 | } 132 | } 133 | } 134 | 135 | dependencies { 136 | compile fileTree(dir: "libs", include: ["*.jar"]) 137 | compile "com.android.support:appcompat-v7:23.0.1" 138 | compile "com.facebook.react:react-native:+" // From node_modules 139 | } 140 | 141 | // Run this once to be able to run the application with BUCK 142 | // puts all compile dependencies into folder libs for BUCK to use 143 | task copyDownloadableDepsToLibs(type: Copy) { 144 | from configurations.compile 145 | into 'libs' 146 | } 147 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/java/com/mirrorator/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.mirrorator; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "Mirrorator"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/java/com/mirrorator/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.mirrorator; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | return Arrays.asList( 25 | new MainReactPackage() 26 | ); 27 | } 28 | }; 29 | 30 | @Override 31 | public ReactNativeHost getReactNativeHost() { 32 | return mReactNativeHost; 33 | } 34 | 35 | @Override 36 | public void onCreate() { 37 | super.onCreate(); 38 | SoLoader.init(this, /* native exopackage */ false); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Estimote/iOS-Mirror-SDK/f0d9522e85d7c61d486fdbea00df800ae5592d1b/Tools/Mirrorator/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Estimote/iOS-Mirror-SDK/f0d9522e85d7c61d486fdbea00df800ae5592d1b/Tools/Mirrorator/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Estimote/iOS-Mirror-SDK/f0d9522e85d7c61d486fdbea00df800ae5592d1b/Tools/Mirrorator/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Estimote/iOS-Mirror-SDK/f0d9522e85d7c61d486fdbea00df800ae5592d1b/Tools/Mirrorator/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Mirrorator 3 | 4 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Estimote/iOS-Mirror-SDK/f0d9522e85d7c61d486fdbea00df800ae5592d1b/Tools/Mirrorator/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Tools/Mirrorator/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 6 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /Tools/Mirrorator/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Mirrorator' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /Tools/Mirrorator/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mirrorator", 3 | "displayName": "Mirrorator" 4 | } -------------------------------------------------------------------------------- /Tools/Mirrorator/index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View 13 | } from 'react-native'; 14 | 15 | export default class Mirrorator extends Component { 16 | render() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.android.js 24 | 25 | 26 | Double tap R on your keyboard to reload,{'\n'} 27 | Shake or press menu button for dev menu 28 | 29 | 30 | ); 31 | } 32 | } 33 | 34 | const styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); 52 | 53 | AppRegistry.registerComponent('Mirrorator', () => Mirrorator); 54 | -------------------------------------------------------------------------------- /Tools/Mirrorator/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import _ from 'lodash' 8 | import React, { Component } from 'react'; 9 | import { 10 | AppRegistry, 11 | StyleSheet, 12 | Text, 13 | TextInput, 14 | View, 15 | Button, 16 | NativeModules, 17 | SectionList, 18 | FlatList, 19 | Dimensions, 20 | Slider, 21 | NativeEventEmitter 22 | } from 'react-native'; 23 | 24 | const { sendData, setThreshold, sync } = NativeModules.MirrorHelper 25 | const emitter = new NativeEventEmitter(NativeModules.ReactNativeEventEmitter) 26 | 27 | let threshold = 55 28 | const emptyDictionary = { 29 | 0: {'key':'', 'value':''} 30 | } 31 | 32 | class LogView extends Component { 33 | constructor(props) { 34 | super(props) 35 | this.state = {log:[]} 36 | const subscription = emitter.addListener('log', this.onLog.bind(this)) 37 | } 38 | 39 | render() { 40 | return ( 41 | _.uniqueId() } 43 | style = {{ flex : 1 }} 44 | data = {this.state.log} 45 | renderItem = { (item) => this.renderLog(item) } 46 | ListHeaderComponent = { () => LOG } 51 | /> 52 | ) 53 | } 54 | 55 | renderLog({item}) { 56 | console.log(item) 57 | return ( 58 | { item } 64 | ) 65 | } 66 | 67 | onLog(log) { 68 | console.log(log) 69 | this.setState({ log: [ ...this.state.log, log ] }) 70 | } 71 | } 72 | 73 | class Row extends Component { 74 | constructor(props) { 75 | super(props) 76 | const { item : { item: { key, value }} } = this.props 77 | this.state = { 78 | key: key, 79 | value: value 80 | } 81 | } 82 | 83 | render() { 84 | const { item : { index, item: { key, value }}, updateData, removeRow } = this.props 85 | return ( 86 | 95 | this.setState({ 'key': text }) } 106 | onEndEditing = { ({nativeEvent: { text }}) => updateData(index, 'key', text) } 107 | onSubmitEditing = { ({nativeEvent: { text }}) => updateData(index, 'key', text) } 108 | /> 109 | 110 | this.setState({ 'value': text }) } 121 | onEndEditing = { ({nativeEvent: { text }}) => updateData(index, 'value', text) } 122 | onSubmitEditing = { ({nativeEvent: { text }}) => updateData(index, 'value', text) } 123 | /> 124 |