Re: Reading voltage value from BTLE device
Re: Reading voltage value from BTLE device
- Subject: Re: Reading voltage value from BTLE device
- From: Louis Mamakos <email@hidden>
- Date: Wed, 07 Nov 2012 18:07:38 -0500
Is the characteristic value in the GATT database really a 32 bit integer? With the BLE112 implementation, if your BGSCript writes less than 4 bytes and the characteristic isn't defined as being a fixed length, the length may shrink to that which was written to GATT database.
(Presumably the BGscript writing an integer to the characteristic and not a floating point value.)
Louis Mamakos
On Nov 7, 2012, at 4:26 PM, Constantijn Schepens <email@hidden> wrote:
> Hi there,
>
> I am working with a custom bluetooth profile which is designed to store multiple voltage values in its GATT database. (BLE112 using BGScript to be specific) This all works correctly. My iPhone connects correctly as well as finds characteristics correctly. My issue arises when I try to read the values of my characteristics. I just am not managing to read the value that is in the GATT database. It always comes out with really large (but consistently so) numbers, yet I cannot understand why because I feel I am reading the correctly number of bytes. The GATT database stores these values (coming from an ADC) in 4 bytes. The code I am currently trying to use(based on the TemperatureSensor example) is:
>
> CGFloat result = NAN;
> int32_t val = 0;
>
> {sensorZeroCharacteristic.value getBytes:&val length:sizeof(val)];
> result = (CGFloat)val;
>
> Can anyone see what I might be doing wrong or just have a better(correct) way of doing this?
>
> Thanks in advance!
> Constantijn
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Bluetooth-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden