glax ac19e20fb7 Fix OpenShockHttp: Wrong json caused Bad Request
Get OpenShock Shockers from API.
Save Shockers for PiShock and OpenShock in different structs
Implement Action Queue, to avoid synchronous actions getting lost.

Moved SerialPortInfo to own file
Created ShockerJsonConverter
Better separation of Devices/APIs and Shockers
2024-01-29 15:37:19 +01:00
2024-01-17 03:25:13 +01:00
2024-01-17 03:25:13 +01:00
2024-01-20 20:02:12 +01:00
2024-01-17 03:25:31 +01:00
2024-01-20 21:21:54 +01:00

Library to interact with Shock-Collars that are remotely controllable via ESP32-Boards.

GitHub License NuGet Version

Usage

public static void Main(string[] args){
    List<string> shockerIds = new();
    IntensityRange intensityRange = new IntensityRange(30, 50);
    DurationRange durationRange = new DurationRange(1000, 2000);
    string apiKey = ":)";
    OpenShockHttp openShockHttp = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiKey);
    openShockHttp.ShockerIds.AddRange(openShockHttp.GetShockers());
    
    string username = "username";
    string shareCode = "sharecode";
    PiShockHttp piShockHttp = new PiShockHttp(shockerIds, intensityRange, durationRange, apiKey, username, shareCode, apiUri);
    
    ControlAction action = ControlAction.Shock;
    openShockHttp.Control(action, shockerIds.First(), 20, 1000);
    piShockHttp.Control(action);
}

Shocker.Control

Control(ControlAction action, string? shockerId = null, int? intensity = null, int? duration = null)

If shockerId is null, all IDs will be used. If intensity or duration are null, a random value within the configured range will be used.

ControlAction

From here

Variables

ApiKey

  • For OpenShock (HTTP) get token here
  • For PiShock (HTTP) get information here

ShockerIds

List of Shocker-Ids, comma seperated.

[ "ID-1-asdasd", "ID-2-fghfgh" ]

OpenShockHttp also can retrieve IDs automatically.

Intensity Range

in percent

0-100

Duration Range

in ms

  • 0-30000 OpenShock
  • 0-15000 PiShock

Username (PiShockHttp only)

For PiShock (HTTP) get information here

Sharecode (PiShockHttp only)

For PiShock (HTTP) get information here

Description
C#-Library to Interact with ESP-Remote Shockcollars
Readme 190 KiB
Languages
C# 100%