Bluetooth low energy, how to parse R-R Interval value?

前端 未结 5 646
醉梦人生
醉梦人生 2021-01-07 02:18

My application is receiving information from smart heart device. Now i can see pulse value. Could you please help me to parse R-R Interval value? How can i check device supp

5条回答
  •  鱼传尺愫
    2021-01-07 02:51

    EDIT: this work for me, i get the correct rr values: In some cases you can find two values at the same time for rr.

    - (void) updateWithHRMData:(NSData *)datas {
    
        const uint8_t *reportData = [datas bytes];
    
        uint16_t bpm = 0;
        uint16_t bpm2 = 0;
    
        if ((reportData[0] & 0x04) == 0)
        {
            NSLog(@"%@", @"Data are not present");
        }
        else
        {
    
            bpm = CFSwapInt16LittleToHost(*(uint16_t *)(&reportData[2]));
    
            bpm2 = CFSwapInt16LittleToHost(*(uint16_t *)(&reportData[4]));
    
            if (bpm != 0 || bpm2 != 0) {
    
                    NSLog(@"%u", bpm);
    
                    if (bpm2 != 0) {
                        NSLog(@"%u", bpm2);
                    }
    
            }
    
        }
    
    }
    

提交回复
热议问题