GithubHelp home page GithubHelp logo

devicehive / android-ble Goto Github PK

View Code? Open in Web Editor NEW
42.0 37.0 15.0 497 KB

DeviceHive Bluetooth Low Energy bridge for Android

Home Page: http://devicehive.com

License: Other

Java 100.00%
ble ble-device devicehive gateway bluetooth-devices gatt devicehive-iot-clouds iot bluetooth-low-energy bluetooth-le

android-ble's Introduction

DeviceHive Android Gateway for BLE devices

DeviceHive Android Gateway for Bluetooth Low Energy devices makes it possible to connect multiple Bluetooth Low Energy devices to DeviceHive IoT clouds through single Android device. Now compatible with Android N.
Just imagine multiple sensors, or buttons, or indicators, connected to your smart home through single Android phone, tablet or other device! All your need - just start Gateway, connect to your device and send a command (or subscribe for sensor data notifications).

Commands

To achieve such interconnection between your devices and DeviceHive, you can use such commands. They should be sent to DeviceHive IoT cloud (with Admin Panel for example) through Gateway to perform certain BLE actions that conform to Generic Access Protocol:

scan - Start scanning for bluetooth devices with automatic timeout

scan/start, scan/stop - Start and stop scanning manually. Can be used in manual demos or automatical scripts that detect whether necessary device is discovered and scanning can be finished

gatt/connect, gatt/disconnect - Connect to device that is discovered, disconnect from connected device. Use json with such format as parameter for this command:

{"device":"A1:A2:A3:A4:A5:A6"}

where "A1:A2:A3:A4:A5:A6" is address of your BLE device.
Actually Gateway supports autoconnect - if device is discovered, but wasn't connected, call to any command will initiate connection to the device, and if it succeeds, perform command on that connection.

gatt/primary - get list of GATT services. Usually BLE device provides certain services that gives access to main functionality. Use the same format for json parameter:

{"device":"A1:A2:A3:A4:A5:A6"}

where "A1:A2:A3:A4:A5:A6" is address of your BLE device.

gatt/characteristics - get list of GATT characteristics for selected service. Specify device address and serviceUUID in json parameter:

{"device":"A1:A2:A3:A4:A5:A6", "serviceUUID":"AA00"}

Notice that Android BTLE Gateway understands short UUID format ("AA00") and translates it to full UUID seamlessly. Of course, you can use long format too, if you feel more comfortable with such numbers like "F00000A1-0451-4000-B000-000000000000".

gatt/read - Read value from characteristic:

{"device":"A1:A2:A3:A4:A5:A6", "serviceUUID":"AA00", "characteristicUUID":"AA01"}

You must point deviceID and serviceUUID because Gateway supports multiple connections - and each command should determine exact destination without ambiguity. Result json will contain value and status:

{"value":"0x9C, 0x00, 0x10, 0x5A", 
"device":"A1:A2:A3:A4:A5:A6", "serviceUUID":"AA00", "characteristicUUID":"AA01"
"status":"success"}

gatt/write - Write value to specified characteristic. Uses the same format as read, but requires value to be defined (otherwise fails with warning that user must define value key for this command):

{"device":"A1:A2:A3:A4:A5:A6", "serviceUUID":"AA00", "characteristicUUID":"AA01", "value":"01"}

gatt/notifications, gatt/notifications/stop - Subscribe for notifications from device, unsubscribe. These notifications will be stacked in the "Notifications" section in DeviceHive Admin Panel. Use such json parameter format:

{"device":"A1:A2:A3:A4:A5:A6", "serviceUUID":"AA00", "characteristicUUID":"AA01"}

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

Media materials

Watch this Official DeviceHive Video which shows live usage of DeviceHive Android Gateway for BLE devices with Texas Instruments CC2650 SensorTag

If something seems still unclear - please, seek for answer in this Presentation with live use cases, explaining usage of DeviceHive Android Gateway for BLE devices with Texas Instruments CC2650 SensorTag from the previous video.

Supported Android Versions

DeviceHive Android Gateway for BLE devices supports Android versions starting from 4.3 Jelly Bean MR2 (API 18) up to Android N (API 24).
On all Android versions Gateway requires Bluetooth Admin permission to turn on Bluetooth adapter.
Starting with Android M (API 23) due to changes in BLE devices discovery internals, Gateway requires Location permission and turns on Location automatically as soon as you allow this permission. When Gateway becomes inactive, it stops interactions with Location services, so doesn't impact battery life anymore. If you want to eliminate possible impact of other applications, that may access your Locations services in background, please turn off Location manually.

DeviceHive license

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 2015-2018 DataArt Apps · All Rights Reserved

android-ble's People

Contributors

alrybakov avatar edubovik avatar nikolay-kha avatar platon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.