CShock/README.md

57 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

2024-01-17 04:17:37 +01:00
Library to interact with Shock-Collars that are remotely controllable via ESP32-Boards.
2024-01-17 04:24:14 +01:00
[![GitHub License](https://img.shields.io/github/license/c9glax/cshocker)](https://github.com/C9Glax/CShocker)
2024-01-20 21:21:54 +01:00
[![NuGet Version](https://img.shields.io/nuget/v/CShocker)](https://www.nuget.org/packages/CShocker)
2024-01-19 02:21:36 +01:00
# Usage
```csharp
public static void Main(string[] args){
string apiKey = ":)";
2024-02-11 22:58:53 +01:00
OpenShockHttp openShockHttp = new (apiKey);
2024-02-04 16:26:10 +01:00
OpenShockShocker shocker1 = openShockHttp.GetShockers().First();
2024-02-01 23:07:48 +01:00
shocker1.Control(ControlAction.Vibrate, 20, 1000);
2024-01-19 02:21:36 +01:00
2024-02-01 23:07:48 +01:00
shocker1.Dispose();
List<SerialPortInfo> serialPorts = SerialHelper.GetSerialPorts();
int selectedPort = 1;
2024-02-11 22:58:53 +01:00
OpenShockSerial openShockSerial = new(serialPorts[selectedPort], apiKey);
2024-02-04 16:26:10 +01:00
OpenShockShocker shocker2 = openShockSerial.GetShockers().First();
2024-02-01 23:07:48 +01:00
shocker2.Control(ControlAction.Vibrate, 20, 1000);
shocker2.Dispose();
2024-01-19 02:21:36 +01:00
}
```
## `Shocker.Control`
```csharp
2024-02-11 22:58:53 +01:00
Control(ControlAction action, int intensity, int duration)
2024-01-19 02:21:36 +01:00
```
### ControlAction
2024-02-01 23:07:48 +01:00
From [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Devices/Additional/ControlActionEnum.cs)
2024-01-19 02:21:36 +01:00
## Variables
### ApiKey
- For OpenShock (HTTP) get token [here](https://shocklink.net/#/dashboard/tokens)
### Intensity Range
in percent
`0-100`
### Duration Range
in ms
- `0-30000` OpenShock
- `0-15000` PiShock
2024-02-01 23:07:48 +01:00
## Future
### ~~Username (PiShockHttp only)~~
~~For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)~~
2024-01-19 02:21:36 +01:00
2024-02-01 23:07:48 +01:00
### ~~Sharecode (PiShockHttp only)~~
~~For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)~~