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 if (tmpface->queryInterface(auuid, aface))
00120 return PVMFSuccess;
00121 PVInterface* errMsg = NULL;
00122 if (tmpface->queryInterface(PVMFErrorInfoMessageInterfaceUUID, errMsg))
00123 {
00124
00125 PVMFErrorInfoMessageInterface* nextErr =
00126 OSCL_DYNAMIC_CAST(PVMFErrorInfoMessageInterface*, errMsg)->GetNextMessage();
00127 while (nextErr)
00128 {
00129 if (nextErr->queryInterface(auuid, aface))
00130 return PVMFSuccess;
00131 nextErr = nextErr->GetNextMessage();
00132 }
00133 }
00134 }
00135 return PVMFFailure;
00136 }
00137
00138 private:
00139 int32 iEventDataSize;
00140 };
00141
00142
00149 class PVAsyncInformationalEvent : public PVMFAsyncEvent
00150 {
00151 public:
00155 PVAsyncInformationalEvent(PVEventType aEventType,
00156 PVExclusivePtr aEventData = NULL,
00157 uint8* aLocalBuffer = NULL,
00158 int32 aLocalBufferSize = 0):
00159 PVMFAsyncEvent(PVMFInfoEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
00160 {
00161 }
00162
00166 PVAsyncInformationalEvent(PVEventType aEventType,
00167 OsclAny* aContext,
00168 PVInterface* aEventExtInterface,
00169 PVExclusivePtr aEventData = NULL,
00170 uint8* aLocalBuffer = NULL,
00171 int32 aLocalBufferSize = 0):
00172 PVMFAsyncEvent(PVMFInfoEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
00173 {
00174 }
00175
00179 ~PVAsyncInformationalEvent() {}
00180
00185 PVResponseType GetResponseType()const
00186 {
00187 return 0;
00188 }
00189
00193 PVEventType GetEventType()const
00194 {
00195 return PVMFAsyncEvent::GetEventType();
00196 }
00197
00201 void GetEventData(PVExclusivePtr& aPtr)const
00202 {
00203 aPtr = PVMFAsyncEvent::GetEventData();
00204 }
00205 };
00206
00213 class PVAsyncErrorEvent : public PVMFAsyncEvent
00214 {
00215 public:
00219 PVAsyncErrorEvent(PVEventType aEventType,
00220 PVExclusivePtr aEventData = NULL,
00221 uint8* aLocalBuffer = NULL,
00222 int32 aLocalBufferSize = 0):
00223 PVMFAsyncEvent(PVMFErrorEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
00224 {
00225 }
00226
00230 PVAsyncErrorEvent(PVEventType aEventType,
00231 OsclAny* aContext,
00232 PVInterface* aEventExtInterface,
00233 PVExclusivePtr aEventData = NULL,
00234 uint8* aLocalBuffer = NULL,
00235 int32 aLocalBufferSize = 0):
00236 PVMFAsyncEvent(PVMFErrorEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
00237 {
00238 }
00239
00243 ~PVAsyncErrorEvent() {}
00244
00249 PVResponseType GetResponseType()const
00250 {
00251 return 0;
00252 }
00253
00257 PVEventType GetEventType()const
00258 {
00259 return PVMFAsyncEvent::GetEventType();
00260 }
00261
00265 void GetEventData(PVExclusivePtr& aPtr)const
00266 {
00267 aPtr = PVMFAsyncEvent::GetEventData();
00268 }
00269 };
00270
00271
00272 #endif // PV_ENGINE_OBSERVER_MESSAGE_H_INCLUDED