123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- #ifndef __PINPAD_SERVER_G_H
- #define __PINPAD_SERVER_G_H
- #pragma once
- // This code is generated by spgen tool!
- #include "PinPad_def_g.h"
- namespace PinPad {
- class PinPadService_ServerSessionBase : public CServerSessionBase
- {
- public:
- PinPadService_ServerSessionBase() { }
- virtual ~PinPadService_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 PinPadService_Method_GetInput:
- if (dwSignature == PinPadService_MethodSignature_GetInput) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_InputWaitMore:
- if (dwSignature == PinPadService_MethodSignature_InputWaitMore) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_InputCancel:
- if (dwSignature == PinPadService_MethodSignature_InputCancel) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_Exit:
- if (dwSignature == PinPadService_MethodSignature_Exit) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_LoadKeys:
- if (dwSignature == PinPadService_MethodSignature_LoadKeys) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_EncryptData:
- if (dwSignature == PinPadService_MethodSignature_EncryptData) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetInputSM:
- if (dwSignature == PinPadService_MethodSignature_GetInputSM) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_LoadKeysSM:
- if (dwSignature == PinPadService_MethodSignature_LoadKeysSM) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_EncryptDataSM:
- if (dwSignature == PinPadService_MethodSignature_EncryptDataSM) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_QueryFunc:
- if (dwSignature == PinPadService_MethodSignature_QueryFunc) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetCheckCode:
- if (dwSignature == PinPadService_MethodSignature_GetCheckCode) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_CrossTermCall:
- if (dwSignature == PinPadService_MethodSignature_CrossTermCall) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_CrossTermInvokeInfo:
- if (dwSignature == PinPadService_MethodSignature_CrossTermInvokeInfo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetDevInfo:
- if (dwSignature == PinPadService_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 PinPadService_Method_GetInput:
- if (dwSignature != PinPadService_MethodSignature_GetInput) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_InputWaitMore:
- if (dwSignature != PinPadService_MethodSignature_InputWaitMore) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_InputCancel:
- if (dwSignature != PinPadService_MethodSignature_InputCancel) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_Exit:
- if (dwSignature != PinPadService_MethodSignature_Exit) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_LoadKeys:
- if (dwSignature != PinPadService_MethodSignature_LoadKeys) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_EncryptData:
- if (dwSignature != PinPadService_MethodSignature_EncryptData) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetInputSM:
- if (dwSignature != PinPadService_MethodSignature_GetInputSM) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_LoadKeysSM:
- if (dwSignature != PinPadService_MethodSignature_LoadKeysSM) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_EncryptDataSM:
- if (dwSignature != PinPadService_MethodSignature_EncryptDataSM) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_QueryFunc:
- if (dwSignature != PinPadService_MethodSignature_QueryFunc) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetCheckCode:
- if (dwSignature != PinPadService_MethodSignature_GetCheckCode) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_CrossTermCall:
- if (dwSignature != PinPadService_MethodSignature_CrossTermCall) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_CrossTermInvokeInfo:
- if (dwSignature != PinPadService_MethodSignature_CrossTermInvokeInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetDevInfo:
- if (dwSignature != PinPadService_MethodSignature_GetDevInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- virtual void Handle_GetInput(SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_InputWaitMore(SpOnewayCallContext<PinPadService_InputWaitMore_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_InputCancel(SpOnewayCallContext<PinPadService_InputCancel_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_Exit(SpOnewayCallContext<PinPadService_Exit_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_LoadKeys(SpReqAnsContext<PinPadService_LoadKeys_Req, PinPadService_LoadKeys_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_EncryptData(SpReqAnsContext<PinPadService_EncryptData_Req, PinPadService_EncryptData_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetInputSM(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_LoadKeysSM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadService_LoadKeysSM_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_EncryptDataSM(SpReqAnsContext<PinPadService_EncryptDataSM_Req, PinPadService_EncryptDataSM_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_QueryFunc(SpReqAnsContext<PinPadService_QueryFunc_Req, PinPadService_QueryFunc_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCode_Req, PinPadService_GetCheckCode_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_CrossTermCall(SpReqAnsContext<PinPadService_CrossTermCall_Req, PinPadService_CrossTermCall_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_CrossTermInvokeInfo(SpOnewayCallContext<PinPadService_CrossTermInvokeInfo_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetDevInfo(SpReqAnsContext<PinPadService_GetDevInfo_Req, PinPadService_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 PinPadService_Method_GetInput:
- {
- SpReqAnsContext<PinPadService_GetInput_Req,PinPadService_GetInput_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_GetInput_Req,PinPadService_GetInput_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetInput(ctx);
- }
- break;
- case PinPadService_Method_InputWaitMore:
- {
- SpOnewayCallContext<PinPadService_InputWaitMore_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<PinPadService_InputWaitMore_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- Handle_InputWaitMore(ctx);
- }
- break;
- case PinPadService_Method_InputCancel:
- {
- SpOnewayCallContext<PinPadService_InputCancel_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<PinPadService_InputCancel_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- Handle_InputCancel(ctx);
- }
- break;
- case PinPadService_Method_Exit:
- {
- SpOnewayCallContext<PinPadService_Exit_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<PinPadService_Exit_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- Handle_Exit(ctx);
- }
- break;
- case PinPadService_Method_LoadKeys:
- {
- SpReqAnsContext<PinPadService_LoadKeys_Req,PinPadService_LoadKeys_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_LoadKeys_Req,PinPadService_LoadKeys_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_LoadKeys(ctx);
- }
- break;
- case PinPadService_Method_EncryptData:
- {
- SpReqAnsContext<PinPadService_EncryptData_Req,PinPadService_EncryptData_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_EncryptData_Req,PinPadService_EncryptData_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_EncryptData(ctx);
- }
- break;
- case PinPadService_Method_GetInputSM:
- {
- SpReqAnsContext<PinPadService_GetInputSM_Req,PinPadService_GetInputSM_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_GetInputSM_Req,PinPadService_GetInputSM_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetInputSM(ctx);
- }
- break;
- case PinPadService_Method_LoadKeysSM:
- {
- SpReqAnsContext<PinPadService_LoadKeysSM_Req,PinPadService_LoadKeysSM_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_LoadKeysSM_Req,PinPadService_LoadKeysSM_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_LoadKeysSM(ctx);
- }
- break;
- case PinPadService_Method_EncryptDataSM:
- {
- SpReqAnsContext<PinPadService_EncryptDataSM_Req,PinPadService_EncryptDataSM_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_EncryptDataSM_Req,PinPadService_EncryptDataSM_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_EncryptDataSM(ctx);
- }
- break;
- case PinPadService_Method_QueryFunc:
- {
- SpReqAnsContext<PinPadService_QueryFunc_Req,PinPadService_QueryFunc_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_QueryFunc_Req,PinPadService_QueryFunc_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_QueryFunc(ctx);
- }
- break;
- case PinPadService_Method_GetCheckCode:
- {
- SpReqAnsContext<PinPadService_GetCheckCode_Req,PinPadService_GetCheckCode_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_GetCheckCode_Req,PinPadService_GetCheckCode_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetCheckCode(ctx);
- }
- break;
- case PinPadService_Method_CrossTermCall:
- {
- SpReqAnsContext<PinPadService_CrossTermCall_Req,PinPadService_CrossTermCall_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_CrossTermCall_Req,PinPadService_CrossTermCall_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_CrossTermCall(ctx);
- }
- break;
- case PinPadService_Method_CrossTermInvokeInfo:
- {
- SpOnewayCallContext<PinPadService_CrossTermInvokeInfo_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<PinPadService_CrossTermInvokeInfo_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- Handle_CrossTermInvokeInfo(ctx);
- }
- break;
- case PinPadService_Method_GetDevInfo:
- {
- SpReqAnsContext<PinPadService_GetDevInfo_Req,PinPadService_GetDevInfo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_GetDevInfo_Req,PinPadService_GetDevInfo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetDevInfo(ctx);
- }
- break;
- default:
- assert(0);
- break;
- }
-
- } else {
- pTransactionContext->SendAnswer(Error);
- }
- }
- };
- ///////////////////////////
- } // namespace PinPad
- #endif // __PINPAD_SERVER_G_H
|