Open shinxxxxwon opened 3 weeks ago
We are implementing a function to print PDF by linking CUPS source using JNI in Android.
Tests were conducted on two printers.
job_id = getJobId(monitor->http, monitor->http_resource, monitor->printer_uri, &new_state, monitor->requesting_user); LOGE("1.job_id = %d", job_id); ///1.job_id = -1
The reason getJobId() returns -1 is because job_id was not found in ippFindAttribute().
getJobId()
job_id
ippFindAttribute()
int getJobId(http_t *http, char *http_resource, char *printer_uri, /* I - URI buffer */ job_state_dyn_t *job_state_dyn, const char *requesting_user) { int job_id = -1; // Requested print job attributes static const char *jattrs[] = {"job-id"}; ipp_t *request = NULL; /* IPP request object */ ipp_t *response = NULL; /* IPP response object */ request = ippNewRequest(IPP_GET_JOBS); LOGE("getJobId: http_resource => %s", http_resource); //getJobId: http_resource => /ipp/print LOGE("getJobId: printer_uri => %s", printer_uri); //getJobId: printer_uri => ipp://printer_id_addr/ipp/print LOGE("getJobId: requesting_user => %s", requesting_user); if (request != NULL) { //request not null ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer_uri); ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, requesting_user); ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(jattrs) / sizeof(jattrs[0]), NULL, jattrs); if ((response = ipp_doCupsRequest(http, request, http_resource, printer_uri)) == NULL) { job_state_dyn->job_state = IPP_JOB_STATE_UNABLE_TO_CONNECT; job_state_dyn->job_state_reasons[0] = IPP_JOB_STATE_REASON_UNABLE_TO_CONNECT; } else { ipp_attribute_t *attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER); //attr = NULL (not find "job_id" attr) if (attr != NULL) { LOGE("getJobId() attr->integer : %d", attr->values[0].integer); job_id = ippGetInteger(attr, 0); LOGE("getJobId(): attr != NULL -> %d", job_id); } else LOGE("getJobId() attr is NULL"); LOGE("getJobId() job_id is %d", job_id); } } if (request != NULL) ippDelete(request); if (response != NULL) ippDelete(response); ///LOG LOGE("getJobId() returning job-id: %d", job_id); ///getJobId() returning job-id :-1 return job_id; }
Why can't I find the job_id attribute for a specific print?
Additionally, ported to use boringssl for printers that require tls upgrade.
boringssl
tls
We are implementing a function to print PDF by linking CUPS source using JNI in Android.
Tests were conducted on two printers.
The reason
getJobId()
returns -1 is becausejob_id
was not found inippFindAttribute()
.Why can't I find the
job_id
attribute for a specific print?Additionally, ported to use
boringssl
for printers that requiretls
upgrade.