using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assets.Scripts.Devices.Ant.Pages.CalibrationPages
{
    internal class FecCalibrationPage : ICalibrationPage
    {
        public bool CanHandle(byte calibrationId)
        {
            return (int)calibrationId == 20;
        }

        public void Handle(byte[] dataPayload, AbstractAntDevice device)
        {
            var fecDevice = device as FitDevice;
            if (fecDevice == null)
                return;

            var offset = (int)(short)((int)dataPayload[7] | (int)dataPayload[6] << 8);

            fecDevice.DoCalibrationSuccess(offset);
        }
    }
}
