BUILDING
-For Windows XP and later:
- - Using the in-box hid.dll
- - Build with VC++ 2008 and WDK 7.1, or VC++ 2013 "community edition" with WDK 8.1
+For Windows XP and newer:
+ - Build with VC++ 2008 with WDK 7.1, or VC++ 2013 "community edition" with WDK 8.1
For Linux (PC, x86):
- using the old libusb (v. 0.1; usb.h)
- tested on Centos 5, Ubuntu 12.04, Mint
-SOURCE based on a V-USB HID example.
-LICENSE: TBD!
- Should be non-GPL; rewrite all prototype code!
-
->>> Target for 1st public release:
-================================
-1. Remove GPL encumberment
-2. Make a .so for Linux (Windows already has orig DLL)
-
-Other TODO's
-============
-
- *** Check that these devices indeed have unique IDs!
- The orig. h file mentions function: usb_relay_device_set_serial(int hHandle, char serial[5]);
- which may be used by mfg to burn the ID? but the orig. DLL does not export it.
- In detection code (find by "unique ID"), check only by product name, Ignore vendor string?
-
-TODO: Make a .so callable from Java, Python etc.
- For this, move to libusb 1.x (libusb.h)?
-TODO: provide the original API "usb_relay_device.h" API, compatible with the orig. usb_relay_device.dll
- The orig .h file and example are in orig dir (slightly adapted and updated to VC2008)
- In orig .h file relay state "open" means ON (the red LED is on). "Close" means OFF (the red LED is off)
-~~
-
-Uses code by:
-Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
-Author: Christian Starkjohann
-Creation Date: 2008-04-11
-
+For OS X 10.9:
+ - build with Xcode and IOKit framewrork
+
~~
-The relay device ID - from HID attributes:
-vendorName = "www.dcttech.com" -> this site does not exist (squatted)
-productName = "USBRelayN" where N=1|2|4
-
How to use USB_RELAY_DEVICE DLL
+===============================
Version 1.0
Changes to the original DLL:
-============================
+----------------------------
- Type used for handles changed from int to intptr_t, for 64-bit compatibility.
This should be binary compatible with existing 32-bit clients.
Windows, Visual C++ applications
-================================
+---------------------------------
Include file name: usb_relay_device.h
Library file name: usb_relay_device.lib
Put the following lines in your source file:
- #include <usb_relay_device.h>
- #pragma comment(lib, "usb_relay_device.lib")
+ `#include <usb_relay_device.h>`
+
+ `#pragma comment(lib, "usb_relay_device.lib")`
The file usb_relay_device.dll must be installed with your application.
Use either 32-bit or 64-bit DLL, matching your application.
Using the API:
--------------
- * usb_relay_init()
+ * `usb_relay_init()`
Call this before calling other functions
- * usb_relay_device_enumerate()
+ * `usb_relay_device_enumerate`
Enumerates all Relay devices plugged into the PC.
Returns list of usb_relay_device_info structures.
Caller should free this list by passing it to usb_relay_device_free_enumerate().
- * usb_relay_device_open()
+ * `usb_relay_device_open`
Opens one Relay board device by its usb_relay_device_info structure,
obtained from usb_relay_device_enumerate().
- * usb_relay_device_open_with_serial_number
+ * `usb_relay_device_open_with_serial_number`
Opens one Relay board device by its serial number string.
These strings can be obtained from usb_relay_device_enumerate().
- * usb_relay_device_open_one_relay_channel
+ * `usb_relay_device_open_one_relay_channel`
Turns ON one channel of a Relay board.
Parameters:
- device handle, obtained from usb_relay_device_open()
- Index: integer from 1 to the maximal number of channels on a board.
- * usb_relay_device_open_all_relay_channel
+ * `usb_relay_device_open_all_relay_channel`
Turns ON all channels on a board.
- * usb_relay_device_close_one_relay_channel
+ * `usb_relay_device_close_one_relay_channel`
Turns OFF one channel of a Relay board.
Parameters:
- - device handle, obtained from usb_relay_device_open()
+ - device handle, obtained from `usb_relay_device_open()`
- Index: integer from 1 to the maximal number of channels on a board.
- * usb_relay_device_close_all_relay_channel()
+ * `usb_relay_device_close_all_relay_channel`
Turns OFF all channels on a board.
- * usb_relay_device_get_status
+ * `usb_relay_device_get_status`
Get status of all channels on a board as a bit mask.
The least significant bit in returned value corresponds to channel 1.
Bit value 1 means the corresponding relay is switched ON, value 0 means the relay is OFF.
- * usb_relay_device_close
- Closes the Relay device handle opened by usb_relay_device_open() or
- usb_relay_device_open_with_serial_number()
+ * `usb_relay_device_close`
+ Closes the Relay device handle opened by `usb_relay_device_open()` or
+ `usb_relay_device_open_with_serial_number()`
- * usb_relay_exit
+* `usb_relay_exit`
Finalizes the library
Error handling
Managed .NET applications (C#, VB.NET)
-======================================
+---------------------------------------
TBD
Python (CPython)
-================
+-------------------
TBD
GCC or MinGW applications
-=========================
+--------------------------
TBD