weliem / blessed-android-coroutines

BLESSED Coroutines, a Bluetooth Low Energy (BLE) library for Android using Kotlin Coroutines
MIT License
128 stars 34 forks source link

Not showing temp or anything in the screen #3

Closed simpxlify closed 3 years ago

simpxlify commented 3 years ago

Hello, I found out this by coincidence while studying Bluetooth and coroutines on android studio kotlin and I found out your library in java which is amazing and works amazingly, I found out this one too just now and wanted to run a test if it worked as smooth as the java one but the text when you measure temperature is not showing, didn't test anything else but that for now but I don't know if you are going to look into this, in the logcat it all works wonderful.

weliem commented 3 years ago

That is strange. Works totally fine on my phone.... can you try again or try on a different phone?

Make sure you have uninstalled the Java version if you have it installed....otherwise 2 apps are competing for the same data.

simpxlify commented 3 years ago

I've tried with the heart rate machine and works fine, the temp one only works sometimes somehow, does it have to do with battery at all? I'll test with a phone later for sure.

weliem commented 3 years ago

As you can see in the code, all measurement types are treated the same way. Don't see anything different for the temperature measurement. Can you share a log for a case where it doesn't appear?

simpxlify commented 3 years ago

image

The logs do appear when temperature appears on the screen, I was comparing the java version because on java seems to always work, might be the coroutines fault for not being as fast? I really have no clue but the java one actually always work so it cant be the devices fault. In this example he connects but cant read any value or present it on the screen

martijnvanwelie commented 3 years ago

As you can see in the logs, no temperature value was received. So nothing will be displayed.

simpxlify commented 3 years ago

As you can see in the logs, no temperature value was received. So nothing will be displayed.

Yes, but that's the thing, it's giving a temperature on the thermometer but it's just not getting passed, with some exceptions that sometimes they do pass occasionally, also tried with a scale and pulseOx today and they dont even connect, I think I need to dig better into this.

weliem commented 3 years ago

I see you are using the Taidoc 1241. It indeed behaves a bit strange. The first measurement normally comes through but the second doesn't. I usually disconnect 2 seconds after receiving measurements and then I wait for it to turn off (around 30 seconds). That sort of makes it manageable. But the real problem is the device itself...

simpxlify commented 3 years ago

I see you are using the Taidoc 1241. It indeed behaves a bit strange. The first measurement normally comes through but the second doesn't. I usually disconnect 2 seconds after receiving measurements and then I wait for it to turn off (around 30 seconds). That sort of makes it manageable. But the real problem is the device itself...

Okay, so it might be indeed the device himself, I'll try to get another thermometer with bluetooth, thank you very much sir, but I simply cant get how in java it just works wonders reading it and in kt it just behaves so odd.

simpxlify commented 3 years ago

Alright I made them all connect, I have yet to get better understanding of this, Im doing a general scan for now because oximeter and scale werent getting connected, I get them all to connect but once again they just dont show their values or anything and I cant find the cause at all, the only one that always instantly show his values is the blood pressure one, I dont know what is failing here to them not to write on logcat or screen when they connect, if you have any suggestion please let me know, thank you in advance.

weliem commented 3 years ago

Please share some logs, otherwise I have no clue what is going on....

simpxlify commented 3 years ago

image Im sorry, alright here are the logs for the pulse oximeter right as he starts I get values on the pulseOx but they are not passed to the mobile phone.

martijnvanwelie commented 3 years ago

Ok, you should know that all Taidoc devices use a mix of standard services and proprietary services. The pulseoximeter you are using does not have the standard PulseOX service. You need to use the proprietary service and it's protocol of writing commands. You should contact Taidoc to get their official documentation.

simpxlify commented 3 years ago

Okay, I will do that, sir I have one more question if you could answer, could you please explain me as an example this part of the code:

val timestampPresent = flags and 0x02 > 0 val userIDPresent = flags and 0x04 > 0 val bmiAndHeightPresent = flags and 0x08 > 0

I dont quite understood this flags and numbers, if you could please explain I would be grateful to you.

weliem commented 3 years ago

The first byte is used to indicate whether certain content will be in the byte array. So every 'bit' of the 'byte' has a meaning. This code just tests which bits are on/off.