mod_cardissuerStand.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. #include "CardIssuerStand_server_g.h"
  2. #include "CardIssuerStand_def_g.h"
  3. #include "CardIssuerStandFSM.h"
  4. #include "DevEntityCommBase.hpp"
  5. using namespace CardIssuerStand;
  6. class CCardIssuerEntity;
  7. class CardIssuerServerSession : public CardIssuerStandService_ServerSessionBase
  8. {
  9. public:
  10. CardIssuerServerSession(CCardIssuerEntity* pEntity):m_pEntity(pEntity){}
  11. virtual ~CardIssuerServerSession(){}
  12. virtual void Handle_Insert(SpReqAnsContext<CardIssuerStandService_Insert_Req, CardIssuerStandService_Insert_Ans>::Pointer ctx);
  13. virtual void Handle_Read(SpReqAnsContext<CardIssuerStandService_Read_Req, CardIssuerStandService_Read_Ans>::Pointer ctx);
  14. virtual void Handle_Capture(SpReqAnsContext<CardIssuerStandService_Capture_Req, CardIssuerStandService_Capture_Ans>::Pointer ctx);
  15. virtual void Handle_Eject(SpReqAnsContext<CardIssuerStandService_Eject_Req, CardIssuerStandService_Eject_Ans>::Pointer ctx);
  16. virtual void Handle_CancelInsert(SpOnewayCallContext<CardIssuerStandService_CancelInsert_Info>::Pointer ctx);
  17. virtual void Handle_InsertWaitMore(SpOnewayCallContext<CardIssuerStandService_InsertWaitMore_Info>::Pointer ctx);
  18. virtual void Handle_PreOnline(SpReqAnsContext<CardIssuerStandService_PreOnline_Req, CardIssuerStandService_PreOnline_Ans>::Pointer ctx);
  19. virtual void Handle_PostOnline(SpReqAnsContext<CardIssuerStandService_PostOnline_Req, CardIssuerStandService_PostOnline_Ans>::Pointer ctx);
  20. virtual void Handle_Exit(SpOnewayCallContext<CardIssuerStandService_Exit_Info>::Pointer ctx);
  21. virtual void Handle_SetIssueFlag(SpOnewayCallContext<CardIssuerStandService_SetIssueFlag_Info>::Pointer ctx);
  22. virtual void Handle_QueryCardInfo(SpReqAnsContext<CardIssuerStandService_QueryCardInfo_Req, CardIssuerStandService_QueryCardInfo_Ans>::Pointer ctx);
  23. virtual void Handle_WriteTrack(SpReqAnsContext<CardIssuerStandService_WriteTrack_Req, CardIssuerStandService_WriteTrack_Ans>::Pointer ctx);
  24. virtual void Handle_GetMaterialCountEx(SpReqAnsContext<CardIssuerStandService_GetMaterialCountEx_Req, CardIssuerStandService_GetMaterialCountEx_Ans>::Pointer ctx);
  25. virtual void Handle_SetMaterialCountEx(SpReqAnsContext<CardIssuerStandService_SetMaterialCountEx_Req, CardIssuerStandService_SetMaterialCountEx_Ans>::Pointer ctx);
  26. virtual void Handle_SetSomeFlag(SpReqAnsContext<CardIssuerStandService_SetSomeFlag_Req, CardIssuerStandService_SetSomeFlag_Ans>::Pointer ctx);
  27. virtual void Handle_IssueEx(SpReqAnsContext<CardIssuerStandService_IssueEx_Req, CardIssuerStandService_IssueEx_Ans>::Pointer ctx);
  28. virtual void Handle_SAMICCommand(SpReqAnsContext<CardIssuerStandService_SAMICCommand_Req, CardIssuerStandService_SAMICCommand_Ans>::Pointer ctx);
  29. virtual void Handle_QueryCIStatus(SpReqAnsContext<CardIssuerStandService_QueryCIStatus_Req, CardIssuerStandService_QueryCIStatus_Ans>::Pointer ctx);
  30. virtual void Handle_GetDevInfo(SpReqAnsContext<CardIssuerStandService_GetDevInfo_Req, CardIssuerStandService_GetDevInfo_Ans>::Pointer ctx);
  31. //JS接口定义
  32. virtual void Handle_ReadJS(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, CardIssuerStandService_ReadJS_Ans>::Pointer ctx);
  33. virtual void Handle_PostOnlineJS(SpReqAnsContext<CardIssuerStandService_PostOnlineJS_Req, CardIssuerStandService_PostOnlineJS_Ans>::Pointer ctx);
  34. virtual void Handle_EjectJS(SpReqAnsContext<CardIssuerStandService_EjectJS_Req, CardIssuerStandService_EjectJS_Ans>::Pointer ctx);
  35. virtual void Handle_CaptureJS(SpReqAnsContext<CardIssuerStandService_CaptureJS_Req, CardIssuerStandService_CaptureJS_Ans>::Pointer ctx);
  36. virtual void Handle_QueryHasCardJS(SpReqAnsContext<CardIssuerStandService_QueryHasCardJS_Req, CardIssuerStandService_QueryHasCardJS_Ans>::Pointer ctx);
  37. virtual void Handle_IssueFromBoxJS(SpReqAnsContext<CardIssuerStandService_IssueFromBoxJS_Req, CardIssuerStandService_IssueFromBoxJS_Ans>::Pointer ctx);
  38. virtual void Handle_InsertJS(SpReqAnsContext<CardIssuerStandService_InsertJS_Req, CardIssuerStandService_InsertJS_Ans>::Pointer ctx);
  39. virtual void Handle_CancelInsertJS(SpOnewayCallContext<CardIssuerStandService_CancelInsertJS_Info>::Pointer ctx);
  40. private:
  41. CCardIssuerEntity* m_pEntity;
  42. };
  43. class CCardIssuerEntity : public CDevAdptEntityBase, public ISysVarListener
  44. {
  45. public:
  46. CCardIssuerEntity() :bInitialized(false)
  47. {
  48. }
  49. virtual ~CCardIssuerEntity(){}
  50. virtual const char *GetEntityName() const { return "CardIssuerStand"; }
  51. virtual void OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext)
  52. {
  53. LOG_FUNCTION();
  54. ErrorCodeEnum eStart = m_fsm.Init(this);
  55. if (eStart == Error_Succeed)
  56. {
  57. }
  58. GetFunction()->RegistSysVarEvent("UIState", this);
  59. pTransactionContext->SendAnswer(eStart);
  60. }
  61. virtual void OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer<ITransactionContext> pTransactionContext)
  62. {
  63. ErrorCodeEnum Error = __OnStart(Error_Succeed);
  64. pTransactionContext->SendAnswer(Error);
  65. }
  66. virtual void OnPrePause(CSmartPointer<ITransactionContext> pTransactionContext)
  67. {
  68. ErrorCodeEnum Error = __OnPause(Error_Succeed,pTransactionContext);
  69. pTransactionContext->SendAnswer(Error);
  70. }
  71. virtual ErrorCodeEnum __OnStart(ErrorCodeEnum preOperationError)
  72. {
  73. return Error_Succeed;
  74. }
  75. virtual ErrorCodeEnum __OnPause(ErrorCodeEnum preOperationError, CSmartPointer<ITransactionContext> pTransactionContext)
  76. {
  77. return Error_Succeed;
  78. }
  79. virtual ErrorCodeEnum __OnClose(ErrorCodeEnum preOperationError)
  80. {
  81. return Error_Succeed;
  82. }
  83. virtual void OnSelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext)
  84. {
  85. m_fsm.SelfTest(eTestType,pTransactionContext);
  86. }
  87. virtual CServerSessionBase* OnNewSession(const char*,const char*)
  88. {
  89. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("A new connecting request arrived.");
  90. m_bNewSessionInit = true;
  91. return new CardIssuerServerSession(this);
  92. }
  93. void Insert(SpReqAnsContext<CardIssuerStandService_Insert_Req, CardIssuerStandService_Insert_Ans>::Pointer ctx)
  94. {
  95. LOG_FUNCTION();
  96. if(!m_fsm.GetDevInitFlag()){
  97. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  98. LogWarn(Severity_Middle, Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed, "Insert but DevOpen failed.");
  99. }else{
  100. m_bNewSessionInit = false;
  101. m_fsm.SetExitFlag(false);
  102. CardAcceptEvent *e = new CardAcceptEvent();
  103. e->ctx = ctx;
  104. m_fsm.PostEventFIFO(e);
  105. }
  106. }
  107. void Read(SpReqAnsContext<CardIssuerStandService_Read_Req, CardIssuerStandService_Read_Ans>::Pointer ctx)
  108. {
  109. LOG_FUNCTION();
  110. CardReadEvent* e = new CardReadEvent();
  111. e->ctx = ctx;
  112. m_fsm.PostEventFIFO(e);
  113. }
  114. void Capture(SpReqAnsContext<CardIssuerStandService_Capture_Req, CardIssuerStandService_Capture_Ans>::Pointer ctx)
  115. {
  116. LOG_FUNCTION();
  117. CardCaptureEvent* e = new CardCaptureEvent();
  118. e->ctx = ctx;
  119. m_fsm.PostEventFIFO(e);
  120. }
  121. void Eject(SpReqAnsContext<CardIssuerStandService_Eject_Req, CardIssuerStandService_Eject_Ans>::Pointer ctx)
  122. {
  123. LOG_FUNCTION();
  124. CardEjectEvent* e = new CardEjectEvent();
  125. e->ctx = ctx;
  126. m_fsm.PostEventFIFO(e);
  127. }
  128. void CancelInsert(SpOnewayCallContext<CardIssuerStandService_CancelInsert_Info>::Pointer ctx)
  129. {
  130. LOG_FUNCTION();
  131. CancelAcceptEvent *e = new CancelAcceptEvent();
  132. m_fsm.PostEventFIFO(e);
  133. }
  134. void InsertWaitMore(SpOnewayCallContext<CardIssuerStandService_InsertWaitMore_Info>::Pointer ctx)
  135. {
  136. LOG_FUNCTION();
  137. if (m_fsm.GetWaitFlag())
  138. m_fsm.SetWaitMore();
  139. }
  140. void Issue(SpReqAnsContext<CardIssuerStandService_Issue_Req, CardIssuerStandService_Issue_Ans>::Pointer ctx)
  141. {
  142. LOG_FUNCTION();
  143. m_bNewSessionInit = false;
  144. CardIssueEvent *pEvt = new CardIssueEvent();
  145. pEvt->ctx = ctx;
  146. m_fsm.PostEventFIFO(pEvt);
  147. }
  148. void PreOnline(SpReqAnsContext<CardIssuerStandService_PreOnline_Req, CardIssuerStandService_PreOnline_Ans>::Pointer ctx)
  149. {
  150. LOG_FUNCTION();
  151. if (!m_fsm.GetDevInitFlag()) {
  152. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  153. }
  154. else {
  155. if (ctx->Req.reserved1.GetLength() > 0 && strnicmp("kaku#", (const char*)ctx->Req.reserved1, 5) == 0)
  156. {
  157. int state = m_fsm.GetFSMState();
  158. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("PreOnline m_currentFSMState:%d", state));
  159. if (state == 9)
  160. {
  161. ctx->Answer(Error_BridgeNotOK);
  162. return;
  163. }
  164. else if (state != 2)
  165. {
  166. ctx->Answer(Error_InvalidState);
  167. return;
  168. }
  169. }
  170. PreOnlineEvent* e = new PreOnlineEvent();
  171. e->ctx = ctx;
  172. m_fsm.PostEventFIFO(e);
  173. }
  174. }
  175. void PostOnline(SpReqAnsContext<CardIssuerStandService_PostOnline_Req, CardIssuerStandService_PostOnline_Ans>::Pointer ctx)
  176. {
  177. LOG_FUNCTION();
  178. PostOnlineEvent* e = new PostOnlineEvent();
  179. e->ctx = ctx;
  180. m_fsm.PostEventFIFO(e);
  181. }
  182. void Exit(SpOnewayCallContext<CardIssuerStandService_Exit_Info>::Pointer ctx)
  183. {
  184. LOG_FUNCTION();
  185. m_bNewSessionInit = false;
  186. FSMEvent *evt = new FSMEvent(USER_EVT_EXIT);
  187. m_fsm.PostEventFIFO(evt);
  188. }
  189. void QueryCardInfo(SpReqAnsContext<CardIssuerStandService_QueryCardInfo_Req, CardIssuerStandService_QueryCardInfo_Ans>::Pointer ctx)
  190. {
  191. if (m_bNewSessionInit)
  192. {
  193. FSMEvent *pEvt = new FSMEvent(USER_EVT_EXIT);
  194. m_fsm.PostEventFIFO(pEvt);
  195. ctx->Ans.position = CI_MEDIA_NOTPRESENT;
  196. ctx->Answer(Error_Succeed);
  197. }
  198. else
  199. {
  200. int ret = m_fsm.QueryCardPos();
  201. if (ret != 1)//query hardware ok
  202. ctx->Ans.position = ret;
  203. else
  204. {
  205. if (_stricmp(m_fsm.GetCurrStateName(), "Hold") == 0)
  206. ctx->Ans.position = 2;
  207. else
  208. ctx->Ans.position = 0;
  209. }
  210. ctx->Answer(Error_Succeed);
  211. }
  212. }
  213. void SetIssueFlag(SpOnewayCallContext<CardIssuerStandService_SetIssueFlag_Info>::Pointer ctx){ m_fsm.FrontSetIssueFlag(true); }
  214. void GetMaterialCountEx(SpReqAnsContext<CardIssuerStandService_GetMaterialCountEx_Req, CardIssuerStandService_GetMaterialCountEx_Ans>::Pointer ctx)
  215. {
  216. m_bNewSessionInit = false;
  217. GetMaterialExEvent *pEvt = new GetMaterialExEvent();
  218. pEvt->ctx = ctx;
  219. m_fsm.PostEventFIFO(pEvt);
  220. }
  221. void SetMaterialCountEx(SpReqAnsContext<CardIssuerStandService_SetMaterialCountEx_Req, CardIssuerStandService_SetMaterialCountEx_Ans>::Pointer ctx)
  222. {
  223. m_bNewSessionInit = false;
  224. SetMaterialExEvent *pEvt = new SetMaterialExEvent();
  225. pEvt->ctx = ctx;
  226. m_fsm.PostEventFIFO(pEvt);
  227. }
  228. void SetSomeFlag(SpReqAnsContext<CardIssuerStandService_SetSomeFlag_Req, CardIssuerStandService_SetSomeFlag_Ans>::Pointer ctx)
  229. {
  230. //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set issue flag to %d", ctx->Req.IssueBusiness);
  231. if (ctx->Req.IssueBusiness == 1)
  232. m_fsm.FrontSetIssueFlag(true);
  233. else if (ctx->Req.IssueBusiness == 0)
  234. m_fsm.FrontSetIssueFlag(false);
  235. else if (ctx->Req.IssueBusiness == 2)//oilyang@20170621 query issue direction
  236. {
  237. ctx->Ans.reserved1.Init(1);
  238. ctx->Ans.reserved1[0] = (m_fsm.QueryIssueFlag() ? 0 : 1);//according to yzx
  239. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("issue direction:%d",ctx->Ans.reserved1[0]);//if 0 capture card eles eject card
  240. }
  241. else if (ctx->Req.IssueBusiness == 3)//oilyang@20181210
  242. {
  243. m_fsm.SetCancelByRFICFlag();
  244. }
  245. else if (ctx->Req.IssueBusiness == 4)//oilyang@20181220 get ic card account,for simple/lazy...
  246. {
  247. ctx->Ans.reserved2.Init(1);
  248. ctx->Ans.reserved2[0] = m_fsm.GetPreOnlineICCardNo();
  249. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("GetPreOnlineICCardNo:%d", ctx->Ans.reserved2[0].GetLength());
  250. }
  251. if (ctx->Req.reserved1.GetCount() > 0)
  252. {
  253. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set hopper num:%d",ctx->Req.reserved1[0]);
  254. if (ctx->Req.reserved1[0] == 1)
  255. m_fsm.SetHopperNum(1);
  256. else if (ctx->Req.reserved1[0] == 3)
  257. m_fsm.SetHopperNum(3);
  258. }
  259. ctx->Answer(Error_Succeed);
  260. }
  261. void IssueEx(SpReqAnsContext<CardIssuerStandService_IssueEx_Req, CardIssuerStandService_IssueEx_Ans>::Pointer ctx)
  262. {
  263. LOG_FUNCTION();
  264. int state = m_fsm.GetFSMState();
  265. if (!m_fsm.GetDevInitFlag()) {
  266. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  267. }
  268. else if (state == 9) {
  269. ctx->Answer(Error_InvalidState, CardIssuer_UserErrorCode_StandEntityInFailState);
  270. }
  271. else {
  272. m_bNewSessionInit = false;
  273. CardIssueExEvent* pEvt = new CardIssueExEvent();
  274. pEvt->ctx = ctx;
  275. m_fsm.PostEventFIFO(pEvt);
  276. }
  277. }
  278. void GetDevInfo(SpReqAnsContext<CardIssuerStandService_GetDevInfo_Req, CardIssuerStandService_GetDevInfo_Ans>::Pointer ctx)
  279. {
  280. LOG_FUNCTION();
  281. ctx->Ans.state = m_fsm.GetDevState();
  282. if (m_fsm.GetDevInitingFlag()) {
  283. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetDevInfo device is opening,state return 0");
  284. ctx->Ans.state = DEVICE_STATUS_NOT_READY;
  285. ctx->Answer(Error_NotInit, CardIssuer_UserErrorCode_DevOpen_Failed);
  286. }
  287. else {
  288. //设备未正常打开时,直接报state=0;
  289. if (!m_fsm.GetDevInitFlag()) {
  290. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetDevInfo device is not open,state return 0");
  291. ctx->Ans.state = DEVICE_STATUS_NOT_READY;
  292. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  293. }
  294. else {
  295. if (ctx->Ans.state != DEVICE_STATUS_NORMAL) {
  296. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetDevInfo state=%d", ctx->Ans.state);
  297. }
  298. ctx->Answer(Error_Succeed);
  299. }
  300. }
  301. }
  302. void QueryCIStatus(SpReqAnsContext<CardIssuerStandService_QueryCIStatus_Req, CardIssuerStandService_QueryCIStatus_Ans>::Pointer ctx)
  303. {
  304. m_fsm.QueryCIStatus(ctx);
  305. }
  306. virtual void OnSysVarEvent(const char* pszKey, const char* pszValue, const char* pszOldValue, const char* pszEntityName);
  307. virtual bool IsService()const{return true;}
  308. virtual bool IsMultiThread()const{return true;}
  309. //JS接口实现
  310. void ReadJS(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, CardIssuerStandService_ReadJS_Ans>::Pointer ctx)
  311. {
  312. LOG_FUNCTION();
  313. if (!m_fsm.GetDevInitFlag())
  314. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  315. else
  316. {
  317. ReadJSEvent* pEvt = new ReadJSEvent();
  318. pEvt->ctx = ctx;
  319. m_fsm.PostEventFIFO(pEvt);
  320. }
  321. }
  322. void PostOnlineJS(SpReqAnsContext<CardIssuerStandService_PostOnlineJS_Req, CardIssuerStandService_PostOnlineJS_Ans>::Pointer ctx)
  323. {
  324. LOG_FUNCTION();
  325. if (!m_fsm.GetDevInitFlag())
  326. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  327. else
  328. {
  329. PostOnlineJSEvent* pEvt = new PostOnlineJSEvent();
  330. pEvt->ctx = ctx;
  331. m_fsm.PostEventFIFO(pEvt);
  332. }
  333. }
  334. void EjectJS(SpReqAnsContext<CardIssuerStandService_EjectJS_Req, CardIssuerStandService_EjectJS_Ans>::Pointer ctx)
  335. {
  336. LOG_FUNCTION();
  337. if (!m_fsm.GetDevInitFlag())
  338. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  339. else
  340. {
  341. EjectJSEvent* e = new EjectJSEvent();
  342. e->ctx = ctx;
  343. m_fsm.PostEventFIFO(e);
  344. }
  345. }
  346. void CaptureJS(SpReqAnsContext<CardIssuerStandService_CaptureJS_Req, CardIssuerStandService_CaptureJS_Ans>::Pointer ctx)
  347. {
  348. LOG_FUNCTION();
  349. if (!m_fsm.GetDevInitFlag())
  350. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  351. else
  352. {
  353. CaptureJSEvent* e = new CaptureJSEvent();
  354. e->ctx = ctx;
  355. m_fsm.PostEventFIFO(e);
  356. }
  357. }
  358. void QueryHasCardJS(SpReqAnsContext<CardIssuerStandService_QueryHasCardJS_Req, CardIssuerStandService_QueryHasCardJS_Ans>::Pointer ctx)
  359. {
  360. LOG_FUNCTION();
  361. if (!m_fsm.GetDevInitFlag())
  362. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  363. else
  364. m_fsm.QueryHasCardJS(ctx);
  365. }
  366. void IssueFromBoxJS(SpReqAnsContext<CardIssuerStandService_IssueFromBoxJS_Req, CardIssuerStandService_IssueFromBoxJS_Ans>::Pointer ctx)
  367. {
  368. LOG_FUNCTION();
  369. if (!m_fsm.GetDevInitFlag())
  370. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  371. else
  372. {
  373. IssueFromBoxJSEvent* pEvt = new IssueFromBoxJSEvent();
  374. pEvt->ctx = ctx;
  375. m_fsm.PostEventFIFO(pEvt);
  376. }
  377. }
  378. void InsertJS(SpReqAnsContext<CardIssuerStandService_InsertJS_Req, CardIssuerStandService_InsertJS_Ans>::Pointer ctx)
  379. {
  380. LOG_FUNCTION();
  381. if (!m_fsm.GetDevInitFlag())
  382. ctx->Answer(Error_DevNotAvailable, CardIssuer_UserErrorCode_DevOpen_Failed);
  383. else
  384. {
  385. InsertJSEvent* pEvt = new InsertJSEvent();
  386. pEvt->ctx = ctx;
  387. m_fsm.PostEventFIFO(pEvt);
  388. }
  389. }
  390. void CancelInsertJS(SpOnewayCallContext<CardIssuerStandService_CancelInsertJS_Info>::Pointer ctx)
  391. {
  392. LOG_FUNCTION();
  393. CancelInsertJSEvent* evt = new CancelInsertJSEvent();
  394. m_fsm.PostEventFIFO(evt);
  395. }
  396. protected:
  397. private:
  398. CCardIssuerFSM m_fsm;
  399. bool bInitialized,m_bNewSessionInit;
  400. };