implemented stop for BLEHandler and BikeSimulator
This commit is contained in:
@@ -44,7 +44,7 @@ namespace Hardware
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
|
|
||||||
BLE bleBike = new BLE();
|
BLE bleBike = new BLE();
|
||||||
|
|
||||||
Thread.Sleep(1000); // We need some time to list available devices
|
Thread.Sleep(1000); // We need some time to list available devices
|
||||||
@@ -203,5 +203,11 @@ namespace Hardware
|
|||||||
|
|
||||||
bleBike.WriteCharacteristic("6e40fec3-b5a3-f393-e0a9-e50e24dcca9e", antMessage);
|
bleBike.WriteCharacteristic("6e40fec3-b5a3-f393-e0a9-e50e24dcca9e", antMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop()
|
||||||
|
{
|
||||||
|
bleBike.SubscriptionValueChanged -= BleBike_SubscriptionValueChanged;
|
||||||
|
bleHeart.SubscriptionValueChanged -= BleBike_SubscriptionValueChanged;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ namespace Hardware.Simulators
|
|||||||
byte[] powerArray;
|
byte[] powerArray;
|
||||||
byte[] accPowerArray;
|
byte[] accPowerArray;
|
||||||
|
|
||||||
|
bool running = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BikeSimulator(IDataReceiver dataReceiver)
|
public BikeSimulator(IDataReceiver dataReceiver)
|
||||||
@@ -51,12 +53,14 @@ namespace Hardware.Simulators
|
|||||||
//Example BLE Message
|
//Example BLE Message
|
||||||
//4A-09-4E-05-19-16-00-FF-28-00-00-20-F0
|
//4A-09-4E-05-19-16-00-FF-28-00-00-20-F0
|
||||||
|
|
||||||
|
this.running = true;
|
||||||
|
|
||||||
float x = 0.0f;
|
float x = 0.0f;
|
||||||
|
|
||||||
//Perlin for Random values
|
//Perlin for Random values
|
||||||
ImprovedPerlin improvedPerlin = new ImprovedPerlin(0, LibNoise.NoiseQuality.Best);
|
ImprovedPerlin improvedPerlin = new ImprovedPerlin(0, LibNoise.NoiseQuality.Best);
|
||||||
|
|
||||||
while (true)
|
while (this.running)
|
||||||
{
|
{
|
||||||
CalculateVariables(improvedPerlin.GetValue(x) + 1);
|
CalculateVariables(improvedPerlin.GetValue(x) + 1);
|
||||||
|
|
||||||
@@ -124,6 +128,10 @@ namespace Hardware.Simulators
|
|||||||
this.resistance = (byte)Math.Max(Math.Min(Math.Round(percentage / 0.5), 255), 0);
|
this.resistance = (byte)Math.Max(Math.Min(Math.Round(percentage / 0.5), 255), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop()
|
||||||
|
{
|
||||||
|
this.running = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,7 @@ namespace ProftaakRH
|
|||||||
public interface IHandler
|
public interface IHandler
|
||||||
{
|
{
|
||||||
void setResistance(float percentage);
|
void setResistance(float percentage);
|
||||||
|
|
||||||
|
void stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user