diff --git a/pom.xml b/pom.xml index 1c2358b..67d3069 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.github.nicholasastuart myo-java - 0.7.1-SNAPSHOT + 0.9.1-SNAPSHOT org.sonatype.oss oss-parent diff --git a/src/main/java/com/thalmic/myo/AbstractDeviceListener.java b/src/main/java/com/thalmic/myo/AbstractDeviceListener.java index f2cd13e..0b8ef88 100644 --- a/src/main/java/com/thalmic/myo/AbstractDeviceListener.java +++ b/src/main/java/com/thalmic/myo/AbstractDeviceListener.java @@ -1,58 +1,72 @@ package com.thalmic.myo; import com.thalmic.myo.enums.Arm; +import com.thalmic.myo.enums.WarmupResult; +import com.thalmic.myo.enums.WarmupState; import com.thalmic.myo.enums.XDirection; public class AbstractDeviceListener implements DeviceListener { - @Override - public void onPair(Myo myo, long timestamp, FirmwareVersion firmwareVersion) { - } + @Override + public void onPair(Myo myo, long timestamp, FirmwareVersion firmwareVersion) { + } - @Override - public void onUnpair(Myo myo, long timestamp) { - } + @Override + public void onUnpair(Myo myo, long timestamp) { + } - @Override - public void onConnect(Myo myo, long timestamp, FirmwareVersion firmwareVersion) { - } + @Override + public void onConnect(Myo myo, long timestamp, FirmwareVersion firmwareVersion) { + } - @Override - public void onDisconnect(Myo myo, long timestamp) { - } + @Override + public void onDisconnect(Myo myo, long timestamp) { + } - @Override - public void onArmSync(Myo myo, long timestamp, Arm arm, XDirection xDirection) { - } + @Override + public void onArmSync(Myo myo, long timestamp, Arm arm, XDirection xDirection, float rotation, WarmupState warmupState) { + } - @Override - public void onArmUnsync(Myo myo, long timestamp) { - } + @Override + public void onArmUnsync(Myo myo, long timestamp) { + } - @Override - public void onUnlock(Myo myo, long timestamp) { - } + @Override + public void onUnlock(Myo myo, long timestamp) { + } - @Override - public void onLock(Myo myo, long timestamp) { - } + @Override + public void onLock(Myo myo, long timestamp) { + } - @Override - public void onPose(Myo myo, long timestamp, Pose pose) { - } + @Override + public void onPose(Myo myo, long timestamp, Pose pose) { + } - @Override - public void onOrientationData(Myo myo, long timestamp, Quaternion rotation) { - } + @Override + public void onOrientationData(Myo myo, long timestamp, Quaternion rotation) { + } - @Override - public void onAccelerometerData(Myo myo, long timestamp, Vector3 accel) { - } + @Override + public void onAccelerometerData(Myo myo, long timestamp, Vector3 accel) { + } - @Override - public void onGyroscopeData(Myo myo, long timestamp, Vector3 gyro) { - } + @Override + public void onGyroscopeData(Myo myo, long timestamp, Vector3 gyro) { + } - @Override - public void onRssi(Myo myo, long timestamp, int rssi) { - } + @Override + public void onRssi(Myo myo, long timestamp, int rssi) { + } + + @Override + public void onEmgData(Myo myo, long timestamp, byte[] emg) { + } + + @Override + public void onBatteryLevelReceived(Myo myo, long timestamp, int level) { + } + + @Override + public void onWarmupCompleted(Myo myo, long timestamp, WarmupResult warmupResult) { + } } diff --git a/src/main/java/com/thalmic/myo/DeviceListener.java b/src/main/java/com/thalmic/myo/DeviceListener.java index e43ba96..df8a96d 100644 --- a/src/main/java/com/thalmic/myo/DeviceListener.java +++ b/src/main/java/com/thalmic/myo/DeviceListener.java @@ -1,32 +1,40 @@ package com.thalmic.myo; import com.thalmic.myo.enums.Arm; +import com.thalmic.myo.enums.WarmupResult; +import com.thalmic.myo.enums.WarmupState; import com.thalmic.myo.enums.XDirection; public interface DeviceListener { - public void onPair(Myo myo, long timestamp, FirmwareVersion firmwareVersion); + public void onPair(Myo myo, long timestamp, FirmwareVersion firmwareVersion); - public void onUnpair(Myo myo, long timestamp); + public void onUnpair(Myo myo, long timestamp); - public void onConnect(Myo myo, long timestamp, FirmwareVersion firmwareVersion); + public void onConnect(Myo myo, long timestamp, FirmwareVersion firmwareVersion); - public void onDisconnect(Myo myo, long timestamp); + public void onDisconnect(Myo myo, long timestamp); - public void onArmSync(Myo myo, long timestamp, Arm arm, XDirection xDirection); + public void onArmSync(Myo myo, long timestamp, Arm arm, XDirection xDirection, float rotation, WarmupState warmupState); - public void onArmUnsync(Myo myo, long timestamp); + public void onArmUnsync(Myo myo, long timestamp); - public void onUnlock(Myo myo, long timestamp); + public void onUnlock(Myo myo, long timestamp); - public void onLock(Myo myo, long timestamp); + public void onLock(Myo myo, long timestamp); - public void onPose(Myo myo, long timestamp, Pose pose); + public void onPose(Myo myo, long timestamp, Pose pose); - public void onOrientationData(Myo myo, long timestamp, Quaternion rotation); + public void onOrientationData(Myo myo, long timestamp, Quaternion rotation); - public void onAccelerometerData(Myo myo, long timestamp, Vector3 accel); + public void onAccelerometerData(Myo myo, long timestamp, Vector3 accel); - public void onGyroscopeData(Myo myo, long timestamp, Vector3 gyro); + public void onGyroscopeData(Myo myo, long timestamp, Vector3 gyro); - public void onRssi(Myo myo, long timestamp, int rssi); + public void onRssi(Myo myo, long timestamp, int rssi); + + public void onBatteryLevelReceived(Myo myo, long timestamp, int level); + + public void onEmgData(Myo myo, long timestamp, byte[] emg); + + public void onWarmupCompleted(Myo myo, long timestamp, WarmupResult warmupResult); } \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/FirmwareVersion.java b/src/main/java/com/thalmic/myo/FirmwareVersion.java index 45fcacb..114443c 100644 --- a/src/main/java/com/thalmic/myo/FirmwareVersion.java +++ b/src/main/java/com/thalmic/myo/FirmwareVersion.java @@ -1,75 +1,75 @@ package com.thalmic.myo; public class FirmwareVersion { - private final int firmwareVersionMajor; - private final int firmwareVersionMinor; - private final int firmwareVersionPath; - private final int firmwareVersionHardwareRev; + private final int firmwareVersionMajor; + private final int firmwareVersionMinor; + private final int firmwareVersionPath; + private final int firmwareVersionHardwareRev; - public FirmwareVersion(int firmwareVersionMajor, int firmwareVersionMinor, int firmwareVersionPath, int firmwareVersionHardwareRev) { - super(); - this.firmwareVersionMajor = firmwareVersionMajor; - this.firmwareVersionMinor = firmwareVersionMinor; - this.firmwareVersionPath = firmwareVersionPath; - this.firmwareVersionHardwareRev = firmwareVersionHardwareRev; - } - - public int getFirmwareVersionMajor() { - return firmwareVersionMajor; - } - - public int getFirmwareVersionMinor() { - return firmwareVersionMinor; - } - - public int getFirmwareVersionPath() { - return firmwareVersionPath; - } - - public int getFirmwareVersionHardwareRev() { - return firmwareVersionHardwareRev; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + firmwareVersionHardwareRev; - result = prime * result + firmwareVersionMajor; - result = prime * result + firmwareVersionMinor; - result = prime * result + firmwareVersionPath; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; + public FirmwareVersion(int firmwareVersionMajor, int firmwareVersionMinor, int firmwareVersionPath, int firmwareVersionHardwareRev) { + super(); + this.firmwareVersionMajor = firmwareVersionMajor; + this.firmwareVersionMinor = firmwareVersionMinor; + this.firmwareVersionPath = firmwareVersionPath; + this.firmwareVersionHardwareRev = firmwareVersionHardwareRev; } - if (obj == null) { - return false; + + public int getFirmwareVersionMajor() { + return firmwareVersionMajor; } - if (getClass() != obj.getClass()) { - return false; + + public int getFirmwareVersionMinor() { + return firmwareVersionMinor; } - FirmwareVersion other = (FirmwareVersion) obj; - if (firmwareVersionHardwareRev != other.firmwareVersionHardwareRev) { - return false; + + public int getFirmwareVersionPath() { + return firmwareVersionPath; } - if (firmwareVersionMajor != other.firmwareVersionMajor) { - return false; + + public int getFirmwareVersionHardwareRev() { + return firmwareVersionHardwareRev; } - if (firmwareVersionMinor != other.firmwareVersionMinor) { - return false; + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + firmwareVersionHardwareRev; + result = prime * result + firmwareVersionMajor; + result = prime * result + firmwareVersionMinor; + result = prime * result + firmwareVersionPath; + return result; } - if (firmwareVersionPath != other.firmwareVersionPath) { - return false; + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + FirmwareVersion other = (FirmwareVersion) obj; + if (firmwareVersionHardwareRev != other.firmwareVersionHardwareRev) { + return false; + } + if (firmwareVersionMajor != other.firmwareVersionMajor) { + return false; + } + if (firmwareVersionMinor != other.firmwareVersionMinor) { + return false; + } + if (firmwareVersionPath != other.firmwareVersionPath) { + return false; + } + return true; } - return true; - } - @Override - public String toString() { - return "FirmwareVersion [firmwareVersionMajor=" + firmwareVersionMajor + ", firmwareVersionMinor=" + firmwareVersionMinor + ", firmwareVersionPath=" + firmwareVersionPath + ", firmwareVersionHardwareRev=" + firmwareVersionHardwareRev + "]"; - } + @Override + public String toString() { + return "FirmwareVersion [firmwareVersionMajor=" + firmwareVersionMajor + ", firmwareVersionMinor=" + firmwareVersionMinor + ", firmwareVersionPath=" + firmwareVersionPath + ", firmwareVersionHardwareRev=" + firmwareVersionHardwareRev + "]"; + } } \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/Hub.java b/src/main/java/com/thalmic/myo/Hub.java index 6ad2a66..424bef8 100644 --- a/src/main/java/com/thalmic/myo/Hub.java +++ b/src/main/java/com/thalmic/myo/Hub.java @@ -1,228 +1,236 @@ package com.thalmic.myo; +import java.io.BufferedOutputStream; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Field; -import java.net.URISyntaxException; -import java.net.URL; import java.nio.file.Files; import java.nio.file.StandardCopyOption; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; import com.thalmic.myo.enums.LockingPolicy; public final class Hub { - private static final File TEMP_DIRECTORY_LOCATION = new File(System.getProperty("java.io.tmpdir")); - private long nativeHandle; - private final String applicationIdentifier; + private static final File TEMP_DIRECTORY_LOCATION = new File(System.getProperty("java.io.tmpdir")); + private long nativeHandle; + private final String applicationIdentifier; - public Hub() { - this(""); - } + public Hub() { + this(""); + } - public Hub(String applicationIdentifier) { - this.applicationIdentifier = applicationIdentifier; - loadJniResources(); - initialize(applicationIdentifier); - } + public Hub(String applicationIdentifier) { + this.applicationIdentifier = applicationIdentifier; + loadJniResources(); + initialize(applicationIdentifier); + } - private native void initialize(String applicationIdentifier); + private native void initialize(String applicationIdentifier); - public native Myo waitForMyo(int timeout); + public native Myo waitForMyo(int timeout); - public native void addListener(DeviceListener listener); + public native void addListener(DeviceListener listener); - public native void removeListener(DeviceListener listener); + public native void removeListener(DeviceListener listener); - public native void run(int duration); + public native void run(int duration); - public native void runOnce(int duration); + public native void runOnce(int duration); - public void setLockingPolicy(LockingPolicy lockingPolicy) { - setLockingPolicy(lockingPolicy.ordinal()); - } + public void setLockingPolicy(LockingPolicy lockingPolicy) { + setLockingPolicy(lockingPolicy.ordinal()); + } - private native void setLockingPolicy(int lockingPolicy); + private native void setLockingPolicy(int lockingPolicy); - public void copyDirectory(File sourceLocation, File targetLocation) throws IOException { - if (sourceLocation.isDirectory()) { - if (!targetLocation.exists()) { - targetLocation.mkdir(); - } + private final void loadJniResources() { + String osName = System.getProperty("os.name").toLowerCase(); + if (osName.contains("mac")) { + boolean wasLoadSuccessful = loadOSXResourceFromSysPath(); + if (!wasLoadSuccessful) { + wasLoadSuccessful = copyAndLoadOSXFromTemp(); + if (!wasLoadSuccessful) { + throw new UnsatisfiedLinkError("Could Not Load myo and myo-java libs"); + } + } - String[] children = sourceLocation.list(); - for (int i = 0; i < children.length; i++) { - copyDirectory(new File(sourceLocation, children[i]), new File(targetLocation, children[i])); - } - } else { - Files.copy(sourceLocation.toPath(), targetLocation.toPath(), StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); - } - } - - private final void loadJniResources() { - String osName = System.getProperty("os.name") - .toLowerCase(); - if (osName.contains("mac")) { - boolean wasLoadSuccessful = loadOSXResourceFromSysPath(); - if (!wasLoadSuccessful) { - wasLoadSuccessful = copyAndLoadOSXFromTemp(); - if (!wasLoadSuccessful) { - throw new UnsatisfiedLinkError("Could Not Load myo and myo-java libs"); - } - } - - } else if (osName.contains("win")) { - boolean wasLoadSuccessful = loadX64ResourcesFromSysPath(); - if (!wasLoadSuccessful) { - wasLoadSuccessful = loadWin32ResourcesFromSysPath(); - if (!wasLoadSuccessful) { - setLibDirectory(); - - wasLoadSuccessful = copyAndLoadX64FromTemp(); - if (!wasLoadSuccessful) { - wasLoadSuccessful = copyAndLoadWin32FromTemp(); + } else if (osName.contains("win")) { + boolean wasLoadSuccessful = loadX64ResourcesFromSysPath(); if (!wasLoadSuccessful) { - throw new UnsatisfiedLinkError("Could Not Load myo and myo-java libs"); + wasLoadSuccessful = loadWin32ResourcesFromSysPath(); + if (!wasLoadSuccessful) { + setLibDirectory(); + + wasLoadSuccessful = copyAndLoadX64FromTemp(); + if (!wasLoadSuccessful) { + wasLoadSuccessful = copyAndLoadWin32FromTemp(); + if (!wasLoadSuccessful) { + throw new UnsatisfiedLinkError("Could Not Load myo and myo-java libs"); + } + } + } } - } + } else { + System.err.println("Your Operating System is not supported at this time."); } - } - } else { - System.err.println("Your Operating System is not supported at this time."); } - } - - private void setLibDirectory() { - try { - System.setProperty("java.library.path", TEMP_DIRECTORY_LOCATION.getAbsolutePath()); - Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); - fieldSysPath.setAccessible(true); - fieldSysPath.set(null, null); - } catch (Exception e) { - e.printStackTrace(); + + private void setLibDirectory() { + try { + System.setProperty("java.library.path", TEMP_DIRECTORY_LOCATION.getAbsolutePath()); + Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); + fieldSysPath.setAccessible(true); + fieldSysPath.set(null, null); + } catch (Exception e) { + e.printStackTrace(); + } + } - } - - private boolean copyAndLoadOSXFromTemp() { - try { - File macMyoTempFile = new File(TEMP_DIRECTORY_LOCATION, "libmyo.jnilib"); - InputStream macMyoInputStream = this.getClass() - .getResourceAsStream("/osx/libmyo.jnilib"); - Files.copy(macMyoInputStream, macMyoTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); - macMyoTempFile.deleteOnExit(); - - File myoFrameworkTempDirectory = new File(TEMP_DIRECTORY_LOCATION, "myo.framework"); - URL resource = this.getClass() - .getResource("/osx/myo.framework"); - File myoFrameworkCompleteDirectory = new File(resource.toURI()); - copyDirectory(myoFrameworkCompleteDirectory, myoFrameworkTempDirectory); - myoFrameworkTempDirectory.deleteOnExit(); - - setLibDirectory(); - System.loadLibrary("myo"); - return true; - } catch (UnsatisfiedLinkError e) { - String errorMessage = String.format("Unable to load %s from directory %s.", "libmyo.jnilib", TEMP_DIRECTORY_LOCATION); - System.err.println(errorMessage); - } catch (IOException | URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + public void unzipFile(InputStream inputStream, File destDirectory) throws IOException { + if (!destDirectory.exists()) { + destDirectory.mkdir(); + } + try (ZipInputStream zipInputStream = new ZipInputStream(inputStream)) { + ZipEntry zipEntry = null; + while ((zipEntry = zipInputStream.getNextEntry()) != null) { + File newFileFromZip = new File(destDirectory, zipEntry.getName()); + newFileFromZip.deleteOnExit(); + if (zipEntry.isDirectory()) { + newFileFromZip.mkdir(); + } else { + try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(newFileFromZip))) { + byte[] bytesIn = new byte[4096]; + int read = 0; + while ((read = zipInputStream.read(bytesIn)) != -1) { + outputStream.write(bytesIn, 0, read); + } + } + } + zipInputStream.closeEntry(); + } + } } - return false; - } - - private boolean loadOSXResourceFromSysPath() throws UnsatisfiedLinkError { - try { - System.loadLibrary("myo"); - return true; - } catch (UnsatisfiedLinkError e) { - String errorMessage = String.format("Unable to load myo from system directories."); - System.err.println(errorMessage); + + private boolean copyAndLoadOSXFromTemp() { + try { + + File macMyoTempFile = new File(TEMP_DIRECTORY_LOCATION, "libmyo.jnilib"); + try (InputStream macMyoInputStream = this.getClass().getResourceAsStream("/osx/libmyo.jnilib")) { + Files.copy(macMyoInputStream, macMyoTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + macMyoTempFile.deleteOnExit(); + + try (InputStream macMyoLibInputStream = this.getClass().getResourceAsStream("/osx/myo.zip")) { + unzipFile(macMyoLibInputStream, TEMP_DIRECTORY_LOCATION); + } + + setLibDirectory(); + System.loadLibrary("myo"); + return true; + } catch (UnsatisfiedLinkError e) { + e.printStackTrace(); + String errorMessage = String.format("Unable to load %s from directory %s", "libmyo.jnilib", TEMP_DIRECTORY_LOCATION); + System.err.println(errorMessage); + } catch (IOException e) { + e.printStackTrace(); + } + return false; } - return false; - } - - private boolean loadX64ResourcesFromSysPath() throws UnsatisfiedLinkError { - try { - System.loadLibrary("myo64"); - System.loadLibrary("JNIJavaMyoLib"); - return true; - } catch (UnsatisfiedLinkError e) { - String errorMessage = String.format("Unable to load myo64 from system directories."); - System.err.println(errorMessage); + + private boolean loadOSXResourceFromSysPath() throws UnsatisfiedLinkError { + try { + System.loadLibrary("myo"); + return true; + } catch (UnsatisfiedLinkError e) { + String errorMessage = String.format("Unable to load myo from system directories."); + System.err.println(errorMessage); + } + return false; } - return false; - } - - private boolean loadWin32ResourcesFromSysPath() throws UnsatisfiedLinkError { - try { - System.loadLibrary("myo32"); - System.loadLibrary("JNIJavaMyoLib"); - return true; - } catch (UnsatisfiedLinkError e) { - String errorMessage = String.format("Unable to load myo32 from system directories."); - System.err.println(errorMessage); + + private boolean loadX64ResourcesFromSysPath() throws UnsatisfiedLinkError { + try { + System.loadLibrary("myo64"); + System.loadLibrary("JNIJavaMyoLib"); + return true; + } catch (UnsatisfiedLinkError e) { + String errorMessage = String.format("Unable to load myo64 from system directories."); + System.err.println(errorMessage); + } + return false; } - return false; - } - - private boolean copyAndLoadX64FromTemp() { - try { - File myo64DllTempFile = new File(TEMP_DIRECTORY_LOCATION, "myo64.dll"); - InputStream myo64DllInputStream = this.getClass() - .getResourceAsStream("/x64/myo64.dll"); - Files.copy(myo64DllInputStream, myo64DllTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); - - File jniJavaMyoLibDllTempFile = new File(TEMP_DIRECTORY_LOCATION, "JNIJavaMyoLib64.dll"); - InputStream jniJavaMyoLibDllInputStream = this.getClass() - .getResourceAsStream("/x64/JNIJavaMyoLib.dll"); - Files.copy(jniJavaMyoLibDllInputStream, jniJavaMyoLibDllTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); - - myo64DllTempFile.deleteOnExit(); - jniJavaMyoLibDllTempFile.deleteOnExit(); - - System.loadLibrary("myo64"); - System.loadLibrary("JNIJavaMyoLib64"); - return true; - } catch (UnsatisfiedLinkError e) { - String errorMessage = String.format("Unable to load %s from directory %s.", "myo64.dll", TEMP_DIRECTORY_LOCATION); - System.err.println(errorMessage); - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); + + private boolean loadWin32ResourcesFromSysPath() throws UnsatisfiedLinkError { + try { + System.loadLibrary("myo32"); + System.loadLibrary("JNIJavaMyoLib"); + return true; + } catch (UnsatisfiedLinkError e) { + String errorMessage = String.format("Unable to load myo32 from system directories."); + System.err.println(errorMessage); + } + return false; } - return false; - } - - private boolean copyAndLoadWin32FromTemp() { - try { - File myo32DllTempFile = new File(TEMP_DIRECTORY_LOCATION, "myo32.dll"); - myo32DllTempFile.deleteOnExit(); - InputStream myo32DllInputStream = this.getClass() - .getResourceAsStream("/Win32/myo32.dll"); - Files.copy(myo32DllInputStream, myo32DllTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); - - File jniJavaMyoLibDllTempFile = new File(TEMP_DIRECTORY_LOCATION, "JNIJavaMyoLib32.dll"); - InputStream jniJavaMyoLibDllInputStream = this.getClass() - .getResourceAsStream("/Win32/JNIJavaMyoLib.dll"); - Files.copy(jniJavaMyoLibDllInputStream, jniJavaMyoLibDllTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); - - myo32DllTempFile.deleteOnExit(); - jniJavaMyoLibDllTempFile.deleteOnExit(); - - System.loadLibrary("myo32"); - System.loadLibrary("JNIJavaMyoLib32"); - return true; - } catch (UnsatisfiedLinkError e) { - String errorMessage = String.format("Unable to load %s from directory %s.", "myo32.dll", TEMP_DIRECTORY_LOCATION); - System.err.println(errorMessage); - } catch (IOException e) { - e.printStackTrace(); + private boolean copyAndLoadX64FromTemp() { + try { + File myo64DllTempFile = new File(TEMP_DIRECTORY_LOCATION, "myo64.dll"); + myo64DllTempFile.deleteOnExit(); + try (InputStream myo64DllInputStream = this.getClass().getResourceAsStream("/x64/myo64.dll")) { + Files.copy(myo64DllInputStream, myo64DllTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + + File jniJavaMyoLibDllTempFile = new File(TEMP_DIRECTORY_LOCATION, "JNIJavaMyoLib64.dll"); + jniJavaMyoLibDllTempFile.deleteOnExit(); + try (InputStream jniJavaMyoLibDllInputStream = this.getClass().getResourceAsStream("/x64/JNIJavaMyoLib.dll")) { + Files.copy(jniJavaMyoLibDllInputStream, jniJavaMyoLibDllTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + + System.loadLibrary("myo64"); + System.loadLibrary("JNIJavaMyoLib64"); + return true; + } catch (UnsatisfiedLinkError e) { + String errorMessage = String.format("Unable to load %s from directory %s.", "myo64.dll", TEMP_DIRECTORY_LOCATION); + System.err.println(errorMessage); + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return false; } - return false; - } + private boolean copyAndLoadWin32FromTemp() { + try { + File myo32DllTempFile = new File(TEMP_DIRECTORY_LOCATION, "myo32.dll"); + myo32DllTempFile.deleteOnExit(); + try (InputStream myo32DllInputStream = this.getClass().getResourceAsStream("/Win32/myo32.dll")) { + Files.copy(myo32DllInputStream, myo32DllTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + + File jniJavaMyoLibDllTempFile = new File(TEMP_DIRECTORY_LOCATION, "JNIJavaMyoLib32.dll"); + jniJavaMyoLibDllTempFile.deleteOnExit(); + + try (InputStream jniJavaMyoLibDllInputStream = this.getClass().getResourceAsStream("/Win32/JNIJavaMyoLib.dll")) { + Files.copy(jniJavaMyoLibDllInputStream, jniJavaMyoLibDllTempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + + System.loadLibrary("myo32"); + System.loadLibrary("JNIJavaMyoLib32"); + return true; + } catch (UnsatisfiedLinkError e) { + String errorMessage = String.format("Unable to load %s from directory %s.", "myo32.dll", TEMP_DIRECTORY_LOCATION); + System.err.println(errorMessage); + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return false; + } } \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/Myo.java b/src/main/java/com/thalmic/myo/Myo.java index 0372b3b..ab5dffd 100644 --- a/src/main/java/com/thalmic/myo/Myo.java +++ b/src/main/java/com/thalmic/myo/Myo.java @@ -1,29 +1,38 @@ package com.thalmic.myo; +import com.thalmic.myo.enums.StreamEmgType; import com.thalmic.myo.enums.UnlockType; import com.thalmic.myo.enums.VibrationType; public final class Myo { - private long nativeHandle; + private long nativeHandle; - private Myo() { - } + private Myo() { + } - public void vibrate(VibrationType type) { - vibrate(type.ordinal()); - } + public void vibrate(VibrationType type) { + vibrate(type.ordinal()); + } - private native void vibrate(int type); + private native void vibrate(int type); - public native void requestRssi(); + public native void requestRssi(); - public void unlock(UnlockType unlockType) { - unlock(unlockType.ordinal()); - } + public native void requestBatteryLevel(); + + public void unlock(UnlockType unlockType) { + unlock(unlockType.ordinal()); + } - private native void unlock(int unlockType); + private native void unlock(int unlockType); - public native void lock(); + public native void lock(); - public native void notifyUserAction(); + public native void notifyUserAction(); + + public void setStreamEmg(StreamEmgType streamEmgType) { + setStreamEmg(streamEmgType.ordinal()); + } + + private native void setStreamEmg(int streamEmgType); } \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/Quaternion.java b/src/main/java/com/thalmic/myo/Quaternion.java index c2cdab2..e0b38a4 100644 --- a/src/main/java/com/thalmic/myo/Quaternion.java +++ b/src/main/java/com/thalmic/myo/Quaternion.java @@ -52,7 +52,7 @@ public final Quaternion normalized() { } public final Quaternion conjugate() { - return new Quaternion(-x, -y, -z, -w); + return new Quaternion(-x, -y, -z, w); } public static Quaternion fromAxisAngle(Vector3 axis, double angle) { diff --git a/src/main/java/com/thalmic/myo/Vector3.java b/src/main/java/com/thalmic/myo/Vector3.java index 74e3f4d..34abf06 100644 --- a/src/main/java/com/thalmic/myo/Vector3.java +++ b/src/main/java/com/thalmic/myo/Vector3.java @@ -51,7 +51,7 @@ public double dot(Vector3 rightHandSide) { } public Vector3 cross(Vector3 rightHandSide) { - return new Vector3(x * rightHandSide.z - z * rightHandSide.y, z * rightHandSide.x - x * rightHandSide.z, x * rightHandSide.y - y * rightHandSide.x); + return new Vector3(y * rightHandSide.z - z * rightHandSide.y, z * rightHandSide.x - x * rightHandSide.z, x * rightHandSide.y - y * rightHandSide.x); } public double angleTo(Vector3 rightHandSide) { @@ -108,4 +108,4 @@ public String toString() { return "Vector3 [x=" + x + ", y=" + y + ", z=" + z + "]"; } -} \ No newline at end of file +} diff --git a/src/main/java/com/thalmic/myo/enums/StreamEmgType.java b/src/main/java/com/thalmic/myo/enums/StreamEmgType.java new file mode 100644 index 0000000..4eb6d17 --- /dev/null +++ b/src/main/java/com/thalmic/myo/enums/StreamEmgType.java @@ -0,0 +1,5 @@ +package com.thalmic.myo.enums; + +public enum StreamEmgType { + STREAM_EMG_DISABLED, STREAM_EMG_ENABLED +} \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/enums/WarmupResult.java b/src/main/java/com/thalmic/myo/enums/WarmupResult.java new file mode 100644 index 0000000..9b15a21 --- /dev/null +++ b/src/main/java/com/thalmic/myo/enums/WarmupResult.java @@ -0,0 +1,5 @@ +package com.thalmic.myo.enums; + +public enum WarmupResult { + WARMUP_RESULT_UNKNOWN, WARMUP_RESULT_SUCCESS, WARMUP_RESULT_FAILED_TIMEOUT; +} \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/enums/WarmupState.java b/src/main/java/com/thalmic/myo/enums/WarmupState.java new file mode 100644 index 0000000..93a452b --- /dev/null +++ b/src/main/java/com/thalmic/myo/enums/WarmupState.java @@ -0,0 +1,5 @@ +package com.thalmic.myo.enums; + +public enum WarmupState { + WARMUP_STATE_UNKNOWN, WARMUP_STATE_COLD, WARMUP_STATE_WARM; +} \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/example/DataCollector.java b/src/main/java/com/thalmic/myo/example/DataCollector.java index f34f3fa..85997ec 100644 --- a/src/main/java/com/thalmic/myo/example/DataCollector.java +++ b/src/main/java/com/thalmic/myo/example/DataCollector.java @@ -7,89 +7,89 @@ import com.thalmic.myo.enums.Arm; import com.thalmic.myo.enums.PoseType; import com.thalmic.myo.enums.VibrationType; +import com.thalmic.myo.enums.WarmupState; import com.thalmic.myo.enums.XDirection; public class DataCollector extends AbstractDeviceListener { - private static final int SCALE = 18; - private double rollW; - private double pitchW; - private double yawW; - private Pose currentPose; - private Arm whichArm; + private static final int SCALE = 18; + private double rollW; + private double pitchW; + private double yawW; + private Pose currentPose; + private Arm whichArm; - public DataCollector() { - rollW = 0; - pitchW = 0; - yawW = 0; - currentPose = new Pose(); - } + public DataCollector() { + rollW = 0; + pitchW = 0; + yawW = 0; + currentPose = new Pose(); + } - @Override - public void onOrientationData(Myo myo, long timestamp, Quaternion rotation) { - Quaternion normalized = rotation.normalized(); + @Override + public void onOrientationData(Myo myo, long timestamp, Quaternion rotation) { + Quaternion normalized = rotation.normalized(); - double roll = Math.atan2(2.0f * (normalized.getW() * normalized.getX() + normalized.getY() * normalized.getZ()), 1.0f - 2.0f * (normalized.getX() * normalized.getX() + normalized.getY() * normalized.getY())); - double pitch = Math.asin(2.0f * (normalized.getW() * normalized.getY() - normalized.getZ() * normalized.getX())); - double yaw = Math.atan2(2.0f * (normalized.getW() * normalized.getZ() + normalized.getX() * normalized.getY()), 1.0f - 2.0f * (normalized.getY() * normalized.getY() + normalized.getZ() * normalized.getZ())); + double roll = Math.atan2(2.0f * (normalized.getW() * normalized.getX() + normalized.getY() * normalized.getZ()), 1.0f - 2.0f * (normalized.getX() * normalized.getX() + normalized.getY() * normalized.getY())); + double pitch = Math.asin(2.0f * (normalized.getW() * normalized.getY() - normalized.getZ() * normalized.getX())); + double yaw = Math.atan2(2.0f * (normalized.getW() * normalized.getZ() + normalized.getX() * normalized.getY()), 1.0f - 2.0f * (normalized.getY() * normalized.getY() + normalized.getZ() * normalized.getZ())); - rollW = ((roll + Math.PI) / (Math.PI * 2.0) * SCALE); - pitchW = ((pitch + Math.PI / 2.0) / Math.PI * SCALE); - yawW = ((yaw + Math.PI) / (Math.PI * 2.0) * SCALE); - } + rollW = ((roll + Math.PI) / (Math.PI * 2.0) * SCALE); + pitchW = ((pitch + Math.PI / 2.0) / Math.PI * SCALE); + yawW = ((yaw + Math.PI) / (Math.PI * 2.0) * SCALE); + } - @Override - public void onPose(Myo myo, long timestamp, Pose pose) { - currentPose = pose; - if (currentPose.getType() == PoseType.FIST) { - myo.vibrate(VibrationType.VIBRATION_MEDIUM); + @Override + public void onPose(Myo myo, long timestamp, Pose pose) { + currentPose = pose; + if (currentPose.getType() == PoseType.FIST) { + myo.vibrate(VibrationType.VIBRATION_MEDIUM); + } } - } - @Override - public void onArmSync(Myo myo, long timestamp, Arm arm, XDirection xDirection) { - whichArm = arm; - } + @Override + public void onArmSync(Myo myo, long timestamp, Arm arm, XDirection xDirection, float rotation, WarmupState warmupState) { + whichArm = arm; + } - @Override - public void onArmUnsync(Myo myo, long timestamp) { - whichArm = null; - } + @Override + public void onArmUnsync(Myo myo, long timestamp) { + whichArm = null; + } - @Override - public String toString() { - StringBuilder builder = new StringBuilder("\r"); + @Override + public String toString() { + StringBuilder builder = new StringBuilder("\r"); - String xDisplay = String.format("[%s%s]", repeatCharacter('*', (int) rollW), repeatCharacter(' ', (int) (SCALE - rollW))); - String yDisplay = String.format("[%s%s]", repeatCharacter('*', (int) pitchW), repeatCharacter(' ', (int) (SCALE - pitchW))); - String zDisplay = String.format("[%s%s]", repeatCharacter('*', (int) yawW), repeatCharacter(' ', (int) (SCALE - yawW))); + String xDisplay = String.format("[%s%s]", repeatCharacter('*', (int) rollW), repeatCharacter(' ', (int) (SCALE - rollW))); + String yDisplay = String.format("[%s%s]", repeatCharacter('*', (int) pitchW), repeatCharacter(' ', (int) (SCALE - pitchW))); + String zDisplay = String.format("[%s%s]", repeatCharacter('*', (int) yawW), repeatCharacter(' ', (int) (SCALE - yawW))); - String armString = null; - if (whichArm != null) { - armString = String.format("[%s]", whichArm == Arm.ARM_LEFT ? "L" : "R"); - } else { - armString = String.format("[?]"); - } - String poseString = null; - if (currentPose != null) { - String poseTypeString = currentPose.getType() - .toString(); - poseString = String.format("[%s%" + (SCALE - poseTypeString.length()) + "s]", poseTypeString, " "); - } else { - poseString = String.format("[%14s]", " "); + String armString = null; + if (whichArm != null) { + armString = String.format("[%s]", whichArm == Arm.ARM_LEFT ? "L" : "R"); + } else { + armString = String.format("[?]"); + } + String poseString = null; + if (currentPose != null) { + String poseTypeString = currentPose.getType().toString(); + poseString = String.format("[%s%" + (SCALE - poseTypeString.length()) + "s]", poseTypeString, " "); + } else { + poseString = String.format("[%14s]", " "); + } + builder.append(xDisplay); + builder.append(yDisplay); + builder.append(zDisplay); + builder.append(armString); + builder.append(poseString); + return builder.toString(); } - builder.append(xDisplay); - builder.append(yDisplay); - builder.append(zDisplay); - builder.append(armString); - builder.append(poseString); - return builder.toString(); - } - private String repeatCharacter(char character, int numOfTimes) { - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < numOfTimes; i++) { - builder.append(character); + private String repeatCharacter(char character, int numOfTimes) { + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < numOfTimes; i++) { + builder.append(character); + } + return builder.toString(); } - return builder.toString(); - } } \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/example/EmgDataCollector.java b/src/main/java/com/thalmic/myo/example/EmgDataCollector.java new file mode 100644 index 0000000..3b9da4c --- /dev/null +++ b/src/main/java/com/thalmic/myo/example/EmgDataCollector.java @@ -0,0 +1,33 @@ +package com.thalmic.myo.example; + +import java.util.Arrays; + +import com.thalmic.myo.AbstractDeviceListener; +import com.thalmic.myo.FirmwareVersion; +import com.thalmic.myo.Myo; + +public class EmgDataCollector extends AbstractDeviceListener { + private byte[] emgSamples; + + public EmgDataCollector() { + } + + @Override + public void onPair(Myo myo, long timestamp, FirmwareVersion firmwareVersion) { + if (emgSamples != null) { + for (int i = 0; i < emgSamples.length; i++) { + emgSamples[i] = 0; + } + } + } + + @Override + public void onEmgData(Myo myo, long timestamp, byte[] emg) { + this.emgSamples = emg; + } + + @Override + public String toString() { + return Arrays.toString(emgSamples); + } +} diff --git a/src/main/java/com/thalmic/myo/example/EmgDataSample.java b/src/main/java/com/thalmic/myo/example/EmgDataSample.java new file mode 100644 index 0000000..fc1dc14 --- /dev/null +++ b/src/main/java/com/thalmic/myo/example/EmgDataSample.java @@ -0,0 +1,35 @@ +package com.thalmic.myo.example; + +import com.thalmic.myo.DeviceListener; +import com.thalmic.myo.Hub; +import com.thalmic.myo.Myo; +import com.thalmic.myo.enums.StreamEmgType; + +public class EmgDataSample { + public static void main(String[] args) { + try { + Hub hub = new Hub("com.example.emg-data-sample"); + + System.out.println("Attempting to find a Myo..."); + Myo myo = hub.waitForMyo(10000); + + if (myo == null) { + throw new RuntimeException("Unable to find a Myo!"); + } + + System.out.println("Connected to a Myo armband!"); + myo.setStreamEmg(StreamEmgType.STREAM_EMG_ENABLED); + DeviceListener dataCollector = new EmgDataCollector(); + hub.addListener(dataCollector); + + while (true) { + hub.run(1000 / 20); + System.out.println(dataCollector); + } + } catch (Exception e) { + System.err.println("Error: "); + e.printStackTrace(); + System.exit(1); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/example/HelloMyo.java b/src/main/java/com/thalmic/myo/example/HelloMyo.java index e50d56f..29fbff4 100644 --- a/src/main/java/com/thalmic/myo/example/HelloMyo.java +++ b/src/main/java/com/thalmic/myo/example/HelloMyo.java @@ -1,5 +1,6 @@ package com.thalmic.myo.example; +import com.thalmic.myo.DeviceListener; import com.thalmic.myo.Hub; import com.thalmic.myo.Myo; @@ -10,29 +11,29 @@ -XX:+UseOSErrorReporting */ public class HelloMyo { - public static void main(String[] args) { - try { - Hub hub = new Hub("com.example.hello-myo"); + public static void main(String[] args) { + try { + Hub hub = new Hub("com.example.hello-myo"); - System.out.println("Attempting to find a Myo..."); - Myo myo = hub.waitForMyo(10000); + System.out.println("Attempting to find a Myo..."); + Myo myo = hub.waitForMyo(10000); - if (myo == null) { - throw new RuntimeException("Unable to find a Myo!"); - } + if (myo == null) { + throw new RuntimeException("Unable to find a Myo!"); + } - System.out.println("Connected to a Myo armband!"); - DataCollector dataCollector = new DataCollector(); - hub.addListener(dataCollector); + System.out.println("Connected to a Myo armband!"); + DeviceListener dataCollector = new DataCollector(); + hub.addListener(dataCollector); - while (true) { - hub.run(1000 / 20); - System.out.print(dataCollector); - } - } catch (Exception e) { - System.err.println("Error: "); - e.printStackTrace(); - System.exit(1); + while (true) { + hub.run(1000 / 20); + System.out.print(dataCollector); + } + } catch (Exception e) { + System.err.println("Error: "); + e.printStackTrace(); + System.exit(1); + } } - } } \ No newline at end of file diff --git a/src/main/java/com/thalmic/myo/example/MultipleMyos.java b/src/main/java/com/thalmic/myo/example/MultipleMyos.java index dc87cb7..813f744 100644 --- a/src/main/java/com/thalmic/myo/example/MultipleMyos.java +++ b/src/main/java/com/thalmic/myo/example/MultipleMyos.java @@ -4,20 +4,20 @@ import com.thalmic.myo.Hub; public class MultipleMyos { - public static void main(String... args) { - try { - Hub hub = new Hub("com.example.multiple-myos"); + public static void main(String... args) { + try { + Hub hub = new Hub("com.example.multiple-myos"); - DeviceListener printer = new PrintMyoEvents(); - hub.addListener(printer); + DeviceListener printer = new PrintMyoEvents(); + hub.addListener(printer); - while (true) { - hub.run(10); - } - } catch (Exception e) { - System.err.println("Error: "); - e.printStackTrace(); - System.exit(1); + while (true) { + hub.run(10); + } + } catch (Exception e) { + System.err.println("Error: "); + e.printStackTrace(); + System.exit(1); + } } - } } \ No newline at end of file diff --git a/src/main/resources/Win32/JNIJavaMyoLib.dll b/src/main/resources/Win32/JNIJavaMyoLib.dll index b1cef4f..e8626a9 100644 Binary files a/src/main/resources/Win32/JNIJavaMyoLib.dll and b/src/main/resources/Win32/JNIJavaMyoLib.dll differ diff --git a/src/main/resources/Win32/myo32.dll b/src/main/resources/Win32/myo32.dll index d596b6c..a3b7538 100644 Binary files a/src/main/resources/Win32/myo32.dll and b/src/main/resources/Win32/myo32.dll differ diff --git a/src/main/resources/osx/libmyo.jnilib b/src/main/resources/osx/libmyo.jnilib old mode 100644 new mode 100755 index dfa81c3..b541b30 Binary files a/src/main/resources/osx/libmyo.jnilib and b/src/main/resources/osx/libmyo.jnilib differ diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/DeviceListener.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/DeviceListener.hpp deleted file mode 100644 index fca151b..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/DeviceListener.hpp +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include "Pose.hpp" - -namespace myo { - -class Myo; -template -class Quaternion; -template -class Vector3; - -/// Enumeration identifying a right arm or left arm. -enum Arm { - armLeft = libmyo_arm_left, - armRight = libmyo_arm_right, - armUnknown = libmyo_arm_unknown -}; - -/// Possible directions for Myo's +x axis relative to a user's arm. -enum XDirection { - xDirectionTowardWrist = libmyo_x_direction_toward_wrist, - xDirectionTowardElbow = libmyo_x_direction_toward_elbow, - xDirectionUnknown = libmyo_x_direction_unknown -}; - -/// Firmware version of Myo. -struct FirmwareVersion { - unsigned int firmwareVersionMajor; ///< Myo's major version must match the required major version. - unsigned int firmwareVersionMinor; ///< Myo's minor version must match the required minor version. - unsigned int firmwareVersionPatch; ///< Myo's patch version must greater or equal to the required patch version. - unsigned int firmwareVersionHardwareRev; ///< Myo's hardware revision; not used to detect firmware version mismatch. -}; - -/// A DeviceListener receives events about a Myo. -/// @see Hub::addListener() -class DeviceListener { -public: - virtual ~DeviceListener() {} - - /// Called when a Myo has been paired. - virtual void onPair(Myo* myo, uint64_t timestamp, FirmwareVersion firmwareVersion) {} - - /// Called when a Myo has been unpaired. - virtual void onUnpair(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo has been connected. - virtual void onConnect(Myo* myo, uint64_t timestamp, FirmwareVersion firmwareVersion) {} - - /// Called when a paired Myo has been disconnected. - virtual void onDisconnect(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo recognizes that it is on an arm. - virtual void onArmSync(Myo* myo, uint64_t timestamp, Arm arm, XDirection xDirection) {} - - /// Called when a paired Myo is moved or removed from the arm. - virtual void onArmUnsync(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo becomes unlocked. - virtual void onUnlock(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo becomes locked. - virtual void onLock(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo has provided a new pose. - virtual void onPose(Myo* myo, uint64_t timestamp, Pose pose) {} - - /// Called when a paired Myo has provided new orientation data. - virtual void onOrientationData(Myo* myo, uint64_t timestamp, const Quaternion& rotation) {} - - /// Called when a paired Myo has provided new accelerometer data in units of g. - virtual void onAccelerometerData(Myo* myo, uint64_t timestamp, const Vector3& accel) {} - - /// Called when a paired Myo has provided new gyroscope data in units of deg/s. - virtual void onGyroscopeData(Myo* myo, uint64_t timestamp, const Vector3& gyro) {} - - /// Called when a paired Myo has provided a new RSSI value. - /// @see Myo::requestRssi() to request an RSSI value from the Myo. - virtual void onRssi(Myo* myo, uint64_t timestamp, int8_t rssi) {} - - /// @cond LIBMYO_INTERNALS - - virtual void onOpaqueEvent(libmyo_event_t) {} - - /// @endcond -}; - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/Hub.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/Hub.hpp deleted file mode 100644 index 748f94b..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/Hub.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include - -namespace myo { - -class Myo; -class DeviceListener; - -/// @brief A Hub provides access to one or more Myo instances. -class Hub { -public: - /// Construct a hub. - /// \a applicationIdentifier must follow a reverse domain name format (ex. com.domainname.appname). Application - /// identifiers can be formed from the set of alphanumeric ASCII characters (a-z, A-Z, 0-9). The hyphen (-) and - /// underscore (_) characters are permitted if they are not adjacent to a period (.) character (i.e. not at the - /// start or end of each segment), but are not permitted in the top-level domain. Application identifiers must have - /// three or more segments. For example, if a company's domain is example.com and the application is named - /// hello-world, one could use "com.example.hello-world" as a valid application identifier. \a applicationIdentifier - /// can be an empty string. - /// Throws an exception of type std::invalid_argument if \a applicationIdentifier is not in the proper reverse - /// domain name format or is longer than 255 characters. - /// Throws an exception of type std::runtime_error if the hub initialization failed for some reason, typically - /// because Myo Connect is not running and a connection can thus not be established. - Hub(const std::string& applicationIdentifier = ""); - - /// Deallocate any resources associated with a Hub. - /// This will cause all Myo instances retrieved from this Hub to become invalid. - ~Hub(); - - /// Wait for a Myo to become paired, or time out after \a timeout_ms milliseconds if provided. - /// If \a timeout_ms is zero, this function blocks until a Myo is found. - /// This function must not be called concurrently with run() or runOnce(). - Myo* waitForMyo(unsigned int milliseconds = 0); - - /// Register a listener to be called when device events occur. - void addListener(DeviceListener* listener); - - /// Remove a previously registered listener. - void removeListener(DeviceListener* listener); - - /// Locking policies supported by Myo. - enum LockingPolicy { - lockingPolicyNone = libmyo_locking_policy_none, - lockingPolicyStandard = libmyo_locking_policy_standard - }; - - /// Set the locking policy for Myos connected to the Hub. - void setLockingPolicy(LockingPolicy lockingPolicy); - - /// Run the event loop for the specified duration (in milliseconds). - void run(unsigned int duration_ms); - - /// Run the event loop until a single event occurs, or the specified duration (in milliseconds) has elapsed. - void runOnce(unsigned int duration_ms); - - /// @cond MYO_INTERNALS - - /// Return the internal libmyo object corresponding to this hub. - libmyo_hub_t libmyoObject(); - -protected: - void onDeviceEvent(libmyo_event_t event); - - Myo* lookupMyo(libmyo_myo_t opaqueMyo) const; - - Myo* addMyo(libmyo_myo_t opaqueMyo); - - libmyo_hub_t _hub; - std::vector _myos; - std::vector _listeners; - - /// @endcond - -private: - // Not implemented - Hub(const Hub&); - Hub& operator=(const Hub&); -}; - -/// @example hello-myo.cpp -/// @example multiple-myos.cpp - -} // namespace myo - -#include "impl/Hub_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/Myo.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/Myo.hpp deleted file mode 100644 index 1474f8c..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/Myo.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -namespace myo { - -/// Represents a Myo device with a specific MAC address. -/// This class can not be instantiated directly; instead, use Hub to get access to a Myo. -/// There is only one Myo instance corresponding to each device; thus, if the addresses of two Myo instances compare -/// equal, they refer to the same device. -class Myo { -public: - /// Types of vibration supported by the Myo. - enum VibrationType { - vibrationShort = libmyo_vibration_short, - vibrationMedium = libmyo_vibration_medium, - vibrationLong = libmyo_vibration_long - }; - - /// Vibrate the Myo. - void vibrate(VibrationType type); - - /// Request the RSSI of the Myo. An onRssi event will likely be generated with the value of the RSSI. - /// @see DeviceListener::onRssi() - void requestRssi() const; - - /// Unlock types supported by Myo. - enum UnlockType { - unlockTimed = libmyo_unlock_timed, - unlockHold = libmyo_unlock_hold - }; - - /// Unlock the Myo. - /// Myo will remain unlocked for a short amount of time, after which it will automatically lock again. - /// If Myo was locked, an onUnlock event will be generated. - void unlock(UnlockType type); - - /// Force the Myo to lock immediately. - /// If Myo was unlocked, an onLock event will be generated. - void lock(); - - /// Notify the Myo that a user action was recognized. - /// Will cause Myo to vibrate. - void notifyUserAction(); - - /// @cond MYO_INTERNALS - - /// Return the internal libmyo object corresponding to this device. - libmyo_myo_t libmyoObject() const; - - /// @endcond - -private: - Myo(libmyo_myo_t myo); - ~Myo(); - - libmyo_myo_t _myo; - - // Not implemented. - Myo(const Myo&); - Myo& operator=(const Myo&); - - friend class Hub; -}; - -} // namespace myo - -#include "impl/Myo_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/Pose.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/Pose.hpp deleted file mode 100644 index 8d668b4..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/Pose.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include -#include - -#include - -namespace myo { - -/// A pose represents a detected configuration of the user's hand. -class Pose { -public: - /// Types of poses supported by the SDK. - enum Type { - rest = libmyo_pose_rest, - fist = libmyo_pose_fist, - waveIn = libmyo_pose_wave_in, - waveOut = libmyo_pose_wave_out, - fingersSpread = libmyo_pose_fingers_spread, - doubleTap = libmyo_pose_double_tap, - unknown = libmyo_pose_unknown - }; - - /// Construct a pose of type Pose::none. - Pose(); - - /// Construct a pose with the given type. - Pose(Type type); - - /// Returns true if and only if the two poses are of the same type. - bool operator==(Pose other) const; - - /// Equivalent to `!(*this == other)`. - bool operator!=(Pose other) const; - - /// Returns the type of this pose. - Type type() const; - - /// Return a human-readable string representation of the pose. - std::string toString() const; - -private: - Type _type; -}; - -/// @relates Pose -/// Returns true if and only if the type of pose is the same as the provided type. -bool operator==(Pose pose, Pose::Type t); - -/// @relates Pose -/// Equivalent to `pose == type`. -bool operator==(Pose::Type type, Pose pose); - -/// @relates Pose -/// Equivalent to `!(pose == type)`. -bool operator!=(Pose pose, Pose::Type type); - -/// @relates Pose -/// Equivalent to `!(type == pose)`. -bool operator!=(Pose::Type type, Pose pose); - -/// @relates Pose -/// Write the name of the provided pose to the provided output stream. -std::ostream& operator<<(std::ostream& out, const Pose& pose); - -} // namespace myo - -#include "impl/Pose_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/Quaternion.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/Quaternion.hpp deleted file mode 100644 index 6e56df3..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/Quaternion.hpp +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include "Vector3.hpp" - -namespace myo { - -/// A quaternion that can be used to represent a rotation. -/// This type provides only very basic functionality to store quaternions that's sufficient to retrieve the data to -/// be placed in a full featured quaternion type. -template -class Quaternion { - public: - /// Construct a quaternion that represents zero rotation (i.e. the multiplicative identity). - Quaternion() - : _x(0) - , _y(0) - , _z(0) - , _w(1) - { - } - - /// Construct a quaternion with the provided components. - Quaternion(T x, T y, T z, T w) - : _x(x) - , _y(y) - , _z(z) - , _w(w) - { - } - - /// Set the components of this quaternion to be those of the other. - Quaternion& operator=(const Quaternion other) - { - _x = other._x; - _y = other._y; - _z = other._z; - _w = other._w; - - return *this; - } - - /// Return the x-component of this quaternion's vector. - T x() const { return _x; } - - /// Return the y-component of this quaternion's vector. - T y() const { return _y; } - - /// Return the z-component of this quaternion's vector. - T z() const { return _z; } - - /// Return the w-component (scalar) of this quaternion. - T w() const { return _w; } - - /// Return the quaternion multiplied by \a rhs. - /// Note that quaternion multiplication is not commutative. - Quaternion operator*(const Quaternion& rhs) const - { - return Quaternion( - _w * rhs._x + _x * rhs._w + _y * rhs._z - _z * rhs._y, - _w * rhs._y - _x * rhs._z + _y * rhs._w + _z * rhs._x, - _w * rhs._z + _x * rhs._y - _y * rhs._x + _z * rhs._w, - _w * rhs._w - _x * rhs._x - _y * rhs._y - _z * rhs._z - ); - } - - /// Multiply this quaternion by \a rhs. - /// Return this quaternion updated with the result. - Quaternion& operator*=(const Quaternion& rhs) - { - *this = *this * rhs; - return *this; - } - - /// Return the unit quaternion corresponding to the same rotation as this one. - Quaternion normalized() const - { - T magnitude = std::sqrt(_x * _x + _y * _y + _z * _z + _w * _w); - - return Quaternion(_x / magnitude, _y / magnitude, _z / magnitude, _w / magnitude); - } - - /// Return this quaternion's conjugate. - Quaternion conjugate() const - { - return Quaternion(-_x, -_y, -_z, _w); - } - - /// Return a quaternion that represents a right-handed rotation of \a angle radians about the given \a axis. - /// \a axis The unit vector representing the axis of rotation. - /// \a angle The angle of rotation, in radians. - static Quaternion fromAxisAngle(const myo::Vector3& axis, T angle) - { - return Quaternion(axis.x() * std::sin(angle / 2), - axis.y() * std::sin(angle / 2), - axis.z() * std::sin(angle / 2), - std::cos(angle / 2)); - } - - private: - T _x, _y, _z, _w; -}; - -/// Return a copy of this \a vec rotated by \a quat. -/// \relates myo::Quaternion -template -Vector3 rotate(const Quaternion& quat, const Vector3& vec) -{ - myo::Quaternion qvec(vec.x(), vec.y(), vec.z(), 0); - myo::Quaternion result = quat * qvec * quat.conjugate(); - return Vector3(result.x(), result.y(), result.z()); -} - -/// Return a quaternion that represents a rotation from vector \a from to \a to. -/// \relates myo::Quaternion -/// See http://stackoverflow.com/questions/1171849/finding-quaternion-representing-the-rotation-from-one-vector-to-another -/// for some explanation. -template -Quaternion rotate(const Vector3& from, const Vector3& to) -{ - Vector3 cross = from.cross(to); - - // The product of the square of magnitudes and the cosine of the angle between from and to. - T cosTheta = from.dot(to); - - // Return identity if the vectors are the same direction. - if (cosTheta >= 1) { - return Quaternion(); - } - - // The product of the square of the magnitudes - T k = std::sqrt(from.dot(from) * to.dot(to)); - - // Return identity in the degenerate case. - if (k <= 0) { - return Quaternion(); - } - - // Special handling for vectors facing opposite directions. - if (cosTheta / k <= -1) { - Vector3 xAxis(1, 0, 0); - Vector3 yAxis(0, 1, 0); - - cross = from.cross(std::abs(from.dot(xAxis)) < 1 ? xAxis : yAxis); - k = cosTheta = 0; - } - - return Quaternion( - cross.x(), - cross.y(), - cross.z(), - k + cosTheta); -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/Vector3.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/Vector3.hpp deleted file mode 100644 index 774654b..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/Vector3.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#define _USE_MATH_DEFINES -#include - -namespace myo { - -/// A vector of three components. -/// This type provides very basic functionality to store a three dimensional vector that's sufficient to retrieve -/// the data to be placed in a full featured vector type. A few common vector operations, such as dot product and -/// cross product, are also provided. -template -class Vector3 { - public: - /// Construct a vector of all zeroes. - Vector3() - { - _data[0] = 0; - _data[1] = 0; - _data[2] = 0; - } - - /// Construct a vector with the three provided components. - Vector3(T x, T y, T z) - { - _data[0] = x; - _data[1] = y; - _data[2] = z; - } - - /// Construct a vector with the same components as \a other. - Vector3(const Vector3& other) - { - *this = other; - } - - /// Set the components of this vector to be the same as \a other. - Vector3& operator=(const Vector3& other) - { - _data[0] = other._data[0]; - _data[1] = other._data[1]; - _data[2] = other._data[2]; - - return *this; - } - - /// Return a copy of the component of this vector at \a index, which should be 0, 1, or 2. - T operator[](unsigned int index) const - { - return _data[index]; - } - - /// Return the x-component of this vector. - T x() const { return _data[0]; } - - /// Return the y-component of this vector. - T y() const { return _data[1]; } - - /// Return the z-component of this vector. - T z() const { return _data[2]; } - - /// Return the magnitude of this vector. - T magnitude() const - { - return std::sqrt(x() * x() + y() * y() + z() * z()); - } - - /// Return a normalized copy of this vector. - Vector3 normalized() const - { - T norm = magnitude(); - return Vector3(x() / norm, y() / norm, z() / norm); - } - - /// Return the dot product of this vector and \a rhs. - T dot(const Vector3& rhs) const - { - return x() * rhs.x() + y() * rhs.y() + z() * rhs.z(); - } - - /// Return the cross product of this vector and \a rhs. - Vector3 cross(const Vector3& rhs) const - { - return Vector3( - y() * rhs.z() - z() * rhs.y(), - z() * rhs.x() - x() * rhs.z(), - x() * rhs.y() - y() * rhs.x() - ); - } - - /// Return the angle between this vector and \a rhs, in radians. - T angleTo(const Vector3& rhs) const - { - return std::acos(dot(rhs) / (magnitude() * rhs.magnitude())); - } - - private: - T _data[3]; -}; - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/detail/ThrowOnError.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/detail/ThrowOnError.hpp deleted file mode 100644 index 3be0f3f..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/detail/ThrowOnError.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_CXX_DETAIL_THROWONERROR_HPP -#define MYO_CXX_DETAIL_THROWONERROR_HPP - -#include - -#include - -#if defined(_MSC_VER) && _MSC_VER <= 1800 -#define LIBMYO_NOEXCEPT(b) -#else -#if __cplusplus >= 201103L -# define LIBMYO_NOEXCEPT(b) noexcept(b) -#else -# define LIBMYO_NOEXCEPT(b) -#endif -#endif - -namespace myo { - -class ThrowOnError { -public: - ThrowOnError() - : _error() - { - } - - ~ThrowOnError() LIBMYO_NOEXCEPT(false) - { - if (_error) - { - switch (libmyo_error_kind(_error)) { - case libmyo_error: - case libmyo_error_runtime: - { - std::runtime_error exception(libmyo_error_cstring(_error)); - libmyo_free_error_details(_error); - throw exception; - } - case libmyo_error_invalid_argument: - { - std::invalid_argument exception(libmyo_error_cstring(_error)); - libmyo_free_error_details(_error); - throw exception; - } - case libmyo_success: - { - break; - } - } - } - } - - operator libmyo_error_details_t*() - { - return &_error; - } - -private: - libmyo_error_details_t _error; - - // Not implemented - ThrowOnError(const ThrowOnError&); // = delete; - ThrowOnError& operator=(const ThrowOnError&); // = delete; -}; - -} //namespace libmyo - -#endif // MYO_CXX_DETAIL_THROWONERROR_HPP diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/impl/Hub_impl.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/impl/Hub_impl.hpp deleted file mode 100644 index d47dcb7..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/impl/Hub_impl.hpp +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#include "../Hub.hpp" - -#include -#include - -#include "../DeviceListener.hpp" -#include "../Myo.hpp" -#include "../Pose.hpp" -#include "../Quaternion.hpp" -#include "../Vector3.hpp" -#include "../detail/ThrowOnError.hpp" - -namespace myo { - -inline -Hub::Hub(const std::string& applicationIdentifier) -: _hub(0) -, _myos() -, _listeners() -{ - libmyo_init_hub(&_hub, applicationIdentifier.c_str(), ThrowOnError()); -} - -inline -Hub::~Hub() -{ - for (std::vector::iterator I = _myos.begin(), IE = _myos.end(); I != IE; ++I) { - delete *I; - } - libmyo_shutdown_hub(_hub, 0); -} - -inline -Myo* Hub::waitForMyo(unsigned int timeout_ms) -{ - std::size_t prevSize = _myos.size(); - - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - libmyo_myo_t opaque_myo = libmyo_event_get_myo(event); - - switch (libmyo_event_get_type(event)) { - case libmyo_event_paired: - hub->addMyo(opaque_myo); - return libmyo_handler_stop; - default: - break; - } - - return libmyo_handler_continue; - } - }; - - do { - libmyo_run(_hub, timeout_ms ? timeout_ms : 1000, &local::handler, this, ThrowOnError()); - } while (!timeout_ms && _myos.size() <= prevSize); - - if (_myos.size() <= prevSize) { - return 0; - } - - return _myos.back(); -} - -inline -void Hub::addListener(DeviceListener* listener) -{ - if (std::find(_listeners.begin(), _listeners.end(), listener) != _listeners.end()) { - // Listener was already added. - return; - } - _listeners.push_back(listener); -} - -inline -void Hub::removeListener(DeviceListener* listener) -{ - std::vector::iterator I = std::find(_listeners.begin(), _listeners.end(), listener); - if (I == _listeners.end()) { - // Don't have this listener. - return; - } - - _listeners.erase(I); -} - -inline -void Hub::setLockingPolicy(LockingPolicy lockingPolicy) -{ - libmyo_set_locking_policy(_hub, static_cast(lockingPolicy), ThrowOnError()); -} - -inline -void Hub::onDeviceEvent(libmyo_event_t event) -{ - libmyo_myo_t opaqueMyo = libmyo_event_get_myo(event); - - Myo* myo = lookupMyo(opaqueMyo); - - if (!myo && libmyo_event_get_type(event) == libmyo_event_paired) { - myo = addMyo(opaqueMyo); - } - - if (!myo) { - // Ignore events for Myos we don't know about. - return; - } - - for (std::vector::iterator I = _listeners.begin(), IE = _listeners.end(); I != IE; ++I) { - DeviceListener* listener = *I; - - listener->onOpaqueEvent(event); - - uint64_t time = libmyo_event_get_timestamp(event); - - switch (libmyo_event_get_type(event)) { - case libmyo_event_paired: { - FirmwareVersion version = {libmyo_event_get_firmware_version(event, libmyo_version_major), - libmyo_event_get_firmware_version(event, libmyo_version_minor), - libmyo_event_get_firmware_version(event, libmyo_version_patch), - libmyo_event_get_firmware_version(event, libmyo_version_hardware_rev)}; - listener->onPair(myo, time, version); - break; - } - case libmyo_event_unpaired: - listener->onUnpair(myo, time); - break; - case libmyo_event_connected: { - FirmwareVersion version = {libmyo_event_get_firmware_version(event, libmyo_version_major), - libmyo_event_get_firmware_version(event, libmyo_version_minor), - libmyo_event_get_firmware_version(event, libmyo_version_patch), - libmyo_event_get_firmware_version(event, libmyo_version_hardware_rev)}; - listener->onConnect(myo, time, version); - break; - } - case libmyo_event_disconnected: - listener->onDisconnect(myo, time); - break; - case libmyo_event_arm_synced: - listener->onArmSync(myo, time, - static_cast(libmyo_event_get_arm(event)), - static_cast(libmyo_event_get_x_direction(event))); - break; - case libmyo_event_arm_unsynced: - listener->onArmUnsync(myo, time); - break; - case libmyo_event_unlocked: - listener->onUnlock(myo, time); - break; - case libmyo_event_locked: - listener->onLock(myo, time); - break; - case libmyo_event_orientation: - listener->onOrientationData(myo, time, - Quaternion(libmyo_event_get_orientation(event, libmyo_orientation_x), - libmyo_event_get_orientation(event, libmyo_orientation_y), - libmyo_event_get_orientation(event, libmyo_orientation_z), - libmyo_event_get_orientation(event, libmyo_orientation_w))); - listener->onAccelerometerData(myo, time, - Vector3(libmyo_event_get_accelerometer(event, 0), - libmyo_event_get_accelerometer(event, 1), - libmyo_event_get_accelerometer(event, 2))); - - listener->onGyroscopeData(myo, time, - Vector3(libmyo_event_get_gyroscope(event, 0), - libmyo_event_get_gyroscope(event, 1), - libmyo_event_get_gyroscope(event, 2))); - - break; - case libmyo_event_pose: - listener->onPose(myo, time, Pose(static_cast(libmyo_event_get_pose(event)))); - break; - case libmyo_event_rssi: - listener->onRssi(myo, time, libmyo_event_get_rssi(event)); - break; - } - } -} - -inline -void Hub::run(unsigned int duration_ms) -{ - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - hub->onDeviceEvent(event); - - return libmyo_handler_continue; - } - }; - libmyo_run(_hub, duration_ms, &local::handler, this, ThrowOnError()); -} - -inline -void Hub::runOnce(unsigned int duration_ms) -{ - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - hub->onDeviceEvent(event); - - return libmyo_handler_stop; - } - }; - libmyo_run(_hub, duration_ms, &local::handler, this, ThrowOnError()); -} - -inline -libmyo_hub_t Hub::libmyoObject() -{ - return _hub; -} - -inline -Myo* Hub::lookupMyo(libmyo_myo_t opaqueMyo) const -{ - Myo* myo = 0; - for (std::vector::const_iterator I = _myos.begin(), IE = _myos.end(); I != IE; ++I) { - if ((*I)->libmyoObject() == opaqueMyo) { - myo = *I; - break; - } - } - - return myo; -} - -inline -Myo* Hub::addMyo(libmyo_myo_t opaqueMyo) -{ - Myo* myo = new Myo(opaqueMyo); - - _myos.push_back(myo); - - return myo; -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/impl/Myo_impl.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/impl/Myo_impl.hpp deleted file mode 100644 index 8803381..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/impl/Myo_impl.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#include "../Myo.hpp" -#include "../detail/ThrowOnError.hpp" - -#include - -namespace myo { - -inline -void Myo::vibrate(VibrationType type) -{ - libmyo_vibrate(_myo, static_cast(type), ThrowOnError()); -} - -inline -void Myo::requestRssi() const -{ - libmyo_request_rssi(_myo, ThrowOnError()); -} - -inline -void Myo::unlock(UnlockType type) -{ - libmyo_myo_unlock(_myo, static_cast(type), ThrowOnError()); -} - -inline -void Myo::lock() -{ - libmyo_myo_lock(_myo, ThrowOnError()); -} - -inline -void Myo::notifyUserAction() -{ - libmyo_myo_notify_user_action(_myo, libmyo_user_action_single, ThrowOnError()); -} - -inline -libmyo_myo_t Myo::libmyoObject() const -{ - return _myo; -} - -inline -Myo::Myo(libmyo_myo_t myo) -: _myo(myo) -{ - if (!_myo) { - throw std::invalid_argument("Cannot construct Myo instance with null pointer"); - } -} - -inline -Myo::~Myo() -{ -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Headers/cxx/impl/Pose_impl.hpp b/src/main/resources/osx/myo.framework/Headers/cxx/impl/Pose_impl.hpp deleted file mode 100644 index 7432e39..0000000 --- a/src/main/resources/osx/myo.framework/Headers/cxx/impl/Pose_impl.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_CXX_IMPL_POSE_IMPL_HPP -#define MYO_CXX_IMPL_POSE_IMPL_HPP - -#include "../Pose.hpp" - -#include - -namespace myo { - -inline -Pose::Pose() -: _type(unknown) -{ -} - -inline -Pose::Pose(Pose::Type type) -: _type(type) -{ -} - -inline -bool Pose::operator==(Pose other) const -{ - return _type == other._type; -} - -inline -bool Pose::operator!=(Pose other) const -{ - return !(*this == other); -} - -inline -Pose::Type Pose::type() const -{ - return _type; -} - -inline -bool operator==(Pose pose, Pose::Type type) -{ - return pose.type() == type; -} - -inline -bool operator==(Pose::Type type, Pose pose) -{ - return pose == type; -} - -inline -bool operator!=(Pose pose, Pose::Type type) -{ - return !(pose == type); -} - -inline -bool operator!=(Pose::Type type, Pose pose) -{ - return !(type == pose); -} - -inline -std::string Pose::toString() const -{ - switch (type()) { - case Pose::rest: - return "rest"; - case Pose::fist: - return "fist"; - case Pose::waveIn: - return "waveIn"; - case Pose::waveOut: - return "waveOut"; - case Pose::fingersSpread: - return "fingersSpread"; - case Pose::doubleTap: - return "doubleTap"; - case Pose::unknown: - return "unknown"; - } - - return ""; -} - -inline -std::ostream& operator<<(std::ostream& out, const Pose& pose) -{ - return out << pose.toString(); -} - -} // namespace myo - -#endif // MYO_CXX_IMPL_POSE_IMPL_HPP diff --git a/src/main/resources/osx/myo.framework/Headers/libmyo.h b/src/main/resources/osx/myo.framework/Headers/libmyo.h deleted file mode 100644 index e3b2e5b..0000000 --- a/src/main/resources/osx/myo.framework/Headers/libmyo.h +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_LIBMYO_H -#define MYO_LIBMYO_H - -#include - -#include "libmyo/detail/visibility.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// @file libmyo.h -/// libmyo C API declarations. - -typedef void* libmyo_hub_t; - -/// \defgroup errors Error Handling -/// @{ - -/// Function result codes. -/// All libmyo functions that can fail return a value of this type. -typedef enum { - libmyo_success, - libmyo_error, - libmyo_error_invalid_argument, - libmyo_error_runtime -} libmyo_result_t; - -/// Opaque handle to detailed error information. -typedef void* libmyo_error_details_t; - -/// Return a null-terminated string with a detailed error message. -LIBMYO_EXPORT -const char* libmyo_error_cstring(libmyo_error_details_t); - -/// Returns the kind of error that occurred. -LIBMYO_EXPORT -libmyo_result_t libmyo_error_kind(libmyo_error_details_t); - -/// Free the resources allocated by an error object. -LIBMYO_EXPORT -void libmyo_free_error_details(libmyo_error_details_t); - -/// @} - -/// @defgroup libmyo_hub Hub instance -/// @{ - -/// Initialize a connection to the hub. -/// \a application_identifier must follow a reverse domain name format (ex. com.domainname.appname). Application -/// identifiers can be formed from the set of alphanumeric ASCII characters (a-z, A-Z, 0-9). The hyphen (-) and -/// underscore (_) characters are permitted if they are not adjacent to a period (.) character (i.e. not at the start or -/// end of each segment), but are not permitted in the top-level domain. Application identifiers must have three or more -/// segments. For example, if a company's domain is example.com and the application is named hello-world, one could use -/// "com.example.hello-world" as a valid application identifier. \a application_identifier can be NULL or empty. -/// @returns libmyo_success if the connection is successfully established, otherwise: -/// - libmyo_error_runtime if a connection could not be established -/// - libmyo_error_invalid_argument if \a out_hub is NULL -/// - libmyo_error_invalid_argument if \a application_identifier is longer than 255 characters -/// - libmyo_error_invalid_argument if \a application_identifier is not in the proper reverse domain name format -LIBMYO_EXPORT -libmyo_result_t libmyo_init_hub(libmyo_hub_t* out_hub, const char* application_identifier, - libmyo_error_details_t* out_error); - -/// Free the resources allocated to a hub. -/// @returns libmyo_success if shutdown is successful, otherwise: -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error if \a hub is not a valid hub -LIBMYO_EXPORT -libmyo_result_t libmyo_shutdown_hub(libmyo_hub_t hub, libmyo_error_details_t* out_error); - -// Locking policies. -typedef enum { - libmyo_locking_policy_none, ///< Pose events are always sent. - libmyo_locking_policy_standard ///< Pose events are not sent while a Myo is locked. -} libmyo_locking_policy_t; - -/// Set the locking policy for Myos connected to the hub. -/// @returns libmyo_success if the locking policy is successfully set, otherwise -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error if \a hub is not a valid hub -LIBMYO_EXPORT -libmyo_result_t libmyo_set_locking_policy(libmyo_hub_t hub, libmyo_locking_policy_t locking_policy, - libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_myo Myo instances -/// @{ - -/// Opaque type corresponding to a known Myo device. -typedef void* libmyo_myo_t; - -/// Types of vibration -typedef enum { - libmyo_vibration_short, - libmyo_vibration_medium, - libmyo_vibration_long -} libmyo_vibration_type_t; - -/// Vibrate the given myo. -/// Can be called when a Myo is paired. -/// @returns libmyo_success if the Myo successfully vibrated, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_vibrate(libmyo_myo_t myo, libmyo_vibration_type_t type, libmyo_error_details_t* out_error); - -/// Request the RSSI for a given myo. -/// Can be called when a Myo is paired. A libmyo_event_rssi event will likely be generated with the value of the RSSI. -/// @returns libmyo_success if the Myo successfully got the RSSI, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_request_rssi(libmyo_myo_t myo, libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_poses Pose recognition. -/// @{ - -/// Supported poses. -typedef enum { - libmyo_pose_rest = 0, ///< Rest pose. - libmyo_pose_fist = 1, ///< User is making a fist. - libmyo_pose_wave_in = 2, ///< User has an open palm rotated towards the posterior of their wrist. - libmyo_pose_wave_out = 3, ///< User has an open palm rotated towards the anterior of their wrist. - libmyo_pose_fingers_spread = 4, ///< User has an open palm with their fingers spread away from each other. - libmyo_pose_double_tap = 5, ///< User tapped their thumb and middle finger together twice in succession. - - libmyo_num_poses, ///< Number of poses supported; not a valid pose. - - libmyo_pose_unknown = 0xffff ///< Unknown pose. -} libmyo_pose_t; - -/// @} - -/// @defgroup libmyo_locking Myo locking mechanism - -/// Valid unlock types. -typedef enum { - libmyo_unlock_timed = 0, ///< Unlock for a fixed period of time. - libmyo_unlock_hold = 1, ///< Unlock until explicitly told to re-lock. -} libmyo_unlock_type_t; - -/// Unlock the given Myo. -/// Can be called when a Myo is paired. A libmyo_event_unlocked event will be generated if the Myo was locked. -/// @returns libmyo_success if the Myo was successfully unlocked, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_unlock(libmyo_myo_t myo, libmyo_unlock_type_t type, libmyo_error_details_t* out_error); - -/// Lock the given Myo immediately. -/// Can be called when a Myo is paired. A libmyo_event_locked event will be generated if the Myo was unlocked. -/// @returns libmyo_success if the Myo was successfully locked, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_lock(libmyo_myo_t myo, libmyo_error_details_t* out_error); - -/// User action types. -typedef enum { - libmyo_user_action_single = 0, ///< User did a single, discrete action, such as pausing a video. -} libmyo_user_action_type_t; - -/// Notify the given Myo that a user action was recognized. -/// Can be called when a Myo is paired. Will cause Myo to vibrate. -/// @returns libmyo_success if the Myo was successfully notified, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_notify_user_action(libmyo_myo_t myo, libmyo_user_action_type_t type, - libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_events Event Handling -/// @{ - -/// Types of events. -typedef enum { - libmyo_event_paired, ///< Successfully paired with a Myo. - libmyo_event_unpaired, ///< Successfully unpaired from a Myo. - libmyo_event_connected, ///< A Myo has successfully connected. - libmyo_event_disconnected, ///< A Myo has been disconnected. - libmyo_event_arm_synced, ///< A Myo has recognized that the sync gesture has been successfully performed. - libmyo_event_arm_unsynced, ///< A Myo has been moved or removed from the arm. - libmyo_event_orientation, ///< Orientation data has been received. - libmyo_event_pose, ///< A change in pose has been detected. @see libmyo_pose_t. - libmyo_event_rssi, ///< An RSSI value has been received. - libmyo_event_unlocked, ///< A Myo has become unlocked. - libmyo_event_locked, ///< A Myo has become locked. -} libmyo_event_type_t; - -/// Information about an event. -typedef const void* libmyo_event_t; - -/// Retrieve the type of an event. -LIBMYO_EXPORT -uint32_t libmyo_event_get_type(libmyo_event_t event); - -/// Retrieve the timestamp of an event. -/// @see libmyo_now() for details on timestamps. -LIBMYO_EXPORT -uint64_t libmyo_event_get_timestamp(libmyo_event_t event); - -/// Retrieve the Myo associated with an event. -LIBMYO_EXPORT -libmyo_myo_t libmyo_event_get_myo(libmyo_event_t event); - -/// Components of version. -typedef enum { - libmyo_version_major, ///< Major version. - libmyo_version_minor, ///< Minor version. - libmyo_version_patch, ///< Patch version. - libmyo_version_hardware_rev, ///< Hardware revision. -} libmyo_version_component_t; - -/// Hardware revisions. -typedef enum { - libmyo_hardware_rev_c = 1, ///< Alpha units - libmyo_hardware_rev_d = 2, ///< Consumer units -} libmyo_hardware_rev_t; - -/// Retrieve the Myo armband's firmware version from this event. -/// Valid for libmyo_event_paired and libmyo_event_connected events. -LIBMYO_EXPORT -unsigned int libmyo_event_get_firmware_version(libmyo_event_t event, libmyo_version_component_t); - -/// Enumeration identifying a right arm or left arm. @see libmyo_event_get_arm(). -typedef enum { - libmyo_arm_right, ///< Myo is on the right arm. - libmyo_arm_left, ///< Myo is on the left arm. - libmyo_arm_unknown, ///< Unknown arm. -} libmyo_arm_t; - -/// Retrieve the arm associated with an event. -/// Valid for libmyo_event_arm_synced events only. -LIBMYO_EXPORT -libmyo_arm_t libmyo_event_get_arm(libmyo_event_t event); - -/// Possible directions for Myo's +x axis relative to a user's arm. -typedef enum { - libmyo_x_direction_toward_wrist, ///< Myo's +x axis is pointing toward the user's wrist. - libmyo_x_direction_toward_elbow, ///< Myo's +x axis is pointing toward the user's elbow. - libmyo_x_direction_unknown, ///< Unknown +x axis direction. -} libmyo_x_direction_t; - -/// Retrieve the x-direction associated with an event. -/// The x-direction specifies which way Myo's +x axis is pointing relative to the user's arm. -/// Valid for libmyo_event_arm_synced events only. -LIBMYO_EXPORT -libmyo_x_direction_t libmyo_event_get_x_direction(libmyo_event_t event); - -/// Index into orientation data, which is provided as a quaternion. -/// Orientation data is returned as a unit quaternion of floats, represented as `w + x * i + y * j + z * k`. -typedef enum { - libmyo_orientation_x = 0, ///< First component of the quaternion's vector part - libmyo_orientation_y = 1, ///< Second component of the quaternion's vector part - libmyo_orientation_z = 2, ///< Third component of the quaternion's vector part - libmyo_orientation_w = 3, ///< Scalar component of the quaternion. -} libmyo_orientation_index; - -/// Retrieve orientation data associated with an event. -/// Valid for libmyo_event_orientation events only. -/// @see libmyo_orientation_index -LIBMYO_EXPORT -float libmyo_event_get_orientation(libmyo_event_t event, libmyo_orientation_index index); - -/// Retrieve raw accelerometer data associated with an event in units of g. -/// Valid for libmyo_event_orientation events only. -/// Requires `index < 3`. -LIBMYO_EXPORT -float libmyo_event_get_accelerometer(libmyo_event_t event, unsigned int index); - -/// Retrieve raw gyroscope data associated with an event in units of deg/s. -/// Valid for libmyo_event_orientation events only. -/// Requires `index < 3`. -LIBMYO_EXPORT -float libmyo_event_get_gyroscope(libmyo_event_t event, unsigned int index); - -/// Retrieve the pose associated with an event. -/// Valid for libmyo_event_pose events only. -LIBMYO_EXPORT -libmyo_pose_t libmyo_event_get_pose(libmyo_event_t event); - -/// Retreive the RSSI associated with an event. -/// Valid for libmyo_event_rssi events only. -LIBMYO_EXPORT -int8_t libmyo_event_get_rssi(libmyo_event_t event); - -/// Return type for event handlers. -typedef enum { - libmyo_handler_continue, ///< Continue processing events - libmyo_handler_stop, ///< Stop processing events -} libmyo_handler_result_t; - -/// Callback function type to handle events as they occur from libmyo_run(). -typedef libmyo_handler_result_t (*libmyo_handler_t)(void* user_data, libmyo_event_t event); - -/// Process events and call the provided callback as they occur. -/// Runs for up to approximately \a duration_ms milliseconds or until a called handler returns libmyo_handler_stop. -/// @returns libmyo_success after a successful run, otherwise -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error_invalid_argument if \a handler is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_run(libmyo_hub_t hub, unsigned int duration_ms, libmyo_handler_t handler, void* user_data, - libmyo_error_details_t* out_error); - -/// @} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // MYO_LIBMYO_H diff --git a/src/main/resources/osx/myo.framework/Headers/libmyo/detail/visibility.h b/src/main/resources/osx/myo.framework/Headers/libmyo/detail/visibility.h deleted file mode 100644 index 3a23e6a..0000000 --- a/src/main/resources/osx/myo.framework/Headers/libmyo/detail/visibility.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_LIBMYO_DETAIL_VISIBILITY_H -#define MYO_LIBMYO_DETAIL_VISIBILITY_H - -#if defined(_WIN32) || defined(__CYGWIN__) - #ifdef myo_EXPORTS - #ifdef __GNUC__ - #define LIBMYO_EXPORT __attribute__ ((dllexport)) - #else - #define LIBMYO_EXPORT __declspec(dllexport) - #endif - #else - #ifdef LIBMYO_STATIC_BUILD - #define LIBMYO_EXPORT - #else - #ifdef __GNUC__ - #define LIBMYO_EXPORT __attribute__ ((dllimport)) - #else - #define LIBMYO_EXPORT __declspec(dllimport) - #endif - #endif - #endif -#else - #if __GNUC__ >= 4 - #define LIBMYO_EXPORT __attribute__ ((visibility ("default"))) - #else - #define LIBMYO_EXPORT - #endif -#endif - -#endif // MYO_LIBMYO_DETAIL_VISIBILITY_H diff --git a/src/main/resources/osx/myo.framework/Headers/myo.hpp b/src/main/resources/osx/myo.framework/Headers/myo.hpp deleted file mode 100644 index 5ea17fb..0000000 --- a/src/main/resources/osx/myo.framework/Headers/myo.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -/// The namespace in which all of the %Myo C++ bindings are contained. -namespace myo {} - -#include "cxx/DeviceListener.hpp" -#include "cxx/Hub.hpp" -#include "cxx/Myo.hpp" -#include "cxx/Pose.hpp" -#include "cxx/Quaternion.hpp" -#include "cxx/Vector3.hpp" diff --git a/src/main/resources/osx/myo.framework/Resources/Info.plist b/src/main/resources/osx/myo.framework/Resources/Info.plist deleted file mode 100644 index aeec5cc..0000000 --- a/src/main/resources/osx/myo.framework/Resources/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - myo - CFBundleIconFile - - CFBundleIdentifier - - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - - CFBundleShortVersionString - - CSResourcesFileMapped - - - diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/DeviceListener.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/DeviceListener.hpp deleted file mode 100644 index fca151b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/DeviceListener.hpp +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include "Pose.hpp" - -namespace myo { - -class Myo; -template -class Quaternion; -template -class Vector3; - -/// Enumeration identifying a right arm or left arm. -enum Arm { - armLeft = libmyo_arm_left, - armRight = libmyo_arm_right, - armUnknown = libmyo_arm_unknown -}; - -/// Possible directions for Myo's +x axis relative to a user's arm. -enum XDirection { - xDirectionTowardWrist = libmyo_x_direction_toward_wrist, - xDirectionTowardElbow = libmyo_x_direction_toward_elbow, - xDirectionUnknown = libmyo_x_direction_unknown -}; - -/// Firmware version of Myo. -struct FirmwareVersion { - unsigned int firmwareVersionMajor; ///< Myo's major version must match the required major version. - unsigned int firmwareVersionMinor; ///< Myo's minor version must match the required minor version. - unsigned int firmwareVersionPatch; ///< Myo's patch version must greater or equal to the required patch version. - unsigned int firmwareVersionHardwareRev; ///< Myo's hardware revision; not used to detect firmware version mismatch. -}; - -/// A DeviceListener receives events about a Myo. -/// @see Hub::addListener() -class DeviceListener { -public: - virtual ~DeviceListener() {} - - /// Called when a Myo has been paired. - virtual void onPair(Myo* myo, uint64_t timestamp, FirmwareVersion firmwareVersion) {} - - /// Called when a Myo has been unpaired. - virtual void onUnpair(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo has been connected. - virtual void onConnect(Myo* myo, uint64_t timestamp, FirmwareVersion firmwareVersion) {} - - /// Called when a paired Myo has been disconnected. - virtual void onDisconnect(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo recognizes that it is on an arm. - virtual void onArmSync(Myo* myo, uint64_t timestamp, Arm arm, XDirection xDirection) {} - - /// Called when a paired Myo is moved or removed from the arm. - virtual void onArmUnsync(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo becomes unlocked. - virtual void onUnlock(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo becomes locked. - virtual void onLock(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo has provided a new pose. - virtual void onPose(Myo* myo, uint64_t timestamp, Pose pose) {} - - /// Called when a paired Myo has provided new orientation data. - virtual void onOrientationData(Myo* myo, uint64_t timestamp, const Quaternion& rotation) {} - - /// Called when a paired Myo has provided new accelerometer data in units of g. - virtual void onAccelerometerData(Myo* myo, uint64_t timestamp, const Vector3& accel) {} - - /// Called when a paired Myo has provided new gyroscope data in units of deg/s. - virtual void onGyroscopeData(Myo* myo, uint64_t timestamp, const Vector3& gyro) {} - - /// Called when a paired Myo has provided a new RSSI value. - /// @see Myo::requestRssi() to request an RSSI value from the Myo. - virtual void onRssi(Myo* myo, uint64_t timestamp, int8_t rssi) {} - - /// @cond LIBMYO_INTERNALS - - virtual void onOpaqueEvent(libmyo_event_t) {} - - /// @endcond -}; - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Hub.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Hub.hpp deleted file mode 100644 index 748f94b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Hub.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include - -namespace myo { - -class Myo; -class DeviceListener; - -/// @brief A Hub provides access to one or more Myo instances. -class Hub { -public: - /// Construct a hub. - /// \a applicationIdentifier must follow a reverse domain name format (ex. com.domainname.appname). Application - /// identifiers can be formed from the set of alphanumeric ASCII characters (a-z, A-Z, 0-9). The hyphen (-) and - /// underscore (_) characters are permitted if they are not adjacent to a period (.) character (i.e. not at the - /// start or end of each segment), but are not permitted in the top-level domain. Application identifiers must have - /// three or more segments. For example, if a company's domain is example.com and the application is named - /// hello-world, one could use "com.example.hello-world" as a valid application identifier. \a applicationIdentifier - /// can be an empty string. - /// Throws an exception of type std::invalid_argument if \a applicationIdentifier is not in the proper reverse - /// domain name format or is longer than 255 characters. - /// Throws an exception of type std::runtime_error if the hub initialization failed for some reason, typically - /// because Myo Connect is not running and a connection can thus not be established. - Hub(const std::string& applicationIdentifier = ""); - - /// Deallocate any resources associated with a Hub. - /// This will cause all Myo instances retrieved from this Hub to become invalid. - ~Hub(); - - /// Wait for a Myo to become paired, or time out after \a timeout_ms milliseconds if provided. - /// If \a timeout_ms is zero, this function blocks until a Myo is found. - /// This function must not be called concurrently with run() or runOnce(). - Myo* waitForMyo(unsigned int milliseconds = 0); - - /// Register a listener to be called when device events occur. - void addListener(DeviceListener* listener); - - /// Remove a previously registered listener. - void removeListener(DeviceListener* listener); - - /// Locking policies supported by Myo. - enum LockingPolicy { - lockingPolicyNone = libmyo_locking_policy_none, - lockingPolicyStandard = libmyo_locking_policy_standard - }; - - /// Set the locking policy for Myos connected to the Hub. - void setLockingPolicy(LockingPolicy lockingPolicy); - - /// Run the event loop for the specified duration (in milliseconds). - void run(unsigned int duration_ms); - - /// Run the event loop until a single event occurs, or the specified duration (in milliseconds) has elapsed. - void runOnce(unsigned int duration_ms); - - /// @cond MYO_INTERNALS - - /// Return the internal libmyo object corresponding to this hub. - libmyo_hub_t libmyoObject(); - -protected: - void onDeviceEvent(libmyo_event_t event); - - Myo* lookupMyo(libmyo_myo_t opaqueMyo) const; - - Myo* addMyo(libmyo_myo_t opaqueMyo); - - libmyo_hub_t _hub; - std::vector _myos; - std::vector _listeners; - - /// @endcond - -private: - // Not implemented - Hub(const Hub&); - Hub& operator=(const Hub&); -}; - -/// @example hello-myo.cpp -/// @example multiple-myos.cpp - -} // namespace myo - -#include "impl/Hub_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Myo.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Myo.hpp deleted file mode 100644 index 1474f8c..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Myo.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -namespace myo { - -/// Represents a Myo device with a specific MAC address. -/// This class can not be instantiated directly; instead, use Hub to get access to a Myo. -/// There is only one Myo instance corresponding to each device; thus, if the addresses of two Myo instances compare -/// equal, they refer to the same device. -class Myo { -public: - /// Types of vibration supported by the Myo. - enum VibrationType { - vibrationShort = libmyo_vibration_short, - vibrationMedium = libmyo_vibration_medium, - vibrationLong = libmyo_vibration_long - }; - - /// Vibrate the Myo. - void vibrate(VibrationType type); - - /// Request the RSSI of the Myo. An onRssi event will likely be generated with the value of the RSSI. - /// @see DeviceListener::onRssi() - void requestRssi() const; - - /// Unlock types supported by Myo. - enum UnlockType { - unlockTimed = libmyo_unlock_timed, - unlockHold = libmyo_unlock_hold - }; - - /// Unlock the Myo. - /// Myo will remain unlocked for a short amount of time, after which it will automatically lock again. - /// If Myo was locked, an onUnlock event will be generated. - void unlock(UnlockType type); - - /// Force the Myo to lock immediately. - /// If Myo was unlocked, an onLock event will be generated. - void lock(); - - /// Notify the Myo that a user action was recognized. - /// Will cause Myo to vibrate. - void notifyUserAction(); - - /// @cond MYO_INTERNALS - - /// Return the internal libmyo object corresponding to this device. - libmyo_myo_t libmyoObject() const; - - /// @endcond - -private: - Myo(libmyo_myo_t myo); - ~Myo(); - - libmyo_myo_t _myo; - - // Not implemented. - Myo(const Myo&); - Myo& operator=(const Myo&); - - friend class Hub; -}; - -} // namespace myo - -#include "impl/Myo_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Pose.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Pose.hpp deleted file mode 100644 index 8d668b4..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Pose.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include -#include - -#include - -namespace myo { - -/// A pose represents a detected configuration of the user's hand. -class Pose { -public: - /// Types of poses supported by the SDK. - enum Type { - rest = libmyo_pose_rest, - fist = libmyo_pose_fist, - waveIn = libmyo_pose_wave_in, - waveOut = libmyo_pose_wave_out, - fingersSpread = libmyo_pose_fingers_spread, - doubleTap = libmyo_pose_double_tap, - unknown = libmyo_pose_unknown - }; - - /// Construct a pose of type Pose::none. - Pose(); - - /// Construct a pose with the given type. - Pose(Type type); - - /// Returns true if and only if the two poses are of the same type. - bool operator==(Pose other) const; - - /// Equivalent to `!(*this == other)`. - bool operator!=(Pose other) const; - - /// Returns the type of this pose. - Type type() const; - - /// Return a human-readable string representation of the pose. - std::string toString() const; - -private: - Type _type; -}; - -/// @relates Pose -/// Returns true if and only if the type of pose is the same as the provided type. -bool operator==(Pose pose, Pose::Type t); - -/// @relates Pose -/// Equivalent to `pose == type`. -bool operator==(Pose::Type type, Pose pose); - -/// @relates Pose -/// Equivalent to `!(pose == type)`. -bool operator!=(Pose pose, Pose::Type type); - -/// @relates Pose -/// Equivalent to `!(type == pose)`. -bool operator!=(Pose::Type type, Pose pose); - -/// @relates Pose -/// Write the name of the provided pose to the provided output stream. -std::ostream& operator<<(std::ostream& out, const Pose& pose); - -} // namespace myo - -#include "impl/Pose_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Quaternion.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Quaternion.hpp deleted file mode 100644 index 6e56df3..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Quaternion.hpp +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include "Vector3.hpp" - -namespace myo { - -/// A quaternion that can be used to represent a rotation. -/// This type provides only very basic functionality to store quaternions that's sufficient to retrieve the data to -/// be placed in a full featured quaternion type. -template -class Quaternion { - public: - /// Construct a quaternion that represents zero rotation (i.e. the multiplicative identity). - Quaternion() - : _x(0) - , _y(0) - , _z(0) - , _w(1) - { - } - - /// Construct a quaternion with the provided components. - Quaternion(T x, T y, T z, T w) - : _x(x) - , _y(y) - , _z(z) - , _w(w) - { - } - - /// Set the components of this quaternion to be those of the other. - Quaternion& operator=(const Quaternion other) - { - _x = other._x; - _y = other._y; - _z = other._z; - _w = other._w; - - return *this; - } - - /// Return the x-component of this quaternion's vector. - T x() const { return _x; } - - /// Return the y-component of this quaternion's vector. - T y() const { return _y; } - - /// Return the z-component of this quaternion's vector. - T z() const { return _z; } - - /// Return the w-component (scalar) of this quaternion. - T w() const { return _w; } - - /// Return the quaternion multiplied by \a rhs. - /// Note that quaternion multiplication is not commutative. - Quaternion operator*(const Quaternion& rhs) const - { - return Quaternion( - _w * rhs._x + _x * rhs._w + _y * rhs._z - _z * rhs._y, - _w * rhs._y - _x * rhs._z + _y * rhs._w + _z * rhs._x, - _w * rhs._z + _x * rhs._y - _y * rhs._x + _z * rhs._w, - _w * rhs._w - _x * rhs._x - _y * rhs._y - _z * rhs._z - ); - } - - /// Multiply this quaternion by \a rhs. - /// Return this quaternion updated with the result. - Quaternion& operator*=(const Quaternion& rhs) - { - *this = *this * rhs; - return *this; - } - - /// Return the unit quaternion corresponding to the same rotation as this one. - Quaternion normalized() const - { - T magnitude = std::sqrt(_x * _x + _y * _y + _z * _z + _w * _w); - - return Quaternion(_x / magnitude, _y / magnitude, _z / magnitude, _w / magnitude); - } - - /// Return this quaternion's conjugate. - Quaternion conjugate() const - { - return Quaternion(-_x, -_y, -_z, _w); - } - - /// Return a quaternion that represents a right-handed rotation of \a angle radians about the given \a axis. - /// \a axis The unit vector representing the axis of rotation. - /// \a angle The angle of rotation, in radians. - static Quaternion fromAxisAngle(const myo::Vector3& axis, T angle) - { - return Quaternion(axis.x() * std::sin(angle / 2), - axis.y() * std::sin(angle / 2), - axis.z() * std::sin(angle / 2), - std::cos(angle / 2)); - } - - private: - T _x, _y, _z, _w; -}; - -/// Return a copy of this \a vec rotated by \a quat. -/// \relates myo::Quaternion -template -Vector3 rotate(const Quaternion& quat, const Vector3& vec) -{ - myo::Quaternion qvec(vec.x(), vec.y(), vec.z(), 0); - myo::Quaternion result = quat * qvec * quat.conjugate(); - return Vector3(result.x(), result.y(), result.z()); -} - -/// Return a quaternion that represents a rotation from vector \a from to \a to. -/// \relates myo::Quaternion -/// See http://stackoverflow.com/questions/1171849/finding-quaternion-representing-the-rotation-from-one-vector-to-another -/// for some explanation. -template -Quaternion rotate(const Vector3& from, const Vector3& to) -{ - Vector3 cross = from.cross(to); - - // The product of the square of magnitudes and the cosine of the angle between from and to. - T cosTheta = from.dot(to); - - // Return identity if the vectors are the same direction. - if (cosTheta >= 1) { - return Quaternion(); - } - - // The product of the square of the magnitudes - T k = std::sqrt(from.dot(from) * to.dot(to)); - - // Return identity in the degenerate case. - if (k <= 0) { - return Quaternion(); - } - - // Special handling for vectors facing opposite directions. - if (cosTheta / k <= -1) { - Vector3 xAxis(1, 0, 0); - Vector3 yAxis(0, 1, 0); - - cross = from.cross(std::abs(from.dot(xAxis)) < 1 ? xAxis : yAxis); - k = cosTheta = 0; - } - - return Quaternion( - cross.x(), - cross.y(), - cross.z(), - k + cosTheta); -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Vector3.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Vector3.hpp deleted file mode 100644 index 774654b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/Vector3.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#define _USE_MATH_DEFINES -#include - -namespace myo { - -/// A vector of three components. -/// This type provides very basic functionality to store a three dimensional vector that's sufficient to retrieve -/// the data to be placed in a full featured vector type. A few common vector operations, such as dot product and -/// cross product, are also provided. -template -class Vector3 { - public: - /// Construct a vector of all zeroes. - Vector3() - { - _data[0] = 0; - _data[1] = 0; - _data[2] = 0; - } - - /// Construct a vector with the three provided components. - Vector3(T x, T y, T z) - { - _data[0] = x; - _data[1] = y; - _data[2] = z; - } - - /// Construct a vector with the same components as \a other. - Vector3(const Vector3& other) - { - *this = other; - } - - /// Set the components of this vector to be the same as \a other. - Vector3& operator=(const Vector3& other) - { - _data[0] = other._data[0]; - _data[1] = other._data[1]; - _data[2] = other._data[2]; - - return *this; - } - - /// Return a copy of the component of this vector at \a index, which should be 0, 1, or 2. - T operator[](unsigned int index) const - { - return _data[index]; - } - - /// Return the x-component of this vector. - T x() const { return _data[0]; } - - /// Return the y-component of this vector. - T y() const { return _data[1]; } - - /// Return the z-component of this vector. - T z() const { return _data[2]; } - - /// Return the magnitude of this vector. - T magnitude() const - { - return std::sqrt(x() * x() + y() * y() + z() * z()); - } - - /// Return a normalized copy of this vector. - Vector3 normalized() const - { - T norm = magnitude(); - return Vector3(x() / norm, y() / norm, z() / norm); - } - - /// Return the dot product of this vector and \a rhs. - T dot(const Vector3& rhs) const - { - return x() * rhs.x() + y() * rhs.y() + z() * rhs.z(); - } - - /// Return the cross product of this vector and \a rhs. - Vector3 cross(const Vector3& rhs) const - { - return Vector3( - y() * rhs.z() - z() * rhs.y(), - z() * rhs.x() - x() * rhs.z(), - x() * rhs.y() - y() * rhs.x() - ); - } - - /// Return the angle between this vector and \a rhs, in radians. - T angleTo(const Vector3& rhs) const - { - return std::acos(dot(rhs) / (magnitude() * rhs.magnitude())); - } - - private: - T _data[3]; -}; - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/detail/ThrowOnError.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/detail/ThrowOnError.hpp deleted file mode 100644 index 3be0f3f..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/detail/ThrowOnError.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_CXX_DETAIL_THROWONERROR_HPP -#define MYO_CXX_DETAIL_THROWONERROR_HPP - -#include - -#include - -#if defined(_MSC_VER) && _MSC_VER <= 1800 -#define LIBMYO_NOEXCEPT(b) -#else -#if __cplusplus >= 201103L -# define LIBMYO_NOEXCEPT(b) noexcept(b) -#else -# define LIBMYO_NOEXCEPT(b) -#endif -#endif - -namespace myo { - -class ThrowOnError { -public: - ThrowOnError() - : _error() - { - } - - ~ThrowOnError() LIBMYO_NOEXCEPT(false) - { - if (_error) - { - switch (libmyo_error_kind(_error)) { - case libmyo_error: - case libmyo_error_runtime: - { - std::runtime_error exception(libmyo_error_cstring(_error)); - libmyo_free_error_details(_error); - throw exception; - } - case libmyo_error_invalid_argument: - { - std::invalid_argument exception(libmyo_error_cstring(_error)); - libmyo_free_error_details(_error); - throw exception; - } - case libmyo_success: - { - break; - } - } - } - } - - operator libmyo_error_details_t*() - { - return &_error; - } - -private: - libmyo_error_details_t _error; - - // Not implemented - ThrowOnError(const ThrowOnError&); // = delete; - ThrowOnError& operator=(const ThrowOnError&); // = delete; -}; - -} //namespace libmyo - -#endif // MYO_CXX_DETAIL_THROWONERROR_HPP diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Hub_impl.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Hub_impl.hpp deleted file mode 100644 index d47dcb7..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Hub_impl.hpp +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#include "../Hub.hpp" - -#include -#include - -#include "../DeviceListener.hpp" -#include "../Myo.hpp" -#include "../Pose.hpp" -#include "../Quaternion.hpp" -#include "../Vector3.hpp" -#include "../detail/ThrowOnError.hpp" - -namespace myo { - -inline -Hub::Hub(const std::string& applicationIdentifier) -: _hub(0) -, _myos() -, _listeners() -{ - libmyo_init_hub(&_hub, applicationIdentifier.c_str(), ThrowOnError()); -} - -inline -Hub::~Hub() -{ - for (std::vector::iterator I = _myos.begin(), IE = _myos.end(); I != IE; ++I) { - delete *I; - } - libmyo_shutdown_hub(_hub, 0); -} - -inline -Myo* Hub::waitForMyo(unsigned int timeout_ms) -{ - std::size_t prevSize = _myos.size(); - - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - libmyo_myo_t opaque_myo = libmyo_event_get_myo(event); - - switch (libmyo_event_get_type(event)) { - case libmyo_event_paired: - hub->addMyo(opaque_myo); - return libmyo_handler_stop; - default: - break; - } - - return libmyo_handler_continue; - } - }; - - do { - libmyo_run(_hub, timeout_ms ? timeout_ms : 1000, &local::handler, this, ThrowOnError()); - } while (!timeout_ms && _myos.size() <= prevSize); - - if (_myos.size() <= prevSize) { - return 0; - } - - return _myos.back(); -} - -inline -void Hub::addListener(DeviceListener* listener) -{ - if (std::find(_listeners.begin(), _listeners.end(), listener) != _listeners.end()) { - // Listener was already added. - return; - } - _listeners.push_back(listener); -} - -inline -void Hub::removeListener(DeviceListener* listener) -{ - std::vector::iterator I = std::find(_listeners.begin(), _listeners.end(), listener); - if (I == _listeners.end()) { - // Don't have this listener. - return; - } - - _listeners.erase(I); -} - -inline -void Hub::setLockingPolicy(LockingPolicy lockingPolicy) -{ - libmyo_set_locking_policy(_hub, static_cast(lockingPolicy), ThrowOnError()); -} - -inline -void Hub::onDeviceEvent(libmyo_event_t event) -{ - libmyo_myo_t opaqueMyo = libmyo_event_get_myo(event); - - Myo* myo = lookupMyo(opaqueMyo); - - if (!myo && libmyo_event_get_type(event) == libmyo_event_paired) { - myo = addMyo(opaqueMyo); - } - - if (!myo) { - // Ignore events for Myos we don't know about. - return; - } - - for (std::vector::iterator I = _listeners.begin(), IE = _listeners.end(); I != IE; ++I) { - DeviceListener* listener = *I; - - listener->onOpaqueEvent(event); - - uint64_t time = libmyo_event_get_timestamp(event); - - switch (libmyo_event_get_type(event)) { - case libmyo_event_paired: { - FirmwareVersion version = {libmyo_event_get_firmware_version(event, libmyo_version_major), - libmyo_event_get_firmware_version(event, libmyo_version_minor), - libmyo_event_get_firmware_version(event, libmyo_version_patch), - libmyo_event_get_firmware_version(event, libmyo_version_hardware_rev)}; - listener->onPair(myo, time, version); - break; - } - case libmyo_event_unpaired: - listener->onUnpair(myo, time); - break; - case libmyo_event_connected: { - FirmwareVersion version = {libmyo_event_get_firmware_version(event, libmyo_version_major), - libmyo_event_get_firmware_version(event, libmyo_version_minor), - libmyo_event_get_firmware_version(event, libmyo_version_patch), - libmyo_event_get_firmware_version(event, libmyo_version_hardware_rev)}; - listener->onConnect(myo, time, version); - break; - } - case libmyo_event_disconnected: - listener->onDisconnect(myo, time); - break; - case libmyo_event_arm_synced: - listener->onArmSync(myo, time, - static_cast(libmyo_event_get_arm(event)), - static_cast(libmyo_event_get_x_direction(event))); - break; - case libmyo_event_arm_unsynced: - listener->onArmUnsync(myo, time); - break; - case libmyo_event_unlocked: - listener->onUnlock(myo, time); - break; - case libmyo_event_locked: - listener->onLock(myo, time); - break; - case libmyo_event_orientation: - listener->onOrientationData(myo, time, - Quaternion(libmyo_event_get_orientation(event, libmyo_orientation_x), - libmyo_event_get_orientation(event, libmyo_orientation_y), - libmyo_event_get_orientation(event, libmyo_orientation_z), - libmyo_event_get_orientation(event, libmyo_orientation_w))); - listener->onAccelerometerData(myo, time, - Vector3(libmyo_event_get_accelerometer(event, 0), - libmyo_event_get_accelerometer(event, 1), - libmyo_event_get_accelerometer(event, 2))); - - listener->onGyroscopeData(myo, time, - Vector3(libmyo_event_get_gyroscope(event, 0), - libmyo_event_get_gyroscope(event, 1), - libmyo_event_get_gyroscope(event, 2))); - - break; - case libmyo_event_pose: - listener->onPose(myo, time, Pose(static_cast(libmyo_event_get_pose(event)))); - break; - case libmyo_event_rssi: - listener->onRssi(myo, time, libmyo_event_get_rssi(event)); - break; - } - } -} - -inline -void Hub::run(unsigned int duration_ms) -{ - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - hub->onDeviceEvent(event); - - return libmyo_handler_continue; - } - }; - libmyo_run(_hub, duration_ms, &local::handler, this, ThrowOnError()); -} - -inline -void Hub::runOnce(unsigned int duration_ms) -{ - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - hub->onDeviceEvent(event); - - return libmyo_handler_stop; - } - }; - libmyo_run(_hub, duration_ms, &local::handler, this, ThrowOnError()); -} - -inline -libmyo_hub_t Hub::libmyoObject() -{ - return _hub; -} - -inline -Myo* Hub::lookupMyo(libmyo_myo_t opaqueMyo) const -{ - Myo* myo = 0; - for (std::vector::const_iterator I = _myos.begin(), IE = _myos.end(); I != IE; ++I) { - if ((*I)->libmyoObject() == opaqueMyo) { - myo = *I; - break; - } - } - - return myo; -} - -inline -Myo* Hub::addMyo(libmyo_myo_t opaqueMyo) -{ - Myo* myo = new Myo(opaqueMyo); - - _myos.push_back(myo); - - return myo; -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Myo_impl.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Myo_impl.hpp deleted file mode 100644 index 8803381..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Myo_impl.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#include "../Myo.hpp" -#include "../detail/ThrowOnError.hpp" - -#include - -namespace myo { - -inline -void Myo::vibrate(VibrationType type) -{ - libmyo_vibrate(_myo, static_cast(type), ThrowOnError()); -} - -inline -void Myo::requestRssi() const -{ - libmyo_request_rssi(_myo, ThrowOnError()); -} - -inline -void Myo::unlock(UnlockType type) -{ - libmyo_myo_unlock(_myo, static_cast(type), ThrowOnError()); -} - -inline -void Myo::lock() -{ - libmyo_myo_lock(_myo, ThrowOnError()); -} - -inline -void Myo::notifyUserAction() -{ - libmyo_myo_notify_user_action(_myo, libmyo_user_action_single, ThrowOnError()); -} - -inline -libmyo_myo_t Myo::libmyoObject() const -{ - return _myo; -} - -inline -Myo::Myo(libmyo_myo_t myo) -: _myo(myo) -{ - if (!_myo) { - throw std::invalid_argument("Cannot construct Myo instance with null pointer"); - } -} - -inline -Myo::~Myo() -{ -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Pose_impl.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Pose_impl.hpp deleted file mode 100644 index 7432e39..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/cxx/impl/Pose_impl.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_CXX_IMPL_POSE_IMPL_HPP -#define MYO_CXX_IMPL_POSE_IMPL_HPP - -#include "../Pose.hpp" - -#include - -namespace myo { - -inline -Pose::Pose() -: _type(unknown) -{ -} - -inline -Pose::Pose(Pose::Type type) -: _type(type) -{ -} - -inline -bool Pose::operator==(Pose other) const -{ - return _type == other._type; -} - -inline -bool Pose::operator!=(Pose other) const -{ - return !(*this == other); -} - -inline -Pose::Type Pose::type() const -{ - return _type; -} - -inline -bool operator==(Pose pose, Pose::Type type) -{ - return pose.type() == type; -} - -inline -bool operator==(Pose::Type type, Pose pose) -{ - return pose == type; -} - -inline -bool operator!=(Pose pose, Pose::Type type) -{ - return !(pose == type); -} - -inline -bool operator!=(Pose::Type type, Pose pose) -{ - return !(type == pose); -} - -inline -std::string Pose::toString() const -{ - switch (type()) { - case Pose::rest: - return "rest"; - case Pose::fist: - return "fist"; - case Pose::waveIn: - return "waveIn"; - case Pose::waveOut: - return "waveOut"; - case Pose::fingersSpread: - return "fingersSpread"; - case Pose::doubleTap: - return "doubleTap"; - case Pose::unknown: - return "unknown"; - } - - return ""; -} - -inline -std::ostream& operator<<(std::ostream& out, const Pose& pose) -{ - return out << pose.toString(); -} - -} // namespace myo - -#endif // MYO_CXX_IMPL_POSE_IMPL_HPP diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/libmyo.h b/src/main/resources/osx/myo.framework/Versions/A/Headers/libmyo.h deleted file mode 100644 index e3b2e5b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/libmyo.h +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_LIBMYO_H -#define MYO_LIBMYO_H - -#include - -#include "libmyo/detail/visibility.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// @file libmyo.h -/// libmyo C API declarations. - -typedef void* libmyo_hub_t; - -/// \defgroup errors Error Handling -/// @{ - -/// Function result codes. -/// All libmyo functions that can fail return a value of this type. -typedef enum { - libmyo_success, - libmyo_error, - libmyo_error_invalid_argument, - libmyo_error_runtime -} libmyo_result_t; - -/// Opaque handle to detailed error information. -typedef void* libmyo_error_details_t; - -/// Return a null-terminated string with a detailed error message. -LIBMYO_EXPORT -const char* libmyo_error_cstring(libmyo_error_details_t); - -/// Returns the kind of error that occurred. -LIBMYO_EXPORT -libmyo_result_t libmyo_error_kind(libmyo_error_details_t); - -/// Free the resources allocated by an error object. -LIBMYO_EXPORT -void libmyo_free_error_details(libmyo_error_details_t); - -/// @} - -/// @defgroup libmyo_hub Hub instance -/// @{ - -/// Initialize a connection to the hub. -/// \a application_identifier must follow a reverse domain name format (ex. com.domainname.appname). Application -/// identifiers can be formed from the set of alphanumeric ASCII characters (a-z, A-Z, 0-9). The hyphen (-) and -/// underscore (_) characters are permitted if they are not adjacent to a period (.) character (i.e. not at the start or -/// end of each segment), but are not permitted in the top-level domain. Application identifiers must have three or more -/// segments. For example, if a company's domain is example.com and the application is named hello-world, one could use -/// "com.example.hello-world" as a valid application identifier. \a application_identifier can be NULL or empty. -/// @returns libmyo_success if the connection is successfully established, otherwise: -/// - libmyo_error_runtime if a connection could not be established -/// - libmyo_error_invalid_argument if \a out_hub is NULL -/// - libmyo_error_invalid_argument if \a application_identifier is longer than 255 characters -/// - libmyo_error_invalid_argument if \a application_identifier is not in the proper reverse domain name format -LIBMYO_EXPORT -libmyo_result_t libmyo_init_hub(libmyo_hub_t* out_hub, const char* application_identifier, - libmyo_error_details_t* out_error); - -/// Free the resources allocated to a hub. -/// @returns libmyo_success if shutdown is successful, otherwise: -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error if \a hub is not a valid hub -LIBMYO_EXPORT -libmyo_result_t libmyo_shutdown_hub(libmyo_hub_t hub, libmyo_error_details_t* out_error); - -// Locking policies. -typedef enum { - libmyo_locking_policy_none, ///< Pose events are always sent. - libmyo_locking_policy_standard ///< Pose events are not sent while a Myo is locked. -} libmyo_locking_policy_t; - -/// Set the locking policy for Myos connected to the hub. -/// @returns libmyo_success if the locking policy is successfully set, otherwise -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error if \a hub is not a valid hub -LIBMYO_EXPORT -libmyo_result_t libmyo_set_locking_policy(libmyo_hub_t hub, libmyo_locking_policy_t locking_policy, - libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_myo Myo instances -/// @{ - -/// Opaque type corresponding to a known Myo device. -typedef void* libmyo_myo_t; - -/// Types of vibration -typedef enum { - libmyo_vibration_short, - libmyo_vibration_medium, - libmyo_vibration_long -} libmyo_vibration_type_t; - -/// Vibrate the given myo. -/// Can be called when a Myo is paired. -/// @returns libmyo_success if the Myo successfully vibrated, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_vibrate(libmyo_myo_t myo, libmyo_vibration_type_t type, libmyo_error_details_t* out_error); - -/// Request the RSSI for a given myo. -/// Can be called when a Myo is paired. A libmyo_event_rssi event will likely be generated with the value of the RSSI. -/// @returns libmyo_success if the Myo successfully got the RSSI, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_request_rssi(libmyo_myo_t myo, libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_poses Pose recognition. -/// @{ - -/// Supported poses. -typedef enum { - libmyo_pose_rest = 0, ///< Rest pose. - libmyo_pose_fist = 1, ///< User is making a fist. - libmyo_pose_wave_in = 2, ///< User has an open palm rotated towards the posterior of their wrist. - libmyo_pose_wave_out = 3, ///< User has an open palm rotated towards the anterior of their wrist. - libmyo_pose_fingers_spread = 4, ///< User has an open palm with their fingers spread away from each other. - libmyo_pose_double_tap = 5, ///< User tapped their thumb and middle finger together twice in succession. - - libmyo_num_poses, ///< Number of poses supported; not a valid pose. - - libmyo_pose_unknown = 0xffff ///< Unknown pose. -} libmyo_pose_t; - -/// @} - -/// @defgroup libmyo_locking Myo locking mechanism - -/// Valid unlock types. -typedef enum { - libmyo_unlock_timed = 0, ///< Unlock for a fixed period of time. - libmyo_unlock_hold = 1, ///< Unlock until explicitly told to re-lock. -} libmyo_unlock_type_t; - -/// Unlock the given Myo. -/// Can be called when a Myo is paired. A libmyo_event_unlocked event will be generated if the Myo was locked. -/// @returns libmyo_success if the Myo was successfully unlocked, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_unlock(libmyo_myo_t myo, libmyo_unlock_type_t type, libmyo_error_details_t* out_error); - -/// Lock the given Myo immediately. -/// Can be called when a Myo is paired. A libmyo_event_locked event will be generated if the Myo was unlocked. -/// @returns libmyo_success if the Myo was successfully locked, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_lock(libmyo_myo_t myo, libmyo_error_details_t* out_error); - -/// User action types. -typedef enum { - libmyo_user_action_single = 0, ///< User did a single, discrete action, such as pausing a video. -} libmyo_user_action_type_t; - -/// Notify the given Myo that a user action was recognized. -/// Can be called when a Myo is paired. Will cause Myo to vibrate. -/// @returns libmyo_success if the Myo was successfully notified, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_notify_user_action(libmyo_myo_t myo, libmyo_user_action_type_t type, - libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_events Event Handling -/// @{ - -/// Types of events. -typedef enum { - libmyo_event_paired, ///< Successfully paired with a Myo. - libmyo_event_unpaired, ///< Successfully unpaired from a Myo. - libmyo_event_connected, ///< A Myo has successfully connected. - libmyo_event_disconnected, ///< A Myo has been disconnected. - libmyo_event_arm_synced, ///< A Myo has recognized that the sync gesture has been successfully performed. - libmyo_event_arm_unsynced, ///< A Myo has been moved or removed from the arm. - libmyo_event_orientation, ///< Orientation data has been received. - libmyo_event_pose, ///< A change in pose has been detected. @see libmyo_pose_t. - libmyo_event_rssi, ///< An RSSI value has been received. - libmyo_event_unlocked, ///< A Myo has become unlocked. - libmyo_event_locked, ///< A Myo has become locked. -} libmyo_event_type_t; - -/// Information about an event. -typedef const void* libmyo_event_t; - -/// Retrieve the type of an event. -LIBMYO_EXPORT -uint32_t libmyo_event_get_type(libmyo_event_t event); - -/// Retrieve the timestamp of an event. -/// @see libmyo_now() for details on timestamps. -LIBMYO_EXPORT -uint64_t libmyo_event_get_timestamp(libmyo_event_t event); - -/// Retrieve the Myo associated with an event. -LIBMYO_EXPORT -libmyo_myo_t libmyo_event_get_myo(libmyo_event_t event); - -/// Components of version. -typedef enum { - libmyo_version_major, ///< Major version. - libmyo_version_minor, ///< Minor version. - libmyo_version_patch, ///< Patch version. - libmyo_version_hardware_rev, ///< Hardware revision. -} libmyo_version_component_t; - -/// Hardware revisions. -typedef enum { - libmyo_hardware_rev_c = 1, ///< Alpha units - libmyo_hardware_rev_d = 2, ///< Consumer units -} libmyo_hardware_rev_t; - -/// Retrieve the Myo armband's firmware version from this event. -/// Valid for libmyo_event_paired and libmyo_event_connected events. -LIBMYO_EXPORT -unsigned int libmyo_event_get_firmware_version(libmyo_event_t event, libmyo_version_component_t); - -/// Enumeration identifying a right arm or left arm. @see libmyo_event_get_arm(). -typedef enum { - libmyo_arm_right, ///< Myo is on the right arm. - libmyo_arm_left, ///< Myo is on the left arm. - libmyo_arm_unknown, ///< Unknown arm. -} libmyo_arm_t; - -/// Retrieve the arm associated with an event. -/// Valid for libmyo_event_arm_synced events only. -LIBMYO_EXPORT -libmyo_arm_t libmyo_event_get_arm(libmyo_event_t event); - -/// Possible directions for Myo's +x axis relative to a user's arm. -typedef enum { - libmyo_x_direction_toward_wrist, ///< Myo's +x axis is pointing toward the user's wrist. - libmyo_x_direction_toward_elbow, ///< Myo's +x axis is pointing toward the user's elbow. - libmyo_x_direction_unknown, ///< Unknown +x axis direction. -} libmyo_x_direction_t; - -/// Retrieve the x-direction associated with an event. -/// The x-direction specifies which way Myo's +x axis is pointing relative to the user's arm. -/// Valid for libmyo_event_arm_synced events only. -LIBMYO_EXPORT -libmyo_x_direction_t libmyo_event_get_x_direction(libmyo_event_t event); - -/// Index into orientation data, which is provided as a quaternion. -/// Orientation data is returned as a unit quaternion of floats, represented as `w + x * i + y * j + z * k`. -typedef enum { - libmyo_orientation_x = 0, ///< First component of the quaternion's vector part - libmyo_orientation_y = 1, ///< Second component of the quaternion's vector part - libmyo_orientation_z = 2, ///< Third component of the quaternion's vector part - libmyo_orientation_w = 3, ///< Scalar component of the quaternion. -} libmyo_orientation_index; - -/// Retrieve orientation data associated with an event. -/// Valid for libmyo_event_orientation events only. -/// @see libmyo_orientation_index -LIBMYO_EXPORT -float libmyo_event_get_orientation(libmyo_event_t event, libmyo_orientation_index index); - -/// Retrieve raw accelerometer data associated with an event in units of g. -/// Valid for libmyo_event_orientation events only. -/// Requires `index < 3`. -LIBMYO_EXPORT -float libmyo_event_get_accelerometer(libmyo_event_t event, unsigned int index); - -/// Retrieve raw gyroscope data associated with an event in units of deg/s. -/// Valid for libmyo_event_orientation events only. -/// Requires `index < 3`. -LIBMYO_EXPORT -float libmyo_event_get_gyroscope(libmyo_event_t event, unsigned int index); - -/// Retrieve the pose associated with an event. -/// Valid for libmyo_event_pose events only. -LIBMYO_EXPORT -libmyo_pose_t libmyo_event_get_pose(libmyo_event_t event); - -/// Retreive the RSSI associated with an event. -/// Valid for libmyo_event_rssi events only. -LIBMYO_EXPORT -int8_t libmyo_event_get_rssi(libmyo_event_t event); - -/// Return type for event handlers. -typedef enum { - libmyo_handler_continue, ///< Continue processing events - libmyo_handler_stop, ///< Stop processing events -} libmyo_handler_result_t; - -/// Callback function type to handle events as they occur from libmyo_run(). -typedef libmyo_handler_result_t (*libmyo_handler_t)(void* user_data, libmyo_event_t event); - -/// Process events and call the provided callback as they occur. -/// Runs for up to approximately \a duration_ms milliseconds or until a called handler returns libmyo_handler_stop. -/// @returns libmyo_success after a successful run, otherwise -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error_invalid_argument if \a handler is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_run(libmyo_hub_t hub, unsigned int duration_ms, libmyo_handler_t handler, void* user_data, - libmyo_error_details_t* out_error); - -/// @} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // MYO_LIBMYO_H diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/libmyo/detail/visibility.h b/src/main/resources/osx/myo.framework/Versions/A/Headers/libmyo/detail/visibility.h deleted file mode 100644 index 3a23e6a..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/libmyo/detail/visibility.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_LIBMYO_DETAIL_VISIBILITY_H -#define MYO_LIBMYO_DETAIL_VISIBILITY_H - -#if defined(_WIN32) || defined(__CYGWIN__) - #ifdef myo_EXPORTS - #ifdef __GNUC__ - #define LIBMYO_EXPORT __attribute__ ((dllexport)) - #else - #define LIBMYO_EXPORT __declspec(dllexport) - #endif - #else - #ifdef LIBMYO_STATIC_BUILD - #define LIBMYO_EXPORT - #else - #ifdef __GNUC__ - #define LIBMYO_EXPORT __attribute__ ((dllimport)) - #else - #define LIBMYO_EXPORT __declspec(dllimport) - #endif - #endif - #endif -#else - #if __GNUC__ >= 4 - #define LIBMYO_EXPORT __attribute__ ((visibility ("default"))) - #else - #define LIBMYO_EXPORT - #endif -#endif - -#endif // MYO_LIBMYO_DETAIL_VISIBILITY_H diff --git a/src/main/resources/osx/myo.framework/Versions/A/Headers/myo.hpp b/src/main/resources/osx/myo.framework/Versions/A/Headers/myo.hpp deleted file mode 100644 index 5ea17fb..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Headers/myo.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -/// The namespace in which all of the %Myo C++ bindings are contained. -namespace myo {} - -#include "cxx/DeviceListener.hpp" -#include "cxx/Hub.hpp" -#include "cxx/Myo.hpp" -#include "cxx/Pose.hpp" -#include "cxx/Quaternion.hpp" -#include "cxx/Vector3.hpp" diff --git a/src/main/resources/osx/myo.framework/Versions/A/Resources/Info.plist b/src/main/resources/osx/myo.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index aeec5cc..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - myo - CFBundleIconFile - - CFBundleIdentifier - - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - - CFBundleShortVersionString - - CSResourcesFileMapped - - - diff --git a/src/main/resources/osx/myo.framework/Versions/A/_CodeSignature/CodeResources b/src/main/resources/osx/myo.framework/Versions/A/_CodeSignature/CodeResources deleted file mode 100644 index fc3eb0b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/A/_CodeSignature/CodeResources +++ /dev/null @@ -1,167 +0,0 @@ - - - - - files - - Resources/Info.plist - - tUgLZV94WtJ7c7dl1ZQDEnyfe2U= - - - files2 - - Headers/cxx/DeviceListener.hpp - - 8yfndLec98x4Cn1+KZRVCLa3shs= - - Headers/cxx/Hub.hpp - - Fbz8JZI7eK65JHM/AjOke73z9Z0= - - Headers/cxx/Myo.hpp - - ODiDag94t9NJEEg0mXjBZoxv4sQ= - - Headers/cxx/Pose.hpp - - bV/b65asnTpOQVVUseBE2Jks2yY= - - Headers/cxx/Quaternion.hpp - - bvsi/ZwGqVs0ZiHbWPUtsWlsK8k= - - Headers/cxx/Vector3.hpp - - OQUYhjK6FE/MwW8eyy24OtbHO4I= - - Headers/cxx/detail/ThrowOnError.hpp - - ZG7+E/cEH4UadH/3StifiGVjRxE= - - Headers/cxx/impl/Hub_impl.hpp - - tzmsoi84HDRz8mWxOrwNdQvSbNg= - - Headers/cxx/impl/Myo_impl.hpp - - YWywl+yKDTQh+PLbM1978Rokphc= - - Headers/cxx/impl/Pose_impl.hpp - - dimtyDcx8DWcpkDi1creWJADmRA= - - Headers/libmyo.h - - K8mq4FdQR+4dIHjORuPCLcgDgmo= - - Headers/libmyo/detail/visibility.h - - dPUWLcemRGRDAJVc1Gonqqzo2K0= - - Headers/myo.hpp - - JeFdPeQ4BqtfHJyJxRiXrDHj6xw= - - Resources/Info.plist - - tUgLZV94WtJ7c7dl1ZQDEnyfe2U= - - - rules - - ^Resources/ - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^version.plist$ - - - rules2 - - .*\.dSYM($|/) - - weight - 11 - - ^(.*/)?\.DS_Store$ - - omit - - weight - 2000 - - ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ - - nested - - weight - 10 - - ^.* - - ^Info\.plist$ - - omit - - weight - 20 - - ^PkgInfo$ - - omit - - weight - 20 - - ^Resources/ - - weight - 20 - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^[^/]+$ - - nested - - weight - 10 - - ^embedded\.provisionprofile$ - - weight - 20 - - ^version\.plist$ - - weight - 20 - - - - diff --git a/src/main/resources/osx/myo.framework/Versions/A/myo b/src/main/resources/osx/myo.framework/Versions/A/myo deleted file mode 100755 index 5f8fa55..0000000 Binary files a/src/main/resources/osx/myo.framework/Versions/A/myo and /dev/null differ diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/DeviceListener.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/DeviceListener.hpp deleted file mode 100644 index fca151b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/DeviceListener.hpp +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include "Pose.hpp" - -namespace myo { - -class Myo; -template -class Quaternion; -template -class Vector3; - -/// Enumeration identifying a right arm or left arm. -enum Arm { - armLeft = libmyo_arm_left, - armRight = libmyo_arm_right, - armUnknown = libmyo_arm_unknown -}; - -/// Possible directions for Myo's +x axis relative to a user's arm. -enum XDirection { - xDirectionTowardWrist = libmyo_x_direction_toward_wrist, - xDirectionTowardElbow = libmyo_x_direction_toward_elbow, - xDirectionUnknown = libmyo_x_direction_unknown -}; - -/// Firmware version of Myo. -struct FirmwareVersion { - unsigned int firmwareVersionMajor; ///< Myo's major version must match the required major version. - unsigned int firmwareVersionMinor; ///< Myo's minor version must match the required minor version. - unsigned int firmwareVersionPatch; ///< Myo's patch version must greater or equal to the required patch version. - unsigned int firmwareVersionHardwareRev; ///< Myo's hardware revision; not used to detect firmware version mismatch. -}; - -/// A DeviceListener receives events about a Myo. -/// @see Hub::addListener() -class DeviceListener { -public: - virtual ~DeviceListener() {} - - /// Called when a Myo has been paired. - virtual void onPair(Myo* myo, uint64_t timestamp, FirmwareVersion firmwareVersion) {} - - /// Called when a Myo has been unpaired. - virtual void onUnpair(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo has been connected. - virtual void onConnect(Myo* myo, uint64_t timestamp, FirmwareVersion firmwareVersion) {} - - /// Called when a paired Myo has been disconnected. - virtual void onDisconnect(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo recognizes that it is on an arm. - virtual void onArmSync(Myo* myo, uint64_t timestamp, Arm arm, XDirection xDirection) {} - - /// Called when a paired Myo is moved or removed from the arm. - virtual void onArmUnsync(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo becomes unlocked. - virtual void onUnlock(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo becomes locked. - virtual void onLock(Myo* myo, uint64_t timestamp) {} - - /// Called when a paired Myo has provided a new pose. - virtual void onPose(Myo* myo, uint64_t timestamp, Pose pose) {} - - /// Called when a paired Myo has provided new orientation data. - virtual void onOrientationData(Myo* myo, uint64_t timestamp, const Quaternion& rotation) {} - - /// Called when a paired Myo has provided new accelerometer data in units of g. - virtual void onAccelerometerData(Myo* myo, uint64_t timestamp, const Vector3& accel) {} - - /// Called when a paired Myo has provided new gyroscope data in units of deg/s. - virtual void onGyroscopeData(Myo* myo, uint64_t timestamp, const Vector3& gyro) {} - - /// Called when a paired Myo has provided a new RSSI value. - /// @see Myo::requestRssi() to request an RSSI value from the Myo. - virtual void onRssi(Myo* myo, uint64_t timestamp, int8_t rssi) {} - - /// @cond LIBMYO_INTERNALS - - virtual void onOpaqueEvent(libmyo_event_t) {} - - /// @endcond -}; - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Hub.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Hub.hpp deleted file mode 100644 index 748f94b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Hub.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include - -namespace myo { - -class Myo; -class DeviceListener; - -/// @brief A Hub provides access to one or more Myo instances. -class Hub { -public: - /// Construct a hub. - /// \a applicationIdentifier must follow a reverse domain name format (ex. com.domainname.appname). Application - /// identifiers can be formed from the set of alphanumeric ASCII characters (a-z, A-Z, 0-9). The hyphen (-) and - /// underscore (_) characters are permitted if they are not adjacent to a period (.) character (i.e. not at the - /// start or end of each segment), but are not permitted in the top-level domain. Application identifiers must have - /// three or more segments. For example, if a company's domain is example.com and the application is named - /// hello-world, one could use "com.example.hello-world" as a valid application identifier. \a applicationIdentifier - /// can be an empty string. - /// Throws an exception of type std::invalid_argument if \a applicationIdentifier is not in the proper reverse - /// domain name format or is longer than 255 characters. - /// Throws an exception of type std::runtime_error if the hub initialization failed for some reason, typically - /// because Myo Connect is not running and a connection can thus not be established. - Hub(const std::string& applicationIdentifier = ""); - - /// Deallocate any resources associated with a Hub. - /// This will cause all Myo instances retrieved from this Hub to become invalid. - ~Hub(); - - /// Wait for a Myo to become paired, or time out after \a timeout_ms milliseconds if provided. - /// If \a timeout_ms is zero, this function blocks until a Myo is found. - /// This function must not be called concurrently with run() or runOnce(). - Myo* waitForMyo(unsigned int milliseconds = 0); - - /// Register a listener to be called when device events occur. - void addListener(DeviceListener* listener); - - /// Remove a previously registered listener. - void removeListener(DeviceListener* listener); - - /// Locking policies supported by Myo. - enum LockingPolicy { - lockingPolicyNone = libmyo_locking_policy_none, - lockingPolicyStandard = libmyo_locking_policy_standard - }; - - /// Set the locking policy for Myos connected to the Hub. - void setLockingPolicy(LockingPolicy lockingPolicy); - - /// Run the event loop for the specified duration (in milliseconds). - void run(unsigned int duration_ms); - - /// Run the event loop until a single event occurs, or the specified duration (in milliseconds) has elapsed. - void runOnce(unsigned int duration_ms); - - /// @cond MYO_INTERNALS - - /// Return the internal libmyo object corresponding to this hub. - libmyo_hub_t libmyoObject(); - -protected: - void onDeviceEvent(libmyo_event_t event); - - Myo* lookupMyo(libmyo_myo_t opaqueMyo) const; - - Myo* addMyo(libmyo_myo_t opaqueMyo); - - libmyo_hub_t _hub; - std::vector _myos; - std::vector _listeners; - - /// @endcond - -private: - // Not implemented - Hub(const Hub&); - Hub& operator=(const Hub&); -}; - -/// @example hello-myo.cpp -/// @example multiple-myos.cpp - -} // namespace myo - -#include "impl/Hub_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Myo.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Myo.hpp deleted file mode 100644 index 1474f8c..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Myo.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -namespace myo { - -/// Represents a Myo device with a specific MAC address. -/// This class can not be instantiated directly; instead, use Hub to get access to a Myo. -/// There is only one Myo instance corresponding to each device; thus, if the addresses of two Myo instances compare -/// equal, they refer to the same device. -class Myo { -public: - /// Types of vibration supported by the Myo. - enum VibrationType { - vibrationShort = libmyo_vibration_short, - vibrationMedium = libmyo_vibration_medium, - vibrationLong = libmyo_vibration_long - }; - - /// Vibrate the Myo. - void vibrate(VibrationType type); - - /// Request the RSSI of the Myo. An onRssi event will likely be generated with the value of the RSSI. - /// @see DeviceListener::onRssi() - void requestRssi() const; - - /// Unlock types supported by Myo. - enum UnlockType { - unlockTimed = libmyo_unlock_timed, - unlockHold = libmyo_unlock_hold - }; - - /// Unlock the Myo. - /// Myo will remain unlocked for a short amount of time, after which it will automatically lock again. - /// If Myo was locked, an onUnlock event will be generated. - void unlock(UnlockType type); - - /// Force the Myo to lock immediately. - /// If Myo was unlocked, an onLock event will be generated. - void lock(); - - /// Notify the Myo that a user action was recognized. - /// Will cause Myo to vibrate. - void notifyUserAction(); - - /// @cond MYO_INTERNALS - - /// Return the internal libmyo object corresponding to this device. - libmyo_myo_t libmyoObject() const; - - /// @endcond - -private: - Myo(libmyo_myo_t myo); - ~Myo(); - - libmyo_myo_t _myo; - - // Not implemented. - Myo(const Myo&); - Myo& operator=(const Myo&); - - friend class Hub; -}; - -} // namespace myo - -#include "impl/Myo_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Pose.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Pose.hpp deleted file mode 100644 index 8d668b4..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Pose.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include -#include - -#include - -namespace myo { - -/// A pose represents a detected configuration of the user's hand. -class Pose { -public: - /// Types of poses supported by the SDK. - enum Type { - rest = libmyo_pose_rest, - fist = libmyo_pose_fist, - waveIn = libmyo_pose_wave_in, - waveOut = libmyo_pose_wave_out, - fingersSpread = libmyo_pose_fingers_spread, - doubleTap = libmyo_pose_double_tap, - unknown = libmyo_pose_unknown - }; - - /// Construct a pose of type Pose::none. - Pose(); - - /// Construct a pose with the given type. - Pose(Type type); - - /// Returns true if and only if the two poses are of the same type. - bool operator==(Pose other) const; - - /// Equivalent to `!(*this == other)`. - bool operator!=(Pose other) const; - - /// Returns the type of this pose. - Type type() const; - - /// Return a human-readable string representation of the pose. - std::string toString() const; - -private: - Type _type; -}; - -/// @relates Pose -/// Returns true if and only if the type of pose is the same as the provided type. -bool operator==(Pose pose, Pose::Type t); - -/// @relates Pose -/// Equivalent to `pose == type`. -bool operator==(Pose::Type type, Pose pose); - -/// @relates Pose -/// Equivalent to `!(pose == type)`. -bool operator!=(Pose pose, Pose::Type type); - -/// @relates Pose -/// Equivalent to `!(type == pose)`. -bool operator!=(Pose::Type type, Pose pose); - -/// @relates Pose -/// Write the name of the provided pose to the provided output stream. -std::ostream& operator<<(std::ostream& out, const Pose& pose); - -} // namespace myo - -#include "impl/Pose_impl.hpp" diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Quaternion.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Quaternion.hpp deleted file mode 100644 index 6e56df3..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Quaternion.hpp +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#include - -#include "Vector3.hpp" - -namespace myo { - -/// A quaternion that can be used to represent a rotation. -/// This type provides only very basic functionality to store quaternions that's sufficient to retrieve the data to -/// be placed in a full featured quaternion type. -template -class Quaternion { - public: - /// Construct a quaternion that represents zero rotation (i.e. the multiplicative identity). - Quaternion() - : _x(0) - , _y(0) - , _z(0) - , _w(1) - { - } - - /// Construct a quaternion with the provided components. - Quaternion(T x, T y, T z, T w) - : _x(x) - , _y(y) - , _z(z) - , _w(w) - { - } - - /// Set the components of this quaternion to be those of the other. - Quaternion& operator=(const Quaternion other) - { - _x = other._x; - _y = other._y; - _z = other._z; - _w = other._w; - - return *this; - } - - /// Return the x-component of this quaternion's vector. - T x() const { return _x; } - - /// Return the y-component of this quaternion's vector. - T y() const { return _y; } - - /// Return the z-component of this quaternion's vector. - T z() const { return _z; } - - /// Return the w-component (scalar) of this quaternion. - T w() const { return _w; } - - /// Return the quaternion multiplied by \a rhs. - /// Note that quaternion multiplication is not commutative. - Quaternion operator*(const Quaternion& rhs) const - { - return Quaternion( - _w * rhs._x + _x * rhs._w + _y * rhs._z - _z * rhs._y, - _w * rhs._y - _x * rhs._z + _y * rhs._w + _z * rhs._x, - _w * rhs._z + _x * rhs._y - _y * rhs._x + _z * rhs._w, - _w * rhs._w - _x * rhs._x - _y * rhs._y - _z * rhs._z - ); - } - - /// Multiply this quaternion by \a rhs. - /// Return this quaternion updated with the result. - Quaternion& operator*=(const Quaternion& rhs) - { - *this = *this * rhs; - return *this; - } - - /// Return the unit quaternion corresponding to the same rotation as this one. - Quaternion normalized() const - { - T magnitude = std::sqrt(_x * _x + _y * _y + _z * _z + _w * _w); - - return Quaternion(_x / magnitude, _y / magnitude, _z / magnitude, _w / magnitude); - } - - /// Return this quaternion's conjugate. - Quaternion conjugate() const - { - return Quaternion(-_x, -_y, -_z, _w); - } - - /// Return a quaternion that represents a right-handed rotation of \a angle radians about the given \a axis. - /// \a axis The unit vector representing the axis of rotation. - /// \a angle The angle of rotation, in radians. - static Quaternion fromAxisAngle(const myo::Vector3& axis, T angle) - { - return Quaternion(axis.x() * std::sin(angle / 2), - axis.y() * std::sin(angle / 2), - axis.z() * std::sin(angle / 2), - std::cos(angle / 2)); - } - - private: - T _x, _y, _z, _w; -}; - -/// Return a copy of this \a vec rotated by \a quat. -/// \relates myo::Quaternion -template -Vector3 rotate(const Quaternion& quat, const Vector3& vec) -{ - myo::Quaternion qvec(vec.x(), vec.y(), vec.z(), 0); - myo::Quaternion result = quat * qvec * quat.conjugate(); - return Vector3(result.x(), result.y(), result.z()); -} - -/// Return a quaternion that represents a rotation from vector \a from to \a to. -/// \relates myo::Quaternion -/// See http://stackoverflow.com/questions/1171849/finding-quaternion-representing-the-rotation-from-one-vector-to-another -/// for some explanation. -template -Quaternion rotate(const Vector3& from, const Vector3& to) -{ - Vector3 cross = from.cross(to); - - // The product of the square of magnitudes and the cosine of the angle between from and to. - T cosTheta = from.dot(to); - - // Return identity if the vectors are the same direction. - if (cosTheta >= 1) { - return Quaternion(); - } - - // The product of the square of the magnitudes - T k = std::sqrt(from.dot(from) * to.dot(to)); - - // Return identity in the degenerate case. - if (k <= 0) { - return Quaternion(); - } - - // Special handling for vectors facing opposite directions. - if (cosTheta / k <= -1) { - Vector3 xAxis(1, 0, 0); - Vector3 yAxis(0, 1, 0); - - cross = from.cross(std::abs(from.dot(xAxis)) < 1 ? xAxis : yAxis); - k = cosTheta = 0; - } - - return Quaternion( - cross.x(), - cross.y(), - cross.z(), - k + cosTheta); -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Vector3.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Vector3.hpp deleted file mode 100644 index 774654b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/Vector3.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -#define _USE_MATH_DEFINES -#include - -namespace myo { - -/// A vector of three components. -/// This type provides very basic functionality to store a three dimensional vector that's sufficient to retrieve -/// the data to be placed in a full featured vector type. A few common vector operations, such as dot product and -/// cross product, are also provided. -template -class Vector3 { - public: - /// Construct a vector of all zeroes. - Vector3() - { - _data[0] = 0; - _data[1] = 0; - _data[2] = 0; - } - - /// Construct a vector with the three provided components. - Vector3(T x, T y, T z) - { - _data[0] = x; - _data[1] = y; - _data[2] = z; - } - - /// Construct a vector with the same components as \a other. - Vector3(const Vector3& other) - { - *this = other; - } - - /// Set the components of this vector to be the same as \a other. - Vector3& operator=(const Vector3& other) - { - _data[0] = other._data[0]; - _data[1] = other._data[1]; - _data[2] = other._data[2]; - - return *this; - } - - /// Return a copy of the component of this vector at \a index, which should be 0, 1, or 2. - T operator[](unsigned int index) const - { - return _data[index]; - } - - /// Return the x-component of this vector. - T x() const { return _data[0]; } - - /// Return the y-component of this vector. - T y() const { return _data[1]; } - - /// Return the z-component of this vector. - T z() const { return _data[2]; } - - /// Return the magnitude of this vector. - T magnitude() const - { - return std::sqrt(x() * x() + y() * y() + z() * z()); - } - - /// Return a normalized copy of this vector. - Vector3 normalized() const - { - T norm = magnitude(); - return Vector3(x() / norm, y() / norm, z() / norm); - } - - /// Return the dot product of this vector and \a rhs. - T dot(const Vector3& rhs) const - { - return x() * rhs.x() + y() * rhs.y() + z() * rhs.z(); - } - - /// Return the cross product of this vector and \a rhs. - Vector3 cross(const Vector3& rhs) const - { - return Vector3( - y() * rhs.z() - z() * rhs.y(), - z() * rhs.x() - x() * rhs.z(), - x() * rhs.y() - y() * rhs.x() - ); - } - - /// Return the angle between this vector and \a rhs, in radians. - T angleTo(const Vector3& rhs) const - { - return std::acos(dot(rhs) / (magnitude() * rhs.magnitude())); - } - - private: - T _data[3]; -}; - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/detail/ThrowOnError.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/detail/ThrowOnError.hpp deleted file mode 100644 index 3be0f3f..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/detail/ThrowOnError.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_CXX_DETAIL_THROWONERROR_HPP -#define MYO_CXX_DETAIL_THROWONERROR_HPP - -#include - -#include - -#if defined(_MSC_VER) && _MSC_VER <= 1800 -#define LIBMYO_NOEXCEPT(b) -#else -#if __cplusplus >= 201103L -# define LIBMYO_NOEXCEPT(b) noexcept(b) -#else -# define LIBMYO_NOEXCEPT(b) -#endif -#endif - -namespace myo { - -class ThrowOnError { -public: - ThrowOnError() - : _error() - { - } - - ~ThrowOnError() LIBMYO_NOEXCEPT(false) - { - if (_error) - { - switch (libmyo_error_kind(_error)) { - case libmyo_error: - case libmyo_error_runtime: - { - std::runtime_error exception(libmyo_error_cstring(_error)); - libmyo_free_error_details(_error); - throw exception; - } - case libmyo_error_invalid_argument: - { - std::invalid_argument exception(libmyo_error_cstring(_error)); - libmyo_free_error_details(_error); - throw exception; - } - case libmyo_success: - { - break; - } - } - } - } - - operator libmyo_error_details_t*() - { - return &_error; - } - -private: - libmyo_error_details_t _error; - - // Not implemented - ThrowOnError(const ThrowOnError&); // = delete; - ThrowOnError& operator=(const ThrowOnError&); // = delete; -}; - -} //namespace libmyo - -#endif // MYO_CXX_DETAIL_THROWONERROR_HPP diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Hub_impl.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Hub_impl.hpp deleted file mode 100644 index d47dcb7..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Hub_impl.hpp +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#include "../Hub.hpp" - -#include -#include - -#include "../DeviceListener.hpp" -#include "../Myo.hpp" -#include "../Pose.hpp" -#include "../Quaternion.hpp" -#include "../Vector3.hpp" -#include "../detail/ThrowOnError.hpp" - -namespace myo { - -inline -Hub::Hub(const std::string& applicationIdentifier) -: _hub(0) -, _myos() -, _listeners() -{ - libmyo_init_hub(&_hub, applicationIdentifier.c_str(), ThrowOnError()); -} - -inline -Hub::~Hub() -{ - for (std::vector::iterator I = _myos.begin(), IE = _myos.end(); I != IE; ++I) { - delete *I; - } - libmyo_shutdown_hub(_hub, 0); -} - -inline -Myo* Hub::waitForMyo(unsigned int timeout_ms) -{ - std::size_t prevSize = _myos.size(); - - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - libmyo_myo_t opaque_myo = libmyo_event_get_myo(event); - - switch (libmyo_event_get_type(event)) { - case libmyo_event_paired: - hub->addMyo(opaque_myo); - return libmyo_handler_stop; - default: - break; - } - - return libmyo_handler_continue; - } - }; - - do { - libmyo_run(_hub, timeout_ms ? timeout_ms : 1000, &local::handler, this, ThrowOnError()); - } while (!timeout_ms && _myos.size() <= prevSize); - - if (_myos.size() <= prevSize) { - return 0; - } - - return _myos.back(); -} - -inline -void Hub::addListener(DeviceListener* listener) -{ - if (std::find(_listeners.begin(), _listeners.end(), listener) != _listeners.end()) { - // Listener was already added. - return; - } - _listeners.push_back(listener); -} - -inline -void Hub::removeListener(DeviceListener* listener) -{ - std::vector::iterator I = std::find(_listeners.begin(), _listeners.end(), listener); - if (I == _listeners.end()) { - // Don't have this listener. - return; - } - - _listeners.erase(I); -} - -inline -void Hub::setLockingPolicy(LockingPolicy lockingPolicy) -{ - libmyo_set_locking_policy(_hub, static_cast(lockingPolicy), ThrowOnError()); -} - -inline -void Hub::onDeviceEvent(libmyo_event_t event) -{ - libmyo_myo_t opaqueMyo = libmyo_event_get_myo(event); - - Myo* myo = lookupMyo(opaqueMyo); - - if (!myo && libmyo_event_get_type(event) == libmyo_event_paired) { - myo = addMyo(opaqueMyo); - } - - if (!myo) { - // Ignore events for Myos we don't know about. - return; - } - - for (std::vector::iterator I = _listeners.begin(), IE = _listeners.end(); I != IE; ++I) { - DeviceListener* listener = *I; - - listener->onOpaqueEvent(event); - - uint64_t time = libmyo_event_get_timestamp(event); - - switch (libmyo_event_get_type(event)) { - case libmyo_event_paired: { - FirmwareVersion version = {libmyo_event_get_firmware_version(event, libmyo_version_major), - libmyo_event_get_firmware_version(event, libmyo_version_minor), - libmyo_event_get_firmware_version(event, libmyo_version_patch), - libmyo_event_get_firmware_version(event, libmyo_version_hardware_rev)}; - listener->onPair(myo, time, version); - break; - } - case libmyo_event_unpaired: - listener->onUnpair(myo, time); - break; - case libmyo_event_connected: { - FirmwareVersion version = {libmyo_event_get_firmware_version(event, libmyo_version_major), - libmyo_event_get_firmware_version(event, libmyo_version_minor), - libmyo_event_get_firmware_version(event, libmyo_version_patch), - libmyo_event_get_firmware_version(event, libmyo_version_hardware_rev)}; - listener->onConnect(myo, time, version); - break; - } - case libmyo_event_disconnected: - listener->onDisconnect(myo, time); - break; - case libmyo_event_arm_synced: - listener->onArmSync(myo, time, - static_cast(libmyo_event_get_arm(event)), - static_cast(libmyo_event_get_x_direction(event))); - break; - case libmyo_event_arm_unsynced: - listener->onArmUnsync(myo, time); - break; - case libmyo_event_unlocked: - listener->onUnlock(myo, time); - break; - case libmyo_event_locked: - listener->onLock(myo, time); - break; - case libmyo_event_orientation: - listener->onOrientationData(myo, time, - Quaternion(libmyo_event_get_orientation(event, libmyo_orientation_x), - libmyo_event_get_orientation(event, libmyo_orientation_y), - libmyo_event_get_orientation(event, libmyo_orientation_z), - libmyo_event_get_orientation(event, libmyo_orientation_w))); - listener->onAccelerometerData(myo, time, - Vector3(libmyo_event_get_accelerometer(event, 0), - libmyo_event_get_accelerometer(event, 1), - libmyo_event_get_accelerometer(event, 2))); - - listener->onGyroscopeData(myo, time, - Vector3(libmyo_event_get_gyroscope(event, 0), - libmyo_event_get_gyroscope(event, 1), - libmyo_event_get_gyroscope(event, 2))); - - break; - case libmyo_event_pose: - listener->onPose(myo, time, Pose(static_cast(libmyo_event_get_pose(event)))); - break; - case libmyo_event_rssi: - listener->onRssi(myo, time, libmyo_event_get_rssi(event)); - break; - } - } -} - -inline -void Hub::run(unsigned int duration_ms) -{ - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - hub->onDeviceEvent(event); - - return libmyo_handler_continue; - } - }; - libmyo_run(_hub, duration_ms, &local::handler, this, ThrowOnError()); -} - -inline -void Hub::runOnce(unsigned int duration_ms) -{ - struct local { - static libmyo_handler_result_t handler(void* user_data, libmyo_event_t event) { - Hub* hub = static_cast(user_data); - - hub->onDeviceEvent(event); - - return libmyo_handler_stop; - } - }; - libmyo_run(_hub, duration_ms, &local::handler, this, ThrowOnError()); -} - -inline -libmyo_hub_t Hub::libmyoObject() -{ - return _hub; -} - -inline -Myo* Hub::lookupMyo(libmyo_myo_t opaqueMyo) const -{ - Myo* myo = 0; - for (std::vector::const_iterator I = _myos.begin(), IE = _myos.end(); I != IE; ++I) { - if ((*I)->libmyoObject() == opaqueMyo) { - myo = *I; - break; - } - } - - return myo; -} - -inline -Myo* Hub::addMyo(libmyo_myo_t opaqueMyo) -{ - Myo* myo = new Myo(opaqueMyo); - - _myos.push_back(myo); - - return myo; -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Myo_impl.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Myo_impl.hpp deleted file mode 100644 index 8803381..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Myo_impl.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#include "../Myo.hpp" -#include "../detail/ThrowOnError.hpp" - -#include - -namespace myo { - -inline -void Myo::vibrate(VibrationType type) -{ - libmyo_vibrate(_myo, static_cast(type), ThrowOnError()); -} - -inline -void Myo::requestRssi() const -{ - libmyo_request_rssi(_myo, ThrowOnError()); -} - -inline -void Myo::unlock(UnlockType type) -{ - libmyo_myo_unlock(_myo, static_cast(type), ThrowOnError()); -} - -inline -void Myo::lock() -{ - libmyo_myo_lock(_myo, ThrowOnError()); -} - -inline -void Myo::notifyUserAction() -{ - libmyo_myo_notify_user_action(_myo, libmyo_user_action_single, ThrowOnError()); -} - -inline -libmyo_myo_t Myo::libmyoObject() const -{ - return _myo; -} - -inline -Myo::Myo(libmyo_myo_t myo) -: _myo(myo) -{ - if (!_myo) { - throw std::invalid_argument("Cannot construct Myo instance with null pointer"); - } -} - -inline -Myo::~Myo() -{ -} - -} // namespace myo diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Pose_impl.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Pose_impl.hpp deleted file mode 100644 index 7432e39..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/cxx/impl/Pose_impl.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_CXX_IMPL_POSE_IMPL_HPP -#define MYO_CXX_IMPL_POSE_IMPL_HPP - -#include "../Pose.hpp" - -#include - -namespace myo { - -inline -Pose::Pose() -: _type(unknown) -{ -} - -inline -Pose::Pose(Pose::Type type) -: _type(type) -{ -} - -inline -bool Pose::operator==(Pose other) const -{ - return _type == other._type; -} - -inline -bool Pose::operator!=(Pose other) const -{ - return !(*this == other); -} - -inline -Pose::Type Pose::type() const -{ - return _type; -} - -inline -bool operator==(Pose pose, Pose::Type type) -{ - return pose.type() == type; -} - -inline -bool operator==(Pose::Type type, Pose pose) -{ - return pose == type; -} - -inline -bool operator!=(Pose pose, Pose::Type type) -{ - return !(pose == type); -} - -inline -bool operator!=(Pose::Type type, Pose pose) -{ - return !(type == pose); -} - -inline -std::string Pose::toString() const -{ - switch (type()) { - case Pose::rest: - return "rest"; - case Pose::fist: - return "fist"; - case Pose::waveIn: - return "waveIn"; - case Pose::waveOut: - return "waveOut"; - case Pose::fingersSpread: - return "fingersSpread"; - case Pose::doubleTap: - return "doubleTap"; - case Pose::unknown: - return "unknown"; - } - - return ""; -} - -inline -std::ostream& operator<<(std::ostream& out, const Pose& pose) -{ - return out << pose.toString(); -} - -} // namespace myo - -#endif // MYO_CXX_IMPL_POSE_IMPL_HPP diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/libmyo.h b/src/main/resources/osx/myo.framework/Versions/Current/Headers/libmyo.h deleted file mode 100644 index e3b2e5b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/libmyo.h +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_LIBMYO_H -#define MYO_LIBMYO_H - -#include - -#include "libmyo/detail/visibility.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// @file libmyo.h -/// libmyo C API declarations. - -typedef void* libmyo_hub_t; - -/// \defgroup errors Error Handling -/// @{ - -/// Function result codes. -/// All libmyo functions that can fail return a value of this type. -typedef enum { - libmyo_success, - libmyo_error, - libmyo_error_invalid_argument, - libmyo_error_runtime -} libmyo_result_t; - -/// Opaque handle to detailed error information. -typedef void* libmyo_error_details_t; - -/// Return a null-terminated string with a detailed error message. -LIBMYO_EXPORT -const char* libmyo_error_cstring(libmyo_error_details_t); - -/// Returns the kind of error that occurred. -LIBMYO_EXPORT -libmyo_result_t libmyo_error_kind(libmyo_error_details_t); - -/// Free the resources allocated by an error object. -LIBMYO_EXPORT -void libmyo_free_error_details(libmyo_error_details_t); - -/// @} - -/// @defgroup libmyo_hub Hub instance -/// @{ - -/// Initialize a connection to the hub. -/// \a application_identifier must follow a reverse domain name format (ex. com.domainname.appname). Application -/// identifiers can be formed from the set of alphanumeric ASCII characters (a-z, A-Z, 0-9). The hyphen (-) and -/// underscore (_) characters are permitted if they are not adjacent to a period (.) character (i.e. not at the start or -/// end of each segment), but are not permitted in the top-level domain. Application identifiers must have three or more -/// segments. For example, if a company's domain is example.com and the application is named hello-world, one could use -/// "com.example.hello-world" as a valid application identifier. \a application_identifier can be NULL or empty. -/// @returns libmyo_success if the connection is successfully established, otherwise: -/// - libmyo_error_runtime if a connection could not be established -/// - libmyo_error_invalid_argument if \a out_hub is NULL -/// - libmyo_error_invalid_argument if \a application_identifier is longer than 255 characters -/// - libmyo_error_invalid_argument if \a application_identifier is not in the proper reverse domain name format -LIBMYO_EXPORT -libmyo_result_t libmyo_init_hub(libmyo_hub_t* out_hub, const char* application_identifier, - libmyo_error_details_t* out_error); - -/// Free the resources allocated to a hub. -/// @returns libmyo_success if shutdown is successful, otherwise: -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error if \a hub is not a valid hub -LIBMYO_EXPORT -libmyo_result_t libmyo_shutdown_hub(libmyo_hub_t hub, libmyo_error_details_t* out_error); - -// Locking policies. -typedef enum { - libmyo_locking_policy_none, ///< Pose events are always sent. - libmyo_locking_policy_standard ///< Pose events are not sent while a Myo is locked. -} libmyo_locking_policy_t; - -/// Set the locking policy for Myos connected to the hub. -/// @returns libmyo_success if the locking policy is successfully set, otherwise -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error if \a hub is not a valid hub -LIBMYO_EXPORT -libmyo_result_t libmyo_set_locking_policy(libmyo_hub_t hub, libmyo_locking_policy_t locking_policy, - libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_myo Myo instances -/// @{ - -/// Opaque type corresponding to a known Myo device. -typedef void* libmyo_myo_t; - -/// Types of vibration -typedef enum { - libmyo_vibration_short, - libmyo_vibration_medium, - libmyo_vibration_long -} libmyo_vibration_type_t; - -/// Vibrate the given myo. -/// Can be called when a Myo is paired. -/// @returns libmyo_success if the Myo successfully vibrated, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_vibrate(libmyo_myo_t myo, libmyo_vibration_type_t type, libmyo_error_details_t* out_error); - -/// Request the RSSI for a given myo. -/// Can be called when a Myo is paired. A libmyo_event_rssi event will likely be generated with the value of the RSSI. -/// @returns libmyo_success if the Myo successfully got the RSSI, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_request_rssi(libmyo_myo_t myo, libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_poses Pose recognition. -/// @{ - -/// Supported poses. -typedef enum { - libmyo_pose_rest = 0, ///< Rest pose. - libmyo_pose_fist = 1, ///< User is making a fist. - libmyo_pose_wave_in = 2, ///< User has an open palm rotated towards the posterior of their wrist. - libmyo_pose_wave_out = 3, ///< User has an open palm rotated towards the anterior of their wrist. - libmyo_pose_fingers_spread = 4, ///< User has an open palm with their fingers spread away from each other. - libmyo_pose_double_tap = 5, ///< User tapped their thumb and middle finger together twice in succession. - - libmyo_num_poses, ///< Number of poses supported; not a valid pose. - - libmyo_pose_unknown = 0xffff ///< Unknown pose. -} libmyo_pose_t; - -/// @} - -/// @defgroup libmyo_locking Myo locking mechanism - -/// Valid unlock types. -typedef enum { - libmyo_unlock_timed = 0, ///< Unlock for a fixed period of time. - libmyo_unlock_hold = 1, ///< Unlock until explicitly told to re-lock. -} libmyo_unlock_type_t; - -/// Unlock the given Myo. -/// Can be called when a Myo is paired. A libmyo_event_unlocked event will be generated if the Myo was locked. -/// @returns libmyo_success if the Myo was successfully unlocked, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_unlock(libmyo_myo_t myo, libmyo_unlock_type_t type, libmyo_error_details_t* out_error); - -/// Lock the given Myo immediately. -/// Can be called when a Myo is paired. A libmyo_event_locked event will be generated if the Myo was unlocked. -/// @returns libmyo_success if the Myo was successfully locked, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_lock(libmyo_myo_t myo, libmyo_error_details_t* out_error); - -/// User action types. -typedef enum { - libmyo_user_action_single = 0, ///< User did a single, discrete action, such as pausing a video. -} libmyo_user_action_type_t; - -/// Notify the given Myo that a user action was recognized. -/// Can be called when a Myo is paired. Will cause Myo to vibrate. -/// @returns libmyo_success if the Myo was successfully notified, otherwise -/// - libmyo_error_invalid_argument if \a myo is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_myo_notify_user_action(libmyo_myo_t myo, libmyo_user_action_type_t type, - libmyo_error_details_t* out_error); - -/// @} - -/// @defgroup libmyo_events Event Handling -/// @{ - -/// Types of events. -typedef enum { - libmyo_event_paired, ///< Successfully paired with a Myo. - libmyo_event_unpaired, ///< Successfully unpaired from a Myo. - libmyo_event_connected, ///< A Myo has successfully connected. - libmyo_event_disconnected, ///< A Myo has been disconnected. - libmyo_event_arm_synced, ///< A Myo has recognized that the sync gesture has been successfully performed. - libmyo_event_arm_unsynced, ///< A Myo has been moved or removed from the arm. - libmyo_event_orientation, ///< Orientation data has been received. - libmyo_event_pose, ///< A change in pose has been detected. @see libmyo_pose_t. - libmyo_event_rssi, ///< An RSSI value has been received. - libmyo_event_unlocked, ///< A Myo has become unlocked. - libmyo_event_locked, ///< A Myo has become locked. -} libmyo_event_type_t; - -/// Information about an event. -typedef const void* libmyo_event_t; - -/// Retrieve the type of an event. -LIBMYO_EXPORT -uint32_t libmyo_event_get_type(libmyo_event_t event); - -/// Retrieve the timestamp of an event. -/// @see libmyo_now() for details on timestamps. -LIBMYO_EXPORT -uint64_t libmyo_event_get_timestamp(libmyo_event_t event); - -/// Retrieve the Myo associated with an event. -LIBMYO_EXPORT -libmyo_myo_t libmyo_event_get_myo(libmyo_event_t event); - -/// Components of version. -typedef enum { - libmyo_version_major, ///< Major version. - libmyo_version_minor, ///< Minor version. - libmyo_version_patch, ///< Patch version. - libmyo_version_hardware_rev, ///< Hardware revision. -} libmyo_version_component_t; - -/// Hardware revisions. -typedef enum { - libmyo_hardware_rev_c = 1, ///< Alpha units - libmyo_hardware_rev_d = 2, ///< Consumer units -} libmyo_hardware_rev_t; - -/// Retrieve the Myo armband's firmware version from this event. -/// Valid for libmyo_event_paired and libmyo_event_connected events. -LIBMYO_EXPORT -unsigned int libmyo_event_get_firmware_version(libmyo_event_t event, libmyo_version_component_t); - -/// Enumeration identifying a right arm or left arm. @see libmyo_event_get_arm(). -typedef enum { - libmyo_arm_right, ///< Myo is on the right arm. - libmyo_arm_left, ///< Myo is on the left arm. - libmyo_arm_unknown, ///< Unknown arm. -} libmyo_arm_t; - -/// Retrieve the arm associated with an event. -/// Valid for libmyo_event_arm_synced events only. -LIBMYO_EXPORT -libmyo_arm_t libmyo_event_get_arm(libmyo_event_t event); - -/// Possible directions for Myo's +x axis relative to a user's arm. -typedef enum { - libmyo_x_direction_toward_wrist, ///< Myo's +x axis is pointing toward the user's wrist. - libmyo_x_direction_toward_elbow, ///< Myo's +x axis is pointing toward the user's elbow. - libmyo_x_direction_unknown, ///< Unknown +x axis direction. -} libmyo_x_direction_t; - -/// Retrieve the x-direction associated with an event. -/// The x-direction specifies which way Myo's +x axis is pointing relative to the user's arm. -/// Valid for libmyo_event_arm_synced events only. -LIBMYO_EXPORT -libmyo_x_direction_t libmyo_event_get_x_direction(libmyo_event_t event); - -/// Index into orientation data, which is provided as a quaternion. -/// Orientation data is returned as a unit quaternion of floats, represented as `w + x * i + y * j + z * k`. -typedef enum { - libmyo_orientation_x = 0, ///< First component of the quaternion's vector part - libmyo_orientation_y = 1, ///< Second component of the quaternion's vector part - libmyo_orientation_z = 2, ///< Third component of the quaternion's vector part - libmyo_orientation_w = 3, ///< Scalar component of the quaternion. -} libmyo_orientation_index; - -/// Retrieve orientation data associated with an event. -/// Valid for libmyo_event_orientation events only. -/// @see libmyo_orientation_index -LIBMYO_EXPORT -float libmyo_event_get_orientation(libmyo_event_t event, libmyo_orientation_index index); - -/// Retrieve raw accelerometer data associated with an event in units of g. -/// Valid for libmyo_event_orientation events only. -/// Requires `index < 3`. -LIBMYO_EXPORT -float libmyo_event_get_accelerometer(libmyo_event_t event, unsigned int index); - -/// Retrieve raw gyroscope data associated with an event in units of deg/s. -/// Valid for libmyo_event_orientation events only. -/// Requires `index < 3`. -LIBMYO_EXPORT -float libmyo_event_get_gyroscope(libmyo_event_t event, unsigned int index); - -/// Retrieve the pose associated with an event. -/// Valid for libmyo_event_pose events only. -LIBMYO_EXPORT -libmyo_pose_t libmyo_event_get_pose(libmyo_event_t event); - -/// Retreive the RSSI associated with an event. -/// Valid for libmyo_event_rssi events only. -LIBMYO_EXPORT -int8_t libmyo_event_get_rssi(libmyo_event_t event); - -/// Return type for event handlers. -typedef enum { - libmyo_handler_continue, ///< Continue processing events - libmyo_handler_stop, ///< Stop processing events -} libmyo_handler_result_t; - -/// Callback function type to handle events as they occur from libmyo_run(). -typedef libmyo_handler_result_t (*libmyo_handler_t)(void* user_data, libmyo_event_t event); - -/// Process events and call the provided callback as they occur. -/// Runs for up to approximately \a duration_ms milliseconds or until a called handler returns libmyo_handler_stop. -/// @returns libmyo_success after a successful run, otherwise -/// - libmyo_error_invalid_argument if \a hub is NULL -/// - libmyo_error_invalid_argument if \a handler is NULL -LIBMYO_EXPORT -libmyo_result_t libmyo_run(libmyo_hub_t hub, unsigned int duration_ms, libmyo_handler_t handler, void* user_data, - libmyo_error_details_t* out_error); - -/// @} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // MYO_LIBMYO_H diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/libmyo/detail/visibility.h b/src/main/resources/osx/myo.framework/Versions/Current/Headers/libmyo/detail/visibility.h deleted file mode 100644 index 3a23e6a..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/libmyo/detail/visibility.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#ifndef MYO_LIBMYO_DETAIL_VISIBILITY_H -#define MYO_LIBMYO_DETAIL_VISIBILITY_H - -#if defined(_WIN32) || defined(__CYGWIN__) - #ifdef myo_EXPORTS - #ifdef __GNUC__ - #define LIBMYO_EXPORT __attribute__ ((dllexport)) - #else - #define LIBMYO_EXPORT __declspec(dllexport) - #endif - #else - #ifdef LIBMYO_STATIC_BUILD - #define LIBMYO_EXPORT - #else - #ifdef __GNUC__ - #define LIBMYO_EXPORT __attribute__ ((dllimport)) - #else - #define LIBMYO_EXPORT __declspec(dllimport) - #endif - #endif - #endif -#else - #if __GNUC__ >= 4 - #define LIBMYO_EXPORT __attribute__ ((visibility ("default"))) - #else - #define LIBMYO_EXPORT - #endif -#endif - -#endif // MYO_LIBMYO_DETAIL_VISIBILITY_H diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Headers/myo.hpp b/src/main/resources/osx/myo.framework/Versions/Current/Headers/myo.hpp deleted file mode 100644 index 5ea17fb..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Headers/myo.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2013-2014 Thalmic Labs Inc. -// Distributed under the Myo SDK license agreement. See LICENSE.txt for details. -#pragma once - -/// The namespace in which all of the %Myo C++ bindings are contained. -namespace myo {} - -#include "cxx/DeviceListener.hpp" -#include "cxx/Hub.hpp" -#include "cxx/Myo.hpp" -#include "cxx/Pose.hpp" -#include "cxx/Quaternion.hpp" -#include "cxx/Vector3.hpp" diff --git a/src/main/resources/osx/myo.framework/Versions/Current/Resources/Info.plist b/src/main/resources/osx/myo.framework/Versions/Current/Resources/Info.plist deleted file mode 100644 index aeec5cc..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/Resources/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - myo - CFBundleIconFile - - CFBundleIdentifier - - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - - CFBundleShortVersionString - - CSResourcesFileMapped - - - diff --git a/src/main/resources/osx/myo.framework/Versions/Current/_CodeSignature/CodeResources b/src/main/resources/osx/myo.framework/Versions/Current/_CodeSignature/CodeResources deleted file mode 100644 index fc3eb0b..0000000 --- a/src/main/resources/osx/myo.framework/Versions/Current/_CodeSignature/CodeResources +++ /dev/null @@ -1,167 +0,0 @@ - - - - - files - - Resources/Info.plist - - tUgLZV94WtJ7c7dl1ZQDEnyfe2U= - - - files2 - - Headers/cxx/DeviceListener.hpp - - 8yfndLec98x4Cn1+KZRVCLa3shs= - - Headers/cxx/Hub.hpp - - Fbz8JZI7eK65JHM/AjOke73z9Z0= - - Headers/cxx/Myo.hpp - - ODiDag94t9NJEEg0mXjBZoxv4sQ= - - Headers/cxx/Pose.hpp - - bV/b65asnTpOQVVUseBE2Jks2yY= - - Headers/cxx/Quaternion.hpp - - bvsi/ZwGqVs0ZiHbWPUtsWlsK8k= - - Headers/cxx/Vector3.hpp - - OQUYhjK6FE/MwW8eyy24OtbHO4I= - - Headers/cxx/detail/ThrowOnError.hpp - - ZG7+E/cEH4UadH/3StifiGVjRxE= - - Headers/cxx/impl/Hub_impl.hpp - - tzmsoi84HDRz8mWxOrwNdQvSbNg= - - Headers/cxx/impl/Myo_impl.hpp - - YWywl+yKDTQh+PLbM1978Rokphc= - - Headers/cxx/impl/Pose_impl.hpp - - dimtyDcx8DWcpkDi1creWJADmRA= - - Headers/libmyo.h - - K8mq4FdQR+4dIHjORuPCLcgDgmo= - - Headers/libmyo/detail/visibility.h - - dPUWLcemRGRDAJVc1Gonqqzo2K0= - - Headers/myo.hpp - - JeFdPeQ4BqtfHJyJxRiXrDHj6xw= - - Resources/Info.plist - - tUgLZV94WtJ7c7dl1ZQDEnyfe2U= - - - rules - - ^Resources/ - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^version.plist$ - - - rules2 - - .*\.dSYM($|/) - - weight - 11 - - ^(.*/)?\.DS_Store$ - - omit - - weight - 2000 - - ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ - - nested - - weight - 10 - - ^.* - - ^Info\.plist$ - - omit - - weight - 20 - - ^PkgInfo$ - - omit - - weight - 20 - - ^Resources/ - - weight - 20 - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^[^/]+$ - - nested - - weight - 10 - - ^embedded\.provisionprofile$ - - weight - 20 - - ^version\.plist$ - - weight - 20 - - - - diff --git a/src/main/resources/osx/myo.framework/Versions/Current/myo b/src/main/resources/osx/myo.framework/Versions/Current/myo deleted file mode 100755 index 5f8fa55..0000000 Binary files a/src/main/resources/osx/myo.framework/Versions/Current/myo and /dev/null differ diff --git a/src/main/resources/osx/myo.framework/myo b/src/main/resources/osx/myo.framework/myo deleted file mode 100755 index 5f8fa55..0000000 Binary files a/src/main/resources/osx/myo.framework/myo and /dev/null differ diff --git a/src/main/resources/osx/myo.zip b/src/main/resources/osx/myo.zip new file mode 100644 index 0000000..35fab50 Binary files /dev/null and b/src/main/resources/osx/myo.zip differ diff --git a/src/main/resources/x64/JNIJavaMyoLib.dll b/src/main/resources/x64/JNIJavaMyoLib.dll index d39a856..2782c67 100644 Binary files a/src/main/resources/x64/JNIJavaMyoLib.dll and b/src/main/resources/x64/JNIJavaMyoLib.dll differ diff --git a/src/main/resources/x64/myo64.dll b/src/main/resources/x64/myo64.dll index be626fd..c1966ef 100644 Binary files a/src/main/resources/x64/myo64.dll and b/src/main/resources/x64/myo64.dll differ