123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- #ifndef __LOCALMEDIAPLAY_SERVER_G_H
- #define __LOCALMEDIAPLAY_SERVER_G_H
- #pragma once
- // This code is generated by spgen tool!
- #include "LocalMediaPlay_def_g.h"
- namespace LocalMediaPlay {
- class PlayService_ServerSessionBase : public CServerSessionBase
- {
- public:
- PlayService_ServerSessionBase()
- {
- /// override by user
- }
- virtual ~PlayService_ServerSessionBase()
- {
- /// override by user
- }
- virtual bool IsExclusive() { return false; }
- virtual bool IsSessionOverlap() { return true; }
- virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
- {
- ErrorCodeEnum Error = Error_Succeed;
- switch (dwMessageID) {
- case PlayService_Method_StartPlayVideo:
- if (dwSignature == PlayService_MethodSignature_StartPlayVideo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StartPlayAudio:
- if (dwSignature == PlayService_MethodSignature_StartPlayAudio) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StartPlayImage:
- if (dwSignature == PlayService_MethodSignature_StartPlayImage) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayVideo:
- if (dwSignature == PlayService_MethodSignature_StopPlayVideo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayAudio:
- if (dwSignature == PlayService_MethodSignature_StopPlayAudio) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayImage:
- if (dwSignature == PlayService_MethodSignature_StopPlayImage) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_GetLocalVideoVolume:
- if (dwSignature == PlayService_MethodSignature_GetLocalVideoVolume) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_SetLocalVideoVolume:
- if (dwSignature == PlayService_MethodSignature_SetLocalVideoVolume) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_GetLocalAudioVolume:
- if (dwSignature == PlayService_MethodSignature_GetLocalAudioVolume) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_SetLocalAudioVolume:
- if (dwSignature == PlayService_MethodSignature_SetLocalAudioVolume) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StartPlayNotice:
- if (dwSignature == PlayService_MethodSignature_StartPlayNotice) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayNotice:
- if (dwSignature == PlayService_MethodSignature_StopPlayNotice) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayAllMedias:
- if (dwSignature == PlayService_MethodSignature_StopPlayAllMedias) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
- {
- ErrorCodeEnum Error = Error_Succeed;
- switch (dwMessageID) {
- case PlayService_Method_StartPlayVideo:
- if (dwSignature != PlayService_MethodSignature_StartPlayVideo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StartPlayAudio:
- if (dwSignature != PlayService_MethodSignature_StartPlayAudio) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StartPlayImage:
- if (dwSignature != PlayService_MethodSignature_StartPlayImage) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayVideo:
- if (dwSignature != PlayService_MethodSignature_StopPlayVideo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayAudio:
- if (dwSignature != PlayService_MethodSignature_StopPlayAudio) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayImage:
- if (dwSignature != PlayService_MethodSignature_StopPlayImage) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_GetLocalVideoVolume:
- if (dwSignature != PlayService_MethodSignature_GetLocalVideoVolume) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_SetLocalVideoVolume:
- if (dwSignature != PlayService_MethodSignature_SetLocalVideoVolume) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_GetLocalAudioVolume:
- if (dwSignature != PlayService_MethodSignature_GetLocalAudioVolume) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_SetLocalAudioVolume:
- if (dwSignature != PlayService_MethodSignature_SetLocalAudioVolume) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StartPlayNotice:
- if (dwSignature != PlayService_MethodSignature_StartPlayNotice) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayNotice:
- if (dwSignature != PlayService_MethodSignature_StopPlayNotice) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PlayService_Method_StopPlayAllMedias:
- if (dwSignature != PlayService_MethodSignature_StopPlayAllMedias) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- virtual void Handle_StartPlayVideo(SpReqAnsContext<PlayService_StartPlayVideo_Req, PlayService_StartPlayVideo_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_StartPlayAudio(SpReqAnsContext<PlayService_StartPlayAudio_Req, PlayService_StartPlayAudio_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_StartPlayImage(SpReqAnsContext<PlayService_StartPlayImage_Req, PlayService_StartPlayImage_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_StopPlayVideo(SpReqAnsContext<PlayService_StopPlayVideo_Req, PlayService_StopPlayVideo_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_StopPlayAudio(SpReqAnsContext<PlayService_StopPlayAudio_Req, PlayService_StopPlayAudio_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_StopPlayImage(SpReqAnsContext<PlayService_StopPlayImage_Req, PlayService_StopPlayImage_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetLocalVideoVolume(SpReqAnsContext<PlayService_GetLocalVideoVolume_Req, PlayService_GetLocalVideoVolume_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_SetLocalVideoVolume(SpReqAnsContext<PlayService_SetLocalVideoVolume_Req, PlayService_SetLocalVideoVolume_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetLocalAudioVolume(SpReqAnsContext<PlayService_GetLocalAudioVolume_Req, PlayService_GetLocalAudioVolume_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_SetLocalAudioVolume(SpReqAnsContext<PlayService_SetLocalAudioVolume_Req, PlayService_SetLocalAudioVolume_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_StartPlayNotice(SpReqAnsContext<PlayService_StartPlayNotice_Req, PlayService_StartPlayNotice_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_StopPlayNotice(SpReqAnsContext<PlayService_StopPlayNotice_Req, PlayService_StopPlayNotice_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_StopPlayAllMedias(SpReqAnsContext<PlayService_StopPlayAllMedias_Req, PlayService_StopPlayAllMedias_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
- {
- CAutoBuffer Buf;
- DWORD dwMessageID;
- DWORD dwMessageSignature;
- ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
- if (Error == Error_Succeed) {
- #ifdef DEBUG
- assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
- #else
- if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
- pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
- return;
- }
- #endif
- switch (dwMessageID) {
- case PlayService_Method_StartPlayVideo:
- {
- SpReqAnsContext<PlayService_StartPlayVideo_Req,PlayService_StartPlayVideo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StartPlayVideo_Req,PlayService_StartPlayVideo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StartPlayVideo(ctx);
- }
- break;
- case PlayService_Method_StartPlayAudio:
- {
- SpReqAnsContext<PlayService_StartPlayAudio_Req,PlayService_StartPlayAudio_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StartPlayAudio_Req,PlayService_StartPlayAudio_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StartPlayAudio(ctx);
- }
- break;
- case PlayService_Method_StartPlayImage:
- {
- SpReqAnsContext<PlayService_StartPlayImage_Req,PlayService_StartPlayImage_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StartPlayImage_Req,PlayService_StartPlayImage_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StartPlayImage(ctx);
- }
- break;
- case PlayService_Method_StopPlayVideo:
- {
- SpReqAnsContext<PlayService_StopPlayVideo_Req,PlayService_StopPlayVideo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StopPlayVideo_Req,PlayService_StopPlayVideo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StopPlayVideo(ctx);
- }
- break;
- case PlayService_Method_StopPlayAudio:
- {
- SpReqAnsContext<PlayService_StopPlayAudio_Req,PlayService_StopPlayAudio_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StopPlayAudio_Req,PlayService_StopPlayAudio_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StopPlayAudio(ctx);
- }
- break;
- case PlayService_Method_StopPlayImage:
- {
- SpReqAnsContext<PlayService_StopPlayImage_Req,PlayService_StopPlayImage_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StopPlayImage_Req,PlayService_StopPlayImage_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StopPlayImage(ctx);
- }
- break;
- case PlayService_Method_GetLocalVideoVolume:
- {
- SpReqAnsContext<PlayService_GetLocalVideoVolume_Req,PlayService_GetLocalVideoVolume_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_GetLocalVideoVolume_Req,PlayService_GetLocalVideoVolume_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetLocalVideoVolume(ctx);
- }
- break;
- case PlayService_Method_SetLocalVideoVolume:
- {
- SpReqAnsContext<PlayService_SetLocalVideoVolume_Req,PlayService_SetLocalVideoVolume_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_SetLocalVideoVolume_Req,PlayService_SetLocalVideoVolume_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_SetLocalVideoVolume(ctx);
- }
- break;
- case PlayService_Method_GetLocalAudioVolume:
- {
- SpReqAnsContext<PlayService_GetLocalAudioVolume_Req,PlayService_GetLocalAudioVolume_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_GetLocalAudioVolume_Req,PlayService_GetLocalAudioVolume_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetLocalAudioVolume(ctx);
- }
- break;
- case PlayService_Method_SetLocalAudioVolume:
- {
- SpReqAnsContext<PlayService_SetLocalAudioVolume_Req,PlayService_SetLocalAudioVolume_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_SetLocalAudioVolume_Req,PlayService_SetLocalAudioVolume_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_SetLocalAudioVolume(ctx);
- }
- break;
- case PlayService_Method_StartPlayNotice:
- {
- SpReqAnsContext<PlayService_StartPlayNotice_Req,PlayService_StartPlayNotice_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StartPlayNotice_Req,PlayService_StartPlayNotice_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StartPlayNotice(ctx);
- }
- break;
- case PlayService_Method_StopPlayNotice:
- {
- SpReqAnsContext<PlayService_StopPlayNotice_Req,PlayService_StopPlayNotice_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StopPlayNotice_Req,PlayService_StopPlayNotice_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StopPlayNotice(ctx);
- }
- break;
- case PlayService_Method_StopPlayAllMedias:
- {
- SpReqAnsContext<PlayService_StopPlayAllMedias_Req,PlayService_StopPlayAllMedias_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PlayService_StopPlayAllMedias_Req,PlayService_StopPlayAllMedias_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_StopPlayAllMedias(ctx);
- }
- break;
- default:
- assert(0);
- break;
- }
-
- } else {
- pTransactionContext->SendAnswer(Error);
- }
- }
- };
- ///////////////////////////
- } // namespace LocalMediaPlay
- #endif // __LOCALMEDIAPLAY_SERVER_G_H
|