2017-01-03 95 views
0

我正嘗試用藍牙將一個計步器手錶連接到我的手機,並且希望從它讀取到我製作的應用程序的步驟。連接成功,我能夠從手錶讀取數據,但我不太清楚如何解釋。十六進制小數解釋

下面是文件,

特徵值的內容:

(1) all the eigenvalue content inside the endian order are small endian order. 

(2) current_pedometer_measurement 
    The value of the current_pedometer_measurement consists of four parts 
    Value type description 
    Flag Uint8 0x01: Number of Steps (Required) 
    0x02: Distance (optional) 
    0x04: Calories (optional) 
    Such as 0x05 that contains the number of steps and calories 
    StepCount Uint24 The number of steps 
    StepDistancer Uint24 How far, in meters 
    StepCalorie Uint24 calories 

    Description: 

    1. Distance and calories are optional, may or may not appear 
     If only the number of steps, then the value is: 01 (steps) 10 27 00 (1 million steps) 
     If there are steps and distances, then the value is: 03 (number of steps, distance) 10 27 00 (1 million steps) 70 17 00 (6 km) 
     Other cases and so on. 
    2. Time value to mobile phone time as the standard, that is, the moment the phone receives the data that is the time of this data. 

(3) target 

    The target value is 
    Value type description 
    Flag Uint8 0x01: Number of Steps (Required) 
    StepCount Uint24 The number of steps 

    Description: 
    1. If the target is 10,000 steps, then the value is: 01 (steps) 10 27 00 (1 million steps) 
    2. If the device writes to the target value, the device is updated. If the device updates the target value, notify the phone. 

我從計步器手錶獲取讀數:

[7, 64, 1, 0, 144, 0, 0, 24, 0, 0] 

誰能幫我解釋它?

回答

1

數據似乎嚴格按照您的描述。第一個字節是標誌字段,在這種情況下,它表示所有3種測量類型正在報告中。或者比特1和2和3等於7.

接下來的9個字節是3個24位數據值,其中64,1,0是步驟,144,0,0是距離,24,0 ,0卡路里。如何轉換字節有點令人困惑,但是如果您使用little-endian格式並假設您以十進制打印它們,那麼這些值是否有意義?

Steps: 00 01 64 = 0x000140 = 320 
Distance: 00 00 144 = 0x000090 = 144 
Calories: 00 00 24 = 0x000018 = 24 

從你的例子上述值可能是十六進制:

10 27 00 = 0x002710 = 10000 
70 17 00 = 0x001770 = 6000 

希望幫助!

恩典

+0

是的,它是我爲目標設定的6000個步驟。我會更多地研究它。 – Dev