예제 #1
0
파일: ofxCUPS.cpp 프로젝트: jkosoy/ofxCUPS
void ofxCUPS::updatePrinterInfo()
{
    cups_dest_t *dests;
    int num_dests = cupsGetDests(&dests);
    cups_dest_t *dest = cupsGetDest(printerName.c_str(), NULL, num_dests, dests);
    const char *value;
    
    value = cupsGetOption("printer-state", dest->num_options, dest->options);
    //    printf("%s printer-state: %s\n", dest->name, value ? value : "no description");
    setPrinterState(ofToInt(value));
    
    
    value = cupsGetOption("printer-state-reasons", dest->num_options, dest->options);
    //    printf("%s printer-state-reasons: %s\n", dest->name, value ? value : "(no description)");
    setPrinterInfo(ofToString(value));
    
    cupsFreeDests(num_dests, dests);
}
예제 #2
0
void ofxCUPS::updatePrinterInfo()
{
    cups_dest_t *dests;
    int num_dests = cupsGetDests(&dests);
    cups_dest_t *dest = NULL;
    dest = cupsGetDest(printerName.c_str(), NULL, num_dests, dests);
    if ( dest == NULL)
    {
        ofLogError() << "NO PRINTER - PRINTER NAME >> [" << printerName << "]" <<endl;
        return;
    }
    const char *value;
    value = cupsGetOption("printer-state", dest->num_options, dest->options);
    //    printf("%s printer-state: %s\n", dest->name, value ? value : "no description");
    setPrinterState(ofToInt(value));
    
    
    value = cupsGetOption("printer-state-reasons", dest->num_options, dest->options);
    //    printf("%s printer-state-reasons: %s\n", dest->name, value ? value : "(no description)");
    setPrinterInfo(ofToString(value));
    
    cupsFreeDests(num_dests, dests);
}