Add status code to debug printout

This commit is contained in:
Anton Thomasson 2019-12-06 20:18:48 +01:00
parent 824a4e3cff
commit 09438afc72
3 changed files with 15 additions and 3 deletions

View file

@ -27,10 +27,9 @@ IppMsg::IppMsg(QNetworkReply* resp)
quint8 majVsn;
quint8 minVsn;
quint16 status;
quint32 reqId;
bts >> majVsn >> minVsn >> status >> reqId;
bts >> majVsn >> minVsn >> _status >> reqId;
QJsonObject* attrs = 0;

View file

@ -68,6 +68,8 @@ public:
QJsonObject getJobAttrs() {return _jobAttrs;}
QJsonObject getOpAttrs() {return _opAttrs;}
quint16 getStatus() {return _status;}
protected:
private:
@ -78,6 +80,8 @@ private:
QJsonObject _jobAttrs;
QJsonObject _printerAttrs;
quint16 _status;
static quint32 _reqid;
};

View file

@ -73,7 +73,7 @@ void IppPrinter::jobRequestFinished(QNetworkReply *reply)
{
try {
IppMsg resp(reply);
qDebug() << resp.getOpAttrs() << resp.getJobAttrs();
qDebug() << resp.getStatus() << resp.getOpAttrs() << resp.getJobAttrs();
_jobAttrs = resp.getJobAttrs();
emit jobAttrsChanged();
}
@ -111,6 +111,15 @@ bool IppPrinter::print(QJsonObject attrs, QString filename){
{"job-name", QJsonObject {{"tag", IppMsg::NameWithoutLanguage}, {"value", fileinfo.fileName()}}},
};
// Only include if printer supports it
// if (filename.endsWith("pdf"))
// {
// attrs.insert("document-format", QJsonObject {{"tag", 73}, {"value", "application/pdf"}});
// }
// else if (filename.endsWith("jpg")) {
// attrs.insert("document-format", QJsonObject {{"tag", 73}, {"value", "image/jpeg"}});
// }
IppMsg job = IppMsg(o, attrs);
QByteArray contents = job.encode(IppMsg::PrintJob);