53 lines
1.8 KiB
C#
53 lines
1.8 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 RequestDataPage: BaseMessage
|
|
{
|
|
private readonly byte _channel;
|
|
private byte _page;
|
|
private byte _descriptorByte1;
|
|
private byte _descriptorByte2;
|
|
private readonly byte _requestedTransmissionResponse;
|
|
|
|
public RequestDataPage(byte channel, byte page, byte? descriptorByte1 = null, byte? descriptorByte2 = null, byte requestedTransmissionResponse = (byte)4)
|
|
: base(channel)
|
|
{
|
|
this._channel = channel;
|
|
this._page = page;//81
|
|
byte? nullable = descriptorByte1;
|
|
this._descriptorByte1 = nullable.HasValue ? nullable.GetValueOrDefault() : byte.MaxValue;
|
|
nullable = descriptorByte2;
|
|
this._descriptorByte2 = nullable.HasValue ? nullable.GetValueOrDefault() : byte.MaxValue;
|
|
this._requestedTransmissionResponse = requestedTransmissionResponse;
|
|
}
|
|
|
|
public override ANTMessage GetMessage()
|
|
{
|
|
byte[] numArray1 = new byte[9]
|
|
{
|
|
this._channel,
|
|
(byte) 70,
|
|
byte.MaxValue,
|
|
byte.MaxValue,
|
|
this._descriptorByte1,//byte.MaxValue
|
|
this._descriptorByte2,//byte.MaxValue
|
|
this._requestedTransmissionResponse,//4
|
|
this._page,//81
|
|
(byte) 1
|
|
};
|
|
ANTMessage antMessage = new ANTMessage();
|
|
antMessage.Id = (byte)79;
|
|
int num = (int)(byte)numArray1.Length;
|
|
antMessage.Size = (byte)num;
|
|
byte[] numArray2 = numArray1;
|
|
antMessage.Data = numArray2;
|
|
return antMessage;
|
|
}
|
|
}
|
|
}
|