PictBridge 05 - PictBridge Library Overview

19
PictBridge Library Overview Bear Lin 2009/04/28

Transcript of PictBridge 05 - PictBridge Library Overview

Page 1: PictBridge 05 - PictBridge Library Overview

PictBridge Library Overview

Bear Lin

2009/04/28

Page 2: PictBridge 05 - PictBridge Library Overview

OutlineSystem Overview Flow of program running in Picture BridgeTASKfnPictProcessQueueDSC to Printer event dispatchingPrinter to DSC events dispatchingfnFilterRecvDataData Encapsulation, decap and routinesPrinter Detection and initialzationPrinting Process

Page 3: PictBridge 05 - PictBridge Library Overview

Picture Bridge Library

PrinterAP Layer

Events: PICT_XXXUser Request

Events : Printer Status

Request

Response

Event

System Overview

Communicate with PTP protocol

Page 4: PictBridge 05 - PictBridge Library Overview

fnPictInit()

fnAppProcessInfoEvent()

fnPictProcess()

User RequestIn Event form

Event from Printer

Flow of program running in Picture Bridge

Page 5: PictBridge 05 - PictBridge Library Overview

DpsAPP

Dps

PTP

g_eAPP_DPSActionType : DPS_ConfigurePrintService, DPS_GetCapability, DPS_StartJob, DPS_AbortJob, DPS_ContinueJob,

Func = fnDPSOperation(), fnDPSDiscovery()

fnPTPSendEventBlock(), fnPTPSendDataBlock(), fnPTPSendResponseBlock()

Request from DSC in event form

Flow of program running in Picture Bridge(cont.)

Notify from Printer in event form

g_ePRN_DPSActionType: DPS_NotifyJobStatus, DPS_NotifyDeviceStatus

Func = fnDpsPrinterReq()

fnPTPCheckCommandBlock(), fnDPSGetContainerInfo(), fnDPSGetMainObjectInfo(),

Page 6: PictBridge 05 - PictBridge Library Overview

struct _Task{

FuncPointer pFunc;unsigned char ucTaskStatus;unsigned char ucTaskStep;unsigned char ucRestoreStep; // added for resend and ptp cancelstruct _Task *pCallerTask;struct _Task *pCalledTask;

};

Double Link List

TASK

Page 7: PictBridge 05 - PictBridge Library Overview

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

BLOCKor Job done, set func to NULL

TASK(cont.)

Page 8: PictBridge 05 - PictBridge Library Overview

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 );

Page 9: PictBridge 05 - PictBridge Library Overview

Queue

Queues : Queue(DSC to Printer), InfoQueue(Printer to DSC).

typedef struct _Event

{

unsigned char ucCode;

unsigned char aDataBuffer[MAX_EVENT_BUF_LEN];//89

unsigned int uiDataLength;

} Event;

typedef struct _InfoEvent

{

unsigned char ucCode;

unsigned char aDataBuffer[MAX_INFO_EVENT_BUF_LEN];//20

unsigned int uiDataLength;

} InfoEvent;

uiDataLength

ucCode

aDataBuffer[89]

Event:

uiDataLength

ucCode

aDataBuffer[20]

InfoEvent:

Page 10: PictBridge 05 - PictBridge Library Overview

Queue(cont.)

typedef struct _Queue

{

Event aEventQueue[MAX_QUEUE_LEN];//3

unsigned char ucReadPointer;

unsigned char ucReadLock;

unsigned char ucWritePointer;

unsigned char ucWriteLock;

unsigned char ucDataLength;

unsigned char ucUrgeFlag;

} Queue;

RP, WP, RL, WL, DL ,UF

Queue:

fnBeforePutEvent()

fnAfterPutEvent()

fnBeforeGetEvent()

fnAfterGetEvent()

Page 11: PictBridge 05 - PictBridge Library Overview

Queue(cont.)

extern Queue g_stInputQueue;

