00001
00002 #ifndef PV_ENGINE_OBSERVER_MESSAGE_H_INCLUDED
00003 #define PV_ENGINE_OBSERVER_MESSAGE_H_INCLUDED
00004
00005 #ifndef OSCL_BASE_H_INCLUDED
00006 #include "oscl_base.h"
00007 #endif
00008 #ifndef OSCL_MEM_H_INCLUDED
00009 #include "oscl_mem.h"
00010 #endif
00011 #ifndef PVMF_RETURN_CODES_H_INCLUDED
00012 #include "pvmf_return_codes.h"
00013 #endif
00014 #ifndef PVMF_EVENT_HANDLING_H_INCLUDED
00015 #include "pvmf_event_handling.h"
00016 #endif
00017 #ifndef PV_ENGINE_TYPES_H_INCLUDED
00018 #include "pv_engine_types.h"
00019 #endif
00020 #ifndef PVMF_ERRORINFOMESSAGE_EXTENSION_H_INCLUDED
00021 #include "pvmf_errorinfomessage_extension.h"
00022 #endif
00023
00024
00030 class PVCmdResponse : public PVMFCmdResp
00031 {
00032 public:
00036 PVCmdResponse(PVCommandId aId,
00037 OsclAny* aContext,
00038 PVMFStatus aStatus,
00039
00040 OsclAny* aEventData = NULL, int32 aEventDataSize = 0):
00041 PVMFCmdResp(aId, aContext, aStatus, NULL, aEventData),
00042 iEventDataSize(aEventDataSize)
00043 {
00044 }
00045
00049 PVCmdResponse(PVCommandId aId,
00050 OsclAny* aContext,
00051 PVMFStatus aStatus,
00052 PVInterface* aEventExtInterface = NULL,
00053
00054 OsclAny* aEventData = NULL, int32 aEventDataSize = 0):
00055 PVMFCmdResp(aId, aContext, aStatus, aEventExtInterface, aEventData),
00056 iEventDataSize(aEventDataSize)
00057 {
00058 }
00059
00064 PVResponseType GetResponseType()const
00065 {
00066 return 0;
00067 }
00068
00072 PVCommandId GetCmdId()const
00073 {
00074 return (PVCommandId)(PVMFCmdResp::GetCmdId());
00075 }
00076
00080 OsclAny* GetContext()const
00081 {
00082 return (OsclAny*)(PVMFCmdResp::GetContext());
00083 }
00084
00088 PVMFStatus GetCmdStatus()const
00089 {
00090 return PVMFCmdResp::GetCmdStatus();
00091 }
00092
00098 OsclAny* GetResponseData()const
00099 {
00100 return PVMFCmdResp::GetEventData();
00101 }
00102
00103 int32 GetResponseDataSize()const
00104 {
00105 return iEventDataSize;
00106 }
00107
00108
00109
00110
00111
00112
00113
00114 PVMFStatus GetExtendedErrorInfoMessage(const PVUuid& auuid, PVInterface*& aface)const
00115 {
00116 PVInterface* tmpface = (PVInterface*)GetEventExtensionInterface();
00117 if (tmpface)
00118 {
00119 PVInterface* errMsg = NULL;
00120 if (tmpface->queryInterface(PVMFErrorInfoMessageInterfaceUUID, errMsg))
00121 {
00122
00123 PVMFErrorInfoMessageInterface* nextErr =
00124 OSCL_DYNAMIC_CAST(PVMFErrorInfoMessageInterface*, errMsg)->GetNextMessage();
00125 while (nextErr)
00126 {
00127 if (nextErr->queryInterface(auuid, aface))
00128 return PVMFSuccess;
00129 nextErr = nextErr->GetNextMessage();
00130 }
00131 }
00132 }
00133 return PVMFFailure;
00134 }
00135
00136 private:
00137 int32 iEventDataSize;
00138 };
00139
00140
00147 class PVAsyncInformationalEvent : public PVMFAsyncEvent
00148 {
00149 public:
00153 PVAsyncInformationalEvent(PVEventType aEventType,
00154 PVExclusivePtr aEventData = NULL,
00155 uint8* aLocalBuffer = NULL,
00156 int32 aLocalBufferSize = 0):
00157 PVMFAsyncEvent(PVMFInfoEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
00158 {
00159 }
00160
00164 PVAsyncInformationalEvent(PVEventType aEventType,
00165 OsclAny* aContext,
00166 PVInterface* aEventExtInterface,
00167 PVExclusivePtr aEventData = NULL,
00168 uint8* aLocalBuffer = NULL,
00169 int32 aLocalBufferSize = 0):
00170 PVMFAsyncEvent(PVMFInfoEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
00171 {
00172 }
00173
00177 ~PVAsyncInformationalEvent() {}
00178
00183 PVResponseType GetResponseType()const
00184 {
00185 return 0;
00186 }
00187
00191 PVEventType GetEventType()const
00192 {
00193 return PVMFAsyncEvent::GetEventType();
00194 }
00195
00199 void GetEventData(PVExclusivePtr& aPtr)const
00200 {
00201 aPtr = PVMFAsyncEvent::GetEventData();
00202 }
00203 };
00204
00211 class PVAsyncErrorEvent : public PVMFAsyncEvent
00212 {
00213 public:
00217 PVAsyncErrorEvent(PVEventType aEventType,
00218 PVExclusivePtr aEventData = NULL,
00219 uint8* aLocalBuffer = NULL,
00220 int32 aLocalBufferSize = 0):
00221 PVMFAsyncEvent(PVMFErrorEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
00222 {
00223 }
00224
00228 PVAsyncErrorEvent(PVEventType aEventType,
00229 OsclAny* aContext,
00230 PVInterface* aEventExtInterface,
00231 PVExclusivePtr aEventData = NULL,
00232 uint8* aLocalBuffer = NULL,
00233 int32 aLocalBufferSize = 0):
00234 PVMFAsyncEvent(PVMFErrorEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
00235 {
00236 }
00237
00241 ~PVAsyncErrorEvent() {}
00242
00247 PVResponseType GetResponseType()const
00248 {
00249 return 0;
00250 }
00251
00255 PVEventType GetEventType()const
00256 {
00257 return PVMFAsyncEvent::GetEventType();
00258 }
00259
00263 void GetEventData(PVExclusivePtr& aPtr)const
00264 {
00265 aPtr = PVMFAsyncEvent::GetEventData();
00266 }
00267 };
00268
00269
00270 #endif // PV_ENGINE_OBSERVER_MESSAGE_H_INCLUDED