powerfun-unity/Assets/Scripts/Devices/Ant/Messages/FecUserConfiguration.cs
2021-03-30 14:23:41 +08:00

41 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Devices.Ant.Messages
{
public class FecUserConfiguration : BaseMessage
{
private readonly int _weight;
public FecUserConfiguration(byte channel, double weight)
: base(channel)
{
this._weight = (int)(weight * 100.0);
}
public override ANTMessage GetMessage()
{
return new ANTMessage()
{
Id = (byte)79,
Size = (byte)4,
Data = new byte[9]
{
this.Channel,
(byte) 55,
(byte) (this._weight & (int) byte.MaxValue),
(byte) (this._weight >> 8 & (int) byte.MaxValue),
byte.MaxValue,
(byte) 143,
(byte) 12,
(byte) 70,
(byte) 0
}
};
}
}
}