Skip to content

How to implement a plugin?

Ahtі Lеgοnκov edited this page Dec 5, 2022 · 1 revision

Create a dll that exports single function:

plugin_interface const* getPluginInterface();

This function returns a pointer to a struct that contains pointers to functions that WinLIRC can call to decode user interaction into remote control codes. WinLIRC calls this function to get access to the plugin's functionality.

struct plugin_interface
{
	uint32_t plugin_api_version;
	int	(*init)(WLEventHandle exitEvent);
	void    (*deinit)();
	int	(*hasGui)();
	void    (*loadSetupGui)();
	int	(*sendIR)(ir_remote* remote, ir_ncode* code, int32_t repeats);
	int	(*decodeIR)(ir_remote* remotes, char* out, size_t out_size);
	int	(*setTransmitters)(uint32_t transmitterMask);
	hardware const* (*getHardware)();
	hardware const* hardware;
};

Interface

init(WLEventHandle exitEvent)

Called after loading the plugin. exitEvent is the event that WinLIRC signals when the plugin should cancel any operations that are in progress, stop threads, if any. Return nonzero to indicate success.

deinit

Called before unloading the plugin.

hasGui

Called to determine if there is a GUI for configuring the plugin. Return non-zero from this function to indicate presence of GUI, 0 otherwise.

loadSetupGui

Called when WinLIRC attempts to display plugin's configuration GUI.

sendIR

Implement this function if the plugin supports sending signals.

decodeIR

Implement this function if the plugin supports receiving signals.

setTransmitters

getHardware

hardware

Clone this wiki locally