Developer

API Reference

IBTImageArchiveInitiator

Brew Release
Brew MP 1.0.2
Description

Bluetooth Basic Imaging Profile version 1.0, Image Archive Initiator role
This interface allows application to make use of the Automatic Archive feature defined by Bluetooth BIP specifications. This feature enables an Imaging Initiator to request that an Imaging Responder with sufficient storage capacity retrieve all or part of its stored images. The typical use case is that of a digital still camera as Image Initiator that requests a PC as Image Responder to drain its recently captured images.
For more information, refer to http://bluetooth.com/Bluetooth/Technology/Works/BIP.htm
Usage

Usage example:



   ===== To create an IBTImageArchiveInitiator object, see instruction in 
         class header file
 
 
   ===== To register signal
   // first create the signals;
   // for example, use ISignalCBFactory_CreateSignal()
   // then register the signals:
   IBTImageArchiveInitiator_OnEventNotify(piInitiator, piSignal);
 
 
   ===== To retrieve and handle events when Event signal is triggered:
   while (IBTImageArchiveInitiator_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_PROGRESS:
            if (AEEBTBIP_FUNC_START_ARCHIVE == eventData.cFunc)
            {
               // eventData.nSize tells how many bytes of data
               // already pulled by responder
               IBTImageArchiveInitiator_GetCurrentFile(
                  piInitiator,
                  szFileName,
                  sizeof(szFileName),
                  &nLenReq);
            }
            else
            {
               // handle progress for other function, if any
            }
            break;

         case AEEBTBIPI_EV_OP_COMPLETED:
            if (AEEBT_RESULT_SUCCESS != eventData.cResult)
            {
               // something went wrong
            }
            else if (AEEBTBIP_FUNC_START_ARCHIVE == eventData.cFunc)
            {
               // eventData.nCount holds the number of images archived
            }
            break;

         case AEEBTBIPI_EV_EVENT_Q_OVERFLOW:
            // eventData.nSize tells how many events got dropped
            // since previous GetEvent()
            break;
      }
   }
   ISignalCtl_Enable(piSignalCtl); // re-enable signal
 
 
   ===== To get an associated IOBEXAuthentication object:
   IBTImageArchiveInitiator_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,
                              TRUE, // allow responder full access
                              TRUE); // config data invalid after next operation
   IOBEXAuthentication_OnResponse(pMe->piAuth, piAuthRespSig);


   ===== To prepare the object for communication with archive responder:
   IBTImageArchiveInitiator_Config(
      piInitiator, 
      archiverBDAddr, 
      0,  // server channel unknown in this example
      AEEBT_SEC_SM4_MEDIUM, 
      0); // disconnect when archiving completes


   ===== To find out archive responder's supported functions:
   IBTImageArchiveInitiator_GetSupportedFuncs(piInitiator);


   ===== To request archive responder to start archiving:
   if ((pMe->cSupportedFuncs & AEEBTBIP_FUNC_START_ARCHIVE) &&
       (SUCCESS == ISHELL_CreateInstance(piShell, AEECLSID_FileSystem2, 
                                         &pMe->piFS)))
   {
      IBTImageArchiveInitiator_StartArchive(
         piInitiator, 
         "fs:/myPics",  // folder of images to archive
         pMe->piFS,     // file system object
         1000,          // progress report every 1000 bytes
         TRUE);         // allow archived files to be deleted
   }


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


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


   ===== When done with Image Archive Initiator:
   IBTImageArchiveInitiator_Release(piInitiator);

   

  • Follow