123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- #ifndef __CARDSWIPER_SERVER_G_H
- #define __CARDSWIPER_SERVER_G_H
- #pragma once
- // This code is generated by spgen tool!
- #include "CardSwiper_def_g.h"
- namespace CardSwiper {
- class CardSwiperService_ServerSessionBase : public CServerSessionBase
- {
- public:
- CardSwiperService_ServerSessionBase() { }
- virtual ~CardSwiperService_ServerSessionBase() { }
- 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 CardSwiperService_Method_CancelInsert:
- if (dwSignature == CardSwiperService_MethodSignature_CancelInsert) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_Read:
- if (dwSignature == CardSwiperService_MethodSignature_Read) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_PreOnline:
- if (dwSignature == CardSwiperService_MethodSignature_PreOnline) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_PostOnline:
- if (dwSignature == CardSwiperService_MethodSignature_PostOnline) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_Exit:
- if (dwSignature == CardSwiperService_MethodSignature_Exit) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_Eject:
- if (dwSignature == CardSwiperService_MethodSignature_Eject) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_QueryCardInfo:
- if (dwSignature == CardSwiperService_MethodSignature_QueryCardInfo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_MagTransferInit:
- if (dwSignature == CardSwiperService_MethodSignature_MagTransferInit) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_QueryConnInfo:
- if (dwSignature == CardSwiperService_MethodSignature_QueryConnInfo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_InsertWaitMore:
- if (dwSignature == CardSwiperService_MethodSignature_InsertWaitMore) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_QueryFWBList:
- if (dwSignature == CardSwiperService_MethodSignature_QueryFWBList) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_BindFWB:
- if (dwSignature == CardSwiperService_MethodSignature_BindFWB) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_GetDevInfo:
- if (dwSignature == CardSwiperService_MethodSignature_GetDevInfo) {
- 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 CardSwiperService_Method_CancelInsert:
- if (dwSignature != CardSwiperService_MethodSignature_CancelInsert) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_Read:
- if (dwSignature != CardSwiperService_MethodSignature_Read) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_PreOnline:
- if (dwSignature != CardSwiperService_MethodSignature_PreOnline) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_PostOnline:
- if (dwSignature != CardSwiperService_MethodSignature_PostOnline) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_Exit:
- if (dwSignature != CardSwiperService_MethodSignature_Exit) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_Eject:
- if (dwSignature != CardSwiperService_MethodSignature_Eject) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_QueryCardInfo:
- if (dwSignature != CardSwiperService_MethodSignature_QueryCardInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_MagTransferInit:
- if (dwSignature != CardSwiperService_MethodSignature_MagTransferInit) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_QueryConnInfo:
- if (dwSignature != CardSwiperService_MethodSignature_QueryConnInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_InsertWaitMore:
- if (dwSignature != CardSwiperService_MethodSignature_InsertWaitMore) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_QueryFWBList:
- if (dwSignature != CardSwiperService_MethodSignature_QueryFWBList) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_BindFWB:
- if (dwSignature != CardSwiperService_MethodSignature_BindFWB) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case CardSwiperService_Method_GetDevInfo:
- if (dwSignature != CardSwiperService_MethodSignature_GetDevInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- virtual void Handle_CancelInsert(SpOnewayCallContext<CardSwiperService_CancelInsert_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_Read(SpReqAnsContext<CardSwiperService_Read_Req, CardSwiperService_Read_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_PreOnline(SpReqAnsContext<CardSwiperService_PreOnline_Req, CardSwiperService_PreOnline_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_PostOnline(SpReqAnsContext<CardSwiperService_PostOnline_Req, CardSwiperService_PostOnline_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_Exit(SpOnewayCallContext<CardSwiperService_Exit_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_Eject(SpReqAnsContext<CardSwiperService_Eject_Req, CardSwiperService_Eject_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_QueryCardInfo(SpReqAnsContext<CardSwiperService_QueryCardInfo_Req, CardSwiperService_QueryCardInfo_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_MagTransferInit(SpReqAnsContext<CardSwiperService_MagTransferInit_Req, CardSwiperService_MagTransferInit_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_QueryConnInfo(SpReqAnsContext<CardSwiperService_QueryConnInfo_Req, CardSwiperService_QueryConnInfo_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_InsertWaitMore(SpOnewayCallContext<CardSwiperService_InsertWaitMore_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_QueryFWBList(SpReqAnsContext<CardSwiperService_QueryFWBList_Req, CardSwiperService_QueryFWBList_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_BindFWB(SpReqAnsContext<CardSwiperService_BindFWB_Req, CardSwiperService_BindFWB_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetDevInfo(SpReqAnsContext<CardSwiperService_GetDevInfo_Req, CardSwiperService_GetDevInfo_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 CardSwiperService_Method_CancelInsert:
- {
- SpOnewayCallContext<CardSwiperService_CancelInsert_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<CardSwiperService_CancelInsert_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- Handle_CancelInsert(ctx);
- }
- break;
- case CardSwiperService_Method_Read:
- {
- SpReqAnsContext<CardSwiperService_Read_Req,CardSwiperService_Read_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_Read_Req,CardSwiperService_Read_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_Read(ctx);
- }
- break;
- case CardSwiperService_Method_PreOnline:
- {
- SpReqAnsContext<CardSwiperService_PreOnline_Req,CardSwiperService_PreOnline_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_PreOnline_Req,CardSwiperService_PreOnline_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_PreOnline(ctx);
- }
- break;
- case CardSwiperService_Method_PostOnline:
- {
- SpReqAnsContext<CardSwiperService_PostOnline_Req,CardSwiperService_PostOnline_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_PostOnline_Req,CardSwiperService_PostOnline_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_PostOnline(ctx);
- }
- break;
- case CardSwiperService_Method_Exit:
- {
- SpOnewayCallContext<CardSwiperService_Exit_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<CardSwiperService_Exit_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- Handle_Exit(ctx);
- }
- break;
- case CardSwiperService_Method_Eject:
- {
- SpReqAnsContext<CardSwiperService_Eject_Req,CardSwiperService_Eject_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_Eject_Req,CardSwiperService_Eject_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_Eject(ctx);
- }
- break;
- case CardSwiperService_Method_QueryCardInfo:
- {
- SpReqAnsContext<CardSwiperService_QueryCardInfo_Req,CardSwiperService_QueryCardInfo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_QueryCardInfo_Req,CardSwiperService_QueryCardInfo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_QueryCardInfo(ctx);
- }
- break;
- case CardSwiperService_Method_MagTransferInit:
- {
- SpReqAnsContext<CardSwiperService_MagTransferInit_Req,CardSwiperService_MagTransferInit_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_MagTransferInit_Req,CardSwiperService_MagTransferInit_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_MagTransferInit(ctx);
- }
- break;
- case CardSwiperService_Method_QueryConnInfo:
- {
- SpReqAnsContext<CardSwiperService_QueryConnInfo_Req,CardSwiperService_QueryConnInfo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_QueryConnInfo_Req,CardSwiperService_QueryConnInfo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_QueryConnInfo(ctx);
- }
- break;
- case CardSwiperService_Method_InsertWaitMore:
- {
- SpOnewayCallContext<CardSwiperService_InsertWaitMore_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<CardSwiperService_InsertWaitMore_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- Handle_InsertWaitMore(ctx);
- }
- break;
- case CardSwiperService_Method_QueryFWBList:
- {
- SpReqAnsContext<CardSwiperService_QueryFWBList_Req,CardSwiperService_QueryFWBList_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_QueryFWBList_Req,CardSwiperService_QueryFWBList_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_QueryFWBList(ctx);
- }
- break;
- case CardSwiperService_Method_BindFWB:
- {
- SpReqAnsContext<CardSwiperService_BindFWB_Req,CardSwiperService_BindFWB_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_BindFWB_Req,CardSwiperService_BindFWB_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_BindFWB(ctx);
- }
- break;
- case CardSwiperService_Method_GetDevInfo:
- {
- SpReqAnsContext<CardSwiperService_GetDevInfo_Req,CardSwiperService_GetDevInfo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<CardSwiperService_GetDevInfo_Req,CardSwiperService_GetDevInfo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetDevInfo(ctx);
- }
- break;
- default:
- assert(0);
- break;
- }
-
- } else {
- pTransactionContext->SendAnswer(Error);
- }
- }
- };
- ///////////////////////////
- } // namespace CardSwiper
- #endif // __CARDSWIPER_SERVER_G_H
|