Coder Social home page Coder Social logo

gizwitsble's Introduction

GizwitsBLE

GizwitsBLE solves the compatibility and reliability issues that have troubled developers. First, many BLE-ready Android phones (e.g. Samsung S2 and Note2) have not been upgraded to Android 4.3. Therefore adding Android app-level BLE support requires developers to code against a number of vendor specific BLE SDK's. Second, the Android 4.3 native BLE support has a number of pitfalls that seriously affect user experience. Since android users rarely upgrade their Operating Systems, Android 4.2 and 4.3 will continue to dominate the Android smartphone market for the next few years.

GizwitsBLE Android SDK was build to be a quick and reliable solution for developers to add robust BLE support for Android 4.2 and Android 4.3+ smartphones with a simple common interface. On Android 4.2 phones, GizwitsBLE automatically detects and adapts to the corresponding vendor specific SDK (e.g. those provided by Samsung and Broadcom), so that developers don't have to learn and code against the specifies of each implementation.

On Android 4.3 phones, BLE related calls tends to crash the app and even the Operating System for no apparent reasons. Through trial and error, the Gizwits team has found that BLE calls must be made serially to avoid system crashes, and therefore all requests (connection, discovery service, read or write characteristics) are queued and executed sequentially. This has made BLE communications much more stable.

GizwitsBLE has a simple interface that's easy to learn and is open sourced. It is also been heavily tested and is commercially ready. It powers dozens of BLE products. We encourage all developers frustrated by the fragmented and inconsistent BLE support on try it out.

Main Features

  • Support Android 4.2 (Broadcom, Sumsung SDK) and Android 4.3+
  • Built in Service, just start the service and receive BLE events by broadcast
  • Built in BLE request queue

Components

  • BleLibrary: this is the library project you can reuse in your project.
  • BluetoothLeGatt: this is the demo app project that uses BleLibrary.

Compile & Run

Eclipse

These two projects are eclipse projects. If you use eclipse, you can import these projects directly and run BluetoothLeGatt.

Android Studio

If you use android studio, you should import these project.

When it goes to Libraries step, it will show libs and libs1, just choose libs and ignore libs1.

When it goes to select project SDK step, ensure you choose Android API > 17.

Then you can run BluetoothLeGatt in android studio.

gizwitsble's People

Contributors

ax003d avatar gzbigegg 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  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  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

gizwitsble's Issues

crash

用户反馈过来的,还有看日志里,明明是三星系统,为啥初始化时还是AndroidBle
SDK_INT=21
MODE=SM-G900V
appVersion=SM-G900V->5.0->v3.5.0->c92 ->BLE:true
App_Type=Remote
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1493)
at android.bluetooth.IBluetoothGatt$Stub$Proxy.unregisterClient(IBluetoothGatt.java:905)
at android.bluetooth.BluetoothGatt.unregisterApp(BluetoothGatt.java:714)
at android.bluetooth.BluetoothGatt.close(BluetoothGatt.java:653)
at com.xtremeprog.sdk.ble.AndroidBle.disconnect(AndroidBle.java:247)
at com.xtremeprog.sdk.ble.BleService$1.run(BleService.java:202)
at java.lang.Thread.run(Thread.java:818)

Issue on Android BLE disconnect

When disconnecting from a device you invoke gatt.disconnect() and immediately after gatt.close(). What this does is that it doesn't allow the bluetooth stack to send in time an onConnectionStateChange message to the GattCallback.

If you remove the gatt.close() command from the AndroidBle disconnect method and append it to the if (newState == BluetoothProfile.STATE_DISCONNECTED) path in onConnectionStateChange all goes well.

Often, before I modified the code, I would receive from time to time some NullPointerException from the onConnectionStateChange implementation. After the change the code runs ok.

Long delays between requests

Is there any way to speed up the request queue when communicating with multiple devices? I'm sending data to 3 devices. Right now, it takes around 300ms to complete.

BLE Connection fail

Just i connect the ble4.0 with my telephone(MI3 OS:6.0.1),I can't connected;
And the logcat shows that
"
D/BluetoothGatt(14678): onClientConnectionState() - status=133 clientIf=5 device=xx:xx:xx:xx:xx:xx
D/blelib(14678): onConnectionStateChange xx:xx:xx:xx:xxxx: status 133 newState 0
"
I thougth it‘s the same with the another issues,just about the “status=133”
The Gatt may be wrong with my telephone opera system, because I use the BLE Connection of System successfully.
(PS. I can't received the Broadcast by the action "BluetoothDevice.ACTION_FOUND" , Thanks for your guide, I use your lib to scan the BL successfully)
Now I have to use old api of BLE Connection.
Finally I think the "status=133" may be bug in some telephone.

Problems with connect/disconnet

If often and quickly call to connect(+send command)/disconnet methods we can get status = 113 in onConnectionStateChange callback(it's so bad). And library has another problems with similar tests . All advise send ble commands in mainThread . This solution can help . What do you think about it ?

Update Readme

It would be super helpful if you could update the README to include how to get started. Basic usage and some documentation would help a lot rather than letting people try reverse engineer the sample app.

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.