using Assets.Scripts.Devices.Ant; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Assets.Scripts.Ble { public static class ServiceUuids { public static readonly byte[] GenericAccessService = new byte[2] { (byte) 24, (byte) 0 }; public static readonly byte[] DeviceInformation = new byte[2] { (byte) 24, (byte) 10 }; public static readonly byte[] Battery = new byte[2] { (byte) 24, (byte) 15 }; public static readonly byte[] CyclingPower = new byte[2] { (byte) 24, (byte) 24 }; public static readonly byte[] CyclingSpeedCadence = new byte[2] { (byte) 24, (byte) 22 }; public static readonly byte[] HeartRate = new byte[2] { (byte) 24, (byte) 13 }; public static readonly byte[] Ftms = new byte[2] { (byte) 24, (byte) 38 }; public static readonly byte[] KineticInRide = new byte[16] { (byte) 233, (byte) 65, (byte) 1, (byte) 0, (byte) 180, (byte) 52, (byte) 68, (byte) 107, (byte) 181, (byte) 204, (byte) 54, (byte) 89, (byte) 47, (byte) 196, (byte) 199, (byte) 36 }; public static readonly byte[] KineticSmartControl = new byte[16] { (byte) 233, (byte) 65, (byte) 2, (byte) 0, (byte) 180, (byte) 52, (byte) 68, (byte) 107, (byte) 181, (byte) 204, (byte) 54, (byte) 89, (byte) 47, (byte) 196, (byte) 199, (byte) 36 }; public static readonly byte[] TacxBle = new byte[16] { (byte) 110, (byte) 64, (byte) 254, (byte) 193, (byte) 181, (byte) 163, (byte) 243, (byte) 147, (byte) 224, (byte) 169, (byte) 229, (byte) 14, (byte) 36, (byte) 220, (byte) 202, (byte) 158 }; public static readonly byte[] Elite = new byte[16] { (byte) 52, (byte) 123, (byte) 0, (byte) 1, (byte) 118, (byte) 53, (byte) 64, (byte) 139, (byte) 137, (byte) 24, (byte) 143, (byte) 243, (byte) 148, (byte) 156, (byte) 229, (byte) 146 }; public static readonly byte[] PowerBeam = new byte[16] { (byte) 192, (byte) 244, (byte) 1, (byte) 58, (byte) 168, (byte) 55, (byte) 65, (byte) 101, (byte) 186, (byte) 185, (byte) 101, (byte) 78, (byte) 247, (byte) 7, (byte) 71, (byte) 198 }; public static readonly byte[][] CyclingRelatedServices = new byte[9][] { ServiceUuids.CyclingPower, ServiceUuids.CyclingSpeedCadence, ServiceUuids.HeartRate, ServiceUuids.KineticInRide, ServiceUuids.KineticSmartControl, ServiceUuids.TacxBle, ServiceUuids.Elite, ServiceUuids.PowerBeam, ServiceUuids.Ftms, }; public static readonly IReadOnlyList Services = (IReadOnlyList)new List() { new ServiceUuid(new Guid("0000180A-0000-1000-8000-00805F9B34FB"), ServiceUuids.DeviceInformation, false), new ServiceUuid(new Guid("0000180F-0000-1000-8000-00805F9B34FB"), ServiceUuids.Battery, false), new ServiceUuid(new Guid("00001818-0000-1000-8000-00805F9B34FB"), ServiceUuids.CyclingPower, true), new ServiceUuid(new Guid("00001816-0000-1000-8000-00805F9B34FB"), ServiceUuids.CyclingSpeedCadence, true), new ServiceUuid(new Guid("0000180D-0000-1000-8000-00805F9B34FB"), ServiceUuids.HeartRate, true), new ServiceUuid(new Guid("00001826-0000-1000-8000-00805F9B34FB"), ServiceUuids.Ftms, true), new ServiceUuid(new Guid("000141e9-34b4-6b44-b5cc-36592fc4c724"), ServiceUuids.KineticInRide, true), new ServiceUuid(new Guid("000241e9-34b4-6b44-b5cc-36592fc4c724"), ServiceUuids.KineticSmartControl, true), new ServiceUuid(new Guid("6e40fec1-b5a3-f393-e0a9-e50e24dcca9e"), ServiceUuids.TacxBle, true), new ServiceUuid(new Guid("01007b34-3576-8b40-8918-8ff3949ce592"), ServiceUuids.Elite, true), new ServiceUuid(new Guid("3a01f4c0-37a8-6541-bab9-654ef70747c6"), ServiceUuids.PowerBeam, true), }; public static readonly IReadOnlyList CyclingServices = ServiceUuids.Services.Where(s => s.IsCycling).ToList(); public static List GetServiceUuidList() { List list = new List(); foreach (var item in Services) { list.Add(item.IdGuid.ToString()); } return list; } public static ServiceUuid Get(byte[] type) { return ServiceUuids.Services.Single(s => s.IdByteArray == type); } public static Guid GetBySensor(SensorType sensor) { switch (sensor) { case SensorType.Cadence: case SensorType.SpeedCadence: return Get(ServiceUuids.CyclingSpeedCadence).IdGuid; case SensorType.HeartRate: return Get(ServiceUuids.HeartRate).IdGuid; case SensorType.Power: return Get(ServiceUuids.PowerBeam).IdGuid; case SensorType.Trainer: return Get(ServiceUuids.TacxBle).IdGuid; default: return Guid.Empty; } } public static class Characteristics { /// /// Heart Rate Measurement /// public static Guid HrMeasurement = new Guid("00002A37-0000-1000-8000-00805F9B34FB"); // Token: 0x040028D4 RID: 10452 public static Guid BodySensorLocation = new Guid("00002A38-0000-1000-8000-00805F9B34FB"); // Token: 0x040028D5 RID: 10453 public static Guid CscMeasurement = new Guid("00002A5B-0000-1000-8000-00805F9B34FB"); // Token: 0x040028D6 RID: 10454 public static Guid CscFeature = new Guid("00002A5C-0000-1000-8000-00805F9B34FB"); // Token: 0x040028D7 RID: 10455 public static Guid SensorLocation = new Guid("00002A5D-0000-1000-8000-00805F9B34FB"); // Token: 0x040028D8 RID: 10456 public static Guid ScControlPoint = new Guid("00002A55-0000-1000-8000-00805F9B34FB"); // Token: 0x040028D9 RID: 10457 public static Guid CyclingPowerMeasurement = new Guid("00002A63-0000-1000-8000-00805F9B34FB"); // Token: 0x040028DA RID: 10458 public static Guid CyclingPowerVector = new Guid("00002A64-0000-1000-8000-00805F9B34FB"); // Token: 0x040028DB RID: 10459 public static Guid CyclingPowerFeature = new Guid("00002A65-0000-1000-8000-00805F9B34FB"); // Token: 0x040028DC RID: 10460 public static Guid CyclingPowerControlPoint = new Guid("00002A66-0000-1000-8000-00805F9B34FB"); // Token: 0x040028DD RID: 10461 public static Guid FitnessMachineFeature = new Guid("00002ACC-0000-1000-8000-00805F9B34FB"); // Token: 0x040028DE RID: 10462 public static Guid FitnessMachineControlPoint = new Guid("00002AD9-0000-1000-8000-00805F9B34FB"); // Token: 0x040028DF RID: 10463 public static Guid IndoorBikeData = new Guid("00002AD2-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E0 RID: 10464 public static Guid FitnessMachineStatus = new Guid("00002ADA-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E1 RID: 10465 public static Guid FirmwareRevision = new Guid("00002A26-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E2 RID: 10466 public static Guid HardwareRevision = new Guid("00002A27-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E3 RID: 10467 public static Guid SoftwareRevision = new Guid("00002A28-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E4 RID: 10468 public static Guid ManufactureNameString = new Guid("00002A29-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E5 RID: 10469 public static Guid ModelNumber = new Guid("00002A24-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E6 RID: 10470 public static Guid SerialNumber = new Guid("00002A25-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E7 RID: 10471 public static Guid PnPId = new Guid("00002A50-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E8 RID: 10472 public static Guid BatteryLevel = new Guid("00002A19-0000-1000-8000-00805F9B34FB"); // Token: 0x040028E9 RID: 10473 public static Guid RscMeasurement = new Guid("00002A53-0000-1000-8000-00805F9B34FB"); // Token: 0x040028EA RID: 10474 public static Guid RscFeature = new Guid("00002A54-0000-1000-8000-00805F9B34FB"); // Token: 0x040028EB RID: 10475 public static Guid CycleOpsControlPoint = new Guid("CA31A533-A858-4DC7-A650-FDEB6DAD4C14"); // Token: 0x040028EC RID: 10476 public static Guid CycleOpsFtmsSystemWeight = new Guid("0D18A170-5498-11E9-8647-D663BD873D93"); // Token: 0x040028ED RID: 10477 public static Guid EliteBreak = new Guid("347B0010-7635-408B-8918-8FF3949CE592"); // Token: 0x040028EE RID: 10478 public static Guid EliteOutOfRange = new Guid("347B0011-7635-408B-8918-8FF3949CE592"); // Token: 0x040028EF RID: 10479 public static Guid EliteSystemWeight = new Guid("347B0018-7635-408B-8918-8FF3949CE592"); // Token: 0x040028F0 RID: 10480 public static Guid EliteTrainerCapabilities = new Guid("347B0019-7635-408B-8918-8FF3949CE592"); // Token: 0x040028F1 RID: 10481 public static Guid StagesRead = new Guid("0C46BEB0-9C22-48FF-AE0E-C6EAE1A2F4E5"); // Token: 0x040028F2 RID: 10482 public static Guid StagesWrite = new Guid("0C46BEB1-9C22-48FF-AE0E-C6EAE1A2F4E5"); // Token: 0x040028F3 RID: 10483 public static Guid TacxFecRead = new Guid("6E40FEC2-B5A3-F393-E0A9-E50E24DCCA9E"); // Token: 0x040028F4 RID: 10484 public static Guid TacxFecWrite = new Guid("6E40FEC3-B5A3-F393-E0A9-E50E24DCCA9E"); // Token: 0x040028F5 RID: 10485 public static Guid TechnoGymStSimulation = new Guid("58094966-498C-470D-8051-37E617A13895"); // Token: 0x040028F6 RID: 10486 public static Guid WahooControlPoint = new Guid("A026E005-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x040028F7 RID: 10487 public static Guid WattbikeAtomRead = new Guid("B4CC1224-BC02-4CAE-ADB9-1217AD2860D1"); // Token: 0x040028F8 RID: 10488 public static Guid WattbikeAtomWrite = new Guid("B4CC1225-BC02-4CAE-ADB9-1217AD2860D1"); // Token: 0x040028F9 RID: 10489 public static Guid WattbikeAtomXRead = new Guid("BABF1724-CEDB-444C-88C3-C672C7A59806"); // Token: 0x040028FA RID: 10490 public static Guid WattbikeAtomXWrite = new Guid("BABF1725-CEDB-444C-88C3-C672C7A59806"); // Token: 0x040028FB RID: 10491 public static Guid FitnessMachineTrainingStatus = new Guid("00002AD3-0000-1000-8000-00805F9B34FB"); // Token: 0x040028FC RID: 10492 public static Guid FitnessMachineSupportedResistanceLevelRange = new Guid("00002AD6-0000-1000-8000-00805F9B34FB"); // Token: 0x040028FD RID: 10493 public static Guid FitnessMachineSupportedPowerRange = new Guid("00002AD8-0000-1000-8000-00805F9B34FB"); // Token: 0x040028FE RID: 10494 public static Guid GemFwUpdate = new Guid("A026E002-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x040028FF RID: 10495 public static Guid GemFwUpdate4 = new Guid("A026E004-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002900 RID: 10496 public static Guid WahooA = new Guid("A026E00A-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002901 RID: 10497 public static Guid Wahoo23 = new Guid("A026E023-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002902 RID: 10498 public static Guid Wahoo37 = new Guid("A026E037-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002903 RID: 10499 public static Guid WahooFitnessType = new Guid("A026E01F-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002904 RID: 10500 public static Guid WahooFitnessState = new Guid("A026E01E-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002905 RID: 10501 public static Guid WahooFitnessStateName = new Guid("A026E020-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002906 RID: 10502 public static Guid WahooFitnessMeasurement = new Guid("A026E01D-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002907 RID: 10503 public static Guid WahooFitnessWorkoutProgramName = new Guid("A026E01B-0A7D-4AB3-97FA-F1500F9FEB8B"); // Token: 0x04002908 RID: 10504 public static Guid WahooFitnessSensorMeasurementInput = new Guid("A026E016-0A7D-4AB3-97FA-F1500F9FEB8B"); public static Guid RowerData = new Guid("00002AD1-0000-1000-8000-00805F9B34FB"); } } }