Developer

API Reference

IBTRemoteCameraInitiator

Brew Release
Brew MP 1.0.2
Description

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

Usage example:




   ===== To create an IBTRemoteCameraInitiator object, see instruction in 
         class header file
 
 
   ===== To register signal
   // first create the signals;
   // for example, use ISignalCBFactory_CreateSignal()
   // then register the signals:
   IBTRemoteCameraInitiator_OnEventNotify(piInitiator, piSignal);
 
 
   ===== To retrieve and handle events when Event signal is triggered:
   while (IBTRemoteCameraInitiator_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 (AEEBT_RESULT_SUCCESS != eventData.cResult)
            {
               // something went wrong
            }
            else
            {
               appHandleOpComplete(); // see sample code below
            }
            break;

         case AEEBTBIPI_EV_OP_PROGRESS:
            // eventData.cFunc tells the function associated with this op
            // eventData.nSize tells number of data bytes received so far
            break;

         case AEEBTBIPI_EV_EVENT_Q_OVERFLOW:
            // eventData.nDroppedEvents tells how many events got dropped
            // since previous GetEvent()
            break;
      }
   }
   ISignalCtl_Enable (piSignalCtl); // re-enable signal
 
 
   ===== To get an associated IOBEXAuthentication object:
   IBTRemoteCameraInitiator_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 Cellphone";
   IOBEXAuthentication_Config(pMe->piAuth,
                              MIBENUM_CHARSET_US_ASCII,
                              (uint8*)szRealm,
                              STRLEN (szRealm),
                              bUserIDRequired,
                              FALSE, // allow responder only read access
                              TRUE); // config data invalid after next operation
   IOBEXAuthentication_OnResponse(pMe->piAuth, piAuthRespSig);


   ===== To prepare the object for communication with remote camera:
   IBTRemoteCameraInitiator_Config(
      piInitiator, 
      cameraBDAddr, 
      0, // server channel unknown in this example
      AEEBT_SEC_SM4_LOW, 
      30); // maximum 30 seconds idle


   ===== To find out camera's supported functions:
   IBTRemoteCameraInitiator_GetSupportedFuncs(piInitiator);


   if (pMe->cSupportedFuncs & AEEBTBIP_FUNC_GET_MONITORING_IMAGE)
   {
      ===== To request camera for the image currently seen by the view finder:
      IBTRemoteCameraInitiator_GetView(
         piInitiator, 
         (IPort1*)piFilePort); // write image data to this file


      ===== To request camera to capture the image currently seen by 
      ===== the view finder:
      IBTRemoteCameraInitiator_TakePicture(
         piInitiator, 
         NULL); // don't store the image locally
   }


   ===== To get the properties of an image from the responder:
   if (pMe->cSupportedFuncs & AEEBTBIP_FUNC_GET_IMAGE_PROPERTIES)
   {
      IBTRemoteCameraInitiator_GetImageProperties(piInitiator, 
                                                  &pMe->handle,
                                                  (IPort1*)piPropertiesFile);
   }


   ===== To pull an image from responder:
   if (pMe->cSupportedFuncs & AEEBTBIP_FUNC_GET_IMAGE)
   {
      IBTRemoteCameraInitiator_GetImage(
         piInitiator, 
         &pMe->handle,
         szDescriptor, // specifies desired format and size
         (IPort1*)piFilePort);
   }



   ===== To pull the thumbnail version of an image from the responder:
   if (pMe->cSupportedFuncs & AEEBTBIP_FUNC_GET_LINKED_THUMBNAIL)
   {
      IBTRemoteCameraInitiator_GetThumbnail(piInitiator, 
                                            &pMe->handle,
                                            (IPort1*)piFilePort);
   }


   ===== sample appHandleOpComplete(eventData):
   switch (eventData.cFunc)
   {
      case AEEBTBIP_FUNC_GET_MONITORING_IMAGE:
      {
         // if eventData.handle is valid, this is the result of
         // IBTRemoteCameraInitiator_TakePicture();
         // the image would already be stored if valid destination
         // was given
         break;
      }
      case AEEBTBIP_FUNC_GET_IMAGE_PROPERTIES:
      {
         // eventData.nSize holds the length of the image properties string
         // which can be extracted from the file object given to
         // the call to IBTRemoteCameraInitiator_GetImageProperties()
         break;
      }
      case AEEBTBIP_FUNC_GET_IMAGE:
      {
         // eventData.nSize is the size of the image which can be 
         // extracted from the file object given to the call to 
         // IBTRemoteCameraInitiator_GetImage()
         break;
      }
      case AEEBTBIP_FUNC_GET_LINKED_THUMBNAIL:
      {
         // eventData.nSize is the size of the thumbnail which can be 
         // extracted from the file object given to the call to 
         // IBTRemoteCameraInitiator_GetThumbnail()
         break;
      }
   }


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


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


   ===== When done with Remote Camera Initiator:
   IBTRemoteCameraInitiator_Release(piInitiator);

   

  • Follow