加ant+相关代码。

This commit is contained in:
suntao committed 2021-03-30 14:23:41 +08:00
1 parent f45711f39f
commit 3c2bb10f07
115 files changed
+9058 -405

No files matched your search

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Devices.Ant.Messages
{
public abstract class BaseMessage
{
protected byte Channel;
public BaseMessage(byte channel)
{
Channel = channel;
}
public abstract ANTMessage GetMessage();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 929d7cdce470dec4d973c5a714fba697
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Devices.Ant.Messages
{
public class FecCalibrate : BaseMessage
{
public FecCalibrate(byte channel) : base(channel)
{
}
public override ANTMessage GetMessage()
{
return new ANTMessage()
{
Id = (byte)79,
Size = (byte)3,
Data = new byte[3]
{
this.Channel,
(byte) 1,
(byte) 192
}
};
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ec7724b4dc1d247428ceab28a8258c6b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,40 @@
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)
}
};
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d38d163148cfd84faf99c5a2bb04010
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,40 @@
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
}
};
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9b2e6e85130827343b3cd09fbae19376
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Devices.Ant.Messages
{
public class GetManufacturersInformation : RequestDataPage
{
public GetManufacturersInformation(byte channel)
: base(channel, (byte)80, new byte?(), new byte?(), (byte)4)
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c125f730d91490941a69906b4a589f4a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Devices.Ant.Messages
{
public class GetProductionInformation : RequestDataPage
{
public GetProductionInformation(byte channel)
: base(channel, (byte)81, new byte?(), new byte?(), (byte)4)
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8bb48d2b993bd7e4b941f8c75135dad5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
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;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 15e2a257350cfc24b90dadd3a2d33e60
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: