Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE no aquisition of data #12

Open
HaukeSchlosser opened this issue Nov 11, 2021 · 11 comments
Open

BLE no aquisition of data #12

HaukeSchlosser opened this issue Nov 11, 2021 · 11 comments

Comments

@HaukeSchlosser
Copy link

D/BluetoothGatt: setCharacteristicNotification() - uuid: 4051eb11-bf0a-4c74-8730-a48f4193fcea enable: true
I/BLECommunication: 88:6B:0F:AB:F8:08 - onDescriptorWrite - 00002902-0000-1000-8000-00805f9b34fb status: 0
D/BluetoothGatt: setCharacteristicNotification() - uuid: 40fdba6b-672e-47c4-808a-e529adff3633 enable: true
I/BLECommunication: 88:6B:0F:AB:F8:08 - Commands 0
I/BLECommunication: 88:6B:0F:AB:F8:08 - onDescriptorWrite - 00002902-0000-1000-8000-00805f9b34fb status: 0
I/BLECommunication: 88:6B:0F:AB:F8:08 - FRAMES 0
I/DeviceActivity: 88:6B:0F:AB:F8:08 -> CONNECTED
I/BLECommunication: 88:6B:0F:AB:F8:08 - characteristic write success
D/BluetoothGatt: onConnectionUpdated() - Device=88:6B:0F:AB:F8:08 interval=9 latency=0 timeout=10 status=0
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
I/BLECommunication: 88:6B:0F:AB:F8:08 - characteristic write success
I/DeviceActivity: 88:6B:0F:AB:F8:08 -> ACQUISITION_OK
I/BLECommunication: 88:6B:0F:AB:F8:08 - characteristic write success

onCharacteristicChanged doesn't get called

@patriciaRibeiro97
Copy link

We could not replicate the problem you are having.
Looking at your logs, all looks to be alright, your setup and configuration are as expected.
In order to help you, we need more information: are you receiving data frames in your app's broadcast receiver? What is the sampling frequency you are using?

@HaukeSchlosser
Copy link
Author

HaukeSchlosser commented Nov 12, 2021

The sampling frequency were 1, 100, 1000 (tried all of them). Program looks like it runs smooth but I simply don't get data from the sensor. Neither onCharacteristicRead or onCharacteristicChanged gets called.

in BLECommunication
private final BroadcastReceiver LogAlarmReceiver = new BroadcastReceiver()
gets called with both
if (identifier != null && identifier.equals(mBluetoothDeviceAddress))
and
if (!payLoad.equals("")) being the case.

Only thing I changed was in BITalinoCommunicationFactory

            case BTH:
                //BTH
                //communication =  new BTHCommunication(activityContext, null);
                communication = new BLECommunication(activityContext);

Because the program would automatically connect via BTH but I specifically want it to operate on BLE (my device is able to do so). The log:

I/DeviceActivity: 88:6B:0F:AB:F8:08 -> CONNECTING
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=12 device=88:6B:0F:AB:F8:08
I/BLECommunication: 88:6B:0F:AB:F8:08 - Connected to GATT server.
D/BluetoothGatt: discoverServices() - device: 88:6B:0F:AB:F8:08
I/BLECommunication: 88:6B:0F:AB:F8:08 - Attempting to start service discovery:true
D/BluetoothGatt: onSearchComplete() = Device=88:6B:0F:AB:F8:08 Status=0
D/BluetoothGatt: setCharacteristicNotification() - uuid: 4051eb11-bf0a-4c74-8730-a48f4193fcea enable: true
I/BLECommunication: 88:6B:0F:AB:F8:08 - onDescriptorWrite - 00002902-0000-1000-8000-00805f9b34fb status: 0
D/BluetoothGatt: setCharacteristicNotification() - uuid: 40fdba6b-672e-47c4-808a-e529adff3633 enable: true
I/BLECommunication: 88:6B:0F:AB:F8:08 - Commands 0
I/BLECommunication: 88:6B:0F:AB:F8:08 - onDescriptorWrite - 00002902-0000-1000-8000-00805f9b34fb status: 0
I/BLECommunication: 88:6B:0F:AB:F8:08 - FRAMES 0
I/DeviceActivity: 88:6B:0F:AB:F8:08 -> CONNECTED
I/BLECommunication: 88:6B:0F:AB:F8:08 - characteristic write success
D/BluetoothGatt: onConnectionUpdated() - Device=88:6B:0F:AB:F8:08 interval=9 latency=0 timeout=10 status=0
E/TEST: BroadcastReceiver LogAlarmReceiver called
E/TEST: BroadcastReceiver LogAlarmReceiver = identifier != null
E/TEST: BroadcastReceiver LogAlarmReceiver = !payLoad.equals("")
E/TEST: BroadcastReceiver LogAlarmReceiver called
E/TEST: BroadcastReceiver LogAlarmReceiver = identifier != null
E/TEST: BroadcastReceiver LogAlarmReceiver called
E/TEST: BroadcastReceiver LogAlarmReceiver = identifier != null
E/TEST: BroadcastReceiver LogAlarmReceiver = !payLoad.equals("")
E/TEST: BroadcastReceiver LogAlarmReceiver called
E/TEST: BroadcastReceiver LogAlarmReceiver = identifier != null
E/TEST: BroadcastReceiver LogAlarmReceiver = !payLoad.equals("")
E/TEST: BroadcastReceiver LogAlarmReceiver called
E/TEST: BroadcastReceiver LogAlarmReceiver = identifier != null
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
I/BLECommunication: 88:6B:0F:AB:F8:08 - characteristic write success
I/DeviceActivity: 88:6B:0F:AB:F8:08 -> ACQUISITION_OK
I/BLECommunication: 88:6B:0F:AB:F8:08 - characteristic write success