extern InfoQueue g_stOutputQueue;

typedef struct _InfoQueue

{

InfoEvent aEventQueue[MAX_INFO_QUEUE_LEN];//4

unsigned char ucReadPointer;

unsigned char ucReadLock;

unsigned char ucWritePointer;

unsigned char ucWriteLock;

unsigned char ucDataLength;

} InfoQueue;

RP, WP, RL, WL, DL

InfoQueue:

fnBeforePutInfoEvent()

fnAfterPutInfoEvent()

fnBeforeGetInfoEvent()

fnBeforeGetInfoEvent()

Page 12: PictBridge 05 - PictBridge Library Overview

Put event in queue:(1) fnBeforePutInfoEvent : 1.Check queue WrLock/Full? 2.Set WrLock. 3.Get WrPtr.(2) FW put event and data in queue with this WrPtr.(3) fnAfterPutInfoEvent : 1.Check queue WrLock. 2.Update WrPtr/DataLen. 3.Check WrPtr boundary. 4.Set WrLock False.

Queue(cont.)

Retrieve event in queue:(1) fnBeforeGetInfoEvent : 1.Check queue RdLock/Empty? 2.Set RdLock. 3.Get RdPtr(2) FW process event and data in queue with this RdPtr.(3) fnAfterGetInfoEvent : 1.Check queue RdLock. 2.Update RdPtr/DataLen. 3.Check RdPtr boundary. 4.Set RdLock False.

Event processing:fnAppProcessInfoEvent(): Decode Printer to DSC events and dispatch.fnProcessEvent() : Decode DSC to Printer events and dispatch.

RdPtr

WrPtr

Page 13: PictBridge 05 - PictBridge Library Overview

fnProcessEvent()

PICT_PRINT

PICT_DPOF

PICT_CONFIGPICT_CAPAPICT_ABORT

PICT_CONTINUE

fnEventAbort()

fnEventGetCapability()

fnEventConfig()

fnExtParseDPOF()fnEventPrintImage()fnEventContinue()

DSC to Printer event dispatching

PICT_PRINT_HUGEJOB_STARTPICT_PRINT_HUGEJOB_CONTENT

fnEventBeforeHugePrint()

PICT_PRINT_HUGEJOB_END

fnEventBeforeHugePrintLast()

Page 14: PictBridge 05 - PictBridge Library Overview

fnAppProcessInfoEvent()

ucCode

MSG_DETECT

MSG_OPERATIONFAIL

MSG_DEVICESTATUSMSG_PRINTSERVICE

……..

g_stMsgDevStatus.ucJobEndReason

g_stMsgDevStatus.ucErrorStatus

g_stMsgDevStatus.ucErrorReasonMinor

Actions and Message displaying

Events from printer

Printer to DSC events dispatching

g_stMsgDevStatus.ucErrorReason

Page 15: PictBridge 05 - PictBridge Library Overview

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()

Page 16: PictBridge 05 - PictBridge Library Overview

GetPartialObject

fnDpsGetFileInfo()GetObjectInfo fnGetFileInfo()

Printer

PTP DPS UI :Implement at Appilication layer

Response

Response

fnDpsGetPartialFile() fnReadFile()

Many times

File TypeFile SIZEFile ID

ulOffset : offset From start of file

uiSize : size dataucBuffer : Buffer

Offset and Data Size for each request

Event : End Normal Job End

fnFilterRecvData(): Dispatching printer request

fnFilterRecvData()(cont.)

Page 17: PictBridge 05 - PictBridge Library Overview

Event PICT_XXXand 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

Page 18: PictBridge 05 - PictBridge Library Overview

fnPictInit() : Assign DPS fnAppInitPrint() Task

PictProcess()

No printer found

fnDPSDiscovery()

Detected

DPS_ConfigurePrintService

fnAppGetCapa()

Application layer Detected Event

Printer Detection and initialzation

Page 19: PictBridge 05 - PictBridge Library Overview

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