Exemplo n.º 1
0
    private double GetBeatTime(byte[] dataPayload)
    {
        int currBeatTime = dataPayload[4];

        currBeatTime |= dataPayload[5] << 8;
        return(RolloverHandler.HandleRollover(currBeatTime, m_CurrentHeartBeatTimeRolloverHandler));
    }
Exemplo n.º 2
0
    //FIXME: Event time -
    private void ExtractHeartRateInfo(byte[] dataPayload)
    {
        double currBeatCount = RolloverHandler.HandleRollover(dataPayload[6], m_CurrentHeartBeatCountHandler);
        var    currBeatTime  = GetBeatTime(dataPayload);


        if (m_InitBeatCount < 0)
        {
            m_InitBeatCount = currBeatCount;
        }

        currBeatCount = currBeatCount - m_InitBeatCount + 1;

        int hr       = dataPayload[7];
        var response = HeartRateResponse.builder(hr, currBeatCount, currBeatTime);

        AddRrParameters(response);
        var heartRateResponse = response.Build();

        if (m_HeartBeatCount < heartRateResponse.HeartRateBeatCount)
        {
//            Debug.Log(heartRateResponse);
            onNewHeartBeat?.Invoke(heartRateResponse);
        }
        m_LastHeartBeatEventTime = response.lastHeartRateBeatTime;
        m_HeartBeatCount         = response.heartRateBeatCount;
    }