Developer

API Reference

IBTBPPRefObjectServer

Brew Release
Brew MP 1.0.2
See Also
Description
This interface enables the Sender of the Basic Printing Profile (BPP) to respond to referenced object requests from the Printer.
Usage

Usage example:


   

===== To create an IBTBPPRefObjectServer object

// First create the IBT object. See .bid file for IBT // Obtain IBTBPPSender object from IBT object.See .bid file for IBTBPPSender. IBTBPPSender_CreateSenderServer(piBTBPPSender, AEECLSID_BTBPPRefObjectServer, &piServer)

===== To register signal

// first create the signal; // for example, use ISignalCBFactory_CreateSignal() // then register the signal: IBTBPPRefObjectServer_OnEventNotify (piServer, piSignal);

===== To Enable the server

IBTBPPRefObjectServer_Enable(piServer, AEEBT_SEC_SM4_MEDIUM, "RefObjectServer", TRUE);

===== To Accept Connection requests

IBTBPPRefObjectServer_ConnectResponse(piServer, TRUE);

===== To retrieve and respond to referenced object requests using a file

// on receiving AEEBTBPPSRV_EV_REF_OBJ_REQ, open the // file that was requested by the printer AEEBTBPPRefObjRequest piRequest; IFilePort1* piTempFile = NULL; int nameLenReq; IBTBPPRefObjectServer_GetRefObjRequest(piServer ,&pRequest, pName, nameLen, &nameLenReq); IFileSystem1_Open (piFileSys, AEECLSID_FilePort1, // supports SEEK pName, // file requested by printer,obtained from piRequest FS_CAP_RDONLY, (void**) &piTempFile); IBTBPPRefObjectServer_RefObjResponse(piServer, (IPort1*)piTempFile, pName); // file requested by printer // the implementation mantains a reference to the file object IFilePort1_Release(piTempFile);

===== E.g. 1 To retrieve and respond to referenced object requests with a buffer.

// on receiving AEEBTBPPSRV_EV_REF_OBJ_REQ AEEBTBPPRefObjRequest request; IBTBPPRefObjectServer_GetRefObjRequest(piServer ,&request, pName, nameLen, &nameLenReq); // printer has requested for 100 bytes (request.nCount) from offset 10 (request.uOffset). // from the actual source,get 100 bytes from offset 10 into buff. // now send to the printer IBTBPPRefObjectServer_RefObjResponseStream(piServer, pName, // name of object requested by printer buff, 100, TRUE); // final

===== E.g. 2 To retrieve and respond to referenced object requests with a buffer

// on receiving AEEBTBPPSRV_EV_REF_OBJ_REQ, AEEBTBPPRefObjRequest request; IBTBPPRefObjectServer_GetRefObjRequest(piServer ,&request, pName, nameLen, &nameLenReq); // printer has requested for remaining bytes (request.nCount = -1) from offset 0 // get first 100 bytes into buff. // now send to the printer IBTBPPRefObjectServer_RefObjResponseStream(piServer, pName, // name of object requested by printer buff, 100, FALSE); // not final as there is more data // wait for AEEBTBPPSRV_EV_REF_OBJ_CONTINUE . . . . // received AEEBTBPPSRV_EV_REF_OBJ_CONTINUE, send the next chunk of data IBTBPPRefObjectServer_RefObjResponseStream(piServer, pName, buff, // contains remaining data. 90, TRUE); // final as there is no more data

===== To retrieve and handle events when Event signal is triggered:

while (IBTBPPRefObjectServer_GetEvent (piServer, &eventData) != AEE_ENOMORE) { switch (eventData.cEvent) { case AEEBTBPP_EV_ENABLED: break; case AEEBTBPP_EV_DISABLED: break; . . . default: break; } } ISignalCtl_Enable (piSignalCtl); // re-enable signal

===== To Disable the server

IBTBPPRefObjectServer_Disable(piServer);

  • Follow