加ant+相关代码。
This commit is contained in:
1 parent
f45711f39f
commit
3c2bb10f07
115 files changed
+9058
-405
No files matched your search
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 099c6c049781ec04fa6d891162fa2971
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Devices.Ant.Pages.CalibrationPages
|
||||
{
|
||||
internal class FecCalibrationPage : ICalibrationPage
|
||||
{
|
||||
public bool CanHandle(byte calibrationId)
|
||||
{
|
||||
return (int)calibrationId == 20;
|
||||
}
|
||||
|
||||
public void Handle(byte[] dataPayload, AbstractAntDevice device)
|
||||
{
|
||||
var fecDevice = device as FitDevice;
|
||||
if (fecDevice == null)
|
||||
return;
|
||||
|
||||
var offset = (int)(short)((int)dataPayload[7] | (int)dataPayload[6] << 8);
|
||||
|
||||
fecDevice.DoCalibrationSuccess(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5af3ac698660b3e4b82e1c6e3b597e19
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Devices.Ant.Pages
|
||||
{
|
||||
public interface IPageHandler
|
||||
{
|
||||
bool CanHandle(byte pageNumber);
|
||||
|
||||
void Handle(byte[] dataPayload, AbstractAntDevice device);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3041b61cfb7f39844a5b465f7d67f48c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Devices.Ant.Pages
|
||||
{
|
||||
public class ManufacturerDataPageHandler : IPageHandler
|
||||
{
|
||||
private readonly Action<ManufacturerDataPageContent> _callback;
|
||||
public ManufacturerDataPageHandler(Action<ManufacturerDataPageContent> callback)
|
||||
{
|
||||
_callback = callback;
|
||||
}
|
||||
|
||||
|
||||
public bool CanHandle(byte pageNumber)
|
||||
{
|
||||
return pageNumber == 80;
|
||||
}
|
||||
|
||||
public void Handle(byte[] dataPayload, AbstractAntDevice device)
|
||||
{
|
||||
int hwRevision = dataPayload[3];
|
||||
int mfgId = (int)dataPayload[4] | (int)dataPayload[5] << 8;
|
||||
int modelNumber = (int)((int)dataPayload[6] | (int)dataPayload[7] << 8);
|
||||
|
||||
//device.ManufacturerId = mfgId;
|
||||
_callback(new ManufacturerDataPageContent(hwRevision, mfgId, modelNumber));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e295cfb6fd138343888b4aefe868f2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user