Reading Multiple Characteristics
Reading Multiple Characteristics
- Subject: Reading Multiple Characteristics
- From: Constantijn Schepens <email@hidden>
- Date: Mon, 26 Nov 2012 14:32:55 +0000
Hi,
I have built hardware around the BLE112 that has 5 sensors on it, each on one of the ADC pins. When in my program I can read any one of these single characteristics and get the value, but as soon as I try to get it to simultaneously do both it seems to only be able to read the first one. I have cascaded them as follows: (inside didUpdateValueForCharacteristic:)
if(characteristic == sensorZeroCharacteristic){ [peripheralDelegate sunMeasurementServiceSensorZeroDidChangeValue:self]; }
else if (characteristic == sensorOneCharacteristic){ [peripheralDelegate sunMeasurementServiceSensorOneDidChangeValue:self]; }
So I logically reasoned that the first if statement was always begin satisfied and hence sunMeasurementServiceSensorOneDidChangeValue was never being called (setting breakpoints I never get into the else if). So to try remedy this, to at least ensure I can read 2 sensors even if it isn't the most elegant solution, I tried:
if(characteristic == sensorZeroCharacteristic||characteristic == sensorOneCharacteristic){ [peripheralDelegate sunMeasurementServiceSensorZeroDidChangeValue:self]; [peripheralDelegate sunMeasurementServiceSensorOneDidChangeValue:self]; }
I thought that this would at least be able to clearly read both. Using breakpoints I verified that both of these methods were indeed being called, but the value of SensorOne always still remained zero (even though the code that reads it is run, and I know it works when I run the whole program only with SensorOne). Is it possible that SensorZero is interrupting this process and not letting it finish, even though the debugger is willing to step through it? Does anyone know any other potential cause or know how this might be fixed from doing something similar?
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