Remove random Integer class.
Add check if value for intensity and duration is within accepted range.
This commit is contained in:
@ -58,7 +58,7 @@ public class OpenShockHttp : OpenShockApi
|
||||
};
|
||||
}
|
||||
|
||||
public OpenShockHttp(IntensityRange intensityRange, DurationRange durationRange, string apiKey, string endpoint = "https://api.shocklink.net", ILogger? logger = null) : base(intensityRange, durationRange, DeviceApi.OpenShockHttp, apiKey, endpoint, logger)
|
||||
public OpenShockHttp(string apiKey, string endpoint = "https://api.shocklink.net", ILogger? logger = null) : base(DeviceApi.OpenShockHttp, apiKey, endpoint, logger)
|
||||
{
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ public class OpenShockSerial : OpenShockApi
|
||||
public SerialPortInfo SerialPortI;
|
||||
private readonly SerialPort _serialPort;
|
||||
|
||||
public OpenShockSerial(IntensityRange intensityRange, DurationRange durationRange, SerialPortInfo serialPortI, string apiKey, string endpoint = "https://api.shocklink.net", ILogger? logger = null) : base(intensityRange, durationRange, DeviceApi.OpenShockSerial, apiKey, endpoint, logger)
|
||||
public OpenShockSerial(SerialPortInfo serialPortI, string apiKey, string endpoint = "https://api.shocklink.net", ILogger? logger = null) : base(DeviceApi.OpenShockSerial, apiKey, endpoint, logger)
|
||||
{
|
||||
this.SerialPortI = serialPortI;
|
||||
this._serialPort = new SerialPort(serialPortI.PortName, BaudRate);
|
||||
|
@ -15,7 +15,7 @@ public class PiShockHttp : PiShockApi
|
||||
public string Username, Endpoint, ApiKey;
|
||||
protected readonly HttpClient HttpClient = new();
|
||||
|
||||
public PiShockHttp(IntensityRange intensityRange, DurationRange durationRange, string apiKey, string username, string endpoint = "https://do.pishock.com/api/apioperate", ILogger? logger = null) : base(intensityRange, durationRange, DeviceApi.PiShockHttp, logger)
|
||||
public PiShockHttp(string apiKey, string username, string endpoint = "https://do.pishock.com/api/apioperate", ILogger? logger = null) : base(DeviceApi.PiShockHttp, logger)
|
||||
{
|
||||
this.Username = username;
|
||||
this.Endpoint = endpoint;
|
||||
|
@ -13,7 +13,7 @@ public class PiShockSerial : PiShockApi
|
||||
public SerialPortInfo SerialPortI;
|
||||
private readonly SerialPort _serialPort;
|
||||
|
||||
public PiShockSerial(IntensityRange intensityRange, DurationRange durationRange, DeviceApi apiType, SerialPortInfo serialPortI, ILogger? logger = null) : base(intensityRange, durationRange, apiType, logger)
|
||||
public PiShockSerial(DeviceApi apiType, SerialPortInfo serialPortI, ILogger? logger = null) : base(apiType, logger)
|
||||
{
|
||||
this.SerialPortI = serialPortI;
|
||||
this._serialPort = new SerialPort(this.SerialPortI.PortName, BaudRate);
|
||||
|
Reference in New Issue
Block a user