115 return KErrNoMemory; |
115 return KErrNoMemory; |
116 } |
116 } |
117 // jobConfig |
117 // jobConfig |
118 TInt count = iReqParam.iJobConfig.Count(); |
118 TInt count = iReqParam.iJobConfig.Count(); |
119 |
119 |
|
120 TInt ret = KErrNone; |
|
121 |
120 elemsP[0].iElement = EDpsJobConfig; |
122 elemsP[0].iElement = EDpsJobConfig; |
121 elemsP[0].iNum = count; |
123 elemsP[0].iNum = count; |
122 aElements.Append(elemsP[0]); |
124 if ( (ret = aElements.Append(elemsP[0])) != KErrNone ) |
|
125 { |
|
126 IF_DEBUG(Print(_L("*** append error"))); |
|
127 return ret; |
|
128 } |
123 for (TInt i = 0; i < count; i++) |
129 for (TInt i = 0; i < count; i++) |
124 { |
130 { |
125 argsP[i].iElement = iReqParam.iJobConfig[i].iElement; |
131 argsP[i].iElement = iReqParam.iJobConfig[i].iElement; |
126 // the parameter only has high bytes (0x1234) |
132 // the parameter only has high bytes (0x1234) |
127 argsP[i].iContent.AppendNumUC(iReqParam.iJobConfig[i].iContent, EHex); |
133 argsP[i].iContent.AppendNumUC(iReqParam.iJobConfig[i].iContent, EHex); |
128 // we have to append the low bytes (0000) |
134 // we have to append the low bytes (0000) |
129 argsP[i].iContent.Append(KDpsLowZero); |
135 argsP[i].iContent.Append(KDpsLowZero); |
130 aArgs.Append(argsP[i]); |
136 if ( (ret = aArgs.Append(argsP[i])) != KErrNone ) |
|
137 { |
|
138 IF_DEBUG(Print(_L("*** append error"))); |
|
139 return ret; |
|
140 } |
131 IF_DEBUG(Print(_L("the element is %d"), argsP[i].iElement)); |
141 IF_DEBUG(Print(_L("the element is %d"), argsP[i].iElement)); |
132 IF_DEBUG(Print(_L("the content is %S"), &(argsP[i].iContent))); |
142 IF_DEBUG(Print(_L("the content is %S"), &(argsP[i].iContent))); |
133 } |
143 } |
134 |
|
135 // printInfo |
144 // printInfo |
136 for (TInt j = 0; j < imageCount; j++) |
145 for (TInt j = 0; j < imageCount; j++) |
137 { |
146 { |
138 // there is at least one argument for fileID |
147 // there is at least one argument for fileID |
139 TInt k = 1; |
148 TInt k = 1; |
140 elemsP[j + 1].iElement = EDpsPrintInfo; |
149 elemsP[j + 1].iElement = EDpsPrintInfo; |
141 argsP[count].iElement = EDpsArgFileID; |
150 argsP[count].iElement = EDpsArgFileID; |
142 argsP[count].iContent.AppendNumFixedWidth(objectHandles[j], EHex, |
151 argsP[count].iContent.AppendNumFixedWidth(objectHandles[j], EHex, |
143 KFullWordWidth); |
152 KFullWordWidth); |
144 aArgs.Append(argsP[count]); |
153 if ( (ret = aArgs.Append(argsP[count])) != KErrNone ) |
|
154 { |
|
155 IF_DEBUG(Print(_L("*** append error"))); |
|
156 return ret; |
|
157 } |
|
158 |
145 |
159 |
146 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
160 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
147 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
161 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
148 count++; |
162 count++; |
149 |
163 |
150 // not empty |
164 // not empty |
151 if (iReqParam.iPrintInfo[j].iFileName) |
165 if (iReqParam.iPrintInfo[j].iFileName) |
152 { |
166 { |
153 argsP[count].iElement = EDpsArgFileName; |
167 argsP[count].iElement = EDpsArgFileName; |
154 argsP[count].iContent.Copy(iReqParam.iPrintInfo[j].iFile); |
168 argsP[count].iContent.Copy(iReqParam.iPrintInfo[j].iFile); |
155 aArgs.Append(argsP[count]); |
169 if ( (ret = aArgs.Append(argsP[count])) != KErrNone) |
|
170 { |
|
171 IF_DEBUG(Print(_L("*** append error"))); |
|
172 return ret; |
|
173 } |
156 |
174 |
157 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
175 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
158 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
176 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
159 |
177 |
160 k++; count++; |
178 k++; count++; |
162 // not empty |
180 // not empty |
163 if (iReqParam.iPrintInfo[j].iDate.Size()) |
181 if (iReqParam.iPrintInfo[j].iDate.Size()) |
164 { |
182 { |
165 argsP[count].iElement = EDpsArgDate; |
183 argsP[count].iElement = EDpsArgDate; |
166 argsP[count].iContent.Copy(iReqParam.iPrintInfo[j].iDate); |
184 argsP[count].iContent.Copy(iReqParam.iPrintInfo[j].iDate); |
167 aArgs.Append(argsP[count]); |
185 if ( (ret = aArgs.Append(argsP[count])) != KErrNone) |
|
186 { |
|
187 IF_DEBUG(Print(_L("*** append error"))); |
|
188 return ret; |
|
189 } |
168 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
190 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
169 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
191 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
170 k++; count++; |
192 k++; count++; |
171 } |
193 } |
172 if (iReqParam.iPrintInfo[j].iCopies != 0) |
194 if (iReqParam.iPrintInfo[j].iCopies != 0) |
173 { |
195 { |
174 argsP[count].iElement = EDpsArgCopies; |
196 argsP[count].iElement = EDpsArgCopies; |
175 argsP[count].iContent.AppendNumFixedWidthUC( |
197 argsP[count].iContent.AppendNumFixedWidthUC( |
176 iReqParam.iPrintInfo[j].iCopies, EDecimal, KCopyFileWidth); |
198 iReqParam.iPrintInfo[j].iCopies, EDecimal, KCopyFileWidth); |
177 aArgs.Append(argsP[count]); |
199 if ( (ret = aArgs.Append(argsP[count])) != KErrNone) |
|
200 { |
|
201 IF_DEBUG(Print(_L("*** append error"))); |
|
202 return ret; |
|
203 } |
178 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
204 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
179 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
205 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
180 k++; count++; |
206 k++; count++; |
181 } |
207 } |
182 if (iReqParam.iPrintInfo[j].iPrtPID != 0) |
208 if (iReqParam.iPrintInfo[j].iPrtPID != 0) |
183 { |
209 { |
184 argsP[count].iElement = EDpsArgPrtPID; |
210 argsP[count].iElement = EDpsArgPrtPID; |
185 argsP[count].iContent.AppendNumUC(iReqParam.iPrintInfo[j].iPrtPID); |
211 argsP[count].iContent.AppendNumUC(iReqParam.iPrintInfo[j].iPrtPID); |
186 aArgs.Append(argsP[count]); |
212 if ( (ret = aArgs.Append(argsP[count])) != KErrNone) |
|
213 { |
|
214 IF_DEBUG(Print(_L("*** append error"))); |
|
215 return ret; |
|
216 } |
187 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
217 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
188 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
218 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
189 k++; count++; |
219 k++; count++; |
190 } |
220 } |
191 if (iReqParam.iPrintInfo[j].iCopyID != 0) |
221 if (iReqParam.iPrintInfo[j].iCopyID != 0) |
192 { |
222 { |
193 argsP[count].iElement = EDpsArgCopyID; |
223 argsP[count].iElement = EDpsArgCopyID; |
194 argsP[count].iContent.AppendNumUC(iReqParam.iPrintInfo[j].iCopyID); |
224 argsP[count].iContent.AppendNumUC(iReqParam.iPrintInfo[j].iCopyID); |
195 aArgs.Append(argsP[count]); |
225 if ( (ret = aArgs.Append(argsP[count])) != KErrNone) |
|
226 { |
|
227 IF_DEBUG(Print(_L("*** append error"))); |
|
228 return ret; |
|
229 } |
196 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
230 IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement)); |
197 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
231 IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent))); |
198 k++; count++; |
232 k++; count++; |
199 } |
233 } |
200 |
234 |
201 elemsP[j + 1].iNum = k; |
235 elemsP[j + 1].iNum = k; |
202 aElements.Append(elemsP[j + 1]); |
236 if ( (ret = aElements.Append(elemsP[j + 1])) != KErrNone) |
|
237 { |
|
238 IF_DEBUG(Print(_L("*** append error"))); |
|
239 return ret; |
|
240 } |
203 } |
241 } |
204 |
242 |
205 delete[] objectHandles; |
243 delete[] objectHandles; |
206 delete[] argsP; |
244 delete[] argsP; |
207 delete[] elemsP; |
245 delete[] elemsP; |
255 IF_DEBUG(Print(_L(">>>TDpsAbortJob::FillReqArgs"))); |
293 IF_DEBUG(Print(_L(">>>TDpsAbortJob::FillReqArgs"))); |
256 TDpsArg arg; |
294 TDpsArg arg; |
257 arg.iElement = EDpsArgAbortStyle; |
295 arg.iElement = EDpsArgAbortStyle; |
258 arg.iContent.AppendNumUC(iReqParam.iAbortStyle, EHex); |
296 arg.iContent.AppendNumUC(iReqParam.iAbortStyle, EHex); |
259 arg.iContent.Append(KDpsLowZero); |
297 arg.iContent.Append(KDpsLowZero); |
260 aArgs.Append(arg); |
298 TInt ret = aArgs.Append(arg); |
|
299 if (ret != KErrNone) |
|
300 { |
|
301 IF_DEBUG(Print(_L("*** append error"))); |
|
302 } |
261 IF_DEBUG(Print(_L("<<<TDpsAbortJob::FillReqArgs"))); |
303 IF_DEBUG(Print(_L("<<<TDpsAbortJob::FillReqArgs"))); |
262 return KErrNone; |
304 return ret; |
263 } |
305 } |
264 |
306 |
265 // --------------------------------------------------------------------------- |
307 // --------------------------------------------------------------------------- |
266 // Some request parameters should be checked |
308 // Some request parameters should be checked |
267 // --------------------------------------------------------------------------- |
309 // --------------------------------------------------------------------------- |
274 IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillReqArgs"))); |
316 IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillReqArgs"))); |
275 // only one element |
317 // only one element |
276 TDpsEle elems; |
318 TDpsEle elems; |
277 elems.iElement = EDpsCapability; |
319 elems.iElement = EDpsCapability; |
278 elems.iNum = 1; |
320 elems.iNum = 1; |
279 aElements.Append(elems); |
321 TInt ret = KErrNone; |
|
322 if ( (ret = aElements.Append(elems)) != KErrNone) |
|
323 { |
|
324 IF_DEBUG(Print(_L("*** append error"))); |
|
325 return ret; |
|
326 } |
280 |
327 |
281 // only one parameter |
328 // only one parameter |
282 TDpsArg argsP; |
329 TDpsArg argsP; |
283 argsP.iElement = iReqParam.iCap; |
330 argsP.iElement = iReqParam.iCap; |
284 aArgs.Append(argsP); |
331 if ( (ret = aArgs.Append(argsP)) != KErrNone) |
|
332 { |
|
333 IF_DEBUG(Print(_L("*** append error"))); |
|
334 return ret; |
|
335 } |
285 if (EDpsArgPaperTypes == iReqParam.iCap || EDpsArgLayouts == iReqParam.iCap) |
336 if (EDpsArgPaperTypes == iReqParam.iCap || EDpsArgLayouts == iReqParam.iCap) |
286 { |
337 { |
287 if (iReqParam.iAttribute != 0) |
338 if (iReqParam.iAttribute != 0) |
288 { |
339 { |
289 aAttrib = iReqParam.iAttribute; |
340 aAttrib = iReqParam.iAttribute; |
352 (iReqParam.iDpsVersions[j].iMajor); |
404 (iReqParam.iDpsVersions[j].iMajor); |
353 argsP[i].iContent.Append(_L(".")); |
405 argsP[i].iContent.Append(_L(".")); |
354 argsP[i].iContent.AppendNumUC |
406 argsP[i].iContent.AppendNumUC |
355 (iReqParam.iDpsVersions[j].iMinor); |
407 (iReqParam.iDpsVersions[j].iMinor); |
356 } |
408 } |
357 aArgs.Append(argsP[i]); |
409 ret = aArgs.Append(argsP[i]); |
358 break; |
410 break; |
359 |
411 |
360 case EDpsArgVendorName: // vender name |
412 case EDpsArgVendorName: // vender name |
361 |
413 |
362 argsP[i].iElement = EDpsArgVendorName; |
414 argsP[i].iElement = EDpsArgVendorName; |
363 argsP[i].iContent.Append(iReqParam.iVendorName); |
415 argsP[i].iContent.Append(iReqParam.iVendorName); |
364 aArgs.Append(argsP[i]); |
416 ret = aArgs.Append(argsP[i]); |
365 |
417 |
366 break; |
418 break; |
367 |
419 |
368 case EDpsArgVendorSpecificVersion: // vender version (optional) |
420 case EDpsArgVendorSpecificVersion: // vender version (optional) |
369 if (iReqParam.iVendorVersion.iMajor && |
421 if (iReqParam.iVendorVersion.iMajor && |
371 { |
423 { |
372 argsP[i].iElement = EDpsArgVendorSpecificVersion; |
424 argsP[i].iElement = EDpsArgVendorSpecificVersion; |
373 argsP[i].iContent.AppendNumUC(iReqParam.iVendorVersion.iMajor); |
425 argsP[i].iContent.AppendNumUC(iReqParam.iVendorVersion.iMajor); |
374 argsP[i].iContent.Append(_L(".")); |
426 argsP[i].iContent.Append(_L(".")); |
375 argsP[i].iContent.AppendNumUC(iReqParam.iVendorVersion.iMinor); |
427 argsP[i].iContent.AppendNumUC(iReqParam.iVendorVersion.iMinor); |
376 aArgs.Append(argsP[i]); |
428 ret = aArgs.Append(argsP[i]); |
377 } |
429 } |
378 |
430 |
379 break; |
431 break; |
380 |
432 |
381 case EDpsArgProductName: // produce name |
433 case EDpsArgProductName: // produce name |
382 argsP[i].iElement = EDpsArgProductName; |
434 argsP[i].iElement = EDpsArgProductName; |
383 argsP[i].iContent.Append(iReqParam.iProductName); |
435 argsP[i].iContent.Append(iReqParam.iProductName); |
384 aArgs.Append(argsP[i]); |
436 ret = aArgs.Append(argsP[i]); |
385 break; |
437 break; |
386 |
438 |
387 case EDpsArgSerialNo: // serialNo (optional) |
439 case EDpsArgSerialNo: // serialNo (optional) |
388 if (iReqParam.iSerialNo.Length()) |
440 if (iReqParam.iSerialNo.Length()) |
389 { |
441 { |
390 argsP[i].iElement = EDpsArgSerialNo; |
442 argsP[i].iElement = EDpsArgSerialNo; |
391 argsP[i].iContent.Append(iReqParam.iSerialNo); |
443 argsP[i].iContent.Append(iReqParam.iSerialNo); |
392 aArgs.Append(argsP[i]); |
444 ret = aArgs.Append(argsP[i]); |
393 } |
445 } |
394 |
446 |
395 break; |
447 break; |
396 |
448 |
397 default: |
449 default: |
417 CDpsTransaction* aTrader) |
475 CDpsTransaction* aTrader) |
418 { |
476 { |
419 IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillRepArgs"))); |
477 IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillRepArgs"))); |
420 CDpsXmlParser* XmlPar = aTrader->Parser(); |
478 CDpsXmlParser* XmlPar = aTrader->Parser(); |
421 |
479 |
|
480 TInt ret = KErrNone; |
|
481 |
422 if (aArgs.Count()) |
482 if (aArgs.Count()) |
423 { |
483 { |
424 if (EDpsArgPaperTypes == aArgs[0].iElement || |
484 if (EDpsArgPaperTypes == aArgs[0].iElement || |
425 EDpsArgLayouts == aArgs[0].iElement) |
485 EDpsArgLayouts == aArgs[0].iElement) |
426 { |
486 { |
427 if (XmlPar->HasAttribute()) |
487 if (XmlPar->HasAttribute()) |
428 { |
488 { |
429 TDpsAttribute attrib; |
489 TDpsAttribute attrib; |
430 XmlPar->GetAttribute(attrib); |
490 XmlPar->GetAttribute(attrib); |
431 iRepParam.iContent.Append(attrib); |
491 ret = iRepParam.iContent.Append(attrib); |
432 } |
492 } |
433 else |
493 else |
434 { |
494 { |
435 iRepParam.iContent.Append(0); |
495 ret = iRepParam.iContent.Append(0); |
436 } |
496 } |
|
497 |
|
498 if (ret != KErrNone) |
|
499 { |
|
500 IF_DEBUG(Print(_L("*** append error"))); |
|
501 return ret; |
|
502 } |
437 } |
503 } |
438 TUint32 value; |
504 TUint32 value; |
439 TLex8 converter; |
505 TLex8 converter; |
440 TLex8 parser(aArgs[0].iContent); |
506 TLex8 parser(aArgs[0].iContent); |
441 parser.SkipSpace(); |
507 parser.SkipSpace(); |
464 { |
530 { |
465 TDpsPaperType paperType; |
531 TDpsPaperType paperType; |
466 TInt major = value >> KShiftLength; |
532 TInt major = value >> KShiftLength; |
467 paperType.iMajor = (TDpsPaperTypeMajor)major; |
533 paperType.iMajor = (TDpsPaperTypeMajor)major; |
468 paperType.iMinor = (TDpsPaperTypeMinor)(value & KDpsMinorMask); |
534 paperType.iMinor = (TDpsPaperTypeMinor)(value & KDpsMinorMask); |
469 iRepParam.iPaperType.Append(paperType); |
535 ret = iRepParam.iPaperType.Append(paperType); |
470 } |
536 } |
471 else |
537 else |
472 { |
538 { |
473 // remove the extra zeros |
539 // remove the extra zeros |
474 value = value >> KShiftLength; |
540 value = value >> KShiftLength; |
475 iRepParam.iContent.Append(value); |
541 ret = iRepParam.iContent.Append(value); |
476 IF_DEBUG(Print(_L("the value is %x"), value)); |
542 IF_DEBUG(Print(_L("the value is %x"), value)); |
477 } |
543 } |
478 |
544 |
|
545 if (ret != KErrNone) |
|
546 { |
|
547 IF_DEBUG(Print(_L("*** append error"))); |
|
548 return ret; |
|
549 } |
479 } |
550 } |
480 iRepParam.iCap = aArgs[0].iElement; |
551 iRepParam.iCap = aArgs[0].iElement; |
481 |
552 |
482 } |
553 } |
483 |
554 |