Skip to content

Commit

Permalink
Merge branch 'release/v0.0.6'
Browse files Browse the repository at this point in the history
Conflicts:
	library/build.gradle
	library/repository/jp/kshoji/ble-midi/maven-metadata.xml
	library/repository/jp/kshoji/ble-midi/maven-metadata.xml.md5
	library/repository/jp/kshoji/ble-midi/maven-metadata.xml.sha1
  • Loading branch information
kshoji committed Mar 2, 2015
2 parents f3509c5 + de33031 commit 942d1ff
Show file tree
Hide file tree
Showing 39 changed files with 484 additions and 335 deletions.
5 changes: 3 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ repositories {
}

dependencies {
compile 'jp.kshoji:javax-sound-midi:0.0.1:@aar'
compile 'jp.kshoji:javax-sound-midi:0.0.2:@aar'
compile 'com.android.support:support-annotations:21.0.3'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

Expand All @@ -41,7 +42,7 @@ group = 'jp.kshoji'
uploadArchives {
repositories.mavenDeployer {
repository url: 'file://' + file('repository').absolutePath
pom.version = '0.0.5'
pom.version = '0.0.6'
pom.artifactId = 'ble-midi'
}
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
06767e86b773a79b76d8edf86a13c66b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f99dc3730782601331b26cdd801dae95b5008e83
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.kshoji</groupId>
<artifactId>ble-midi</artifactId>
<version>0.0.6-SNAPSHOT</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>jp.kshoji</groupId>
<artifactId>javax-sound-midi</artifactId>
<version>0.0.2-SNAPSHOT</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-annotations</artifactId>
<version>21.0.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a69438019be2b7b8f48ede93b13913da
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e203585507fef5e237bb2006a2c6796c91d9f6e5
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>jp.kshoji</groupId>
<artifactId>ble-midi</artifactId>
<version>0.0.6-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20150223.092902</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20150223092902</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3dd49793141b3b9a146e63036b8c9429
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5d6a737bfb4736e62a3ab6a7cd72e24a203270d2
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1995abd47ecdfce516a4cbb0b2bb3d43
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
206781807e310cfa7ec6d8484434c7b725d42630
24 changes: 24 additions & 0 deletions library/repository/jp/kshoji/ble-midi/0.0.6/ble-midi-0.0.6.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.kshoji</groupId>
<artifactId>ble-midi</artifactId>
<version>0.0.6</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>jp.kshoji</groupId>
<artifactId>javax-sound-midi</artifactId>
<version>0.0.2</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-annotations</artifactId>
<version>21.0.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bf752820d3090cfeb29c5754281567c8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f2818e9684820a08a38cbddd732c28d44e8be857
4 changes: 3 additions & 1 deletion library/repository/jp/kshoji/ble-midi/maven-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<version>0.0.4</version>
<version>0.0.5-SNAPSHOT</version>
<version>0.0.5</version>
<version>0.0.6-SNAPSHOT</version>
<version>0.0.6</version>
</versions>
<lastUpdated>20150202033412</lastUpdated>
<lastUpdated>20150302031602</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e662d2fc19b4d602e12fbf3df8eb8860
c15107f5e2c02e4e9c2d20167816916f
Original file line number Diff line number Diff line change
@@ -1 +1 @@
392d453158c6596606e101503564307c2a0c1763
6a74d79b7c0472191907cecf267e9a7c8531d7cd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;

import java.util.ArrayList;
Expand Down Expand Up @@ -58,7 +60,7 @@ public final class BleMidiCallback extends BluetoothGattCallback {
*
* @param context the context
*/
public BleMidiCallback(final Context context) {
public BleMidiCallback(@NonNull final Context context) {
super();
this.context = context;
}
Expand All @@ -69,7 +71,7 @@ public BleMidiCallback(final Context context) {
* @param device the device
* @return true if already connected
*/
boolean isConnected(BluetoothDevice device) {
boolean isConnected(@NonNull BluetoothDevice device) {
synchronized (deviceAddressGattMap) {
return deviceAddressGattMap.containsKey(device.getAddress());
}
Expand Down Expand Up @@ -239,33 +241,33 @@ public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descri
*
* @param midiInputDevice the device
*/
void disconnectDevice(MidiInputDevice midiInputDevice) {
void disconnectDevice(@NonNull MidiInputDevice midiInputDevice) {
if (!(midiInputDevice instanceof InternalMidiInputDevice)) {
return;
}

disconnectByDeviceAddress(((InternalMidiInputDevice) midiInputDevice).getDeviceAddress());
disconnectByDeviceAddress(midiInputDevice.getDeviceAddress());
}

/**
* Disconnect the specified device
*
* @param midiOutputDevice the device
*/
void disconnectDevice(MidiOutputDevice midiOutputDevice) {
void disconnectDevice(@NonNull MidiOutputDevice midiOutputDevice) {
if (!(midiOutputDevice instanceof InternalMidiOutputDevice)) {
return;
}

disconnectByDeviceAddress(((InternalMidiOutputDevice) midiOutputDevice).getDeviceAddress());
disconnectByDeviceAddress(midiOutputDevice.getDeviceAddress());
}

/**
* Disconnects the device by its address
*
* @param deviceAddress the device address from {@link android.bluetooth.BluetoothGatt}
*/
private void disconnectByDeviceAddress(String deviceAddress) {
private void disconnectByDeviceAddress(@NonNull String deviceAddress) {
synchronized (deviceAddressGattMap) {
BluetoothGatt bluetoothGatt = deviceAddressGattMap.get(deviceAddress);

Expand Down Expand Up @@ -367,7 +369,7 @@ private class BondingBroadcastReceiver extends BroadcastReceiver {
* @param midiInputDevice input device
* @param midiOutputDevice output device
*/
BondingBroadcastReceiver(MidiInputDevice midiInputDevice, MidiOutputDevice midiOutputDevice) {
BondingBroadcastReceiver(@Nullable MidiInputDevice midiInputDevice, @Nullable MidiOutputDevice midiOutputDevice) {
this.midiInputDevice = midiInputDevice;
this.midiOutputDevice = midiOutputDevice;
}
Expand All @@ -384,8 +386,12 @@ public void onReceive(Context context, Intent intent) {
context.unregisterReceiver(this);
bondingBroadcastReceiver = null;

((InternalMidiInputDevice)midiInputDevice).configureAsCentralDevice();
((InternalMidiOutputDevice)midiOutputDevice).configureAsCentralDevice();
if (midiInputDevice != null) {
((InternalMidiInputDevice) midiInputDevice).configureAsCentralDevice();
}
if (midiOutputDevice != null) {
((InternalMidiOutputDevice) midiOutputDevice).configureAsCentralDevice();
}
}
}
}
Expand All @@ -396,6 +402,7 @@ public void onReceive(Context context, Intent intent) {
*
* @return Set of {@link jp.kshoji.blemidi.device.MidiInputDevice}
*/
@NonNull
public Set<MidiInputDevice> getMidiInputDevices() {
Collection<Set<MidiInputDevice>> values = midiInputDevicesMap.values();

Expand All @@ -412,6 +419,7 @@ public Set<MidiInputDevice> getMidiInputDevices() {
*
* @return Set of {@link jp.kshoji.blemidi.device.MidiOutputDevice}
*/
@NonNull
public Set<MidiOutputDevice> getMidiOutputDevices() {
Collection<Set<MidiOutputDevice>> values = midiOutputDevicesMap.values();

Expand All @@ -428,7 +436,7 @@ public Set<MidiOutputDevice> getMidiOutputDevices() {
*
* @param midiDeviceAttachedListener the listener
*/
public void setOnMidiDeviceAttachedListener(OnMidiDeviceAttachedListener midiDeviceAttachedListener) {
public void setOnMidiDeviceAttachedListener(@Nullable OnMidiDeviceAttachedListener midiDeviceAttachedListener) {
this.midiDeviceAttachedListener = midiDeviceAttachedListener;
}

Expand All @@ -437,7 +445,7 @@ public void setOnMidiDeviceAttachedListener(OnMidiDeviceAttachedListener midiDev
*
* @param midiDeviceDetachedListener the listener
*/
public void setOnMidiDeviceDetachedListener(OnMidiDeviceDetachedListener midiDeviceDetachedListener) {
public void setOnMidiDeviceDetachedListener(@Nullable OnMidiDeviceDetachedListener midiDeviceDetachedListener) {
this.midiDeviceDetachedListener = midiDeviceDetachedListener;
}

Expand All @@ -459,7 +467,7 @@ private static final class InternalMidiInputDevice extends MidiInputDevice {
* @param bluetoothGatt the gatt of device
* @throws IllegalArgumentException if specified gatt doesn't contain BLE MIDI service
*/
public InternalMidiInputDevice(final Context context, final BluetoothGatt bluetoothGatt) throws IllegalArgumentException {
public InternalMidiInputDevice(@NonNull final Context context, @NonNull final BluetoothGatt bluetoothGatt) throws IllegalArgumentException {
super();
this.bluetoothGatt = bluetoothGatt;

Expand Down Expand Up @@ -500,6 +508,7 @@ public void setOnMidiInputEventListener(OnMidiInputEventListener midiInputEventL
midiParser.setMidiInputEventListener(midiInputEventListener);
}

@NonNull
@Override
public String getDeviceName() {
return bluetoothGatt.getDevice().getName();
Expand All @@ -510,6 +519,7 @@ public String getDeviceName() {
*
* @return device address
*/
@NonNull
public String getDeviceAddress() {
return bluetoothGatt.getDevice().getAddress();
}
Expand All @@ -519,7 +529,7 @@ public String getDeviceAddress() {
*
* @param data the MIDI data
*/
private void incomingData(byte[] data) {
private void incomingData(@NonNull byte[] data) {
midiParser.parse(data);
}
}
Expand All @@ -540,7 +550,7 @@ private static final class InternalMidiOutputDevice extends MidiOutputDevice {
* @param bluetoothGatt the gatt of device
* @throws IllegalArgumentException if specified gatt doesn't contain BLE MIDI service
*/
public InternalMidiOutputDevice(final Context context, final BluetoothGatt bluetoothGatt) throws IllegalArgumentException {
public InternalMidiOutputDevice(@NonNull final Context context, @NonNull final BluetoothGatt bluetoothGatt) throws IllegalArgumentException {
super();
this.bluetoothGatt = bluetoothGatt;

Expand All @@ -567,7 +577,7 @@ public void configureAsCentralDevice() {
}

@Override
public void transferData(byte[] writeBuffer) {
public void transferData(@NonNull byte[] writeBuffer) {
midiOutputCharacteristic.setValue(writeBuffer);

try {
Expand All @@ -578,6 +588,7 @@ public void transferData(byte[] writeBuffer) {
}
}

@NonNull
@Override
public String getDeviceName() {
return bluetoothGatt.getDevice().getName();
Expand All @@ -588,6 +599,7 @@ public String getDeviceName() {
*
* @return device address
*/
@NonNull
public String getDeviceAddress() {
return bluetoothGatt.getDevice().getAddress();
}
Expand Down
Loading

0 comments on commit 942d1ff

Please sign in to comment.