libcdorganizer - API


libcdorganizer is a library designed to abstract control of (hopefully) all cd organizer devices in a cross-platform library. It takes the basic functionality expected of an organizer (insert, eject, id) and implements it for whatever device it knows how to communicate with.

For developers who want to interface with the library as it exists, you want to see the function list (section 1.2).

For developers who want to extend the functionality of the library to include another device, check section 2.0.

Function List


In general, if a function returns a boolean value, it's a success / failure notification. Returning true means that the operation was successful. Returning false means that the operation failed. In the case of failure, recommend outputting a reason to stderr

One thing to note: For those devices that use the USB bus (all of them for now), the client program must initialize the bus. libcdorganizer does not initialize the USB bus. To make libusb initialize the bus, do the following:


To initialize a vector of available devices, eject slot 42, wait 5 seconds, then insert slot 42:

                #include <cdorganizer/cdorganizerFactory.h>
                #include <vector>         //To hold organizers in
                #include <usb.h>          //For usb bus initialization
                #include <iostream>       //For cout / endl
                #include <unistd.h>       //For sleep

                int main(int argc, char ** argv)

                        std::vector <cdorganizer *> myOrganizers;

                        for(int index(0); index < myOrganizers.size(); index++)
                                std::cout << "Found an organizer called " << myOrganizers[index]->getOrganizerType()
				<< " with ID " << myOrganizers[index]->getId() << std::endl;
                                delete myOrganizers[index];     //Don't leak memory...
                        return 0;

To compile, just run the standard arguments to g++, and add -lusb -lcdorganizer to it