Developer

API Reference

IBTImageArchiveResponder

Brew Release
Brew MP 1.0.2
Description
Bluetooth Basic Imaging Profile version 1.0, Auto Archive Responder 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 usage 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

   
   ===== To create an IBTImageArchiveResponder object, 
   see instruction in class header file
 
 
   ===== To register signal
   // first create the signals;
   // for example, use ISignalCBFactory_CreateSignal()
   // then register the signals:
   IBTImageArchiveResponder_OnEventNotify(piBTBIPSrv, piSignal);


   ===== Find out what imaging capabilities the responder object has:
   char* pszCapXML = NULL;
   int nLen = 0;
   IBTImageArchiveResponder_ReadDefaultCap(piResponder, pszCapXML, nLen, &nLen);
   pszCapXML = MALLOC(nLen);
   if (NULL != pszCapXML)
   {
      IBTImageArchiveResponder_ReadDefaultCap(piResponder, 
                                              pszCapXML, nLen, &nLen);

      // determine if object's imaging capability is adequate
      // in this example, let's assume application prefers 
      // to handle all requests
      pMe->cFuncToHandle = AEEBTBIP_FUNC_ALL;
      FREEIF(pszCapXML);
   }


   ===== To get an associated IOBEXAuthentication object:
   IBTImageArchiveResponder_QueryInterface(piResponder, 
                                           AEEIID_IOBEXAuthentication,
                                           (void**)&pMe->piAuth);

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

   // prepare to initiate authentication; this tells responder object
   // whether initiator should be authenticated
   char szRealm[] = "James PC";
   IOBEXAuthentication_Config(pMe->piAuth,
                              MIBENUM_CHARSET_US_ASCII,
                              (uint8*)szRealm,
                              STRLEN (szRealm),
                              bUserIDRequired,
                              FALSE,   // allow initiator only read access
                              FALSE);  // config data valid until reconfig
   IOBEXAuthentication_OnResponse(pMe->piAuth, piAuthRespSig);

   
   ===== To enable Image Archive Responder:
   FSStatVFSEx stat;
   if ((AEE_SUCCESS == ISHELL_CreateInstance(piShell, AEECLSID_FileSystem2, 
                                             &pMe->piFS)) &&
       (AEE_SUCCESS == IFileSystem2_StatVFS(pMe->piFS, pszMyRootFolder, &stat)))
   {
      IBTImageArchiveResponder_Enable(
         piResponder, 
         AEEBT_SEC_SM4_MEDIUM,
         stat.qwMaxFSSpace,
         "Auto Archive",
         AEEBTBIP_CAP_DISPLAYING,   // just an example
         AEEBTBIP_PUSH_NONE);
   }

 
   ===== To retrieve and handle events when Event signal is triggered:
   while (IBTImageArchiveResponder_GetEvent(piResponder, 
                                            &eventData) != AEE_ENOMORE)
   {
      switch (eventData.cEvent)
      {
         case AEEBTBIPR_EV_ENABLED:
         case AEEBTBIPR_EV_DISABLED:
            // check eventData.cResult to see if it was successful
            break;

         case AEEBTBIPR_EV_CONNECT_REQ:
            char* pszRootFolder = NULL;
            // eventData.bdAddr tells who the initiator is
            // prompt user "Accept conn req from ?"
            if ((FALSE != bUserAccept) &&
                (AEEBTBIP_FUNC_NONE != pMe->cFuncToHandle))
            {
               pszRootFolder = pMe->szMyRootFolderName;
            }
            IBTImageArchiveResponder_AcceptConnection(
               piResponder, 
               bUserAccept,
               pszRootFolder,
               pMe->piFS,
               1000);   // progress report every 1000 bytes of data transferred

         case AEEBTBIPR_EV_CONNECTED:
         case AEEBTBIPR_EV_DISCONNECTED:
            // check eventData.cResult to see if it was successful
            // eventData.bdAddr tells who the initiator is
            break;

         case AEEBTBIPR_EV_FUNC_REQ:
            appRequestHandler(); // see sample code below
            break;

         case AEEBTBIPR_EV_FUNC_ENDED:
            // eventData.cFunc tells what function was performed
            // check eventData.cResult to see if it was successful
            break;

         case AEEBTBIPR_EV_PROGRESS_REPORT:
            // eventData.cFunc tells what function is being performed
            // eventData.nBytes tells accumulative number of data bytes 
            // pulled from initiator
            break;

         case AEEBTBIPR_EV_EVENT_Q_OVERFLOW:
            // eventData.nBytes tells how many events got dropped
            // since previous GetEvent()
            break;
      }
   }
   ISignalCtl_Enable(piSignalCtl); // re-enable signal


   ===== sample appRequestHandler():
   AEEBTBIPImagingReq req;
   if (AEE_SUCCESS == IBTImageArchiveResponder_GetRequestData(piResponder, &req))
   {
      if (AEEBTBIP_FUNC_START_ARCHIVE == req.cRequestedFunc)
      {
         // prompt user "Accept archive request from ?"
         IBTImageArchiveResponder_AcceptArchiveRequest(
            piResponder, 
            bUserAccept,
            bLatestOnly);
      }
      else
      {
         // something's wrong with responder object
      }
   }


   ===== When done with responder object:
   IBTImageArchiveResponder_ForceDisconnect(piResponder);
   IBTImageArchiveResponder_Disable(piResponder);
   IBTImageArchiveResponder_Release(piResponder);

   
  • Follow