DoctorMX Library (MacOSX version)

These are library files to use DoctorMX USB/DMX512 interface hardware from application program.


C/C++ API


Enumerating Devices

RDrMXEnum DrMXEnum_New();
Creates an enumerator for available interface hardware.

void DrMXEnum_Delete(RDrMXEnum aE);
Deletes an enumerator.

CFStringRef DrMXEnum_Next(RDrMXEnum aE);
Returns a device identifier (string) one by one.
This identifier is a unique (permanent) serial number for each interface hardware.
(earlier product do not have a serial number, thus USB connection ID which is assigned by system is used instead)
A serial number is 4 digit decimal number.
(alternative identifier for earlier product consists of more characters)
Returns NULL if no more device is available.

Using a Device

RDrMX DrMX_OpenID(CFRunLoopRef aRL, CFStringRef aID);
Opens a specific interface hardware.
Returns an opaque reference to the interface hardware if available.
Returns NULL if specified hardware is not available for any reason (not connected, etc.).

RDrMX DrMX_Open(CFRunLoopRef aRL);
Opens an any available interface hardware.
(equivalent to DrMX_OpenID(aRL, NULL);)
Returns an opaque reference to the interface hardware if available.
Returns NULL if no hardware is available for any reason (not connected, etc.).

void DrMX_Close(RDrMX aR);
Closes an interface hardware.

int DrMX_Write(RDrMX aR, const unsigned char* aP, int aL, void(*aCB)(void*), void* aRef);
Outputs DMX data.
To output DMX signal continuously, repeat DrMX_Write() periodically.
Returns 1 if output begins.
In this case, aCB will be called when output is completed (aP is not needed to be valid until complete).
Returns 0 if previous output by DrMX_Write() has not completed yet.
Also returns 0 for any errors.

int DrMX_Read(RDrMX aR, unsigned char* aP, int aL, void(*aCB)(void*), void* aRef);
Inputs DMX data.
Returns -1 if no input data is available.
In this case, aCB will be called when input is completed (aP must be valid until complete).
Returns a number of bytes read if there are input data (1 or greater).
Extra data more than specified by aL are silently discarded.
Returns 0 if previous input by DrMX_Read() has not completed yet.
Also returns 0 for any errors.

int DrMX_SetTiming(RDrMX aR, unsigned int aBrk, unsigned int aMAB, unsigned int aMBS);
Sets output signal timing.
Returns 0 if failed for any reason (device is removed, etc.).


Example

   RDrMXEnum	de = DrMXEnum_New();

   for (;;)
   {
      CFString	id = DrMXEnum_Next(de);

      if (id == NULL) break;

      CFRelease(id);
   }
   DrMXEnum_Delete(de);

   /* ----------- */

   unsigned char  wbuf[513];
   unsigned char  rbuf[513];
   int            r;
   RDrMX	  drmx = DrMX_Open(runloop);

   if (drmx != NULL)
   {

      /* setup output data
        |
        |
      */
      r = DrMX_Write(drmx, wbuf, 513, wcb, NULL);
      if (r == 0)
      {
         /* retry later */
      }


      r = DrMX_Read(drmx, rbuf, 513, rcb, NULL);
      if (0 < r)
      {
         /* process input data */
      }


      DrMX_Close(drmx);
   }



For any questions, ask via email.
  • email (uty@kuwatec.co.jp)