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

namespace Assets.Scripts.Devices.Ant.Pages.CalibrationPages
{
    /// <summary>
    /// 校准成功的处理函数
    /// </summary>
    public class SuccessCalibrationPage : ICalibrationPage
    {
        public bool CanHandle(byte calibrationId)
        {
            return (int)calibrationId == 172;
        }

        public void Handle(byte[] dataPayload, AbstractAntDevice device)
        {
            //throw new NotImplementedException();
            var powerDevice = device as PowerDevice;
            if (powerDevice == null)
                return;
            var autoZeroStatus = (AutoZeroStatus)dataPayload[2];
            var offset = (int)((int)dataPayload[7] << 8 | (int)dataPayload[6]);
            powerDevice.DoCalibrationSuccess(offset, autoZeroStatus);


        }
    }
}
