GithubHelp home page GithubHelp logo

revair-ios-sdk's Introduction

WowWee REV Air iOS SDK

The free REV Air iOS SDK lets you control your [WowWee REV Air (http://wowwee.com/rev/) on devices running iOS 9.0 and above and Xcode 8. To use this SDK you will also need a physical REV Air robot.

For information on WowWee products visit: http://www.wowwee.com

Table of Contents

Quick Installation

  1. Clone the repository

     git clone https://github.com/WowWeeLabs/REVAir-iOS-SDK.git
    
  2. In XCode, create a new project. The simplest application is a Single-View application.

  3. Open the project navigator in Xcode and drag the WowWeeREVAirDK.framework file from the Mac OS Finder to the Frameworks directory for your project in XCode.

  1. Confirm that the framework is added to your project by going into Project Settings (first item in the project navigator), then click the first target (e.g. revairsampleproject), then Build Phases. If there is not a "Copy Files" phase., click the top left + to add one. Set the destination to "Frameworks" and add the framework file under the "Name" section.

Also make that the framework is present under the "Link Binary With Libraries" section.

  1. In the DeviceHub.h file, add the following line at the top of the file:

     #import <WowWeeREVAirSDK/WowWeeREVAirSDK.h>
    

Alternatively you can add this line into your Project-Prefix.pch (e.g. REVAir-Prefix.pch) file so that you don't need to import in each class your planning to use the SDK in.

  1. Check that the project compiles successfully after completing the above steps by pressing ⌘+b in Xcode to build the project. The project should build successfully.

  2. You should be now ready to go! Plug in an iOS device then compile and run the project using ⌘+r . When you turn on an REV Air you should see some debug messages in the logs.

Using the SDK

  1. Choose the classes you want to handle the delegate callbacks from an REV Air, these classes will receive callbacks for when events happen (such as finding a new robot, robot connected, robot falls over etc) in this case we will simply choose our DeviceHub class.

     Scan
     	- (void)startScaning{
     		[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onREVAirFinderNotification:) name:REVAirFinderNotificationID object:nil];
     		[[REVAirFinderSDK sharedInstance] scanForRobots];
     	}
    
    
     	-(void)stopScaning{
     		[[REVAirFinderSDK sharedInstance] stopScanForRobots];
     		[[NSNotificationCenter defaultCenter] removeObserver:self name: REVAirFinderNotificationID object:nil];
     	}
    
     Connect directly when found available device via -(void)REVAirFoundNotification:(NSNotification *)note
     	- (void)onREVAirFinderNotification: (NSNotification *)notification {
     			NSDictionary *info = notification.userInfo;
     		    if(info){
     		        NSNumber *code = [info objectForKey: @"code"];
     		        //id data = [info objectForKey: @"data"];
     		        if (code.intValue == REVAirFinderNote_REVAirFound){
     				[peripheralList removeAllObjects];
         
     		        NSMutableArray* arr = [[REVAirFinder sharedInstance] robotsFound];
     		        for (int i=0; i<[arr count]; i++) {
     		                BluetoothRobot *robot = [arr objectAtIndex:i];
     		                [peripheralList addObject:robot];
     	                }
     	                [self.tableView reloadData];
     		    } else if (code.intValue == REVAirFinderNote_REVAirListCleared) {
     		            [self.tableView reloadData];
     		            [peripheralList removeAllObjects];
     		    } else if (code.intValue == REVAirFinderNote_BluetoothError) {
     		            NSLog(@"Bluetooth error!");
     		    } else if (code.intValue == REVAirFinderNote_BluetoothIsOff) {
     		            NSLog(@"Bluetooth is off!");
     		    } else if (code.intValue == REVAirFinderNote_BluetoothIsAvailable) {
     			    NSLog(@“REVAirFinderNote_BluetoothIsAvailable");
     		    }
     		}
     	}
    
     Connect via devices array [[REVAirFinderSDK sharedInstance]devicesFound] 
     	- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     	    REVAir *robot = nil;
     	    robot = [[[REVAirFinder sharedInstance] robotsFound] objectAtIndex:indexPath.row];
     	    robot.delegate = self;
     	    [robot connect];
     	    [viewLoading show];
     	}
     	
     	
     Drive REVAir
     	// - (void)joystickUpdate:(JoystickView *)joystick vector:(CGVector)vector
     		[[REVAirFinder sharedInstance] firstConnectedREVAir].stuntX = (int)(vector.dx * 450);
     		[[REVAirFinder sharedInstance] firstConnectedREVAir].stuntY = (int)(vector.dy * 450);
    
     	- (void)cycle
     		int pitch  = [[REVAirFinder sharedInstance] firstConnectedREVAir].stuntY;
         	int roll  = [[REVAirFinder sharedInstance] firstConnectedREVAir].stuntX;
     		[REVAir REVAirFreeFlightWithThrust:0 yaw:REVAirYAW pitch:pitch roll:roll];
    

Notes about the SDK

CocoaPods Compatible

For now we do not support CocoaPods. Pull requests are welcome.

Apple Watch Support

At present we don't have an Apple Watch device to test with. When it becomes available we are open to adding support for WatchKit.

Full Source Code

At this stage we do not plan on releasing our full library source code.

Are there any restrictions on releasing my own application?

The SDK is currently and will always be free for you to build and release your own applications. Your welcome to charge money or release free applications using our SDK without restrictions.

If you create a great application, all we ask is that you provide a link for people to purchase their own REVAir so they can enjoy your product.

OSX Support

Currently the SDK is not available for OSX however we will make this available if it's important to you. If that's the case please open up an issue in the bug tracker. .

Can I use your cool joystick class?

Yes we have provided the source code in our sample project, feel free to use this or make changes as you want. We would love pull requests.

License

REVAir iOS SDK is available under the Apache License, Version 2.0 license. See the LICENSE.txt file for more info.

You are free to use our SDK in your own projects whether free or paid. There are no restrictions on releasing into the Apple App Store or Google Play.

Contributing

We happily accept any pull requests and monitor issues on GitHub regularly. Please feel free to give us your suggestions or enhancements. Please note that due to resource constraints we most likely cannot add new features to the REV Air robot himself, but we will certainly consider them for inclusion to future robots/versions.

Tell your friends, fork our project, buy our robot and share with us your own projects! These are the best kinds of positive feedback to us.

Credits

Projects using this SDK

revair-ios-sdk's People

Contributors

davidchanwww avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.