├── mobile
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── strings.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── icon_drones_wear.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── icon_drones_wear.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── icon_drones_wear.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── icon_drones_wear.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── icon_drones_wear.png
│ │ │ ├── drawable
│ │ │ │ └── instruction_bg.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── sousoum
│ │ │ │ ├── drone
│ │ │ │ ├── ParrotFlyingDrone.java
│ │ │ │ ├── ParrotDroneFactory.java
│ │ │ │ ├── ParrotJumpingDrone.java
│ │ │ │ ├── ParrotMiniDrone.java
│ │ │ │ ├── ParrotBebopDrone.java
│ │ │ │ └── ParrotDrone.java
│ │ │ │ ├── discovery
│ │ │ │ └── Discoverer.java
│ │ │ │ └── droneswear
│ │ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── sousoum
│ │ │ └── droneswear
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── sousoum
│ │ └── droneswear
│ │ └── ApplicationTest.java
├── proguard-rules.pro
└── build.gradle
├── shared
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ └── color.xml
│ │ │ └── drawable
│ │ │ │ └── button_res.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── sousoum
│ │ │ │ └── shared
│ │ │ │ ├── InteractionType.java
│ │ │ │ ├── ActionType.java
│ │ │ │ ├── JoystickData.java
│ │ │ │ ├── AccelerometerData.java
│ │ │ │ └── Message.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── sousoum
│ │ │ └── shared
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── sousoum
│ │ └── shared
│ │ └── ApplicationTest.java
├── build.gradle
└── proguard-rules.pro
├── wear
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── mipmap-hdpi
│ │ │ └── icon_drones_wear.png
│ │ ├── mipmap-mdpi
│ │ │ └── icon_drones_wear.png
│ │ ├── mipmap-xhdpi
│ │ │ └── icon_drones_wear.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── icon_drones_wear.png
│ │ ├── values
│ │ │ └── strings.xml
│ │ └── layout
│ │ │ ├── action_layout.xml
│ │ │ └── activity_main.xml
│ │ ├── java
│ │ └── com
│ │ │ └── sousoum
│ │ │ ├── service
│ │ │ └── WearMessageListenerService.java
│ │ │ ├── views
│ │ │ └── JoystickView.java
│ │ │ └── droneswear
│ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── LICENSE
├── README.md
├── gradlew.bat
└── gradlew
/mobile/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/shared/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/wear/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':mobile', ':wear', ':shared'
2 |
--------------------------------------------------------------------------------
/mobile/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/shared/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Shared
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/mobile/src/main/res/mipmap-hdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/mobile/src/main/res/mipmap-hdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/mobile/src/main/res/mipmap-mdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/mobile/src/main/res/mipmap-mdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/wear/src/main/res/mipmap-hdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/wear/src/main/res/mipmap-hdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/wear/src/main/res/mipmap-mdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/wear/src/main/res/mipmap-mdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/wear/src/main/res/mipmap-xhdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/wear/src/main/res/mipmap-xhdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/wear/src/main/res/mipmap-xxhdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/wear/src/main/res/mipmap-xxhdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/mobile/src/main/res/mipmap-xhdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/mobile/src/main/res/mipmap-xhdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/mobile/src/main/res/mipmap-xxhdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/mobile/src/main/res/mipmap-xxhdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .idea/
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 | /releases
11 |
--------------------------------------------------------------------------------
/mobile/src/main/res/mipmap-xxxhdpi/icon_drones_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Parrot-Developers/DronesWear/HEAD/mobile/src/main/res/mipmap-xxxhdpi/icon_drones_wear.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Aug 12 00:54:01 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/mobile/src/main/res/drawable/instruction_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/shared/src/main/java/com/sousoum/shared/InteractionType.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.shared;
2 |
3 | /**
4 | * Created by d.bertrand on 15/01/16.
5 | */
6 | public class InteractionType
7 | {
8 | public static final int NONE = 1;
9 | public static final int ACTION = 2;
10 | public static final int JOYSTICK = 4;
11 | }
12 |
--------------------------------------------------------------------------------
/shared/src/main/res/drawable/button_res.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/shared/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/shared/src/main/java/com/sousoum/shared/ActionType.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.shared;
2 |
3 | /**
4 | * Created by d.bertrand on 15/01/16.
5 | */
6 | public class ActionType
7 | {
8 | public static final int NONE = 0;
9 | public static final int JUMP = 1;
10 | public static final int TAKE_OFF = 2;
11 | public static final int LAND = 3;
12 | }
13 |
--------------------------------------------------------------------------------
/wear/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DronesWear
3 | JUMP
4 | TAKE OFF
5 | LAND
6 | Action sent
7 | Connecting…
8 |
9 |
--------------------------------------------------------------------------------
/mobile/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/mobile/src/test/java/com/sousoum/droneswear/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.droneswear;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/shared/src/test/java/com/sousoum/shared/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.shared;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest
11 | {
12 | @Test
13 | public void addition_isCorrect() throws Exception
14 | {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/mobile/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/mobile/src/androidTest/java/com/sousoum/droneswear/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.droneswear;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/shared/src/androidTest/java/com/sousoum/shared/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.shared;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase
10 | {
11 | public ApplicationTest()
12 | {
13 | super(Application.class);
14 | }
15 | }
--------------------------------------------------------------------------------
/mobile/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 | 40dp
7 | 15dp
8 | 15dp
9 | 15dp
10 |
11 |
--------------------------------------------------------------------------------
/shared/src/main/res/values/color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #C6C6C6
6 | #607D8B
7 | #212121
8 | #727272
9 | #FFFFFF
10 | #B6B6B6
11 | #FFFFFF
12 |
--------------------------------------------------------------------------------
/mobile/src/main/java/com/sousoum/drone/ParrotFlyingDrone.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.drone;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 |
6 | import com.parrot.arsdk.ardiscovery.ARDiscoveryDeviceService;
7 |
8 | /**
9 | * Created by d.bertrand on 15/01/16.
10 | */
11 | public abstract class ParrotFlyingDrone extends ParrotDrone {
12 |
13 | public ParrotFlyingDrone(@NonNull ARDiscoveryDeviceService deviceService, Context ctx) {
14 | super(deviceService, ctx);
15 | }
16 |
17 | public abstract void sendEmergency();
18 | }
19 |
--------------------------------------------------------------------------------
/wear/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 /Users/d.bertrand/Development/sdk/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 |
--------------------------------------------------------------------------------
/mobile/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 /Users/d.bertrand/Development/sdk/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 |
--------------------------------------------------------------------------------
/shared/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "26.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 21
9 | targetSdkVersion 26
10 | versionCode rootProject.ext.versionCode
11 | versionName rootProject.ext.versionName
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | testCompile 'junit:junit:4.12'
24 | compile 'com.google.android.gms:play-services-wearable:11.0.4'
25 | }
26 |
--------------------------------------------------------------------------------
/shared/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 /Users/d.bertrand/Development/sdk/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 |
--------------------------------------------------------------------------------
/wear/src/main/res/layout/action_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/wear/src/main/java/com/sousoum/service/WearMessageListenerService.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.service;
2 |
3 | import android.content.Intent;
4 |
5 | import com.google.android.gms.wearable.MessageEvent;
6 | import com.google.android.gms.wearable.WearableListenerService;
7 | import com.sousoum.droneswear.MainActivity;
8 | import com.sousoum.shared.Message;
9 |
10 | /**
11 | * Created by d.bertrand on 12/02/16.
12 | */
13 | public class WearMessageListenerService extends WearableListenerService{
14 |
15 | @Override
16 | public void onMessageReceived(MessageEvent messageEvent) {
17 | super.onMessageReceived(messageEvent);
18 | if(messageEvent.getPath().equals(Message.OPEN_ACTIVITY_MESSAGE)){
19 | Intent intent = new Intent(this , MainActivity.class);
20 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
21 | startActivity(intent);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/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
--------------------------------------------------------------------------------
/shared/src/main/java/com/sousoum/shared/JoystickData.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.shared;
2 |
3 | /**
4 | * Created by d.bertrand on 07/01/16.
5 | */
6 | public class JoystickData
7 | {
8 | private final float mJoystickData[];
9 |
10 | public JoystickData(float percentX, float percentY) {
11 | mJoystickData = new float[2];
12 | setJoystickData(percentX, percentY);
13 | }
14 |
15 | public float getPercentX()
16 | {
17 | return mJoystickData[0];
18 | }
19 |
20 | public float getPercentY()
21 | {
22 | return mJoystickData[1];
23 | }
24 |
25 | public void setJoystickData(float percentX, float percentY) {
26 | mJoystickData[0] = percentX;
27 | mJoystickData[1] = percentY;
28 | }
29 |
30 | @Override
31 | public String toString()
32 | {
33 | return "Joystick = [" + getPercentX() + ", " + getPercentY() + "]";
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/mobile/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "26.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.sousoum.droneswear"
9 | minSdkVersion 21
10 | targetSdkVersion 26
11 | versionCode rootProject.ext.versionCode
12 | versionName rootProject.ext.versionName
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | wearApp project(path: ':wear', configuration: 'wear1Release')
25 | compile project(':shared')
26 | testCompile 'junit:junit:4.12'
27 | compile 'com.android.support:appcompat-v7:26.0.0'
28 | compile 'com.google.android.gms:play-services-wearable:11.0.4'
29 | compile 'com.parrot:arsdk:3.12.6'
30 | }
31 |
--------------------------------------------------------------------------------
/mobile/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/shared/src/main/java/com/sousoum/shared/AccelerometerData.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.shared;
2 |
3 | /**
4 | * Created by d.bertrand on 07/01/16.
5 | */
6 | public class AccelerometerData
7 | {
8 | private final float mAccData[];
9 |
10 | public AccelerometerData(float accX, float accY, float accZ) {
11 | mAccData = new float[3];
12 | setAccData(accX, accY, accZ);
13 | }
14 |
15 | public float getAccX()
16 | {
17 | return mAccData[0];
18 | }
19 |
20 | public float getAccY()
21 | {
22 | return mAccData[1];
23 | }
24 |
25 | public float getAccZ()
26 | {
27 | return mAccData[2];
28 | }
29 |
30 | public void setAccData(float accX, float accY, float accZ) {
31 | mAccData[0] = accX;
32 | mAccData[1] = accY;
33 | mAccData[2] = accZ;
34 | }
35 |
36 | @Override
37 | public String toString()
38 | {
39 | return "Accelero = [" + getAccX() + ", " + getAccY() + ", " + getAccZ() + "]";
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/mobile/src/main/java/com/sousoum/drone/ParrotDroneFactory.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.drone;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 |
6 | import com.parrot.arsdk.ardiscovery.ARDiscoveryDeviceService;
7 | import com.parrot.arsdk.ardiscovery.ARDiscoveryService;
8 |
9 | /**
10 | * Created by d.bertrand on 15/01/16.
11 | */
12 | public class ParrotDroneFactory {
13 | public static ParrotDrone createParrotDrone(@NonNull ARDiscoveryDeviceService deviceService, Context ctx) {
14 | ParrotDrone drone = null;
15 | switch (ARDiscoveryService.getProductFamily(ARDiscoveryService.getProductFromProductID(deviceService.getProductID()))) {
16 | case ARDISCOVERY_PRODUCT_FAMILY_ARDRONE:
17 | drone = new ParrotBebopDrone(deviceService, ctx);
18 | break;
19 | case ARDISCOVERY_PRODUCT_FAMILY_JS:
20 | drone = new ParrotJumpingDrone(deviceService, ctx);
21 | break;
22 | case ARDISCOVERY_PRODUCT_FAMILY_MINIDRONE:
23 | drone = new ParrotMiniDrone(deviceService, ctx);
24 | break;
25 | }
26 |
27 | return drone;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/wear/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 |
4 | android {
5 | compileSdkVersion 26
6 | buildToolsVersion "26.0.1"
7 |
8 | // Allows you to reference product flavors in your
9 | // phone module's build.gradle file
10 | publishNonDefault true
11 |
12 | defaultConfig {
13 | applicationId "com.sousoum.droneswear"
14 | minSdkVersion 23
15 | targetSdkVersion 26
16 | versionCode rootProject.ext.versionCode
17 | versionName rootProject.ext.versionName
18 | }
19 |
20 | productFlavors {
21 | wear1 {
22 | // Use the defaultConfig value
23 | }
24 | wear2 {
25 | minSdkVersion 24
26 | // naming is maj-min-patch-type-build-multiapkvar
27 | // (with two digits for each -
28 | // except type which is 0 for alpha, 1 for beta, 2 for release and build number which is 1 digit)
29 | versionCode = 20100201
30 | }
31 | }
32 |
33 | buildTypes {
34 | release {
35 | minifyEnabled false
36 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
37 | }
38 | }
39 | }
40 |
41 | dependencies {
42 | compile fileTree(dir: 'libs', include: ['*.jar'])
43 | compile 'com.android.support:wear:26.0.0'
44 | compile 'com.google.android.support:wearable:2.0.4'
45 | provided 'com.google.android.wearable:wearable:2.0.4'
46 | compile 'com.google.android.gms:play-services-wearable:11.0.4'
47 | compile project(':shared')
48 | }
49 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016, Djavan Bertrand
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice,
8 | this list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | 3. Neither the name of the copyright holder nor the names of its contributors
15 | may be used to endorse or promote products derived from this software
16 | without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/mobile/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DronesWear
3 | Disconnect your drone from all other devices
4 | Go to your phone/tablet wifi settings
5 | Select the Wifi network of your drone
6 | Authorize a non-internet network in the notifications
7 | Come back in this app
8 | Wait a few seconds and enjoy piloting!
9 | Discovery takes too long to be normal…
10 | Looking for a Parrot device to connect
11 | "Connecting to Parrot Device: %s"
12 | Parrot device disconnected. Trying to reconnect.
13 | Parrot device %s connected
14 | Emergency
15 | If you are experiencing too many disconnections\n
16 | try putting you\'re drone on a 5ghz band \n
17 | (with the Parrot official app).
18 |
19 | Pilot from wear
20 | When you are ready to pilot it, \n
21 | tap on the \n
22 | \"Pilot from wear\" switch.
23 | You can start using your watch \n
24 | to move the drone.
25 |
26 |
--------------------------------------------------------------------------------
/wear/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
15 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
32 |
33 |
34 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #DronesWear
2 |
3 | ##Purpose
4 | DronesWear is an Android app which lets you control some of the Parrot drones
5 | with your Android wear device (and its handheld device).
6 |
7 | It is available on the [Play Store](https://play.google.com/store/apps/details?id=com.sousoum.droneswear).
8 |
9 | ##Supported Parrot drones
10 | You can control these drones:
11 |
12 | - Bebop
13 | - Bebop 2
14 | - Jumping Sumo
15 | - Jumping Race
16 | - Jumping Night
17 | - Rolling Spider
18 | - Airborne Night
19 | - Airborne Cargo
20 | - Mambo
21 |
22 | ##Interactions
23 |
24 | ###Flying drones
25 | On the flying drones, you can take off and land,
26 | and also control the drone on pitch and roll
27 | (make them fly forward, backward, on left and right).
28 |
29 | You can also use the joystick to control the drone orientation and altitude (up and down for altitude, left and right for orientation).
30 |
31 | On the handheld device, you can at any time stop the propellers in case of emergency.
32 |
33 | ###Jumping drones
34 | You can pilot the jumping drones with the watch. You can also make them jump.
35 |
36 | ##Security
37 | At any time, you can stop piloting the drone with the *pilot from wear* switch button on your phone. Switching it off will make the flying drones hover and the jumping ones stop moving.
38 |
39 | ##Usage
40 | 1. Connect your phone to the drone's Wifi.
41 | **If an Android notification asks you if you want to stay connected even
42 | if there is no internet connection, please answer yes**.
43 | 2. Open the app on your phone and on your watch (no precise order required).
44 | 3. Wait for the app to connect to your drone (a message will inform you about the status)
45 | 4. Now that you're connected, the action button is displayed on the watch.
46 | 5. Just move your wrist gently and see how the drone moves :)
47 |
48 | **If disconnections appears to often, be sure that your drone is on a 5ghz Wifi** (if your country laws authorize it). You can change the Wifi band of your drone with the official Parrot app FreeFlight3.
49 |
50 | ##SDK
51 | The app uses the latest Parrot Drone SDK release. It gets the SDK libs from JCenter.
52 |
53 | You can find the SDK documentation here: [http://developer.parrot.com/](http://developer.parrot.com/).
54 |
55 | If you need to ask questions about the SDK: [http://forum.developer.parrot.com/](http://forum.developer.parrot.com/).
56 |
57 | ##Credit
58 | This project has been created and is maintained by Djavan Bertrand.
59 |
60 | Parrot is assuming no responsibility on this code.
61 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/wear/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
32 |
33 |
39 |
40 |
47 |
48 |
49 |
72 |
--------------------------------------------------------------------------------
/mobile/src/main/java/com/sousoum/drone/ParrotJumpingDrone.java:
--------------------------------------------------------------------------------
1 | package com.sousoum.drone;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.util.Log;
6 |
7 | import com.parrot.arsdk.arcommands.ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_ENUM;
8 | import com.parrot.arsdk.arcommands.ARCOMMANDS_JUMPINGSUMO_NETWORK_WIFISCAN_BAND_ENUM;
9 | import com.parrot.arsdk.arcontroller.ARCONTROLLER_DEVICE_STATE_ENUM;
10 | import com.parrot.arsdk.arcontroller.ARCONTROLLER_DICTIONARY_KEY_ENUM;
11 | import com.parrot.arsdk.arcontroller.ARCONTROLLER_ERROR_ENUM;
12 | import com.parrot.arsdk.arcontroller.ARControllerArgumentDictionary;
13 | import com.parrot.arsdk.arcontroller.ARControllerDictionary;
14 | import com.parrot.arsdk.arcontroller.ARDeviceController;
15 | import com.parrot.arsdk.arcontroller.ARFeatureJumpingSumo;
16 | import com.parrot.arsdk.ardiscovery.ARDiscoveryDeviceService;
17 | import com.sousoum.shared.AccelerometerData;
18 | import com.sousoum.shared.ActionType;
19 | import com.sousoum.shared.JoystickData;
20 |
21 | /**
22 | * Created by d.bertrand on 15/01/16.
23 | */
24 | public class ParrotJumpingDrone extends ParrotDrone {
25 | private static final String TAG = "ParrotJumpingDrone";
26 |
27 | public ParrotJumpingDrone(@NonNull ARDiscoveryDeviceService deviceService, Context ctx) {
28 | super(deviceService, ctx);
29 | }
30 |
31 | @Override
32 | public void pilotWithAcceleroData(AccelerometerData accelerometerData) {
33 | if (mDeviceController != null) {
34 | byte speedVal = (byte) -(Math.max(-100, Math.min(100, ((accelerometerData.getAccY() / 9.0) * 50))));
35 | byte turnVal = (byte) -(Math.max(-100, Math.min(100, ((accelerometerData.getAccX() / 9.0) * 50))));
36 | Log.i(TAG, "speed = " + speedVal + " | turn = " + turnVal);
37 | mDeviceController.getFeatureJumpingSumo().setPilotingPCMD((byte) 1, speedVal, turnVal);
38 | }
39 | }
40 |
41 | @Override
42 | public void pilotWithJoystickData(JoystickData joystickData) {}
43 |
44 | @Override
45 | public void stopPiloting() {
46 | if (mDeviceController != null) {
47 | mDeviceController.getFeatureJumpingSumo().setPilotingPCMD((byte) 0, (byte) 0, (byte) 0);
48 | }
49 | }
50 |
51 | @Override
52 | public void sendAction() {
53 | if (mDeviceController != null) {
54 | mDeviceController.getFeatureJumpingSumo().sendAnimationsJump(ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_ENUM.ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_HIGH);
55 | }
56 | }
57 |
58 | @Override
59 | public void onStateChanged(ARDeviceController deviceController, ARCONTROLLER_DEVICE_STATE_ENUM newState, ARCONTROLLER_ERROR_ENUM error) {
60 | super.onStateChanged(deviceController, newState, error);
61 |
62 | if (newState == ARCONTROLLER_DEVICE_STATE_ENUM.ARCONTROLLER_DEVICE_STATE_RUNNING) {
63 | mHandler.post(new Runnable() {
64 | @Override
65 | public void run() {
66 | setCurrentAction(ActionType.JUMP);
67 | }
68 | });
69 | }
70 | }
71 |
72 | @Override
73 | public void onCommandReceived(ARDeviceController deviceController, ARCONTROLLER_DICTIONARY_KEY_ENUM commandKey, ARControllerDictionary elementDictionary) {
74 | super.onCommandReceived(deviceController, commandKey, elementDictionary);
75 |
76 | if ((commandKey == ARCONTROLLER_DICTIONARY_KEY_ENUM.ARCONTROLLER_DICTIONARY_KEY_JUMPINGSUMO_NETWORKSETTINGSSTATE_WIFISELECTIONCHANGED) && (elementDictionary != null)) {
77 | ARControllerArgumentDictionary