CardSwiper_server_g.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. #ifndef __CARDSWIPER_SERVER_G_H
  2. #define __CARDSWIPER_SERVER_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "CardSwiper_def_g.h"
  6. namespace CardSwiper {
  7. class CardSwiperService_ServerSessionBase : public CServerSessionBase
  8. {
  9. public:
  10. CardSwiperService_ServerSessionBase() { }
  11. virtual ~CardSwiperService_ServerSessionBase() { }
  12. virtual bool IsExclusive() { return false; }
  13. virtual bool IsSessionOverlap() { return true; }
  14. virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
  15. {
  16. ErrorCodeEnum Error = Error_Succeed;
  17. switch (dwMessageID) {
  18. case CardSwiperService_Method_CancelInsert:
  19. if (dwSignature == CardSwiperService_MethodSignature_CancelInsert) {
  20. bOverlap = true;
  21. } else {
  22. Error = Error_MethodSignatureFailed;
  23. }
  24. break;
  25. case CardSwiperService_Method_Read:
  26. if (dwSignature == CardSwiperService_MethodSignature_Read) {
  27. bOverlap = true;
  28. } else {
  29. Error = Error_MethodSignatureFailed;
  30. }
  31. break;
  32. case CardSwiperService_Method_PreOnline:
  33. if (dwSignature == CardSwiperService_MethodSignature_PreOnline) {
  34. bOverlap = true;
  35. } else {
  36. Error = Error_MethodSignatureFailed;
  37. }
  38. break;
  39. case CardSwiperService_Method_PostOnline:
  40. if (dwSignature == CardSwiperService_MethodSignature_PostOnline) {
  41. bOverlap = true;
  42. } else {
  43. Error = Error_MethodSignatureFailed;
  44. }
  45. break;
  46. case CardSwiperService_Method_Exit:
  47. if (dwSignature == CardSwiperService_MethodSignature_Exit) {
  48. bOverlap = true;
  49. } else {
  50. Error = Error_MethodSignatureFailed;
  51. }
  52. break;
  53. case CardSwiperService_Method_Eject:
  54. if (dwSignature == CardSwiperService_MethodSignature_Eject) {
  55. bOverlap = true;
  56. } else {
  57. Error = Error_MethodSignatureFailed;
  58. }
  59. break;
  60. case CardSwiperService_Method_QueryCardInfo:
  61. if (dwSignature == CardSwiperService_MethodSignature_QueryCardInfo) {
  62. bOverlap = true;
  63. } else {
  64. Error = Error_MethodSignatureFailed;
  65. }
  66. break;
  67. case CardSwiperService_Method_MagTransferInit:
  68. if (dwSignature == CardSwiperService_MethodSignature_MagTransferInit) {
  69. bOverlap = true;
  70. } else {
  71. Error = Error_MethodSignatureFailed;
  72. }
  73. break;
  74. case CardSwiperService_Method_QueryConnInfo:
  75. if (dwSignature == CardSwiperService_MethodSignature_QueryConnInfo) {
  76. bOverlap = true;
  77. } else {
  78. Error = Error_MethodSignatureFailed;
  79. }
  80. break;
  81. case CardSwiperService_Method_InsertWaitMore:
  82. if (dwSignature == CardSwiperService_MethodSignature_InsertWaitMore) {
  83. bOverlap = true;
  84. } else {
  85. Error = Error_MethodSignatureFailed;
  86. }
  87. break;
  88. case CardSwiperService_Method_QueryFWBList:
  89. if (dwSignature == CardSwiperService_MethodSignature_QueryFWBList) {
  90. bOverlap = true;
  91. } else {
  92. Error = Error_MethodSignatureFailed;
  93. }
  94. break;
  95. case CardSwiperService_Method_BindFWB:
  96. if (dwSignature == CardSwiperService_MethodSignature_BindFWB) {
  97. bOverlap = true;
  98. } else {
  99. Error = Error_MethodSignatureFailed;
  100. }
  101. break;
  102. case CardSwiperService_Method_GetDevInfo:
  103. if (dwSignature == CardSwiperService_MethodSignature_GetDevInfo) {
  104. bOverlap = true;
  105. } else {
  106. Error = Error_MethodSignatureFailed;
  107. }
  108. break;
  109. default:
  110. Error = Error_MethodNotFound;
  111. break;
  112. }
  113. return Error;
  114. }
  115. int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
  116. {
  117. ErrorCodeEnum Error = Error_Succeed;
  118. switch (dwMessageID) {
  119. case CardSwiperService_Method_CancelInsert:
  120. if (dwSignature != CardSwiperService_MethodSignature_CancelInsert) {
  121. Error = Error_MethodSignatureFailed;
  122. }
  123. break;
  124. case CardSwiperService_Method_Read:
  125. if (dwSignature != CardSwiperService_MethodSignature_Read) {
  126. Error = Error_MethodSignatureFailed;
  127. }
  128. break;
  129. case CardSwiperService_Method_PreOnline:
  130. if (dwSignature != CardSwiperService_MethodSignature_PreOnline) {
  131. Error = Error_MethodSignatureFailed;
  132. }
  133. break;
  134. case CardSwiperService_Method_PostOnline:
  135. if (dwSignature != CardSwiperService_MethodSignature_PostOnline) {
  136. Error = Error_MethodSignatureFailed;
  137. }
  138. break;
  139. case CardSwiperService_Method_Exit:
  140. if (dwSignature != CardSwiperService_MethodSignature_Exit) {
  141. Error = Error_MethodSignatureFailed;
  142. }
  143. break;
  144. case CardSwiperService_Method_Eject:
  145. if (dwSignature != CardSwiperService_MethodSignature_Eject) {
  146. Error = Error_MethodSignatureFailed;
  147. }
  148. break;
  149. case CardSwiperService_Method_QueryCardInfo:
  150. if (dwSignature != CardSwiperService_MethodSignature_QueryCardInfo) {
  151. Error = Error_MethodSignatureFailed;
  152. }
  153. break;
  154. case CardSwiperService_Method_MagTransferInit:
  155. if (dwSignature != CardSwiperService_MethodSignature_MagTransferInit) {
  156. Error = Error_MethodSignatureFailed;
  157. }
  158. break;
  159. case CardSwiperService_Method_QueryConnInfo:
  160. if (dwSignature != CardSwiperService_MethodSignature_QueryConnInfo) {
  161. Error = Error_MethodSignatureFailed;
  162. }
  163. break;
  164. case CardSwiperService_Method_InsertWaitMore:
  165. if (dwSignature != CardSwiperService_MethodSignature_InsertWaitMore) {
  166. Error = Error_MethodSignatureFailed;
  167. }
  168. break;
  169. case CardSwiperService_Method_QueryFWBList:
  170. if (dwSignature != CardSwiperService_MethodSignature_QueryFWBList) {
  171. Error = Error_MethodSignatureFailed;
  172. }
  173. break;
  174. case CardSwiperService_Method_BindFWB:
  175. if (dwSignature != CardSwiperService_MethodSignature_BindFWB) {
  176. Error = Error_MethodSignatureFailed;
  177. }
  178. break;
  179. case CardSwiperService_Method_GetDevInfo:
  180. if (dwSignature != CardSwiperService_MethodSignature_GetDevInfo) {
  181. Error = Error_MethodSignatureFailed;
  182. }
  183. break;
  184. default:
  185. Error = Error_MethodNotFound;
  186. break;
  187. }
  188. return Error;
  189. }
  190. virtual void Handle_CancelInsert(SpOnewayCallContext<CardSwiperService_CancelInsert_Info>::Pointer ctx)
  191. {
  192. /// override by user
  193. }
  194. virtual void Handle_Read(SpReqAnsContext<CardSwiperService_Read_Req, CardSwiperService_Read_Ans>::Pointer ctx)
  195. {
  196. /// override by user
  197. }
  198. virtual void Handle_PreOnline(SpReqAnsContext<CardSwiperService_PreOnline_Req, CardSwiperService_PreOnline_Ans>::Pointer ctx)
  199. {
  200. /// override by user
  201. }
  202. virtual void Handle_PostOnline(SpReqAnsContext<CardSwiperService_PostOnline_Req, CardSwiperService_PostOnline_Ans>::Pointer ctx)
  203. {
  204. /// override by user
  205. }
  206. virtual void Handle_Exit(SpOnewayCallContext<CardSwiperService_Exit_Info>::Pointer ctx)
  207. {
  208. /// override by user
  209. }
  210. virtual void Handle_Eject(SpReqAnsContext<CardSwiperService_Eject_Req, CardSwiperService_Eject_Ans>::Pointer ctx)
  211. {
  212. /// override by user
  213. }
  214. virtual void Handle_QueryCardInfo(SpReqAnsContext<CardSwiperService_QueryCardInfo_Req, CardSwiperService_QueryCardInfo_Ans>::Pointer ctx)
  215. {
  216. /// override by user
  217. }
  218. virtual void Handle_MagTransferInit(SpReqAnsContext<CardSwiperService_MagTransferInit_Req, CardSwiperService_MagTransferInit_Ans>::Pointer ctx)
  219. {
  220. /// override by user
  221. }
  222. virtual void Handle_QueryConnInfo(SpReqAnsContext<CardSwiperService_QueryConnInfo_Req, CardSwiperService_QueryConnInfo_Ans>::Pointer ctx)
  223. {
  224. /// override by user
  225. }
  226. virtual void Handle_InsertWaitMore(SpOnewayCallContext<CardSwiperService_InsertWaitMore_Info>::Pointer ctx)
  227. {
  228. /// override by user
  229. }
  230. virtual void Handle_QueryFWBList(SpReqAnsContext<CardSwiperService_QueryFWBList_Req, CardSwiperService_QueryFWBList_Ans>::Pointer ctx)
  231. {
  232. /// override by user
  233. }
  234. virtual void Handle_BindFWB(SpReqAnsContext<CardSwiperService_BindFWB_Req, CardSwiperService_BindFWB_Ans>::Pointer ctx)
  235. {
  236. /// override by user
  237. }
  238. virtual void Handle_GetDevInfo(SpReqAnsContext<CardSwiperService_GetDevInfo_Req, CardSwiperService_GetDevInfo_Ans>::Pointer ctx)
  239. {
  240. /// override by user
  241. }
  242. virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
  243. {
  244. CAutoBuffer Buf;
  245. DWORD dwMessageID;
  246. DWORD dwMessageSignature;
  247. ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
  248. if (Error == Error_Succeed) {
  249. #ifdef DEBUG
  250. assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
  251. #else
  252. if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
  253. pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
  254. return;
  255. }
  256. #endif
  257. switch (dwMessageID) {
  258. case CardSwiperService_Method_CancelInsert:
  259. {
  260. SpOnewayCallContext<CardSwiperService_CancelInsert_Info>::Pointer ctx;
  261. ctx.Attach(new SpOnewayCallContext<CardSwiperService_CancelInsert_Info>());
  262. SpBuffer2Object(Buf, ctx->Info);
  263. Handle_CancelInsert(ctx);
  264. }
  265. break;
  266. case CardSwiperService_Method_Read:
  267. {
  268. SpReqAnsContext<CardSwiperService_Read_Req,CardSwiperService_Read_Ans>::Pointer ctx;
  269. ctx.Attach(new SpReqAnsContext<CardSwiperService_Read_Req,CardSwiperService_Read_Ans>(pTransactionContext));
  270. SpBuffer2Object(Buf, ctx->Req);
  271. Handle_Read(ctx);
  272. }
  273. break;
  274. case CardSwiperService_Method_PreOnline:
  275. {
  276. SpReqAnsContext<CardSwiperService_PreOnline_Req,CardSwiperService_PreOnline_Ans>::Pointer ctx;
  277. ctx.Attach(new SpReqAnsContext<CardSwiperService_PreOnline_Req,CardSwiperService_PreOnline_Ans>(pTransactionContext));
  278. SpBuffer2Object(Buf, ctx->Req);
  279. Handle_PreOnline(ctx);
  280. }
  281. break;
  282. case CardSwiperService_Method_PostOnline:
  283. {
  284. SpReqAnsContext<CardSwiperService_PostOnline_Req,CardSwiperService_PostOnline_Ans>::Pointer ctx;
  285. ctx.Attach(new SpReqAnsContext<CardSwiperService_PostOnline_Req,CardSwiperService_PostOnline_Ans>(pTransactionContext));
  286. SpBuffer2Object(Buf, ctx->Req);
  287. Handle_PostOnline(ctx);
  288. }
  289. break;
  290. case CardSwiperService_Method_Exit:
  291. {
  292. SpOnewayCallContext<CardSwiperService_Exit_Info>::Pointer ctx;
  293. ctx.Attach(new SpOnewayCallContext<CardSwiperService_Exit_Info>());
  294. SpBuffer2Object(Buf, ctx->Info);
  295. Handle_Exit(ctx);
  296. }
  297. break;
  298. case CardSwiperService_Method_Eject:
  299. {
  300. SpReqAnsContext<CardSwiperService_Eject_Req,CardSwiperService_Eject_Ans>::Pointer ctx;
  301. ctx.Attach(new SpReqAnsContext<CardSwiperService_Eject_Req,CardSwiperService_Eject_Ans>(pTransactionContext));
  302. SpBuffer2Object(Buf, ctx->Req);
  303. Handle_Eject(ctx);
  304. }
  305. break;
  306. case CardSwiperService_Method_QueryCardInfo:
  307. {
  308. SpReqAnsContext<CardSwiperService_QueryCardInfo_Req,CardSwiperService_QueryCardInfo_Ans>::Pointer ctx;
  309. ctx.Attach(new SpReqAnsContext<CardSwiperService_QueryCardInfo_Req,CardSwiperService_QueryCardInfo_Ans>(pTransactionContext));
  310. SpBuffer2Object(Buf, ctx->Req);
  311. Handle_QueryCardInfo(ctx);
  312. }
  313. break;
  314. case CardSwiperService_Method_MagTransferInit:
  315. {
  316. SpReqAnsContext<CardSwiperService_MagTransferInit_Req,CardSwiperService_MagTransferInit_Ans>::Pointer ctx;
  317. ctx.Attach(new SpReqAnsContext<CardSwiperService_MagTransferInit_Req,CardSwiperService_MagTransferInit_Ans>(pTransactionContext));
  318. SpBuffer2Object(Buf, ctx->Req);
  319. Handle_MagTransferInit(ctx);
  320. }
  321. break;
  322. case CardSwiperService_Method_QueryConnInfo:
  323. {
  324. SpReqAnsContext<CardSwiperService_QueryConnInfo_Req,CardSwiperService_QueryConnInfo_Ans>::Pointer ctx;
  325. ctx.Attach(new SpReqAnsContext<CardSwiperService_QueryConnInfo_Req,CardSwiperService_QueryConnInfo_Ans>(pTransactionContext));
  326. SpBuffer2Object(Buf, ctx->Req);
  327. Handle_QueryConnInfo(ctx);
  328. }
  329. break;
  330. case CardSwiperService_Method_InsertWaitMore:
  331. {
  332. SpOnewayCallContext<CardSwiperService_InsertWaitMore_Info>::Pointer ctx;
  333. ctx.Attach(new SpOnewayCallContext<CardSwiperService_InsertWaitMore_Info>());
  334. SpBuffer2Object(Buf, ctx->Info);
  335. Handle_InsertWaitMore(ctx);
  336. }
  337. break;
  338. case CardSwiperService_Method_QueryFWBList:
  339. {
  340. SpReqAnsContext<CardSwiperService_QueryFWBList_Req,CardSwiperService_QueryFWBList_Ans>::Pointer ctx;
  341. ctx.Attach(new SpReqAnsContext<CardSwiperService_QueryFWBList_Req,CardSwiperService_QueryFWBList_Ans>(pTransactionContext));
  342. SpBuffer2Object(Buf, ctx->Req);
  343. Handle_QueryFWBList(ctx);
  344. }
  345. break;
  346. case CardSwiperService_Method_BindFWB:
  347. {
  348. SpReqAnsContext<CardSwiperService_BindFWB_Req,CardSwiperService_BindFWB_Ans>::Pointer ctx;
  349. ctx.Attach(new SpReqAnsContext<CardSwiperService_BindFWB_Req,CardSwiperService_BindFWB_Ans>(pTransactionContext));
  350. SpBuffer2Object(Buf, ctx->Req);
  351. Handle_BindFWB(ctx);
  352. }
  353. break;
  354. case CardSwiperService_Method_GetDevInfo:
  355. {
  356. SpReqAnsContext<CardSwiperService_GetDevInfo_Req,CardSwiperService_GetDevInfo_Ans>::Pointer ctx;
  357. ctx.Attach(new SpReqAnsContext<CardSwiperService_GetDevInfo_Req,CardSwiperService_GetDevInfo_Ans>(pTransactionContext));
  358. SpBuffer2Object(Buf, ctx->Req);
  359. Handle_GetDevInfo(ctx);
  360. }
  361. break;
  362. default:
  363. assert(0);
  364. break;
  365. }
  366. } else {
  367. pTransactionContext->SendAnswer(Error);
  368. }
  369. }
  370. };
  371. ///////////////////////////
  372. } // namespace CardSwiper
  373. #endif // __CARDSWIPER_SERVER_G_H