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

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

        public void Handle(byte[] dataPayload, AbstractAntDevice device)
        {
            var powerDevice = device as PowerDevice;
            if (powerDevice == null || (int)dataPayload[2] != 1)
                return;
            //参考类CtfCalibrationResult
            var offset = (int)((int)dataPayload[7] | (int)dataPayload[6] << 8);
            powerDevice.DoCalibrationSuccess(offset, AutoZeroStatus.NotSupported);
        }
    }
}