@HaukeSchlosser
Copy link
Author

If you could tell me with which bytes to configure the UUID it would be highly appreciated.

@patriciaRibeiro97
Copy link

When you find your device in the application, what is the type of communication it returns? You can't create a new instance of a BLECommunication in a BTH device. If your device has both BLE and BTH, you can create a new case for DUAL communication and there you can create a new BLECommunication instance. However, we recommend opting for Bluetooth when your device has both communication types.

@HaukeSchlosser
Copy link
Author

HaukeSchlosser commented Nov 15, 2021

Hello,

the communication type is DUAL
D/PhoneWindow: windowLightStatusBar : false, disable View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
D/DeviceActivity: Communication: DUAL

and as I have written above I have already created a new instance:

case BTH: //BTH //communication = new BTHCommunication(activityContext, null); communication = new BLECommunication(activityContext);

However I have now written in BITalinoCommunicationFactory:

case DUAL: communication = new BLECommunication(activityContext); break;

This method gets called but still no data is aquisitioned.

@HaukeSchlosser
Copy link
Author

As I have stated, both onCharacteristicRead and onCharacteristicChanged do not get called and thus no data is uploaded from the HomeBIT. Because the writing of the characteristic with the START-command is successful, I would guess that the start command is wrong.

There is no documentation about the UUID however and thus it is not possible for me to know with which bytes to configure the HomeBIT.

@patriciaRibeiro97
Copy link

Hi,

I'm sorry you're still having problems with your system.
The BLECommunication workflow in the API is made so that you don't need to configure your device. The configuration is done intrinsically and the user shouldn't worry about that to connect and work with the device. Have you tried to use your device with default BTH communication to ensure everything else is working?

@HaukeSchlosser
Copy link
Author

HaukeSchlosser commented Nov 15, 2021

Dear patricia,

thank you for your reply. I have purchased the HomeBit with the BLE module and I need to integrate this via BLE into the project architecture. Since there is no documentation provided by your company about the configuration of the UUIDs except for this app I have downloaded the app to test/see how it works.

As I have explained above, the BLE aspect of this app does not seem to work and I have provided information about what aspect of the connection/upload procedure does not function (onCharacteristicChanged and onCharacteristicRead).

If you could tell me with which bytes to configure the UUID it would be highly appreciated since I believe that the problem is there.

The BTH communication works.

The only thing I have changed in the app is (in BITalinoCommunicationFactory)

case DUAL:
      communication = new BLECommunication(activityContext); 
      break;

so i can test the BLE connection.

@patriciaRibeiro97
Copy link

Dear Hauke,

Please find the following documents where you can find the UUID command bytes and communication protocols:
https://bitalino.com/storage/uploads/media/revolution-ble-block-datasheet.pdf
https://bitalino.com/storage/uploads/media/revolution-mcu-block-datasheet.pdf
Hope you find this information useful. If you need any further information please don't hesitate to contact us.

Best regards

@HaukeSchlosser
Copy link
Author

Dear patricia,

I have to apologize since I have found the first document provided but not the second one. This solves the issue for me, thanks a lot.

@HaukeSchlosser
Copy link
Author

HaukeSchlosser commented Nov 17, 2021

Hello again.

I am sorry but this app is still not working with BLE for me.
I now have a device with BLE. So it is now D/DeviceActivity: Communication: BLE. Frames is 100. After the start-command the MCU (HomeBIT) is not blinking faster and there are no callbacks like
onCharacteristicChanged

Same if I try manually with the provided documentation.
And same if I try with this:
https://github.com/pires/bitalino-ble-android/blob/master/Application/src/main/java/com/bitalino/ble/BITalinoBLEService.java

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants