FingerPrint_server_g.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. #ifndef __FINGERPRINT_SERVER_G_H
  2. #define __FINGERPRINT_SERVER_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "FingerPrint_def_g.h"
  6. namespace FingerPrint {
  7. class FingerPrintService_ServerSessionBase : public CServerSessionBase
  8. {
  9. public:
  10. FingerPrintService_ServerSessionBase()
  11. {
  12. /// override by user
  13. }
  14. virtual ~FingerPrintService_ServerSessionBase()
  15. {
  16. /// override by user
  17. }
  18. virtual bool IsExclusive() { return false; }
  19. virtual bool IsSessionOverlap() { return true; }
  20. virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
  21. {
  22. ErrorCodeEnum Error = Error_Succeed;
  23. switch (dwMessageID) {
  24. case FingerPrintService_Method_GetImageAndFeature:
  25. if (dwSignature == FingerPrintService_MethodSignature_GetImageAndFeature) {
  26. bOverlap = true;
  27. } else {
  28. Error = Error_MethodSignatureFailed;
  29. }
  30. break;
  31. case FingerPrintService_Method_CancelRegister:
  32. if (dwSignature == FingerPrintService_MethodSignature_CancelRegister) {
  33. bOverlap = true;
  34. } else {
  35. Error = Error_MethodSignatureFailed;
  36. }
  37. break;
  38. case FingerPrintService_Method_CancelMatch:
  39. if (dwSignature == FingerPrintService_MethodSignature_CancelMatch) {
  40. bOverlap = true;
  41. } else {
  42. Error = Error_MethodSignatureFailed;
  43. }
  44. break;
  45. case FingerPrintService_Method_Exit:
  46. if (dwSignature == FingerPrintService_MethodSignature_Exit) {
  47. bOverlap = true;
  48. } else {
  49. Error = Error_MethodSignatureFailed;
  50. }
  51. break;
  52. case FingerPrintService_Method_Match:
  53. if (dwSignature == FingerPrintService_MethodSignature_Match) {
  54. bOverlap = true;
  55. } else {
  56. Error = Error_MethodSignatureFailed;
  57. }
  58. break;
  59. case FingerPrintService_Method_GetDevStatus:
  60. if (dwSignature == FingerPrintService_MethodSignature_GetDevStatus) {
  61. bOverlap = true;
  62. } else {
  63. Error = Error_MethodSignatureFailed;
  64. }
  65. break;
  66. case FingerPrintService_Method_GetDevInfo:
  67. if (dwSignature == FingerPrintService_MethodSignature_GetDevInfo) {
  68. bOverlap = true;
  69. } else {
  70. Error = Error_MethodSignatureFailed;
  71. }
  72. break;
  73. case FingerPrintService_Method_GetImageAndFeatureEx:
  74. if (dwSignature == FingerPrintService_MethodSignature_GetImageAndFeatureEx) {
  75. bOverlap = true;
  76. } else {
  77. Error = Error_MethodSignatureFailed;
  78. }
  79. break;
  80. case FingerPrintService_Method_GetFingerPrint:
  81. if (dwSignature == FingerPrintService_MethodSignature_GetFingerPrint) {
  82. bOverlap = true;
  83. } else {
  84. Error = Error_MethodSignatureFailed;
  85. }
  86. break;
  87. case FingerPrintService_Method_GenerateTemplate:
  88. if (dwSignature == FingerPrintService_MethodSignature_GenerateTemplate) {
  89. bOverlap = true;
  90. } else {
  91. Error = Error_MethodSignatureFailed;
  92. }
  93. break;
  94. default:
  95. Error = Error_MethodNotFound;
  96. break;
  97. }
  98. return Error;
  99. }
  100. int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
  101. {
  102. ErrorCodeEnum Error = Error_Succeed;
  103. switch (dwMessageID) {
  104. case FingerPrintService_Method_GetImageAndFeature:
  105. if (dwSignature != FingerPrintService_MethodSignature_GetImageAndFeature) {
  106. Error = Error_MethodSignatureFailed;
  107. }
  108. break;
  109. case FingerPrintService_Method_CancelRegister:
  110. if (dwSignature != FingerPrintService_MethodSignature_CancelRegister) {
  111. Error = Error_MethodSignatureFailed;
  112. }
  113. break;
  114. case FingerPrintService_Method_CancelMatch:
  115. if (dwSignature != FingerPrintService_MethodSignature_CancelMatch) {
  116. Error = Error_MethodSignatureFailed;
  117. }
  118. break;
  119. case FingerPrintService_Method_Exit:
  120. if (dwSignature != FingerPrintService_MethodSignature_Exit) {
  121. Error = Error_MethodSignatureFailed;
  122. }
  123. break;
  124. case FingerPrintService_Method_Match:
  125. if (dwSignature != FingerPrintService_MethodSignature_Match) {
  126. Error = Error_MethodSignatureFailed;
  127. }
  128. break;
  129. case FingerPrintService_Method_GetDevStatus:
  130. if (dwSignature != FingerPrintService_MethodSignature_GetDevStatus) {
  131. Error = Error_MethodSignatureFailed;
  132. }
  133. break;
  134. case FingerPrintService_Method_GetDevInfo:
  135. if (dwSignature != FingerPrintService_MethodSignature_GetDevInfo) {
  136. Error = Error_MethodSignatureFailed;
  137. }
  138. break;
  139. case FingerPrintService_Method_GetImageAndFeatureEx:
  140. if (dwSignature != FingerPrintService_MethodSignature_GetImageAndFeatureEx) {
  141. Error = Error_MethodSignatureFailed;
  142. }
  143. break;
  144. case FingerPrintService_Method_GetFingerPrint:
  145. if (dwSignature != FingerPrintService_MethodSignature_GetFingerPrint) {
  146. Error = Error_MethodSignatureFailed;
  147. }
  148. break;
  149. case FingerPrintService_Method_GenerateTemplate:
  150. if (dwSignature != FingerPrintService_MethodSignature_GenerateTemplate) {
  151. Error = Error_MethodSignatureFailed;
  152. }
  153. break;
  154. default:
  155. Error = Error_MethodNotFound;
  156. break;
  157. }
  158. return Error;
  159. }
  160. virtual void Handle_GetImageAndFeature(SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req, FingerPrintService_GetImageAndFeature_Ans>::Pointer ctx)
  161. {
  162. /// override by user
  163. }
  164. virtual void Handle_CancelRegister(SpOnewayCallContext<FingerPrintService_CancelRegister_Info>::Pointer ctx)
  165. {
  166. /// override by user
  167. }
  168. virtual void Handle_CancelMatch(SpOnewayCallContext<FingerPrintService_CancelMatch_Info>::Pointer ctx)
  169. {
  170. /// override by user
  171. }
  172. virtual void Handle_Exit(SpOnewayCallContext<FingerPrintService_Exit_Info>::Pointer ctx)
  173. {
  174. /// override by user
  175. }
  176. virtual void Handle_Match(SpReqAnsContext<FingerPrintService_Match_Req, FingerPrintService_Match_Ans>::Pointer ctx)
  177. {
  178. /// override by user
  179. }
  180. virtual void Handle_GetDevStatus(SpReqAnsContext<FingerPrintService_GetDevStatus_Req, FingerPrintService_GetDevStatus_Ans>::Pointer ctx)
  181. {
  182. /// override by user
  183. }
  184. virtual void Handle_GetDevInfo(SpReqAnsContext<FingerPrintService_GetDevInfo_Req, FingerPrintService_GetDevInfo_Ans>::Pointer ctx)
  185. {
  186. /// override by user
  187. }
  188. virtual void Handle_GetImageAndFeatureEx(SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer ctx)
  189. {
  190. /// override by user
  191. }
  192. virtual void Handle_GetFingerPrint(SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer ctx)
  193. {
  194. /// override by user
  195. }
  196. virtual void Handle_GenerateTemplate(SpReqAnsContext<FingerPrintService_GenerateTemplate_Req, FingerPrintService_GenerateTemplate_Ans>::Pointer ctx)
  197. {
  198. /// override by user
  199. }
  200. virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
  201. {
  202. CAutoBuffer Buf;
  203. DWORD dwMessageID;
  204. DWORD dwMessageSignature;
  205. ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
  206. if (Error == Error_Succeed) {
  207. #ifdef DEBUG
  208. assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
  209. #else
  210. if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
  211. pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
  212. return;
  213. }
  214. #endif
  215. switch (dwMessageID) {
  216. case FingerPrintService_Method_GetImageAndFeature:
  217. {
  218. SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req,FingerPrintService_GetImageAndFeature_Ans>::Pointer ctx;
  219. ctx.Attach(new SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req,FingerPrintService_GetImageAndFeature_Ans>(pTransactionContext));
  220. SpBuffer2Object(Buf, ctx->Req);
  221. Handle_GetImageAndFeature(ctx);
  222. }
  223. break;
  224. case FingerPrintService_Method_CancelRegister:
  225. {
  226. SpOnewayCallContext<FingerPrintService_CancelRegister_Info>::Pointer ctx;
  227. ctx.Attach(new SpOnewayCallContext<FingerPrintService_CancelRegister_Info>());
  228. SpBuffer2Object(Buf, ctx->Info);
  229. Handle_CancelRegister(ctx);
  230. }
  231. break;
  232. case FingerPrintService_Method_CancelMatch:
  233. {
  234. SpOnewayCallContext<FingerPrintService_CancelMatch_Info>::Pointer ctx;
  235. ctx.Attach(new SpOnewayCallContext<FingerPrintService_CancelMatch_Info>());
  236. SpBuffer2Object(Buf, ctx->Info);
  237. Handle_CancelMatch(ctx);
  238. }
  239. break;
  240. case FingerPrintService_Method_Exit:
  241. {
  242. SpOnewayCallContext<FingerPrintService_Exit_Info>::Pointer ctx;
  243. ctx.Attach(new SpOnewayCallContext<FingerPrintService_Exit_Info>());
  244. SpBuffer2Object(Buf, ctx->Info);
  245. Handle_Exit(ctx);
  246. }
  247. break;
  248. case FingerPrintService_Method_Match:
  249. {
  250. SpReqAnsContext<FingerPrintService_Match_Req,FingerPrintService_Match_Ans>::Pointer ctx;
  251. ctx.Attach(new SpReqAnsContext<FingerPrintService_Match_Req,FingerPrintService_Match_Ans>(pTransactionContext));
  252. SpBuffer2Object(Buf, ctx->Req);
  253. Handle_Match(ctx);
  254. }
  255. break;
  256. case FingerPrintService_Method_GetDevStatus:
  257. {
  258. SpReqAnsContext<FingerPrintService_GetDevStatus_Req,FingerPrintService_GetDevStatus_Ans>::Pointer ctx;
  259. ctx.Attach(new SpReqAnsContext<FingerPrintService_GetDevStatus_Req,FingerPrintService_GetDevStatus_Ans>(pTransactionContext));
  260. SpBuffer2Object(Buf, ctx->Req);
  261. Handle_GetDevStatus(ctx);
  262. }
  263. break;
  264. case FingerPrintService_Method_GetDevInfo:
  265. {
  266. SpReqAnsContext<FingerPrintService_GetDevInfo_Req,FingerPrintService_GetDevInfo_Ans>::Pointer ctx;
  267. ctx.Attach(new SpReqAnsContext<FingerPrintService_GetDevInfo_Req,FingerPrintService_GetDevInfo_Ans>(pTransactionContext));
  268. SpBuffer2Object(Buf, ctx->Req);
  269. Handle_GetDevInfo(ctx);
  270. }
  271. break;
  272. case FingerPrintService_Method_GetImageAndFeatureEx:
  273. {
  274. SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req,FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer ctx;
  275. ctx.Attach(new SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req,FingerPrintService_GetImageAndFeatureEx_Ans>(pTransactionContext));
  276. SpBuffer2Object(Buf, ctx->Req);
  277. Handle_GetImageAndFeatureEx(ctx);
  278. }
  279. break;
  280. case FingerPrintService_Method_GetFingerPrint:
  281. {
  282. SpReqAnsContext<FingerPrintService_GetFingerPrint_Req,FingerPrintService_GetFingerPrint_Ans>::Pointer ctx;
  283. ctx.Attach(new SpReqAnsContext<FingerPrintService_GetFingerPrint_Req,FingerPrintService_GetFingerPrint_Ans>(pTransactionContext));
  284. SpBuffer2Object(Buf, ctx->Req);
  285. Handle_GetFingerPrint(ctx);
  286. }
  287. break;
  288. case FingerPrintService_Method_GenerateTemplate:
  289. {
  290. SpReqAnsContext<FingerPrintService_GenerateTemplate_Req,FingerPrintService_GenerateTemplate_Ans>::Pointer ctx;
  291. ctx.Attach(new SpReqAnsContext<FingerPrintService_GenerateTemplate_Req,FingerPrintService_GenerateTemplate_Ans>(pTransactionContext));
  292. SpBuffer2Object(Buf, ctx->Req);
  293. Handle_GenerateTemplate(ctx);
  294. }
  295. break;
  296. default:
  297. assert(0);
  298. break;
  299. }
  300. } else {
  301. pTransactionContext->SendAnswer(Error);
  302. }
  303. }
  304. };
  305. ///////////////////////////
  306. } // namespace FingerPrint
  307. #endif // __FINGERPRINT_SERVER_G_H