mod_CardReadAdapter.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. #include "CardReadAdapter_server_g.h"
  2. #include "CardReadAdapter_def_g.h"
  3. #include "CardReadAdapterFSM.h"
  4. using namespace CardReadAdapter;
  5. class CCardReadAdapterEntity;
  6. class CardReadAdapterServerSession : public CardReadAdapterService_ServerSessionBase
  7. {
  8. public:
  9. CardReadAdapterServerSession(CCardReadAdapterEntity* pEntity):m_pEntity(pEntity){}
  10. virtual ~CardReadAdapterServerSession(){}
  11. virtual void Handle_Read(SpReqAnsContext<CardReadAdapterService_Read_Req, CardReadAdapterService_Read_Ans>::Pointer ctx);
  12. virtual void Handle_CancelRead(SpOnewayCallContext<CardReadAdapterService_CancelRead_Info>::Pointer ctx);
  13. virtual void Handle_ReadWaitMore(SpOnewayCallContext<CardReadAdapterService_ReadWaitMore_Info>::Pointer ctx);
  14. virtual void Handle_Capture(SpReqAnsContext<CardReadAdapterService_Capture_Req, CardReadAdapterService_Capture_Ans>::Pointer ctx);
  15. virtual void Handle_Eject(SpReqAnsContext<CardReadAdapterService_Eject_Req, CardReadAdapterService_Eject_Ans>::Pointer ctx);
  16. virtual void Handle_PreOnline(SpReqAnsContext<CardReadAdapterService_PreOnline_Req, CardReadAdapterService_PreOnline_Ans>::Pointer ctx);
  17. virtual void Handle_PostOnline(SpReqAnsContext<CardReadAdapterService_PostOnline_Req, CardReadAdapterService_PostOnline_Ans>::Pointer ctx);
  18. virtual void Handle_Exit(SpOnewayCallContext<CardReadAdapterService_Exit_Info>::Pointer ctx);
  19. virtual void Handle_QueryCardInfo(SpReqAnsContext<CardReadAdapterService_QueryCardInfo_Req, CardReadAdapterService_QueryCardInfo_Ans>::Pointer ctx);
  20. virtual void Handle_WriteTrack(SpReqAnsContext<CardReadAdapterService_WriteTrack_Req, CardReadAdapterService_WriteTrack_Ans>::Pointer ctx);
  21. virtual void Handle_SetSomeFlag(SpReqAnsContext<CardReadAdapterService_SetSomeFlag_Req, CardReadAdapterService_SetSomeFlag_Ans>::Pointer ctx);
  22. virtual void Handle_Issue(SpReqAnsContext<CardReadAdapterService_Issue_Req, CardReadAdapterService_Issue_Ans>::Pointer ctx);
  23. virtual void Handle_GetDevInfo(SpReqAnsContext<CardReadAdapterService_GetDevInfo_Req, CardReadAdapterService_GetDevInfo_Ans>::Pointer ctx);
  24. virtual void Handle_GetMaterialCount(SpReqAnsContext<CardReadAdapterService_GetMaterialCount_Req, CardReadAdapterService_GetMaterialCount_Ans>::Pointer ctx);
  25. virtual void Handle_SetMaterialCount(SpReqAnsContext<CardReadAdapterService_SetMaterialCount_Req, CardReadAdapterService_SetMaterialCount_Ans>::Pointer ctx);
  26. virtual void Handle_GetSCIInfo(SpReqAnsContext<CardReadAdapterService_GetSCIInfo_Req, CardReadAdapterService_GetSCIInfo_Ans>::Pointer ctx);
  27. virtual void Handle_OpenSafeLock(SpReqAnsContext<CardReadAdapterService_OpenSafeLock_Req, CardReadAdapterService_OpenSafeLock_Ans>::Pointer ctx);
  28. virtual void Handle_MagTransferInit(SpReqAnsContext<CardReadAdapterService_MagTransferInit_Req, CardReadAdapterService_MagTransferInit_Ans>::Pointer ctx);
  29. virtual void Handle_QueryConnInfo(SpReqAnsContext<CardReadAdapterService_QueryConnInfo_Req, CardReadAdapterService_QueryConnInfo_Ans>::Pointer ctx);
  30. virtual void Handle_SAMICCommand(SpReqAnsContext<CardReadAdapterService_SAMICCommand_Req, CardReadAdapterService_SAMICCommand_Ans>::Pointer ctx);
  31. virtual void Handle_QueryPrinterStatus(SpReqAnsContext<CardReadAdapterService_QueryPrinterStatus_Req, CardReadAdapterService_QueryPrinterStatus_Ans>::Pointer ctx);
  32. virtual void Handle_Print(SpReqAnsContext<CardReadAdapterService_Print_Req, CardReadAdapterService_Print_Ans>::Pointer ctx);
  33. virtual void Handle_QuerySCIList(SpReqAnsContext<CardReadAdapterService_QuerySCIList_Req, CardReadAdapterService_QuerySCIList_Ans>::Pointer ctx);
  34. virtual void Handle_BindSCI(SpReqAnsContext<CardReadAdapterService_BindSCI_Req, CardReadAdapterService_BindSCI_Ans>::Pointer ctx);
  35. virtual void Handle_PreOnlineOnStore(SpReqAnsContext<CardReadAdapterService_PreOnlineOnStore_Req, CardReadAdapterService_PreOnlineOnStore_Ans>::Pointer ctx);
  36. virtual void Handle_NotifyPreonline(SpReqAnsContext<CardReadAdapterService_NotifyPreonline_Req, CardReadAdapterService_NotifyPreonline_Ans>::Pointer ctx);
  37. virtual void Handle_QueryCardInfoOnStore(SpReqAnsContext<CardReadAdapterService_QueryCardInfoOnStore_Req, CardReadAdapterService_QueryCardInfoOnStore_Ans>::Pointer ctx);
  38. virtual void Handle_GetAddCardInfo(SpReqAnsContext<CardReadAdapterService_GetAddCardInfo_Req, CardReadAdapterService_GetAddCardInfo_Ans>::Pointer ctx);
  39. virtual void Handle_Test1(SpReqAnsContext<CardReadAdapterService_Test1_Req, CardReadAdapterService_Test1_Ans>::Pointer ctx);
  40. virtual void Handle_Test2(SpReqAnsContext<CardReadAdapterService_Test2_Req, CardReadAdapterService_Test2_Ans>::Pointer ctx);
  41. virtual void Handle_CrossTermCall(SpReqAnsContext<CardReadAdapterService_CrossTermCall_Req, CardReadAdapterService_CrossTermCall_Ans>::Pointer ctx);
  42. virtual void Handle_CrossTermInvokeInfo(SpOnewayCallContext<CardReadAdapterService_CrossTermInvokeInfo_Info>::Pointer ctx);
  43. virtual void Handle_PrintCardImmediately(SpReqAnsContext<CardReadAdapterService_PrintCardImmediately_Req, CardReadAdapterService_PrintCardImmediately_Ans>::Pointer ctx);
  44. private:
  45. CCardReadAdapterEntity* m_pEntity;
  46. };
  47. class CCardReadAdapterEntity : public CEntityBase,public IBroadcastListener
  48. {
  49. public:
  50. CCardReadAdapterEntity() :bInitialized(false)//, m_bCIMsg(false), m_bCCMsg(false), m_bCSMsg(false)
  51. {
  52. //MessageBoxA(NULL, "", "", MB_OK);
  53. }
  54. virtual ~CCardReadAdapterEntity(){}
  55. virtual const char *GetEntityName() const { return "CardReadAdapter"; }
  56. virtual void OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext)
  57. {
  58. LOG_FUNCTION();
  59. //MessageBoxA(0,0,0,0);
  60. ErrorCodeEnum eStart = m_fsm.Init(this);
  61. if (eStart == Error_Succeed)
  62. {
  63. GetFunction()->SubscribeBroadcast("CardIssuer", "", this, m_uuidCIMsg);
  64. GetFunction()->SubscribeBroadcast("ContactlessCard", "", this, m_uuidCCMsg);
  65. GetFunction()->SubscribeBroadcast("CardSwiper", "", this, m_uuidCSMsg);
  66. }
  67. pTransactionContext->SendAnswer(eStart);
  68. }
  69. virtual void OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer<ITransactionContext> pTransactionContext)
  70. {
  71. ErrorCodeEnum Error = __OnStart(Error_Succeed);
  72. pTransactionContext->SendAnswer(Error);
  73. }
  74. virtual void OnPrePause(CSmartPointer<ITransactionContext> pTransactionContext)
  75. {
  76. ErrorCodeEnum Error = __OnPause(Error_Succeed);
  77. pTransactionContext->SendAnswer(Error);
  78. }
  79. virtual ErrorCodeEnum __OnStart(ErrorCodeEnum preOperationError)
  80. {
  81. return Error_Succeed;
  82. }
  83. virtual ErrorCodeEnum __OnPause(ErrorCodeEnum preOperationError)
  84. {
  85. return Error_Succeed;
  86. }
  87. virtual ErrorCodeEnum __OnClose(ErrorCodeEnum preOperationError)
  88. {
  89. return Error_Succeed;
  90. }
  91. virtual void OnSelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext)
  92. {
  93. m_fsm.SelfTest(eTestType,pTransactionContext);
  94. }
  95. virtual CServerSessionBase* OnNewSession(const char*,const char*)
  96. {
  97. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("A new connecting request arrived.");
  98. m_bNewSessionInit = true;
  99. return new CardReadAdapterServerSession(this);
  100. }
  101. bool Init()
  102. {
  103. }
  104. void Read(SpReqAnsContext<CardReadAdapterService_Read_Req, CardReadAdapterService_Read_Ans>::Pointer ctx)
  105. {
  106. LOG_FUNCTION();
  107. if (m_fsm.IsRVCIL())
  108. {
  109. CBlob bbSend;
  110. SpObject2Blob(ctx->Req, bbSend);
  111. //m_fsm.SetReadCtx(ctx);
  112. m_fsm.SaveCtx(CardReadAdapterService_Method_Read, ctx);
  113. ctx.AddRef();
  114. m_fsm.LocalCallHeartBeat(CardReadAdapterService_Method_Read, bbSend);
  115. }
  116. else
  117. {
  118. //oilyang@20210125 add:query current FSM state ,then post event
  119. int xFSM, xS2Evt, xS2EvtParam1;
  120. xFSM = xS2Evt = xS2EvtParam1 = 0;
  121. m_fsm.QueryCurrFSMAndLastS2EventInfo(xFSM,xS2Evt,xS2EvtParam1);
  122. CSimpleStringA msg = CSimpleStringA::Format("While FSM is in state:%d lastS2evt:%d,param1:%d,a new Read req arrived."
  123. , xFSM, xS2Evt, xS2EvtParam1);
  124. //3:Working 4:Failed
  125. if (xFSM == 3)
  126. {
  127. ctx->Answer(Error_InvalidState, CardReadAdapter_UserErrorCode_Read_Wrong_In_Working);
  128. LogError(Severity_Middle, Error_InvalidState, CardReadAdapter_UserErrorCode_Read_Wrong_In_Working, (LPCTSTR)msg);
  129. }
  130. else if (xFSM == 4)
  131. {
  132. ctx->Answer(Error_InvalidState, CardReadAdapter_UserErrorCode_Read_Wrong_In_Failed);
  133. LogError(Severity_Middle, Error_InvalidState, CardReadAdapter_UserErrorCode_Read_Wrong_In_Failed, (LPCTSTR)msg);
  134. }
  135. else
  136. {
  137. CardReadEvent* e = new CardReadEvent();
  138. e->ctx = ctx;
  139. m_fsm.PostEventFIFO(e);
  140. }
  141. }
  142. }
  143. void Capture(SpReqAnsContext<CardReadAdapterService_Capture_Req, CardReadAdapterService_Capture_Ans>::Pointer ctx)
  144. {
  145. LOG_FUNCTION();
  146. CardCaptureEvent* e = new CardCaptureEvent();
  147. e->ctx = ctx;
  148. m_fsm.PostEventFIFO(e);
  149. }
  150. void Eject(SpReqAnsContext<CardReadAdapterService_Eject_Req, CardReadAdapterService_Eject_Ans>::Pointer ctx)
  151. {
  152. LOG_FUNCTION();
  153. CardEjectEvent* e = new CardEjectEvent();
  154. e->ctx = ctx;
  155. m_fsm.PostEventFIFO(e);
  156. }
  157. void CancelRead(SpOnewayCallContext<CardReadAdapterService_CancelRead_Info>::Pointer ctx)
  158. {
  159. LOG_FUNCTION();
  160. if (m_fsm.IsRVCIL())
  161. {
  162. CBlob bbSend;
  163. //ErrorCodeEnum eErr = SpObject2Blob(ctx->Info, bbSend);
  164. m_fsm.LocalCallHeartBeat(CardReadAdapterService_Method_CancelRead, bbSend,true);
  165. }
  166. else
  167. {
  168. CancelReadEvent *e = new CancelReadEvent();
  169. m_fsm.PostEventFIFO(e);
  170. }
  171. }
  172. void ReadWaitMore(SpOnewayCallContext<CardReadAdapterService_ReadWaitMore_Info>::Pointer ctx)
  173. {
  174. LOG_FUNCTION();
  175. if (m_fsm.IsRVCIL())
  176. {
  177. CBlob bbSend;
  178. //ErrorCodeEnum eErr = SpObject2Blob(ctx->Info, bbSend);
  179. m_fsm.LocalCallHeartBeat(CardReadAdapterService_Method_ReadWaitMore, bbSend);
  180. }
  181. else
  182. {
  183. ReadWaitMoreEvent *e = new ReadWaitMoreEvent();
  184. m_fsm.PostEventFIFO(e);
  185. }
  186. }
  187. void Issue(SpReqAnsContext<CardReadAdapterService_Issue_Req, CardReadAdapterService_Issue_Ans>::Pointer ctx)
  188. {
  189. m_bNewSessionInit = false;
  190. CardIssueEvent *pEvt = new CardIssueEvent();
  191. pEvt->ctx = ctx;
  192. m_fsm.PostEventFIFO(pEvt);
  193. }
  194. void PreOnline(SpReqAnsContext<CardReadAdapterService_PreOnline_Req, CardReadAdapterService_PreOnline_Ans>::Pointer ctx)
  195. {
  196. LOG_FUNCTION();
  197. PreOnlineEvent* e = new PreOnlineEvent();
  198. e->ctx = ctx;
  199. m_fsm.PostEventFIFO(e);
  200. }
  201. void PostOnline(SpReqAnsContext<CardReadAdapterService_PostOnline_Req, CardReadAdapterService_PostOnline_Ans>::Pointer ctx)
  202. {
  203. LOG_FUNCTION();
  204. PostOnlineEvent* e = new PostOnlineEvent();
  205. e->ctx = ctx;
  206. m_fsm.PostEventFIFO(e);
  207. }
  208. void Exit(SpOnewayCallContext<CardReadAdapterService_Exit_Info>::Pointer ctx)
  209. {
  210. LOG_FUNCTION();
  211. m_bNewSessionInit = false;
  212. if (m_fsm.IsRVCIL())
  213. {
  214. CBlob bbSend;
  215. //ErrorCodeEnum eErr = SpObject2Blob(ctx->Info, bbSend);
  216. m_fsm.LocalCallHeartBeat(CardReadAdapterService_Method_Exit, bbSend);
  217. }
  218. else
  219. {
  220. FSMEvent *evt = new FSMEvent(USER_EVT_EXIT);
  221. m_fsm.PostEventFIFO(evt);
  222. }
  223. }
  224. void QueryCardInfo(SpReqAnsContext<CardReadAdapterService_QueryCardInfo_Req, CardReadAdapterService_QueryCardInfo_Ans>::Pointer ctx)
  225. {
  226. int xFSM, xS2Evt, xS2EvtParam1;
  227. xFSM = xS2Evt = xS2EvtParam1 = 0;
  228. m_fsm.QueryCurrFSMAndLastS2EventInfo(xFSM, xS2Evt, xS2EvtParam1);
  229. CSimpleStringA msg = CSimpleStringA::Format("While FSM is in state:%d lastS2evt:%d,param1:%d,a new QueryCardInfo req arrived."
  230. , xFSM, xS2Evt, xS2EvtParam1);
  231. //3:Working 4:Failed
  232. if (xFSM == 3)
  233. {
  234. ctx->Answer(Error_InvalidState, CardReadAdapter_UserErrorCode_QueryCardInfo_Wrong_In_Working);
  235. LogError(Severity_Middle, Error_InvalidState, CardReadAdapter_UserErrorCode_QueryCardInfo_Wrong_In_Working, (LPCTSTR)msg);
  236. }
  237. else if (xFSM == 4)
  238. {
  239. ctx->Answer(Error_InvalidState, CardReadAdapter_UserErrorCode_QueryCardInfo_Wrong_In_Failed);
  240. LogError(Severity_Middle, Error_InvalidState, CardReadAdapter_UserErrorCode_QueryCardInfo_Wrong_In_Failed, (LPCTSTR)msg);
  241. }
  242. else
  243. {
  244. QueryCardInfoEvent* pEvt = new QueryCardInfoEvent();
  245. pEvt->ctx = ctx;
  246. m_fsm.PostEventFIFO(pEvt);
  247. }
  248. }
  249. void WriteTrack(SpReqAnsContext<CardReadAdapterService_WriteTrack_Req, CardReadAdapterService_WriteTrack_Ans>::Pointer ctx)
  250. {
  251. CardWriteEvent *pEvt = new CardWriteEvent();
  252. pEvt->ctx = ctx;
  253. m_fsm.PostEventFIFO(pEvt);
  254. }
  255. void SetSomeFlag(SpReqAnsContext<CardReadAdapterService_SetSomeFlag_Req, CardReadAdapterService_SetSomeFlag_Ans>::Pointer ctx)
  256. {
  257. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("set issue flag to %d.", ctx->Req.IssueBusiness);
  258. if (ctx->Req.reserved1.GetCount() > 0)
  259. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("hoppernum:%d", ctx->Req.reserved1[0]);
  260. SetSomeFlagEvent *pEvt = new SetSomeFlagEvent();
  261. pEvt->ctx = ctx;
  262. m_fsm.PostEventFIFO(pEvt);
  263. }
  264. void GetMaterialCount(SpReqAnsContext<CardReadAdapterService_GetMaterialCount_Req, CardReadAdapterService_GetMaterialCount_Ans>::Pointer ctx)
  265. {
  266. GetMaterialEvent *pEvt = new GetMaterialEvent();
  267. pEvt->ctx = ctx;
  268. m_fsm.PostEventFIFO(pEvt);
  269. }
  270. void SetMaterialCount(SpReqAnsContext<CardReadAdapterService_SetMaterialCount_Req, CardReadAdapterService_SetMaterialCount_Ans>::Pointer ctx)
  271. {
  272. SetMaterialEvent *pEvt = new SetMaterialEvent();
  273. pEvt->ctx = ctx;
  274. m_fsm.PostEventFIFO(pEvt);
  275. }
  276. void GetSCIInfo(SpReqAnsContext<CardReadAdapterService_GetSCIInfo_Req, CardReadAdapterService_GetSCIInfo_Ans>::Pointer ctx)
  277. {
  278. GetSCIInfoEvent *pEvt = new GetSCIInfoEvent();
  279. pEvt->ctx = ctx;
  280. m_fsm.PostEventFIFO(pEvt);
  281. }
  282. void OpenSafeLock(SpReqAnsContext<CardReadAdapterService_OpenSafeLock_Req, CardReadAdapterService_OpenSafeLock_Ans>::Pointer ctx)
  283. {
  284. OpenSafeLockEvent *pEvt = new OpenSafeLockEvent();
  285. pEvt->ctx = ctx;
  286. m_fsm.PostEventFIFO(pEvt);
  287. }
  288. void MagTransferInit(SpReqAnsContext<CardReadAdapterService_MagTransferInit_Req, CardReadAdapterService_MagTransferInit_Ans>::Pointer ctx)
  289. {
  290. MagTransferInitEvent *pEvt = new MagTransferInitEvent();
  291. pEvt->ctx = ctx;
  292. m_fsm.PostEventFIFO(pEvt);
  293. }
  294. void QueryConnInfo(SpReqAnsContext<CardReadAdapterService_QueryConnInfo_Req, CardReadAdapterService_QueryConnInfo_Ans>::Pointer ctx)
  295. {
  296. QueryConnInfoEvent *pEvt = new QueryConnInfoEvent();
  297. pEvt->ctx = ctx;
  298. m_fsm.PostEventFIFO(pEvt);
  299. }
  300. void SAMICCommand(SpReqAnsContext<CardReadAdapterService_SAMICCommand_Req, CardReadAdapterService_SAMICCommand_Ans>::Pointer ctx)
  301. {
  302. SAMICCommandEvent *pEvt = new SAMICCommandEvent();
  303. pEvt->ctx = ctx;
  304. m_fsm.PostEventFIFO(pEvt);
  305. }
  306. void QueryPrinterStatus(SpReqAnsContext<CardReadAdapterService_QueryPrinterStatus_Req, CardReadAdapterService_QueryPrinterStatus_Ans>::Pointer ctx)
  307. {
  308. QueryPrinterStatusEvent *pEvt = new QueryPrinterStatusEvent();
  309. pEvt->ctx = ctx;
  310. m_fsm.PostEventFIFO(pEvt);
  311. }
  312. void Print(SpReqAnsContext<CardReadAdapterService_Print_Req, CardReadAdapterService_Print_Ans>::Pointer ctx)
  313. {
  314. PrintEvent *pEvt = new PrintEvent();
  315. pEvt->ctx = ctx;
  316. m_fsm.PostEventFIFO(pEvt);
  317. }
  318. void QuerySCIList(SpReqAnsContext<CardReadAdapterService_QuerySCIList_Req, CardReadAdapterService_QuerySCIList_Ans>::Pointer ctx)
  319. {
  320. QuerySCIListEvent *pEvt = new QuerySCIListEvent();
  321. pEvt->ctx = ctx;
  322. m_fsm.PostEventFIFO(pEvt);
  323. }
  324. void BindSCI(SpReqAnsContext<CardReadAdapterService_BindSCI_Req, CardReadAdapterService_BindSCI_Ans>::Pointer ctx)
  325. {
  326. BindSCIEvent *pEvt = new BindSCIEvent();
  327. pEvt->ctx = ctx;
  328. m_fsm.PostEventFIFO(pEvt);
  329. }
  330. void PreOnlineOnStore(SpReqAnsContext<CardReadAdapterService_PreOnlineOnStore_Req, CardReadAdapterService_PreOnlineOnStore_Ans>::Pointer ctx)
  331. {
  332. PreOnlineOnStoreEvent *pEvt = new PreOnlineOnStoreEvent();
  333. pEvt->ctx = ctx;
  334. m_fsm.PostEventFIFO(pEvt);
  335. }
  336. void NotifyPreonline(SpReqAnsContext<CardReadAdapterService_NotifyPreonline_Req, CardReadAdapterService_NotifyPreonline_Ans>::Pointer ctx)
  337. {
  338. NotifyPreonlineEvent *pEvt = new NotifyPreonlineEvent();
  339. pEvt->ctx = ctx;
  340. m_fsm.PostEventFIFO(pEvt);
  341. }
  342. void QueryCardInfoOnStore(SpReqAnsContext<CardReadAdapterService_QueryCardInfoOnStore_Req, CardReadAdapterService_QueryCardInfoOnStore_Ans>::Pointer ctx)
  343. {
  344. QueryCardInfoOnStoreEvent *pEvt = new QueryCardInfoOnStoreEvent();
  345. pEvt->ctx = ctx;
  346. m_fsm.PostEventFIFO(pEvt);
  347. }
  348. void GetAddCardInfo(SpReqAnsContext<CardReadAdapterService_GetAddCardInfo_Req, CardReadAdapterService_GetAddCardInfo_Ans>::Pointer ctx)
  349. {
  350. GetAddCardInfoEvent *pEvt = new GetAddCardInfoEvent();
  351. pEvt->ctx = ctx;
  352. m_fsm.PostEventFIFO(pEvt);
  353. }
  354. void CrossTermCall(SpReqAnsContext<CardReadAdapterService_CrossTermCall_Req, CardReadAdapterService_CrossTermCall_Ans>::Pointer ctx)
  355. {
  356. CrossTermCallEvent *pEvt = new CrossTermCallEvent();
  357. pEvt->ctx = ctx;
  358. m_fsm.PostEventFIFO(pEvt);
  359. }
  360. void CrossTermInvokeInfo(SpOnewayCallContext<CardReadAdapterService_CrossTermInvokeInfo_Info>::Pointer ctx)
  361. {
  362. m_fsm.CrossTermInvokeInfo(ctx);
  363. }
  364. void PrintCardImmediately(SpReqAnsContext<CardReadAdapterService_PrintCardImmediately_Req, CardReadAdapterService_PrintCardImmediately_Ans>::Pointer ctx)
  365. {
  366. PrintCardImEvent* pEvt = new PrintCardImEvent();
  367. pEvt->ctx = ctx;
  368. m_fsm.PostEventFIFO(pEvt);
  369. }
  370. void GetDevInfo(SpReqAnsContext<CardReadAdapterService_GetDevInfo_Req, CardReadAdapterService_GetDevInfo_Ans>::Pointer ctx)
  371. {
  372. GetDevInfoEvent *pEvt = new GetDevInfoEvent();
  373. pEvt->ctx = ctx;
  374. m_fsm.PostEventFIFO(pEvt);
  375. }
  376. virtual bool IsService()const{return true;}
  377. virtual bool IsMultiThread()const{return true;}
  378. virtual void OnBroadcastEvent(CUUID SubID, const char *pszEntityName, DWORD dwMessageId, DWORD dwMessageSignature, CAutoBuffer Buffer);
  379. protected:
  380. private:
  381. CCardReadAdapterFSM m_fsm;
  382. CUUID m_uuidCIMsg, m_uuidCSMsg, m_uuidCCMsg;
  383. bool bInitialized, m_bNewSessionInit;// , m_bCIMsg, m_bCCMsg, m_bCSMsg;
  384. private:
  385. };