empatica / ble-client-windows

This repo contains a simple client for sending commands and receive data from an Empatica E4 using Empatica BLE Server
23 stars 16 forks source link

The battery level return value is incorrect #3

Open VF7777 opened 7 years ago

VF7777 commented 7 years ago

Hi, When I send command 'device_subscribe bat ON' to get battery level, it always returns the value 1 or 0.01, I tested servel hours.

Thank you

hyorkim11 commented 7 years ago

can you provide relevant code?

Aeefire commented 7 years ago

I can confirm the issue. I also do only get 1 or 0.01 every now and then.

Unfortunately I can't share the code with you and don't have time to prepare a minimal sample. But what I am doing is simply splitting responses by "\r\n" to retrieve a single data set, then split this line by empty spaces to receive the parts of a response, then take the third element (i.e. the actual value) and parse a double using bool parseSuccess = Double.TryParse(valueString, NumberStyles.Number, CultureInfo.CreateSpecificCulture(HostCulture), out value);

Whereas HostCulture is either "en-US" or "de-DE", depending on the host culture I am using.

This worked for most data sets.