Skip to content

Commit d868565

Browse files
committed
Imported api v3.0.0-beta02
1 parent 678d0ed commit d868565

24 files changed

+625
-141
lines changed

.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

.idea/gradle.xml

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 16 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/scopes/minified.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Then, add the compile element to the dependencies closure in the module's *build
2121

2222
```gradle
2323
dependencies {
24-
compile 'com.mbientlab:metawear:3.0.0-beta01'
24+
compile 'com.mbientlab:metawear:3.0.0-beta02'
2525
}
2626
```
2727

@@ -80,4 +80,4 @@ public class ExampleActivity extends Activity implements ServiceConnection {
8080
@Override
8181
public void onServiceDisconnected(ComponentName componentName) { }
8282
}
83-
```
83+
```

library/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ android {
3131
defaultConfig {
3232
minSdkVersion 18
3333
targetSdkVersion 24
34-
versionCode 37
35-
versionName "3.0.0-beta01"
34+
versionCode 39
35+
versionName "3.0.0-beta02"
3636
}
3737
buildTypes {
3838
release {

library/src/main/java/com/mbientlab/metawear/android/BtleService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,18 @@ public Object deserializeBoardState() throws IOException, ClassNotFoundException
454454
}
455455

456456
@Override
457-
public void writeGattCharacteristic(final Pair<UUID, UUID> gattCharr, final byte[] value) {
457+
public void writeGattCharacteristic(final GattCharWriteType writeType, final Pair<UUID, UUID> gattCharr, final byte[] value) {
458458
gattScheduler.queueAction(new Callable<Boolean>() {
459459
@Override
460460
public Boolean call() throws Exception {
461461
gattScheduler.setExpectedGattKey(GattActionKey.CHAR_WRITE);
462462

463463
BluetoothGattService service = state.btGatt.getService(gattCharr.first);
464464
BluetoothGattCharacteristic characteristic = service.getCharacteristic(gattCharr.second);
465-
characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
465+
characteristic.setWriteType(writeType == GattCharWriteType.WRITE_WITHOUT_RESPONSE ?
466+
BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE :
467+
BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT
468+
);
466469
characteristic.setValue(value);
467470

468471
state.btGatt.writeCharacteristic(characteristic);

library/src/main/java/com/mbientlab/metawear/impl/LedImpl.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,47 +48,47 @@ public PatternEditor editPattern(Color ledColor) {
4848

4949
return new PatternEditor() {
5050
@Override
51-
public PatternEditor setHighIntensity(byte intensity) {
51+
public PatternEditor highIntensity(byte intensity) {
5252
command[4]= intensity;
5353
return this;
5454
}
5555

5656
@Override
57-
public PatternEditor setLowIntensity(byte intensity) {
57+
public PatternEditor lowIntensity(byte intensity) {
5858
command[5]= intensity;
5959
return this;
6060
}
6161

6262
@Override
63-
public PatternEditor setRiseTime(short time) {
63+
public PatternEditor riseTime(short time) {
6464
command[7]= (byte)((time >> 8) & 0xff);
6565
command[6]= (byte)(time & 0xff);
6666
return this;
6767
}
6868

6969
@Override
70-
public PatternEditor setHighTime(short time) {
70+
public PatternEditor highTime(short time) {
7171
command[9]= (byte)((time >> 8) & 0xff);
7272
command[8]= (byte)(time & 0xff);
7373
return this;
7474
}
7575

7676
@Override
77-
public PatternEditor setFallTime(short time) {
77+
public PatternEditor fallTime(short time) {
7878
command[11]= (byte)((time >> 8) & 0xff);
7979
command[10]= (byte)(time & 0xff);
8080
return this;
8181
}
8282

8383
@Override
84-
public PatternEditor setPulseDuration(short duration) {
84+
public PatternEditor pulseDuration(short duration) {
8585
command[13]= (byte)((duration >> 8) & 0xff);
8686
command[12]= (byte)(duration & 0xff);
8787
return this;
8888
}
8989

9090
@Override
91-
public PatternEditor setDelay(short delay) {
91+
public PatternEditor delay(short delay) {
9292
if (mwPrivate.lookupModuleInfo(ModuleId.LED).revision >= REVISION_LED_DELAYED) {
9393
command[15]= (byte)((delay >> 8) & 0xff);
9494
command[14]= (byte)(delay & 0xff);
@@ -100,7 +100,7 @@ public PatternEditor setDelay(short delay) {
100100
}
101101

102102
@Override
103-
public PatternEditor setRepeatCount(byte count) {
103+
public PatternEditor repeatCount(byte count) {
104104
command[16]= count;
105105
return this;
106106
}
@@ -118,22 +118,22 @@ public PatternEditor editPattern(Color ledColor, PatternPreset preset) {
118118

119119
switch(preset) {
120120
case BLINK:
121-
editor.setHighIntensity((byte) 31)
122-
.setHighTime((short) 50)
123-
.setPulseDuration((short) 500);
121+
editor.highIntensity((byte) 31)
122+
.highTime((short) 50)
123+
.pulseDuration((short) 500);
124124
break;
125125
case PULSE:
126-
editor.setHighIntensity((byte) 31)
127-
.setRiseTime((short) 725)
128-
.setHighTime((short) 500)
129-
.setFallTime((short) 725)
130-
.setPulseDuration((short) 2000);
126+
editor.highIntensity((byte) 31)
127+
.riseTime((short) 725)
128+
.highTime((short) 500)
129+
.fallTime((short) 725)
130+
.pulseDuration((short) 2000);
131131
break;
132132
case SOLID:
133-
editor.setHighIntensity((byte) 31)
134-
.setLowIntensity((byte) 31)
135-
.setHighTime((short) 500)
136-
.setPulseDuration((short) 1000);
133+
editor.highIntensity((byte) 31)
134+
.lowIntensity((byte) 31)
135+
.highTime((short) 500)
136+
.pulseDuration((short) 1000);
137137
break;
138138
}
139139
return editor;

0 commit comments

Comments
 (0)