#1 2016-12-02 15:52:08

tk35
Member
Registered: 2016-12-02
Posts: 2

Can I send sensor value to smart phone via BLE?

Hi Guvalif,

I'm trying to send sensor's data to my android app via BLE, but is it possible?

In PLEN's firmware:

void loop()
{
    if (PLEN2::System::BLESerial().available())
    {
        PLEN2::System::BLESerial().write("From Plen");
    }
}

And in android, i tried to read value of BLE_SHIELD_RX (BLE_SHIELD_TX return error)

 if (isConnected) {
            BluetoothGattService bluetoothGattService = gatt.getService(UUID.fromString(GATTAttributes.BLE_SHIELD_SERVICE));
            if (bluetoothGattService == null) {
                Log.e(TAG, "Can't get a BluetoothGattService");
                return false;
            }
            BluetoothGattCharacteristic characteristic = bluetoothGattService.getCharacteristic(UUID.fromString(GATTAttributes.BLE_SHIELD_RX));
            if (characteristic == null) {
                Log.e(TAG, "Can't get a BluetoothGattCharacteristic");
                return false;
            }
            gatt.readCharacteristic(characteristic); //return true
}

but in onCharacteristicRead, result is an array of 0. So i tried:

 if (isConnected) {
            BluetoothGattService bluetoothGattService = gatt.getService(UUID.fromString(GATTAttributes.BLE_SHIELD_SERVICE));
            if (bluetoothGattService == null) {
                Log.e(TAG, "Can't get a BluetoothGattService");
                return false;
            }
            BluetoothGattCharacteristic characteristic = bluetoothGattService.getCharacteristic(UUID.fromString(GATTAttributes.BLE_SHIELD_RX));
            if (characteristic == null) {
                Log.e(TAG, "Can't get a BluetoothGattCharacteristic");
                return false;
            }
            gatt.setCharacteristicNotification(characteristic, true);
            BluetoothGattDescriptor descriptor = characteristic.getDescriptor(UUID.fromString(GATTAttributes.CLIENT_CHARACTERISTIC_CONFIG));
            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
            gatt.writeDescriptor(descriptor); //return true and onWriteDescriptor is called
}

but onCharacteristicChanged not called.

Am i miss something? Thank you!

Last edited by tk35 (2016-12-05 01:25:25)

Offline

#2 2016-12-05 02:17:41

PLEN Project Committee
Administrator
From: Osaka / Japan
Registered: 2015-08-31
Posts: 9
Website

Re: Can I send sensor value to smart phone via BLE?

Hi tk35,

Unfortunately, current firmware on PLEN2's head-board doesn't have a function that communicates to any other devices.
The firmware is also open-sourced. Please try to customize it if you want to do that :)

s.a. https://github.com/plenprojectcompany/p … are_BLE113

Offline

#3 2016-12-05 03:59:22

tk35
Member
Registered: 2016-12-02
Posts: 2

Re: Can I send sensor value to smart phone via BLE?

Hi admin,

Thank you for reply. But, cc debugger is required to customize BLE113 firmware right?

Offline

#4 2016-12-05 04:51:12

Guvalif
Moderator
From: Osaka / Japan
Registered: 2015-08-31
Posts: 135
Website

Re: Can I send sensor value to smart phone via BLE?

Hi tk35,

Yes, cc debugger is required.

Offline

#5 2017-02-21 16:40:14

Blipor
Member
Registered: 2017-02-21
Posts: 1

Re: Can I send sensor value to smart phone via BLE?

Why is this feature no longer available, when I started to use a proxy server to work with the program. Not sure how it is connected, but why it happened.

Last edited by Blipor (2017-03-10 11:59:51)

Offline

#6 2017-03-27 09:18:16

Guvalif
Moderator
From: Osaka / Japan
Registered: 2015-08-31
Posts: 135
Website

Re: Can I send sensor value to smart phone via BLE?

Hi Blipor,

Your question means "Why is this feature not available as default?" right?

Offline

Board footer

Powered by FluxBB