using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace SketchAssistantWPF
{
///
/// interface providing access to the vibrotactile armband
/// accessing the BodyActuator.dll C library via the StaticLibMotors.dll c++ library
///
public static class LocalArmbandInterface
{
///
/// initializes the armband (and binds the C dll)
/// must be called before calling any other of the methods of this class
/// explicitly allocates memory and therefore must only be called once and must be followed by a call to DestroyArmband eventually
///
/// an integer purely for debugging purposes, -1 means no unexpected behaviour occured and the initialization was successful
[DllImport (@"../Debug/StaticLibMotors.dll", EntryPoint = "?setupArmband@ArmbandInterface@@QAAHXZ",
CallingConvention = CallingConvention.Cdecl)]
public static extern int SetupArmband();
///
/// destroys the armband instance created by SetupArmband (thus freeing its allocated memory)
///
///
[DllImport(@"../Debug/StaticLibMotors.dll", EntryPoint = "?destroyArmband@ArmbandInterface@@QAAHXZ",
CallingConvention = CallingConvention.Cdecl)]
public static extern int DestroyArmband();
///
/// starts actuation of the specified tactor (motor) at the specified intensity (until it is stopped)
///
/// integer from 0 to 7 specifying the number of the tactor to actuate
/// intensity, ranging from 0.0 to 1.0 by default
[DllImport(@"../Debug/StaticLibMotors.dll", EntryPoint = "?startVibrate@ArmbandInterface@@QAAXHM@Z",
CallingConvention = CallingConvention.Cdecl)]
public static extern void StartVibrate(int motorNumber, double intensity);
///
/// stop actuation of the specified tactor (motor)
///
/// integer from 0 to 7 specifying the number of the tactor to stop
[DllImport(@"../Debug/StaticLibMotors.dll", EntryPoint = "?stopVibrate@ArmbandInterface@@QAAXH@Z",
CallingConvention = CallingConvention.Cdecl)]
public static extern void StopVibration(int motorNumber);
///
/// starts actuation of the specified tactor (motor) at the specified intensity for a specified amount of time
///
/// integer from 0 to 7 specifying the number of the tactor to actuate
/// intensity, ranging from 0.0 to 1.0 by default
/// number of millisecons to actuate the tactor for
[DllImport(@"../Debug/StaticLibMotors.dll", EntryPoint = "?actuate100@ArmbandInterface@@QAAXHNH@Z",
CallingConvention = CallingConvention.Cdecl)]
public static extern void Actuate(int tactor, double intensity, int duration);
}
}