Skip to content

Commit

Permalink
Merge pull request #1 from bandjalong/master
Browse files Browse the repository at this point in the history
xBetter support for bluetooth devices
  • Loading branch information
alexwhan authored Nov 15, 2016
2 parents aa29b35 + b7e1329 commit 63ce61f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion FieldPrime/FieldPrime.iml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
11 changes: 8 additions & 3 deletions FieldPrime/app/src/main/java/csiro/fieldprime/ActBluetooth.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public enum DeviceType {
MOTOROLA_CS300("(.*)\r"),
METTLER_TOLEDO_ML3002("(.*)\033enter."),
METTLER_TOLEDO_ML4001("\\s*(.*) g\\s*"),
DECIMAL_IN_STRING("\\D*(\\d+\\.\\d+)\\D*"),
ALLFLEX(".. (.*)\r\n"),
ZEBRA_PRINTER(null)
;
Expand Down Expand Up @@ -499,8 +500,9 @@ protected Void doInBackground(MyBluetoothDevice... params) {
if (matcher.matches()) {
data = matcher.group(1);
} else {
data = "fpmsg: " + "Does not match pattern";
//curLen = 0;
continue;
//continue;
}
}
}
Expand Down Expand Up @@ -543,15 +545,17 @@ protected void onProgressUpdate(String... values) {
updateButtonsAndDetails();
Util.toast("Connection Established");
fillScreen(); // We need to change the text of just connected device
} else {
} else if (values[0].startsWith("fpmsg:")) {
Util.toast(values[0].substring(6));
} else {
String val = values[0];
if (val.length() > 0) {
handlers h = getHandler();
if (h != null) {
h.handleBluetoothValue(val, mDevice);
}
}
}
}
super.onProgressUpdate(values);
}

Expand Down Expand Up @@ -754,6 +758,7 @@ public void onClick(View view) {
case ALLFLEX: // eg "LA 982 123545\r\n"
case METTLER_TOLEDO_ML3002: // {27,101,110,116,101,114,46}; // bytes at end of Mettler Toledo scale send
case METTLER_TOLEDO_ML4001:
case DECIMAL_IN_STRING:
mDevice.mPattern = dt.getPattern();
break;
case ZEBRA_PRINTER:
Expand Down
2 changes: 1 addition & 1 deletion FieldPrime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:2.1.2'
}
}

Expand Down
4 changes: 2 additions & 2 deletions FieldPrime/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Oct 21 11:34:03 PDT 2015
#Mon Oct 10 18:43:39 AEDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

0 comments on commit 63ce61f

Please sign in to comment.