Access to your external hardware

General #

ACCCAL allows you to access your own hardware during the calibration process. It can be used to perform simple actions such as reading the current temperature and humidity, but also for much more complex processes. This concept is called a PLUGIN in ACCCAL. Plugins are Windows DLLs which you can program yourself to access your hardware.

Structure of the DLL #

Exported functions #

The Windows DLL must be a 32bit DLL, which should export the following functions.

#ifdef ACCCALDEMOPLUGIN_EXPORTS
#define ACCCALDEMOPLUGIN_API extern __declspec(dllexport)
#else
#define ACCCALDEMOPLUGIN_API extern __declspec(dllimport)
#endif
// This is the callback to send measured values back to ACCCAL
// VariableName consist of two parts divided by a dot eg. TESTING.TEMPERATURE
// VariableUnit is the Unit of your measured value
// Value is your measured value
typedef void(__stdcall* callback)(const char* VariableName, const char* VariableUnit, const char* Value);

extern "C"
{
// Functions are called in this sequence
ACCCALDEMOPLUGIN_API int Initialize(callback aCallback);
ACCCALDEMOPLUGIN_API void SUTBegin(void);
ACCCALDEMOPLUGIN_API void SUTStep(int StepNo, double Frequency, double Acceleration);
ACCCALDEMOPLUGIN_API void SUTEnd(void);
ACCCALDEMOPLUGIN_API void Finalize(void);
}

At least the Initialize function must be implemented, as this is used to supply the callback as a parameter, which you can use to send your measured values to ACCCAL. This function is called before the calibration process. Here, for example, the connection to your hardware can be opened, variables initialized or similar. From this point on, the callback is also ready to accept measurement data. SUTBegin is then called to signal the start of the calibration process. This is followed by SUTStep for each step in the calibration point template. The current sensitivity is determined in StepNo 0. Once all calibration steps have been completed, SUTEnd is called. Finalize signals the end of the calibration.
All exported functions must have cdecl as the calling convention, only the callback is executed as stdcall.

THE CALLBACK #

The callback looks like this:

void* Callback(const char* VariableName, const char* VariableUnit, const char* Value);

The callback expects 3 parameters of type const char* and does not return a function result. The name of the variable is passed in the VariableName parameter. Variable names consist of two parts separated by a dot (e.g.: DLL.TEMPERATURE) and can therefore be used as placeholders in the reports. It is recommended not to use any special characters in the variable names. VariableUnit contains the unit of the variable and Value contains its measured value. In the simplest case, the call would look like this:

#include "ACCCALDemoPlugin.h"
callback MyCallback;

ACCCALDEMOPLUGIN_API int Initialize(callback aCallback)
{
    MyCallback = aCallback; // Remember the callback
    MyCallback("PLUGIN.BAROMETRIC PRESSURE", "hPa", "1021"); // Calling the callback
    return 1;
}

A measured value can be transferred to ACCCAL via the callback at any time between Initialize and Finalize.

Activate the plugins #

Once you have created your DLL, copy it to the ACCCAL plugin directory. If this does not yet exist, create a new folder with the name Plugins in the ACCCAL installation directory. Open the ACCCAL.INI file and enter your DLL in the [PLUGINS] section.

[PLUGINS]
MYDLL=MYDLL.DLL;1 

Any number of plugins can be entered here. However, you should make sure that not too much time is wasted in the calls.

Demo Plugin #

Two demo plugins in Visual C++ or Delphi are supplied as source code in the Plugins folder during installation. However, you can also use any other programming language for creation, as long as standard 32-bit DLLs can be created with it.