Developer

API Reference

IvCalStore

deprecated
Items marked as deprecated have been replaced by a more powerful, alternative feature. Deprecated interfaces include a reference to the replacement interface, which should be used for all new application development. Deprecated features are still supported for backward compatibility, but should be avoided when developing new applications.
Brew Release
Brew MP 1.0.2
See Also
None
Description
END:VALARM END:VEVENT
Note: For our use case we assume we always get the return value are AEE_SUCCESS and pointers passed in or allocated are valid

   void Sample_vCalStore_Usage1(IvCalStore *pIVCalStore){

      boolean bIsLocked = FALSE;
      IvCalObject *pIvCalObject = NULL, *pIvCalObjectReturned = NULL;
      AEEVProperty nAEEVPropertyOID = 0, nAEEVPropertyOIDFromUID = 0;
      ISignal *pISignalAdd = NULL, *pISignalDelete = NULL;
      ISignal *pISignalLock = NULL, *pISignalModify = NULL;
      char *pszUID = "040000008200E00074C5B7101A82E00800000000100C47396304C8010000000000000
       00010000000430E90713A99A345BD3C8FF5EBBFC655";
      int nReqSize = 0;
      uint32 *pdwOIDs = NULL;
      
      // Once above mentioned vEvent buffer parsing is done, we get
      // pIvCalObject, this can be stored, deleted or updated from CalStore as
      // follows.
      
      nResult = IvCalStore_IsCalendarLocked(pIVCalStore,
                                            bIsLocked);
      if(TRUE == bIsLocked){
         nResult = IvCalStore_UnlockCalendar(pIVCalStore);
         // Only an app with privilege level AEEPRIVID_vCalStoreLock would be able
         // to unlock the calendar.
      }

      // Create signal for Add & IvCalStore_OnAdd function can be  used to get
      // notifications for Add events on the calendar store. Similarly for update,
      // delete.
      nResult = IvCalStore_OnAdd(pIVCalStore, pISignalAdd);
      nResult = IvCalStore_OnDelete(pIVCalStore, pISignalDelete);
      nResult = IvCalStore_OnUpdate(pIVCalStore, pISignalModify);
      nResult = IvCalStore_OnLock(pIVCalStore, pISignalLock);
   
      nResult = IvCalStore_AddObject(pIVCalStore,
                                     pIvCalObject,
                                     &nAEEVPropertyOID);
      // On return nAEEVPropertyOID holds the OID of record added
      
      nResult = IvCalStore_GetObjectOIDs(pIVCalStore, 0, NULL, 0, &nReqSize);
      // On return nReqSize holds 1 since only one vCalObject been added to vCalStore

      if(0 < nReqSize){
         pdwOIDs = (uint32*)MALLOC(nReqSize * sizeof(uint32));
         if(NULL == pdwOIDs){
            // Do error handler
         }
        
         nResult = IvCalStore_GetObjectOIDs(pIVCalStore,
                                            0,
                                            pdwOIDs,
                                            nReqSize,
                                            &nReqSize);
      }

      nResult = IvCalStore_GetObjectByOID(pIVCalStore,
                                          nAEEVPropertyOID, 
                                          &pIvCalObjectReturned);
      // On return pIvCalObjectReturned holds pointer to the returned
      // object


      // add few extra proprties to pIvCalobject & can be updated in CalStore using
      // IvCalStore_UpdateObject
      nResult = IvCalStore_UpdateObject(pIVCalStore,                                             
                                        pIvCalObject);

      nResult = IvCalStore_GetObjectOIDByUID(pIVCalStore, 
                                             pszUID,
                                             &nAEEVPropertyOIDFromUID);
      // on return nAEEVPropertyOIDFromUID holds OID corresponds to the the CalObject
      // which as UID same as pszUID.
      
      if(nAEEVPropertyOID != nAEEVPropertyOIDFromUID){
         // Do error handler
      }

      // Added CalObject can be removed from Calstore using
      nResult = IvCalStore_DeleteObjectByOID(pIVCalStore,
                                             nAEEVPropertyOIDFromUID);

      nResult = IvCalStore_GetObjectOIDs(pIVCalStore, 0, NULL, 0, &nReqSize);
      // One return nReqSize holds zero because the added vCalObject been deleted from
      // Store
      
      // Release the pIvCalObject & pIvCalObjectReturned objects
      
   }
  
Usage

If we have a simple buffer as follows,
      BEGIN:VEVENT
      ORGANIZER:MAILTO:anyone@anywhere.com
      DTSTART:20071003T063000Z
      DTEND:20071003T070000Z
      SEQUENCE:0
      UID:040000008200E00074C5B7101A82E00800000000100C47396304C8010000000000000
       00010000000430E90713A99A345BD3C8FF5EBBFC655
      DTSTAMP:20071003T090837Z
Side Effect
None
Comment
None
  • Follow