[cups] how to use IPP_OP_GET_PRINTER_SUPPORTED_VALUES to get supportedvalues
Michael Sweeet
msweet at apple.com
Tue Apr 14 08:01:25 PDT 2015
Fish,
You don’t want IPP_GET_PRINTER_SUPPORTED_VALUES, you want IPP_OP_GET_PRINTER_ATTRIBUTES to get the (currently configured) sides-supported and color-supported attributes.
> On Apr 14, 2015, at 8:15 AM, Fish Shu <shumenghui at gmail.com> wrote:
>
> I want to use request = ippNewRequest(IPP_GET_PRINTER_SUPPORTED_VALUES)to
> get printer's supportedvalues like color_supported or duplex_supported,but
> How to? thinks for you help. I tried using the following method,but failed.
>
> #include <iostream>
>
> #include <cups/cups.h>
>
> using namespace std;
>
> int main(int argc, char *argv) {
>
> char uri[HTTP_MAX_URI;
>
> std::string result;
> ipp_t *request, *answer;
> ipp_attribute_t *attr;
> httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
> "localhost", 0, "/printers/%s", argv[1]);
>
> request = ippNewRequest(IPP_GET_PRINTER_SUPPORTED_VALUES);
> ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
> NULL, uri);
> ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
> "attributes-charset", NULL,
> "utf-8");
> ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
> "attributes-natural-language",
> NULL, "en");
>
> answer = cupsDoRequest (NULL, request, "/");
>
> for (attr = ippFirstAttribute (answer); attr; attr = ippNextAttribute
> (answer))
> {
> std::cout << ippGetName (attr) << std::endl;
> if(ippGetString (attr, 0 ,NULL) )
> {
> std::cout << ippGetString (attr, 0 ,NULL) << std::endl;
> }
> else
> {
> std::cout << "NULL"<< std::endl;
> }
> }
> //ippDelete(request);
> return 0;
>
> }
> ------------------------------
> _______________________________________________
> cups mailing list
> cups at cups.org
> https://www.cups.org/mailman/listinfo/cups
More information about the cups
mailing list