Skip to content

Commit

Permalink
Merge pull request #1 from devicehive/develop
Browse files Browse the repository at this point in the history
Update client library with the newest Java library
  • Loading branch information
platon authored Feb 19, 2018
2 parents 6a55c5b + b35df1f commit c22eae8
Show file tree
Hide file tree
Showing 124 changed files with 940 additions and 7,564 deletions.
26 changes: 10 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
### Java template
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Android template
# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
# Files for the ART/Dalvik VM
*.dex

# Java class files
Expand All @@ -25,6 +11,7 @@ hs_err_pid*
# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
Expand All @@ -42,4 +29,11 @@ proguard/
# Android Studio Navigation editor temp files
.navigation/

# Created by .ignore support plugin (hsz.mobi)
# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/tasks.xml
.idea/dictionaries
.idea/
27 changes: 1 addition & 26 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,6 @@ You must point deviceID and serviceUUID because Gateway supports multiple connec

Because notifications work for exact characteristic, you don't need to write any boilerplate commands, Gateway will perform this job for you.

**Usage with Freeboard**
--------------------

You can use [Dashboard](https://github.com/devicehive/freeboard) to display live data from DeviceHive notifications.
Just checkout latest version of freeboard with devicehive plugin, start "index.html" and load there [dashboard-sensortag-temp.json](https://github.com/devicehive/android-ble/blob/master/dashboard-sensortag-temp.json) from DeviceHive Android Gateway for BLE devices project root. Then just retrieve api_key from DeviceHive Admin Panel and insert it to Dashboard settings.

Enable characteristic you want to be read, for example by writing there 0x01:
**gatt/write**
`
{"device":"A1:A2:A3:A4:A5:A6", "serviceUUID":"AA00", "characteristicUUID":"AA02", "value":"01"}
`

Enable notifications:
**gatt/notifications**
`
{"device":"A1:A2:A3:A4:A5:A6", "serviceUUID":"AA00", "characteristicUUID":"AA01"}
`

Viola! As soon as you subscribe for notifications, they will update Dashboard displays in realtime.

When you need unsubscribe, use **gatt/notifications/stop** command with the same json as for subscription.

We are happy to announce that **Dashboard** is now available directly from the [**DeviceHive Playground**](http://playground.devicehive.com/dashboard/), so you may use it right there, without local installation, and if you start Dashboard from the Playground, it will start with pre-filled authentication information, so all you need is just create or load your freeboard and use it.


**Media materials**
---------------

Expand All @@ -101,4 +76,4 @@ Starting with **Android M (API 23)** due to changes in BLE devices discovery int

DeviceHive is developed by DataArt Apps and distributed under Open Source MIT license. This basically means you can do whatever you want with the software as long as the copyright notice is included. This also means you don't have to contribute the end product or modified sources back to Open Source, but if you feel like sharing, you are highly encouraged to do so!

© Copyright 2016 DataArt Apps · All Rights Reserved
© Copyright 2015-2018 DataArt Apps · All Rights Reserved
40 changes: 39 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
/build
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/tasks.xml
.idea/dictionaries
.idea/
64 changes: 40 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.dataart.btle_android"
minSdkVersion 18
targetSdkVersion 24
versionCode 2
versionName "2.0"

minSdkVersion 19
targetSdkVersion 27
versionCode 3
versionName "3.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
Expand All @@ -29,18 +24,39 @@ android {
}
useLibrary 'org.apache.http.legacy'
}

ext {
devicehive = "3.1.2"
commons = "1.11"
rxandroid = "2.0.1"
rxjava = "2.1.7"
guava = "23.6-android"
gson = "2.8.2"
timber = "4.6.0"
support = "27.0.2"
gms = "11.8.0"
multidex = "1.0.2"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.jakewharton.timber:timber:2.7.1'
provided "org.projectlombok:lombok:1.12.6"
compile 'commons-codec:commons-codec:1.5'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.google.guava:guava:19.0'

compile 'com.android.support:multidex:1.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "com.android.support:appcompat-v7:${support}"
implementation "com.android.support:design:${support}"

implementation "com.google.code.gson:gson:${gson}"

implementation "com.jakewharton.timber:timber:${timber}"

implementation "commons-codec:commons-codec:${commons}"

implementation "io.reactivex.rxjava2:rxandroid:${rxandroid}"
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
implementation "io.reactivex.rxjava2:rxjava:${rxjava}"

implementation "com.google.android.gms:play-services-location:${gms}"

implementation "com.google.guava:guava:${guava}"

implementation "com.github.devicehive:devicehive-java:${devicehive}"
implementation "com.android.support:multidex:${multidex}"
}
12 changes: 6 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.dataart.btle_android" >

<!-- Declare this required feature if you want to make the app available to BLE-capable
Expand All @@ -20,10 +21,13 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:fullBackupContent="@xml/backup_descriptor"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -32,10 +36,6 @@

<service android:name=".btle_gateway.BluetoothLeService" android:enabled="true"/>

<service
android:name="com.dataart.android.devicehive.network.DeviceHiveApiService"
android:exported="false" />

</application>

</manifest>
90 changes: 0 additions & 90 deletions app/src/main/java/com/dataart/android/devicehive/ApiInfo.java

This file was deleted.

Loading

0 comments on commit c22eae8

Please sign in to comment.