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

namespace Assets.Scripts.Devices.Ant.Messages
{
    public class FecErgMode : BaseMessage
    {
        private readonly int _targetPower;

        public FecErgMode(byte channel, int targetPower)
          : base(channel)
        {
            this._targetPower = targetPower;
        }

        public override ANTMessage GetMessage()
        {
            return new ANTMessage()
            {
                Id = (byte)79,
                Size = (byte)9,
                Data = new byte[9]
              {
                  this.Channel,
                  (byte) 49,
                  byte.MaxValue,
                  byte.MaxValue,
                  byte.MaxValue,
                  byte.MaxValue,
                  byte.MaxValue,
                  (byte) (this._targetPower & (int) byte.MaxValue),
                  (byte) (this._targetPower >> 8 & (int) byte.MaxValue)
              }
            };
        }
    }
}
