接入蓝牙基本结构
This commit is contained in:
1 parent
84e8b50bbf
commit
2f84f70a5f
152 files changed
+6426
-56
No files matched your search
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Commands
|
||||
{
|
||||
public sealed class Command
|
||||
{
|
||||
public CommandType Type { get; }
|
||||
|
||||
// Token: 0x17000562 RID: 1378
|
||||
// (get) Token: 0x06001DF3 RID: 7667 RVA: 0x0007E52C File Offset: 0x0007C72C
|
||||
public CommandAction Action { get; }
|
||||
|
||||
// Token: 0x17000563 RID: 1379
|
||||
// (get) Token: 0x06001DF4 RID: 7668 RVA: 0x0007E534 File Offset: 0x0007C734
|
||||
public object Parameters { get; }
|
||||
|
||||
public Command(CommandType type, CommandAction action) : this(type, null, action)
|
||||
{
|
||||
}
|
||||
|
||||
public Command(CommandType type, object parameters, CommandAction action)
|
||||
{
|
||||
this.Type = type;
|
||||
this.Action = action;
|
||||
this.Parameters = parameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf2dd0151702c7b44bd89069c600abdf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Commands
|
||||
{
|
||||
public delegate void CommandAction(CommandResponseStatus responseStatus, object responseData);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d7be1a82849ca5489cbe39940c1e9ab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
using Assets.Scripts.Ble.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Commands
|
||||
{
|
||||
public static class CommandFactory
|
||||
{
|
||||
public static Command GetBatteryLevel(Action<CommandResponseStatus, int?> action = null)
|
||||
{
|
||||
return new Command(CommandType.GetBatteryLevel, CommandFactory.InjectCommandAction<int>(action));
|
||||
}
|
||||
|
||||
private static CommandAction InjectCommandAction<T>(Action<CommandResponseStatus, T?> action) where T : struct
|
||||
{
|
||||
if (action == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return delegate (CommandResponseStatus status, object data)
|
||||
{
|
||||
T? arg = data as T?;
|
||||
if (data != null && arg == null)
|
||||
{
|
||||
action(new CommandResponseStatus(status.Type, CommandResponseCode.TypeMismatch), null);
|
||||
return;
|
||||
}
|
||||
action(status, arg);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3273ce1de02c2c49adbdce0197d700e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
using Assets.Scripts.Ble.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Commands
|
||||
{
|
||||
public sealed class CommandResponseStatus
|
||||
{
|
||||
public CommandResponseCode ResponseCode { get; }
|
||||
|
||||
// Token: 0x17000565 RID: 1381
|
||||
// (get) Token: 0x06001E0C RID: 7692 RVA: 0x0007E7DC File Offset: 0x0007C9DC
|
||||
public CommandType Type { get; }
|
||||
|
||||
// Token: 0x17000566 RID: 1382
|
||||
// (get) Token: 0x06001E0D RID: 7693 RVA: 0x0007E7E4 File Offset: 0x0007C9E4
|
||||
public bool IsSuccess
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ResponseCode == CommandResponseCode.Success;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001E0E RID: 7694 RVA: 0x0007E7EF File Offset: 0x0007C9EF
|
||||
public CommandResponseStatus(CommandType type, CommandResponseCode responseCode)
|
||||
{
|
||||
this.ResponseCode = responseCode;
|
||||
this.Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e4aa7fe902c40744b67a6cc6dfc5f6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Commands
|
||||
{
|
||||
[Flags]
|
||||
public enum CommandType : long
|
||||
{
|
||||
// Token: 0x04000FF5 RID: 4085
|
||||
None = 0L,
|
||||
// Token: 0x04000FF6 RID: 4086
|
||||
SetTargetPower = 1L,
|
||||
// Token: 0x04000FF7 RID: 4087
|
||||
SetSimParameters = 2L,
|
||||
// Token: 0x04000FF8 RID: 4088
|
||||
SetTargetGear = 4L,
|
||||
// Token: 0x04000FF9 RID: 4089
|
||||
GetCurrentGear = 8L,
|
||||
// Token: 0x04000FFA RID: 4090
|
||||
GetResistanceControlType = 16L,
|
||||
// Token: 0x04000FFB RID: 4091
|
||||
SetResistanceControlType = 32L,
|
||||
// Token: 0x04000FFC RID: 4092
|
||||
SupportGearing = 64L,
|
||||
// Token: 0x04000FFD RID: 4093
|
||||
SetCircumference = 128L,
|
||||
// Token: 0x04000FFE RID: 4094
|
||||
SetSystemWeight = 256L,
|
||||
// Token: 0x04000FFF RID: 4095
|
||||
SetTargetInclination = 512L,
|
||||
// Token: 0x04001000 RID: 4096
|
||||
GetAutoZeroSupport = 1024L,
|
||||
// Token: 0x04001001 RID: 4097
|
||||
GetAutoZero = 2048L,
|
||||
// Token: 0x04001002 RID: 4098
|
||||
SetAutoZero = 4096L,
|
||||
// Token: 0x04001003 RID: 4099
|
||||
SetManualZeroSupport = 8192L,
|
||||
// Token: 0x04001004 RID: 4100
|
||||
SetManualZero = 16384L,
|
||||
// Token: 0x04001005 RID: 4101
|
||||
RequestCrankLength = 32768L,
|
||||
// Token: 0x04001006 RID: 4102
|
||||
SetCrankLength = 65536L,
|
||||
// Token: 0x04001007 RID: 4103
|
||||
WarmupRollDownCalibration = 131072L,
|
||||
// Token: 0x04001008 RID: 4104
|
||||
StartRollDownCalibration = 262144L,
|
||||
// Token: 0x04001009 RID: 4105
|
||||
StopRollDownCalibration = 524288L,
|
||||
// Token: 0x0400100A RID: 4106
|
||||
GetRollDownCalibrationStatus = 1048576L,
|
||||
// Token: 0x0400100B RID: 4107
|
||||
GetRollDownCalibrationParameters = 2097152L,
|
||||
// Token: 0x0400100C RID: 4108
|
||||
GetRollDownCalibrationType = 4194304L,
|
||||
// Token: 0x0400100D RID: 4109
|
||||
GetBatteryLevel = 1073741824L,
|
||||
// Token: 0x0400100E RID: 4110
|
||||
GetPnPId = 2147483648L,
|
||||
// Token: 0x0400100F RID: 4111
|
||||
GetSensorLocation = 549755813888L,
|
||||
// Token: 0x04001010 RID: 4112
|
||||
GetSupportedSensorLocations = 1099511627776L,
|
||||
// Token: 0x04001011 RID: 4113
|
||||
RequestFtmsControl = 1125899906842624L,
|
||||
// Token: 0x04001012 RID: 4114
|
||||
StartTraining = 2251799813685248L,
|
||||
// Token: 0x04001013 RID: 4115
|
||||
PauseTraining = 4503599627370496L,
|
||||
// Token: 0x04001014 RID: 4116
|
||||
ResumeTraining = 9007199254740992L,
|
||||
// Token: 0x04001015 RID: 4117
|
||||
StopTraining = 18014398509481984L,
|
||||
// Token: 0x04001016 RID: 4118
|
||||
RequestAntPage = 1152921504606846976L,
|
||||
// Token: 0x04001017 RID: 4119
|
||||
CyclingDevice = 1073741839L,
|
||||
// Token: 0x04001018 RID: 4120
|
||||
RunningDevice = 1073741826L,
|
||||
// Token: 0x04001019 RID: 4121
|
||||
TrainingController = 33776997205278720L
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a68646ff4441e2f4f8ea96a3056525d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user