Coder Social home page Coder Social logo

sample-bluetooth-le-gattserver's People

Contributors

atn832 avatar carlospuk avatar devunwired avatar dx724 avatar mangini avatar proppy 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

sample-bluetooth-le-gattserver's Issues

Can't pair

I use Android phone and cannot pair with Android Things (Raspberry Pi 3) through Android Phone Settings -> Bluetooth -> Pair new device or createBond programmatically.

The use of ACTION_TIME_TICK

According to adopted BLE Current time Service specifications (https://www.bluetooth.com/specifications/adopted-specifications)
"A server device shall notify this characteristic to the client device depending on the value of Client Characteristic Configuration descriptor when the time of the server device is adjusted. The events that can cause the local time in the server device to change are user interaction (setting time via UI), time zone change, DST offset change, or reference time change. These events are not exclusive."
ACTION_TIME_TICK however, is sent every minute. The notifications should be sent when the time is adjusted.

Sample gatt client

Hi

I have written a simple GATT client that interacts with your server:

https://github.com/jmc420/sample-bluetooth-le-gattclient

I wrote the client because I am getting a connect followed immediately by a disconnect before the client is able to read the time characteristic.

This appears to be caused by this stack trace:

05-22 15:12:32.110 11559-11571/com.example.androidthings.gattserver W/BluetoothGattServer: Unhandled exception in callback
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:1699)
at android.os.Parcel.readException(Parcel.java:1646)
at android.bluetooth.IBluetoothGatt$Stub$Proxy.sendResponse(IBluetoothGatt.java:1424)
at android.bluetooth.BluetoothGattServer.sendResponse(BluetoothGattServer.java:599)
at com.example.androidthings.gattserver.GattServerActivity$gattServerCallback$1.onDescriptorWriteRequest(GattServerActivity.kt:197)
at android.bluetooth.BluetoothGattServer$1.onDescriptorWriteRequest(BluetoothGattServer.java:261)
at android.bluetooth.IBluetoothGattServerCallback$Stub.onTransact(IBluetoothGattServerCallback.java:263)
at android.os.Binder.execTransact(Binder.java:573)

I wrote a stackoveflow question on this issue:

https://stackoverflow.com/questions/50393196/bluetooth-le-gatt-client-and-server

Does the same thing happen for you?

can't connect

I run this demo in my phone,then use another phone connect this phone ,but failed.I don't know what's wrong.

Disconnect client

I have a problem with discoverability of the device and the reconnection after i disconnect from a client.
The only solution was to reboot the rpi and i be able to re-discover and re-connect from my client app.
If you have some advice for resolving this issue.

EDIT: I have an Error 133 (0x85) when i tried to reconnect.

"The application may be doing too much work on its main thread"

just a minor issue but I got the following logcat message while running on a raspberry pi 3
com.example.androidthings.gattserver I/Choreographer: Skipped 86 frames! The application may be doing too much work on its main thread.
wouldn't it be better to move the UI code mLocalTimeView.setText(displayDate); to another thread e.g. a runnable inside a runOnUiThread?
e.g.

    private void updateLocalUi(long timestamp) {
        Date date = new Date(timestamp);
        final String displayDate = DateFormat.getMediumDateFormat(this).format(date)
                + "\n"
                + DateFormat.getTimeFormat(this).format(date);
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mLocalTimeView.setText(displayDate);
            }
        });
    }

Adjust reason byte

In the code, Intent.ACTION_TIME_CHANGED results in TimeProfile.ADJUST_MANUAL (0x01) but for Intent.ACTION_TIMEZONE_CHANGED the adjust reason value is set as 0x04.
According to the current time specs (https://www.bluetooth.com/specifications/adopted-specifications), "If the time information on the server device was set / changed manually, the “Manual Time Update” bit shall be set.
Note: If the time zone or DST offset were changed manually, this bit shall also be set."

In the example scenario, the user is asked to changed the timezone. Shouldn't the ADJUST_TIMEZONE value be 0x05 instead of 0x04 (and shouldn't the same thing apply to DST)?

    // Adjustment Flags
    public static final byte ADJUST_NONE     = 0x0;
    public static final byte ADJUST_MANUAL   = 0x1;
    public static final byte ADJUST_EXTERNAL = 0x2;
    public static final byte ADJUST_TIMEZONE = 0x5;
    public static final byte ADJUST_DST      = 0x9;

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.