2017-01-03 9 views
0

私はブルートゥースと私の電話に歩数計の腕時計を接続しようとしており、私が作ったアプリにそれからステップを読み取るしたい。接続が成功し、私は時計からデータを読むことができますが、私はそれをどのように解釈するのか明確ではありません。ヘキサ10進解釈

以下

は、ドキュメント、

固有値コンテンツです:

(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はカロリーです。バイトを変換する方法はちょっと混乱しますが、リトルエンディアン形式を使用して10進数で印刷したと仮定した場合、これらの値は意味をなさないでしょうか?

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