1 How to use USB_RELAY_DEVICE DLL
5 Changes to the original DLL:
6 ============================
7 - Type used for handles changed from int to intptr_t, for 64-bit compatibility.
8 This should be binary compatible with existing 32-bit clients.
11 Windows, Visual C++ applications
12 ================================
14 Include file name: usb_relay_device.h
15 Library file name: usb_relay_device.lib
17 Put the following lines in your source file:
19 #include <usb_relay_device.h>
20 #pragma comment(lib, "usb_relay_device.lib")
22 The file usb_relay_device.dll must be installed with your application.
23 Use either 32-bit or 64-bit DLL, matching your application.
24 The DLL may require VC++ redistributable runtime library.
30 Call this before calling other functions
32 * usb_relay_device_enumerate()
33 Enumerates all Relay devices plugged into the PC.
34 Returns list of usb_relay_device_info structures.
35 Caller should free this list by passing it to usb_relay_device_free_enumerate().
37 * usb_relay_device_open()
38 Opens one Relay board device by its usb_relay_device_info structure,
39 obtained from usb_relay_device_enumerate().
41 * usb_relay_device_open_with_serial_number
42 Opens one Relay board device by its serial number string.
43 These strings can be obtained from usb_relay_device_enumerate().
45 * usb_relay_device_open_one_relay_channel
46 Turns ON one channel of a Relay board.
48 - device handle, obtained from usb_relay_device_open()
49 - Index: integer from 1 to the maximal number of channels on a board.
51 * usb_relay_device_open_all_relay_channel
52 Turns ON all channels on a board.
54 * usb_relay_device_close_one_relay_channel
55 Turns OFF one channel of a Relay board.
57 - device handle, obtained from usb_relay_device_open()
58 - Index: integer from 1 to the maximal number of channels on a board.
60 * usb_relay_device_close_all_relay_channel()
61 Turns OFF all channels on a board.
63 * usb_relay_device_get_status
64 Get status of all channels on a board as a bit mask.
65 The least significant bit in returned value corresponds to channel 1.
66 Bit value 1 means the corresponding relay is switched ON, value 0 means the relay is OFF.
68 * usb_relay_device_close
69 Closes the Relay device handle opened by usb_relay_device_open() or
70 usb_relay_device_open_with_serial_number()
77 If error occurred, the API functions that return error code return -1;
78 functions that return handles or pointers return NULL.
79 Application is responsible to check the returned value.
83 * The library does not detect hot plug/unplug of USB devices.
84 * The library is not thread-safe. Client application must ensure that
85 only one thread calls the library.
88 Managed .NET applications (C#, VB.NET)
89 ======================================
96 GCC or MinGW applications
97 =========================