Home | History | Annotate | Download | only in include
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 
     19 #ifndef PV_ENGINE_OBSERVER_MESSAGE_H_INCLUDED
     20 #define PV_ENGINE_OBSERVER_MESSAGE_H_INCLUDED
     21 
     22 #ifndef OSCL_BASE_H_INCLUDED
     23 #include "oscl_base.h"
     24 #endif
     25 #ifndef OSCL_MEM_H_INCLUDED
     26 #include "oscl_mem.h"
     27 #endif
     28 #ifndef PVMF_RETURN_CODES_H_INCLUDED
     29 #include "pvmf_return_codes.h"
     30 #endif
     31 #ifndef PVMF_EVENT_HANDLING_H_INCLUDED
     32 #include "pvmf_event_handling.h"
     33 #endif
     34 #ifndef PV_ENGINE_TYPES_H_INCLUDED
     35 #include "pv_engine_types.h"
     36 #endif
     37 
     38 
     39 // CLASS DECLARATION
     40 /**
     41  * PVCmdResponse Class
     42  *
     43  * PVCmdResponse class is used to pass completion status on previously issued commands
     44  **/
     45 class PVCmdResponse : public PVMFCmdResp
     46 {
     47     public:
     48         /**
     49          * Constructor for PVCmdResponse
     50          */
     51         PVCmdResponse(PVCommandId aId,
     52                       OsclAny* aContext,
     53                       PVMFStatus aStatus,
     54                       // Event data will be deprecated
     55                       OsclAny* aEventData = NULL, int32 aEventDataSize = 0):
     56                 PVMFCmdResp(aId, aContext, aStatus, NULL, aEventData),
     57                 iEventDataSize(aEventDataSize)
     58         {
     59         }
     60 
     61         /**
     62          * Constructor with event extension interface
     63          */
     64         PVCmdResponse(PVCommandId aId,
     65                       OsclAny* aContext,
     66                       PVMFStatus aStatus,
     67                       PVInterface* aEventExtInterface = NULL,
     68                       // Event data will be deprecated
     69                       OsclAny* aEventData = NULL, int32 aEventDataSize = 0):
     70                 PVMFCmdResp(aId, aContext, aStatus, aEventExtInterface, aEventData),
     71                 iEventDataSize(aEventDataSize)
     72         {
     73         }
     74 
     75         /**
     76          * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNS 0
     77          * @return Returns the type of Response we get
     78          */
     79         PVResponseType GetResponseType()const
     80         {
     81             return 0;
     82         }
     83 
     84         /**
     85          * @return Returns the unique ID associated with a command of this type.
     86          */
     87         PVCommandId GetCmdId()const
     88         {
     89             return (PVCommandId)(PVMFCmdResp::GetCmdId());
     90         }
     91 
     92         /**
     93          * @return Returns the opaque data that was passed in with the command.
     94          */
     95         OsclAny* GetContext()const
     96         {
     97             return (OsclAny*)(PVMFCmdResp::GetContext());
     98         }
     99 
    100         /**
    101          * @return Returns the completion status of the command
    102          */
    103         PVMFStatus GetCmdStatus()const
    104         {
    105             return PVMFCmdResp::GetCmdStatus();
    106         }
    107 
    108         /**
    109          * WILL BE DEPRECATED WHEN PVMFCmdResp REMOVES EVENT DATA
    110          * @return Returns additional data asociated with the command.
    111          *         This is to be interpreted based on the command issued
    112          *         and the return status
    113          */
    114         OsclAny* GetResponseData()const
    115         {
    116             return PVMFCmdResp::GetEventData();
    117         }
    118 
    119         int32 GetResponseDataSize()const
    120         {
    121             return iEventDataSize;
    122         }
    123 
    124     private:
    125         int32 iEventDataSize;
    126 };
    127 
    128 
    129 /**
    130  * PVAsyncInformationalEvent Class
    131  *
    132  * PVAsyncInformationalEvent is used to pass unsolicited informational indications to the
    133  * user. Additional information can be tagged based on the specific event
    134  **/
    135 class PVAsyncInformationalEvent : public PVMFAsyncEvent
    136 {
    137     public:
    138         /**
    139          * Constructor for PVAsyncInformationalEvent
    140          */
    141         PVAsyncInformationalEvent(PVEventType aEventType,
    142                                   PVExclusivePtr aEventData = NULL,
    143                                   uint8* aLocalBuffer = NULL,
    144                                   int32 aLocalBufferSize = 0):
    145                 PVMFAsyncEvent(PVMFInfoEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
    146         {
    147         }
    148 
    149         /**
    150          * Constructor with context and event extension interface
    151          */
    152         PVAsyncInformationalEvent(PVEventType aEventType,
    153                                   OsclAny* aContext,
    154                                   PVInterface* aEventExtInterface,
    155                                   PVExclusivePtr aEventData = NULL,
    156                                   uint8* aLocalBuffer = NULL,
    157                                   int32 aLocalBufferSize = 0):
    158                 PVMFAsyncEvent(PVMFInfoEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
    159         {
    160         }
    161 
    162         /**
    163          * Destructor
    164          */
    165         ~PVAsyncInformationalEvent() {}
    166 
    167         /**
    168          * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNING 0.
    169          * @return Returns the type of Response we get
    170          */
    171         PVResponseType GetResponseType()const
    172         {
    173             return 0;
    174         }
    175 
    176         /**
    177          * @return Returns the Event type that has been received
    178          */
    179         PVEventType GetEventType()const
    180         {
    181             return PVMFAsyncEvent::GetEventType();
    182         }
    183 
    184         /**
    185          * @return Returns the opaque data asociated with the event.
    186          */
    187         void GetEventData(PVExclusivePtr& aPtr)const
    188         {
    189             aPtr = PVMFAsyncEvent::GetEventData();
    190         }
    191 };
    192 
    193 /**
    194  * PVAsyncErrorEvent Class
    195  *
    196  * PVAsyncErrorEvent is used to pass unsolicited error indications to the
    197  * user. Additional information can be tagged based on the specific event
    198  **/
    199 class PVAsyncErrorEvent : public PVMFAsyncEvent
    200 {
    201     public:
    202         /**
    203          * Constructor for PVAsyncErrorEvent
    204          */
    205         PVAsyncErrorEvent(PVEventType aEventType,
    206                           PVExclusivePtr aEventData = NULL,
    207                           uint8* aLocalBuffer = NULL,
    208                           int32 aLocalBufferSize = 0) :
    209                 PVMFAsyncEvent(PVMFErrorEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
    210         {
    211         }
    212 
    213         /**
    214          * Constructor with context and event extension interface
    215          */
    216         PVAsyncErrorEvent(PVEventType aEventType,
    217                           OsclAny* aContext,
    218                           PVInterface* aEventExtInterface,
    219                           PVExclusivePtr aEventData = NULL,
    220                           uint8* aLocalBuffer = NULL,
    221                           int32 aLocalBufferSize = 0) :
    222                 PVMFAsyncEvent(PVMFErrorEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
    223         {
    224         }
    225 
    226         /**
    227          * Destructor
    228          */
    229         ~PVAsyncErrorEvent() {}
    230 
    231         /**
    232          * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNING 0.
    233          * @return Returns the type of Response we get
    234          */
    235         PVResponseType GetResponseType()const
    236         {
    237             return 0;
    238         }
    239 
    240         /**
    241          * @return Returns the Event type that has been received
    242          */
    243         PVEventType GetEventType()const
    244         {
    245             return PVMFAsyncEvent::GetEventType();
    246         }
    247 
    248         /**
    249          * @return Returns the opaque data asociated with the event.
    250          */
    251         void GetEventData(PVExclusivePtr& aPtr)const
    252         {
    253             aPtr = PVMFAsyncEvent::GetEventData();
    254         }
    255 };
    256 
    257 
    258 #endif // PV_ENGINE_OBSERVER_MESSAGE_H_INCLUDED
    259