libcdorganizer: plugin development


Developing plugins for libcdorganizer is a relatively simple process, once you know how your device operates. In this case, all you need to do is sub-class cdorganizer.h to handle your specific needs.

If your device is capable of doing more than what the library handles, make it known at the "feature requests" portion of the sourceforge project page. This will cause the base class to be updated with some default implementation for those devices that don't support this option.

If your device operates in a fundamentally different way than other devices, again, mention it under the feature requests. We'll go back and forth and iron out an interface that is compatible to all devices.

Minimum Implementation

At a minimum, an organizer plugin will need to implement the following functions:

extern "C" const bool isValid(const unsigned short vid, const unsigned short pid)

Checks a USB vendor and product ID against this plugin. Returns true if there's a match, false if no match

extern "C" cdorganizer * create(struct usb_device * myDev)

Creates an instance of a cdorganizer using the device passed in. Usually just a return new myCdorganizerPlugin(myDev);

extern "C" void destroyall()

You are expected to maintain a listing of all devices you have created. When this function is called, you are to destroy all organizers you have created

extern "C" void destroy(cdorganizer * cdo)

Destroy a particular instance of a cdorganizer

extern "C" const char * pluginName()

Returns a human-readable string describing your plugin (generally used to list supported plugins)