Developer

API Reference

IBTImagePrintInitiator

Brew Release
Brew MP 1.0.2
Description

Bluetooth Basic Imaging Profile version 1.0, Image Print Initiator role
This interface allows application to make use of the Advanced Image Printing feature defined by Bluetooth BIP specifications. The typical use case is a digital still camera as Image Print initiator and a printer as Image Print responder.
For more information, refer to http://bluetooth.com/Bluetooth/Technology/Works/BIP.htm
Usage

Usage example:



   ===== To create an IBTImagePrintInitiator object, see instruction in 
         class header file
 
 
   ===== To register signal
   // first create the signals;
   // for example, use ISignalCBFactory_CreateSignal()
   // then register the signals:
   IBTImagePrintInitiator_OnEventNotify(piInitiator, piSignal);
 
 
   ===== To retrieve and handle events when Event signal is triggered:
   while (IBTImagePrintInitiator_GetEvent(piInitiator, 
                                          &eventData) != AEE_ENOMORE)
   {
      IFilePort1* piTempFile;

      switch (eventData.cEvent)
      {
         case AEEBTBIPI_EV_CONNECTED:
         case AEEBTBIPI_EV_DISCONNECTED:
            break;

         case AEEBTBIPI_EV_GET_FUNCS_DONE:
            if (AEEBT_RESULT_SUCCESS != eventData.cResult)
            {
               pMe->cSupportedFuncs = eventData.cFunc;
            }
            break;

         case AEEBTBIPI_EV_OP_INITIATED:
            // eventData.cFunc is the function associated with 
            // the operation that just started
            break;

         case AEEBTBIPI_EV_OP_COMPLETED:
            if (AEEBTBIP_FUNC_GET_CAPABILITIES == eventData.cFunc)
            {
               // eventData.nSize holds the length of the capabilities string
               // which can be extracted from the file object given to
               // the call to IBTRemoteDisplayInitiator_GetCapabilities()
            }
            else if (AEEBTBIP_FUNC_START_PRINT == eventData.cFunc)
            {
               // check eventData.cResult to see if it was successful
            }
            break;

         case AEEBTBIPI_EV_OP_PROGRESS:
            if (AEEBTBIP_FUNC_START_PRINT == eventData.cFunc)
            {
               IBTImagePrintInitiator_GetCurrentFile(piInitiator,
                                                     szFileName,
                                                     sizeof(szFileName),
                                                     &nLenReq);
            }
            else
            {
               // something's wrong as progress reported is
               // only expected for START_PRINT
            }
            break;

         case AEEBTBIPI_EV_EVENT_Q_OVERFLOW:
            // eventData.nCount tells how many events got dropped
            // since previous GetEvent()
            break;
      }
   }
   ISignalCtl_Enable(piSignalCtl); // re-enable signal
 
 
   ===== To get an associated IOBEXAuthentication object:
   IBTImagePrintInitiator_QueryInterface(piInitiator, 
                                         AEEIID_IOBEXAuthentication,
                                         (void**)&pMe->piAuth);

   // prepare for authentication initiated by responder
   IOBEXAuthentication_OnRequest(pMe->piAuth, piAuthReqSig);

   // prepare to initiate authentication; this tells initiator object
   // to authenticate responder prior to initiating the next operation
   char szRealm[] = "James Camera";
   IOBEXAuthentication_Config(pMe->piAuth,
                              MIBENUM_CHARSET_US_ASCII,
                              (uint8*)szRealm,
                              STRLEN (szRealm),
                              bUserIDRequired,
                              FALSE, // allow printer only read access
                              TRUE); // config data invalid after next operation
   IOBEXAuthentication_OnResponse(pMe->piAuth, piAuthRespSig);


   ===== To prepare the object for communication with printer:
   IBTImagePrintInitiator_Config(
      piInitiator, 
      printerBDAddr, 
      0, // server channel unknown in this example
      AEEBT_SEC_SM4_MEDIUM, 
      0); // disconnect when print job completes


   ===== To find out printer's supported functions:
   IBTImagePrintInitiator_GetSupportedFuncs(piInitiator);


   ===== To find out printer's imaging capability:
   if (pMe->cSupportedFuncs & AEEBTBIP_FUNC_GET_CAPABILITIES)
   {
      IBTImagePrintInitiator_GetCapabilities(piInitiator, (IPort1*)piCapFile);
   }


   ===== To start a print job on the printer:
   if ((pMe->cSupportedFuncs & AEEBTBIP_FUNC_START_PRINT) &&
       (SUCCESS == ISHELL_CreateInstance(piShell, AEECLSID_FileSystem2, 
                                         &pMe->piFS)))
   {
      IBTImagePrintInitiator_StartPrint(
         piInitiator, 
         "fs:/temp/printjob.txt", // contents must conform to DPOF
         pszImageFolder,          // where images reside
         pMe->piFS,               // file system object
         1000);                   // progress report every 1000 bytes
   }


   ===== To cancel the current operation:
   IBTImagePrintInitiator_Cancel(piInitiator);


   ===== To disconnect before the idle timer expires:
   IBTImagePrintInitiator_Disconnect(piInitiator);


   ===== When done with Image Print Initiator:
   IBTImagePrintInitiator_Release(piInitiator);

   
  • Follow