This document provides an overview of the PictBridge Library and outlines the key components and flow of how it works. It describes the system architecture including tasks, queues, event dispatching between the DSC and printer. It also covers the main functions for printer detection, data encapsulation/decapsulation, printing process and task scheduling that allows the library to communicate with printers using the PTP/IPP printing protocol.
2. Outline
System Overview
Flow of program running in Picture Bridge
TASK
fnPictProcess
Queue
DSC to Printer event dispatching
Printer to DSC events dispatching
fnFilterRecvData
Data Encapsulation, decap and routines
Printer Detection and initialzation
Printing Process
6. struct _Task
{
FuncPointer pFunc;
unsigned char ucTaskStatus;
unsigned char ucTaskStep;
unsigned char ucRestoreStep; // added for resend and ptp cancel
struct _Task *pCallerTask;
struct _Task *pCalledTask;
};
Double Link List
TASK
7. Task A Task B Task C
pCallerTask
pCalledTask
Func A Func B Func C
Step 1
:
Step N
Step 1
:
Step M
Step 1
:
Step I
DPSAPP DPS PTP
Scheduled by Pictprocess
RUN
BLOCK
or Job done, set
func to NULL
TASK(cont.)
8. fnProcessEvent()
fnUSBPeriodRoutine()
fnFilterRecvData()
if ( g_stUpPtp.pFunc != NULL && g_stUpPtp.ucTaskStatus == RUN )
( *g_stUpPtp.pFunc ) ( &g_stUpPtp );
Get and process event from DSC main system
Check incoming packet from USB, do data receive
if ( g_stDownPtp.pFunc != NULL && g_stDownPtp.ucTaskStatus == RUN )
( *g_stDownPtp.pFunc ) ( &g_stDownPtp );
if ( g_stUpDps.pFunc != NULL && g_stUpDps.ucTaskStatus == RUN )
( *g_stUpDps.pFunc ) ( &g_stUpDps );
if ( g_stUpDpsApp.pFunc != NULL && g_stUpDpsApp.ucTaskStatus == RUN )
( *g_stUpDpsApp.pFunc ) ( &g_stUpDpsApp );
if ( g_stDownDps.pFunc != NULL && g_stDownDps.ucTaskStatus == RUN )
( *g_stDownDps.pFunc ) ( &g_stDownDps );
if ( g_stDownDpsApp.pFunc != NULL && g_stDownDpsApp.ucTaskStatus == RUN )
g_stDownDpsApp.pFunc ( &g_stDownDpsApp );
Check Printer event, getFileInfo, getFile, getPartialFile
Process DPS,PTP,DpsApp
Upward, downward tasks.
Process Abort, Continue Task
fnPictProcess()
if ( ( g_stFileDps.pFunc != NULL ) && ( g_stFileDps.ucTaskStatus == RUN ) )
( *g_stFileDps.pFunc ) ( &g_stFileDps );
15. fnFilterRecvData()
Request, Response and event
From printer.
Check PTP command
DPS_GetFileInfo DPS_GetFile DPS_GetPartialFile
DPS special optimized actions
fnDpsPrinterReq()
SendObjectInfo
Get XML scripts
XML deciphers :
fnDpsGetEventContent()…
Parameters
fnAppNotifyXXXStatus()
Application
layer
if ( ulObjectHandle > MIN_IMAGE_FILE_ID )
DPS_GetThumb
fnDpsGetFileInfo() fnDpsGetFile()
GetObjectInfo, GetObject
, GetPartialObject, GetThumb
Make sure this is Printer to DSC action
fnFilterRecvData()
Events for
fnAppProcessInfoEvent()
16. GetPartialObject
fnDpsGetFileInfo()GetObjectInfo fnGetFileInfo()
Printer
PTP DPS UI :
Implement at
Appilication layer
Response
Response
fnDpsGetPartialFile() fnReadFile()
Many times
File Type
File SIZE
File ID
ulOffset : offset
From start of file
uiSize : size data
ucBuffer : Buffer
Offset and Data
Size for each request
Event :
End Normal Job End
fnFilterRecvData()
: Dispatching printer request
fnFilterRecvData()(cont.)
17. Event PICT_XXX
and parameters
XML script
{ parameters}
PTP command +
{XML}
USB Header +
PTP command
Applications
DPS
PTP
USB
fnDPSConfigPrintServiceFormat()
fnDPSGetCapabilityFormat()
fnDPSGetJobStatusFormat()
fnDPSGetDevStatusFormat()
…………………….
fnPTPFormatDataBlock()
fnPTPFormatResponseBlock()
fnPTPFormatObjectInfo()
fnPTPFormatDeviceInfo()
…………………..
fnDPSGetOperateContent()
fnDPSGetEventContent()
fnDPSGetParamVal()
fnDPSGetContainerInfo()
: g_stContainerInfo
fnMiscDwordRead()
First 12 byte header
EncapsulationDecapsulation
Data Encapsulation, decap and routines
18. fnPictInit() : Assign DPS fnAppInitPrint() Task
PictProcess()
No printer found
fnDPSDiscovery()
Detected
DPS_ConfigurePrintService
fnAppGetCapa()
Application layer Detected
Event
Printer Detection and initialzation
19. UI: select
Picture + parameters
Issue :
PICT_PRINT Put Event
In queue
fnProcessEvent()
Get Event and dispatch
fnEventPrintImage()
g_eAPP_DPSActionType
: DPS_StartJob
fnDPSOperation()
PTP command, data,
Reponse sequence
USB
fnAppPrint()
Printing Process