Main Page Class Hierarchy Data Structures File List Data Fields Globals

# pv_common_types.h

Go to the documentation of this file.

    00001 #ifndef PV_COMMON_TYPES_H_INCLUDED
    00002 #define PV_COMMON_TYPES_H_INCLUDED
    00003
    00004 //  INCLUDES
    00005 #ifndef OSCL_TYPES_H_INCLUDED
    00006 #include "oscl_types.h"
    00007 #endif
    00008
    00009 #ifndef OSCL_MEM_H_INCLUDED
    00010 #include "oscl_mem.h"
    00011 #endif
    00012
    00013 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED
    00014 #include "oscl_string_containers.h"
    00015 #endif
    00016
    00017 // CONSTANTS
    00018
    00019 // MACROS
    00020 #define PV_COMMON_ASYNC_EVENT_LOCAL_BUF_SIZE 8
    00021
    00022 // DATA TYPES
    00023 /* Temporary definitions */
    00024 typedef int32 TPVCmnCommandType;
    00025 typedef int32 TPVCmnCommandId;
    00026 typedef int32 TPVCmnCommandStatus;
    00027 typedef int32 TPVCmnEventType;
    00028 typedef void* TPVCmnExclusivePtr;
    00029 typedef void* TPVCmnInterfacePtr;
    00030 typedef int32 TPVCmnResponseType;
    00031 typedef int32 TPVCmnSDKModuleInfo;
    00032 typedef uint8* TPVCmnMIMEType;
    00033 typedef uint32 TPVCmnUUID;
    00034 typedef int32 CPVCmnVideoCaps;
    00035 typedef int32 CPVCmnVideoPrefs;
    00036 typedef int32 CPVCmnAudioCaps;
    00037 typedef int32 CPVCmnAudioPrefs;
    00038
    00039 struct TPVCmnSDKInfo
    00040 {
    00041     TPVCmnSDKInfo()
    00042     {
    00043         iDate = 0x00000000;
    00044     }
    00045     TPVCmnSDKInfo& operator=(const TPVCmnSDKInfo& aSDKInfo)
    00046     {
    00047         iLabel = aSDKInfo.iLabel;
    00048         iDate = aSDKInfo.iDate;
    00049         return *this;
    00050     }
    00051
    00052     OSCL_StackString<80> iLabel;
    00053     uint32 iDate; // 0xyyyymmdd
    00054 };
    00055
    00056 // FUNCTION PROTOTYPES
    00057
    00058
    00059 // FORWARD DECLARATIONS
    00060
    00061
    00062 // CLASS DECLARATION
    00073 class CPVCmnInterfaceObserverMessage
    00074 {
    00075     public:
    00076         CPVCmnInterfaceObserverMessage() {}
    00077         CPVCmnInterfaceObserverMessage(TPVCmnResponseType aResponseType): iResponseType(aResponseType) {}
    00078
    00079         virtual ~CPVCmnInterfaceObserverMessage() {};
    00080         TPVCmnResponseType GetResponseType() const
    00081         {
    00082             return iResponseType;
    00083         }
    00084         virtual int GetPriority()const
    00085         {
    00086             return iPriority;
    00087         }
    00088         TPVCmnResponseType iResponseType;
    00089         int iPriority;
    00090         int iOrder;
    00091 };
    00092
    00093 class CPVCmnInterfaceObserverMessageCompare
    00094 {
    00095     public:
    00096         int compare(CPVCmnInterfaceObserverMessage *a, CPVCmnInterfaceObserverMessage *b) const
    00097         {
    00098             if (a->GetPriority() < b->GetPriority())
    00099                 return 1;//prioritized
    00100             else
    00101                 return (a->iOrder > b->iOrder);//fifo
    00102         }
    00103 };
    00104
    00111 class CPVCmnInterfaceCmdMessage;
    00112 class CPVCmnCmdResp : public CPVCmnInterfaceObserverMessage
    00113 {
    00114     public:
    00118         CPVCmnCmdResp(TPVCmnCommandType aType, TPVCmnCommandId aId, void* aContext, TPVCmnCommandStatus aStatus, void* aResponseData = NULL, int aResponseDataSize = 0, TPVCmnResponseType aResponseType = NULL):
    00119                 CPVCmnInterfaceObserverMessage(aResponseType), iCmdType(aType), iCmdId(aId), iContext(aContext), iStatus(aStatus), iResponseData(aResponseData), iResponseDataSize(aResponseDataSize) {}
    00120
    00124         TPVCmnCommandType GetCmdType()const
    00125         {
    00126             return iCmdType;
    00127         }
    00128
    00132         TPVCmnCommandId GetCmdId()const
    00133         {
    00134             return iCmdId;
    00135         }
    00136
    00140         void* GetContext()const
    00141         {
    00142             return iContext;
    00143         }
    00144
    00148         TPVCmnCommandStatus GetCmdStatus()const
    00149         {
    00150             return iStatus;
    00151         }
    00152
    00157         void* GetResponseData()const
    00158         {
    00159             return iResponseData;
    00160         }
    00161         int GetResponseDataSize()const
    00162         {
    00163             return iResponseDataSize;
    00164         }
    00165
    00166     protected:
    00167         TPVCmnCommandType iCmdType;
    00168         TPVCmnCommandId iCmdId;
    00169         void* iContext;
    00170         TPVCmnCommandStatus iStatus;
    00171         void* iResponseData;
    00172         int iResponseDataSize;
    00173 };
    00174
    00175
    00183 class CPVCmnAsyncEvent : public CPVCmnInterfaceObserverMessage
    00184 {
    00185     public:
    00186         CPVCmnAsyncEvent(TPVCmnEventType aEventType, TPVCmnExclusivePtr aExclusivePtr, const uint8 *aLocalBuffer = NULL, uint32 aLocalBufSize = 0, TPVCmnResponseType aResponseType = NULL) :
    00187                 CPVCmnInterfaceObserverMessage(aResponseType),  iEventType(aEventType), iExclusivePtr(aExclusivePtr)
    00188         {
    00189             if (aLocalBuffer)
    00190             {
    00191                 if (aLocalBufSize > PV_COMMON_ASYNC_EVENT_LOCAL_BUF_SIZE)
    00192                 {
    00193                     oscl_memcpy(iLocalBuffer, aLocalBuffer, PV_COMMON_ASYNC_EVENT_LOCAL_BUF_SIZE);
    00194                 }
    00195                 else
    00196                 {
    00197                     oscl_memcpy(iLocalBuffer, aLocalBuffer, aLocalBufSize);
    00198                 }
    00199             }
    00200         }
    00201
    00202         ~CPVCmnAsyncEvent() {}
    00203
    00207         TPVCmnEventType GetEventType()const
    00208         {
    00209             return iEventType;
    00210         }
    00211
    00215         void GetEventData(TPVCmnExclusivePtr& aPtr)const
    00216         {
    00217             aPtr = iExclusivePtr;
    00218         }
    00219
    00223         uint8 * GetLocalBuffer()
    00224         {
    00225             return &iLocalBuffer[0];
    00226         }
    00227
    00228     protected:
    00229         TPVCmnEventType iEventType;
    00230         TPVCmnExclusivePtr iExclusivePtr;
    00231         uint8 iLocalBuffer[PV_COMMON_ASYNC_EVENT_LOCAL_BUF_SIZE];
    00232 };
    00233
    00234 typedef CPVCmnAsyncEvent CPVCmnAsyncInfoEvent;
    00235
    00236 typedef CPVCmnAsyncEvent CPVCmnAsyncErrorEvent;
    00237
    00238 class MPVCmnErrorEventObserver
    00239 {
    00240     public:
    00241         virtual ~MPVCmnErrorEventObserver() {}
    00242         virtual void HandleErrorEventL(const CPVCmnAsyncErrorEvent& aEvent) = 0;
    00243 };
    00244
    00245 class MPVCmnInfoEventObserver
    00246 {
    00247     public:
    00248         virtual ~MPVCmnInfoEventObserver() {}
    00249         virtual void HandleInformationalEventL(const CPVCmnAsyncInfoEvent& aEvent) = 0;
    00250 };
    00251
    00252 class MPVCmnCmdStatusObserver
    00253 {
    00254     public:
    00255         virtual ~MPVCmnCmdStatusObserver() {}
    00256         virtual void CommandCompletedL(const CPVCmnCmdResp& aResponse) = 0;
    00257 };
    00258
    00259 #endif //
    00260
    00261