PinPad_client_g.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. #ifndef __PINPAD_CLIENT_G_H
  2. #define __PINPAD_CLIENT_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "PinPad_def_g.h"
  6. namespace PinPad {
  7. class PinPadService_ClientBase : public CClientSessionBase {
  8. public:
  9. explicit PinPadService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {}
  10. PinPadService_ClientBase* operator () (const linkContext &curLink)
  11. {
  12. m_context = curLink;
  13. return this;
  14. }
  15. protected:
  16. virtual ~PinPadService_ClientBase()
  17. {
  18. /// override by user
  19. }
  20. public:
  21. void OnConnectSucceed()
  22. {
  23. bSessionClosed = false;
  24. }
  25. void OnClose(ErrorCodeEnum)
  26. {
  27. Dbg("session closed.");
  28. bSessionClosed = true;
  29. }
  30. bool QuerySessionClosed()
  31. {
  32. return bSessionClosed;
  33. }
  34. ErrorCodeEnum Connect(CSmartPointer<IAsynWaitSp> &spAsyncWait)
  35. {
  36. CSmartPointer<IEntityFunction> pFunc = m_pEntityBase->GetFunction();
  37. ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "PinPad", "PinPadService", spAsyncWait);
  38. if (Error == Error_Succeed) {
  39. m_bSysManaged = true;
  40. bSessionClosed = false;
  41. }
  42. return Error;
  43. }
  44. ErrorCodeEnum Connect()
  45. {
  46. CSmartPointer<IAsynWaitSp> spAsyncWait;
  47. ErrorCodeEnum Error = Connect(spAsyncWait);
  48. if (Error == Error_Succeed) {
  49. Error = spAsyncWait->WaitAnswer();
  50. }
  51. return Error;
  52. }
  53. ErrorCodeEnum GetInput(PinPadService_GetInput_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  54. {
  55. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  56. CAutoBuffer Buf = SpObject2Buffer(Req);
  57. if (m_context.checkEmpty())
  58. {
  59. m_context.AutoGenerate();
  60. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  61. m_context = m_context.upgradeLink();
  62. }
  63. auto ret = pFunc->AsyncRequest(PinPadService_Method_GetInput, PinPadService_MethodSignature_GetInput, Buf, spAsyncWait, m_context, dwTimeout);
  64. m_context.clear();
  65. return ret;
  66. }
  67. ErrorCodeEnum GetInput(PinPadService_GetInput_Req &Req, PinPadService_GetInput_Ans &Ans, DWORD dwTimeout)
  68. {
  69. CSmartPointer<IAsynWaitSp> spAsyncWait;
  70. ErrorCodeEnum Error = GetInput(Req, spAsyncWait, dwTimeout);
  71. if (Error == Error_Succeed) {
  72. bool bEnd = false;
  73. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  74. LOG_ASSERT(Error || bEnd);
  75. }
  76. return Error;
  77. }
  78. ErrorCodeEnum GetInput(PinPadService_GetInput_Req &Req, PinPadService_GetInput_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  79. {
  80. CSmartPointer<IAsynWaitSp> spAsyncWait;
  81. ErrorCodeEnum Error = GetInput(Req, spAsyncWait, dwTimeout);
  82. if (Error == Error_Succeed) {
  83. bool bEnd = false;
  84. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  85. LOG_ASSERT(Error || bEnd);
  86. }
  87. return Error;
  88. }
  89. ErrorCodeEnum GetInput(PinPadService_GetInput_Req &Req, PinPadService_GetInput_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  90. {
  91. CSmartPointer<IAsynWaitSp> spAsyncWait;
  92. ErrorCodeEnum Error = GetInput(Req, spAsyncWait, dwTimeout);
  93. if (Error == Error_Succeed) {
  94. bool bEnd = false;
  95. CSimpleString str;
  96. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  97. LOG_ASSERT(Error || bEnd);
  98. }
  99. return Error;
  100. }
  101. ErrorCodeEnum InputWaitMore()
  102. {
  103. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  104. if (m_context.checkEmpty())
  105. {
  106. m_context.AutoGenerate();
  107. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  108. m_context = m_context.upgradeLink();
  109. }
  110. auto ret = pFunc->OnewayCall(PinPadService_Method_InputWaitMore, PinPadService_MethodSignature_InputWaitMore, m_context);
  111. m_context.clear();
  112. return ret;
  113. }
  114. ErrorCodeEnum InputCancel()
  115. {
  116. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  117. if (m_context.checkEmpty())
  118. {
  119. m_context.AutoGenerate();
  120. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  121. m_context = m_context.upgradeLink();
  122. }
  123. auto ret = pFunc->OnewayCall(PinPadService_Method_InputCancel, PinPadService_MethodSignature_InputCancel, m_context);
  124. m_context.clear();
  125. return ret;
  126. }
  127. ErrorCodeEnum Exit()
  128. {
  129. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  130. if (m_context.checkEmpty())
  131. {
  132. m_context.AutoGenerate();
  133. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  134. m_context = m_context.upgradeLink();
  135. }
  136. auto ret = pFunc->OnewayCall(PinPadService_Method_Exit, PinPadService_MethodSignature_Exit, m_context);
  137. m_context.clear();
  138. return ret;
  139. }
  140. ErrorCodeEnum LoadKeys(PinPadService_LoadKeys_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  141. {
  142. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  143. CAutoBuffer Buf = SpObject2Buffer(Req);
  144. if (m_context.checkEmpty())
  145. {
  146. m_context.AutoGenerate();
  147. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  148. m_context = m_context.upgradeLink();
  149. }
  150. auto ret = pFunc->AsyncRequest(PinPadService_Method_LoadKeys, PinPadService_MethodSignature_LoadKeys, Buf, spAsyncWait, m_context, dwTimeout);
  151. m_context.clear();
  152. return ret;
  153. }
  154. ErrorCodeEnum LoadKeys(PinPadService_LoadKeys_Req &Req, PinPadService_LoadKeys_Ans &Ans, DWORD dwTimeout)
  155. {
  156. CSmartPointer<IAsynWaitSp> spAsyncWait;
  157. ErrorCodeEnum Error = LoadKeys(Req, spAsyncWait, dwTimeout);
  158. if (Error == Error_Succeed) {
  159. bool bEnd = false;
  160. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  161. LOG_ASSERT(Error || bEnd);
  162. }
  163. return Error;
  164. }
  165. ErrorCodeEnum LoadKeys(PinPadService_LoadKeys_Req &Req, PinPadService_LoadKeys_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  166. {
  167. CSmartPointer<IAsynWaitSp> spAsyncWait;
  168. ErrorCodeEnum Error = LoadKeys(Req, spAsyncWait, dwTimeout);
  169. if (Error == Error_Succeed) {
  170. bool bEnd = false;
  171. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  172. LOG_ASSERT(Error || bEnd);
  173. }
  174. return Error;
  175. }
  176. ErrorCodeEnum LoadKeys(PinPadService_LoadKeys_Req &Req, PinPadService_LoadKeys_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  177. {
  178. CSmartPointer<IAsynWaitSp> spAsyncWait;
  179. ErrorCodeEnum Error = LoadKeys(Req, spAsyncWait, dwTimeout);
  180. if (Error == Error_Succeed) {
  181. bool bEnd = false;
  182. CSimpleString str;
  183. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  184. LOG_ASSERT(Error || bEnd);
  185. }
  186. return Error;
  187. }
  188. ErrorCodeEnum EncryptData(PinPadService_EncryptData_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  189. {
  190. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  191. CAutoBuffer Buf = SpObject2Buffer(Req);
  192. if (m_context.checkEmpty())
  193. {
  194. m_context.AutoGenerate();
  195. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  196. m_context = m_context.upgradeLink();
  197. }
  198. auto ret = pFunc->AsyncRequest(PinPadService_Method_EncryptData, PinPadService_MethodSignature_EncryptData, Buf, spAsyncWait, m_context, dwTimeout);
  199. m_context.clear();
  200. return ret;
  201. }
  202. ErrorCodeEnum EncryptData(PinPadService_EncryptData_Req &Req, PinPadService_EncryptData_Ans &Ans, DWORD dwTimeout)
  203. {
  204. CSmartPointer<IAsynWaitSp> spAsyncWait;
  205. ErrorCodeEnum Error = EncryptData(Req, spAsyncWait, dwTimeout);
  206. if (Error == Error_Succeed) {
  207. bool bEnd = false;
  208. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  209. LOG_ASSERT(Error || bEnd);
  210. }
  211. return Error;
  212. }
  213. ErrorCodeEnum EncryptData(PinPadService_EncryptData_Req &Req, PinPadService_EncryptData_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  214. {
  215. CSmartPointer<IAsynWaitSp> spAsyncWait;
  216. ErrorCodeEnum Error = EncryptData(Req, spAsyncWait, dwTimeout);
  217. if (Error == Error_Succeed) {
  218. bool bEnd = false;
  219. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  220. LOG_ASSERT(Error || bEnd);
  221. }
  222. return Error;
  223. }
  224. ErrorCodeEnum EncryptData(PinPadService_EncryptData_Req &Req, PinPadService_EncryptData_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  225. {
  226. CSmartPointer<IAsynWaitSp> spAsyncWait;
  227. ErrorCodeEnum Error = EncryptData(Req, spAsyncWait, dwTimeout);
  228. if (Error == Error_Succeed) {
  229. bool bEnd = false;
  230. CSimpleString str;
  231. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  232. LOG_ASSERT(Error || bEnd);
  233. }
  234. return Error;
  235. }
  236. ErrorCodeEnum GetInputSM(PinPadService_GetInputSM_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  237. {
  238. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  239. CAutoBuffer Buf = SpObject2Buffer(Req);
  240. if (m_context.checkEmpty())
  241. {
  242. m_context.AutoGenerate();
  243. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  244. m_context = m_context.upgradeLink();
  245. }
  246. auto ret = pFunc->AsyncRequest(PinPadService_Method_GetInputSM, PinPadService_MethodSignature_GetInputSM, Buf, spAsyncWait, m_context, dwTimeout);
  247. m_context.clear();
  248. return ret;
  249. }
  250. ErrorCodeEnum GetInputSM(PinPadService_GetInputSM_Req &Req, PinPadService_GetInputSM_Ans &Ans, DWORD dwTimeout)
  251. {
  252. CSmartPointer<IAsynWaitSp> spAsyncWait;
  253. ErrorCodeEnum Error = GetInputSM(Req, spAsyncWait, dwTimeout);
  254. if (Error == Error_Succeed) {
  255. bool bEnd = false;
  256. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  257. LOG_ASSERT(Error || bEnd);
  258. }
  259. return Error;
  260. }
  261. ErrorCodeEnum GetInputSM(PinPadService_GetInputSM_Req &Req, PinPadService_GetInputSM_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  262. {
  263. CSmartPointer<IAsynWaitSp> spAsyncWait;
  264. ErrorCodeEnum Error = GetInputSM(Req, spAsyncWait, dwTimeout);
  265. if (Error == Error_Succeed) {
  266. bool bEnd = false;
  267. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  268. LOG_ASSERT(Error || bEnd);
  269. }
  270. return Error;
  271. }
  272. ErrorCodeEnum GetInputSM(PinPadService_GetInputSM_Req &Req, PinPadService_GetInputSM_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  273. {
  274. CSmartPointer<IAsynWaitSp> spAsyncWait;
  275. ErrorCodeEnum Error = GetInputSM(Req, spAsyncWait, dwTimeout);
  276. if (Error == Error_Succeed) {
  277. bool bEnd = false;
  278. CSimpleString str;
  279. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  280. LOG_ASSERT(Error || bEnd);
  281. }
  282. return Error;
  283. }
  284. ErrorCodeEnum LoadKeysSM(PinPadService_LoadKeysSM_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  285. {
  286. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  287. CAutoBuffer Buf = SpObject2Buffer(Req);
  288. if (m_context.checkEmpty())
  289. {
  290. m_context.AutoGenerate();
  291. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  292. m_context = m_context.upgradeLink();
  293. }
  294. auto ret = pFunc->AsyncRequest(PinPadService_Method_LoadKeysSM, PinPadService_MethodSignature_LoadKeysSM, Buf, spAsyncWait, m_context, dwTimeout);
  295. m_context.clear();
  296. return ret;
  297. }
  298. ErrorCodeEnum LoadKeysSM(PinPadService_LoadKeysSM_Req &Req, PinPadService_LoadKeysSM_Ans &Ans, DWORD dwTimeout)
  299. {
  300. CSmartPointer<IAsynWaitSp> spAsyncWait;
  301. ErrorCodeEnum Error = LoadKeysSM(Req, spAsyncWait, dwTimeout);
  302. if (Error == Error_Succeed) {
  303. bool bEnd = false;
  304. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  305. LOG_ASSERT(Error || bEnd);
  306. }
  307. return Error;
  308. }
  309. ErrorCodeEnum LoadKeysSM(PinPadService_LoadKeysSM_Req &Req, PinPadService_LoadKeysSM_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  310. {
  311. CSmartPointer<IAsynWaitSp> spAsyncWait;
  312. ErrorCodeEnum Error = LoadKeysSM(Req, spAsyncWait, dwTimeout);
  313. if (Error == Error_Succeed) {
  314. bool bEnd = false;
  315. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  316. LOG_ASSERT(Error || bEnd);
  317. }
  318. return Error;
  319. }
  320. ErrorCodeEnum LoadKeysSM(PinPadService_LoadKeysSM_Req &Req, PinPadService_LoadKeysSM_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  321. {
  322. CSmartPointer<IAsynWaitSp> spAsyncWait;
  323. ErrorCodeEnum Error = LoadKeysSM(Req, spAsyncWait, dwTimeout);
  324. if (Error == Error_Succeed) {
  325. bool bEnd = false;
  326. CSimpleString str;
  327. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  328. LOG_ASSERT(Error || bEnd);
  329. }
  330. return Error;
  331. }
  332. ErrorCodeEnum EncryptDataSM(PinPadService_EncryptDataSM_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  333. {
  334. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  335. CAutoBuffer Buf = SpObject2Buffer(Req);
  336. if (m_context.checkEmpty())
  337. {
  338. m_context.AutoGenerate();
  339. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  340. m_context = m_context.upgradeLink();
  341. }
  342. auto ret = pFunc->AsyncRequest(PinPadService_Method_EncryptDataSM, PinPadService_MethodSignature_EncryptDataSM, Buf, spAsyncWait, m_context, dwTimeout);
  343. m_context.clear();
  344. return ret;
  345. }
  346. ErrorCodeEnum EncryptDataSM(PinPadService_EncryptDataSM_Req &Req, PinPadService_EncryptDataSM_Ans &Ans, DWORD dwTimeout)
  347. {
  348. CSmartPointer<IAsynWaitSp> spAsyncWait;
  349. ErrorCodeEnum Error = EncryptDataSM(Req, spAsyncWait, dwTimeout);
  350. if (Error == Error_Succeed) {
  351. bool bEnd = false;
  352. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  353. LOG_ASSERT(Error || bEnd);
  354. }
  355. return Error;
  356. }
  357. ErrorCodeEnum EncryptDataSM(PinPadService_EncryptDataSM_Req &Req, PinPadService_EncryptDataSM_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  358. {
  359. CSmartPointer<IAsynWaitSp> spAsyncWait;
  360. ErrorCodeEnum Error = EncryptDataSM(Req, spAsyncWait, dwTimeout);
  361. if (Error == Error_Succeed) {
  362. bool bEnd = false;
  363. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  364. LOG_ASSERT(Error || bEnd);
  365. }
  366. return Error;
  367. }
  368. ErrorCodeEnum EncryptDataSM(PinPadService_EncryptDataSM_Req &Req, PinPadService_EncryptDataSM_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  369. {
  370. CSmartPointer<IAsynWaitSp> spAsyncWait;
  371. ErrorCodeEnum Error = EncryptDataSM(Req, spAsyncWait, dwTimeout);
  372. if (Error == Error_Succeed) {
  373. bool bEnd = false;
  374. CSimpleString str;
  375. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  376. LOG_ASSERT(Error || bEnd);
  377. }
  378. return Error;
  379. }
  380. ErrorCodeEnum QueryFunc(PinPadService_QueryFunc_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  381. {
  382. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  383. CAutoBuffer Buf = SpObject2Buffer(Req);
  384. if (m_context.checkEmpty())
  385. {
  386. m_context.AutoGenerate();
  387. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  388. m_context = m_context.upgradeLink();
  389. }
  390. auto ret = pFunc->AsyncRequest(PinPadService_Method_QueryFunc, PinPadService_MethodSignature_QueryFunc, Buf, spAsyncWait, m_context, dwTimeout);
  391. m_context.clear();
  392. return ret;
  393. }
  394. ErrorCodeEnum QueryFunc(PinPadService_QueryFunc_Req &Req, PinPadService_QueryFunc_Ans &Ans, DWORD dwTimeout)
  395. {
  396. CSmartPointer<IAsynWaitSp> spAsyncWait;
  397. ErrorCodeEnum Error = QueryFunc(Req, spAsyncWait, dwTimeout);
  398. if (Error == Error_Succeed) {
  399. bool bEnd = false;
  400. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  401. LOG_ASSERT(Error || bEnd);
  402. }
  403. return Error;
  404. }
  405. ErrorCodeEnum QueryFunc(PinPadService_QueryFunc_Req &Req, PinPadService_QueryFunc_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  406. {
  407. CSmartPointer<IAsynWaitSp> spAsyncWait;
  408. ErrorCodeEnum Error = QueryFunc(Req, spAsyncWait, dwTimeout);
  409. if (Error == Error_Succeed) {
  410. bool bEnd = false;
  411. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  412. LOG_ASSERT(Error || bEnd);
  413. }
  414. return Error;
  415. }
  416. ErrorCodeEnum QueryFunc(PinPadService_QueryFunc_Req &Req, PinPadService_QueryFunc_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  417. {
  418. CSmartPointer<IAsynWaitSp> spAsyncWait;
  419. ErrorCodeEnum Error = QueryFunc(Req, spAsyncWait, dwTimeout);
  420. if (Error == Error_Succeed) {
  421. bool bEnd = false;
  422. CSimpleString str;
  423. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  424. LOG_ASSERT(Error || bEnd);
  425. }
  426. return Error;
  427. }
  428. ErrorCodeEnum GetCheckCode(PinPadService_GetCheckCode_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  429. {
  430. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  431. CAutoBuffer Buf = SpObject2Buffer(Req);
  432. if (m_context.checkEmpty())
  433. {
  434. m_context.AutoGenerate();
  435. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  436. m_context = m_context.upgradeLink();
  437. }
  438. auto ret = pFunc->AsyncRequest(PinPadService_Method_GetCheckCode, PinPadService_MethodSignature_GetCheckCode, Buf, spAsyncWait, m_context, dwTimeout);
  439. m_context.clear();
  440. return ret;
  441. }
  442. ErrorCodeEnum GetCheckCode(PinPadService_GetCheckCode_Req &Req, PinPadService_GetCheckCode_Ans &Ans, DWORD dwTimeout)
  443. {
  444. CSmartPointer<IAsynWaitSp> spAsyncWait;
  445. ErrorCodeEnum Error = GetCheckCode(Req, spAsyncWait, dwTimeout);
  446. if (Error == Error_Succeed) {
  447. bool bEnd = false;
  448. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  449. LOG_ASSERT(Error || bEnd);
  450. }
  451. return Error;
  452. }
  453. ErrorCodeEnum GetCheckCode(PinPadService_GetCheckCode_Req &Req, PinPadService_GetCheckCode_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  454. {
  455. CSmartPointer<IAsynWaitSp> spAsyncWait;
  456. ErrorCodeEnum Error = GetCheckCode(Req, spAsyncWait, dwTimeout);
  457. if (Error == Error_Succeed) {
  458. bool bEnd = false;
  459. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  460. LOG_ASSERT(Error || bEnd);
  461. }
  462. return Error;
  463. }
  464. ErrorCodeEnum GetCheckCode(PinPadService_GetCheckCode_Req &Req, PinPadService_GetCheckCode_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  465. {
  466. CSmartPointer<IAsynWaitSp> spAsyncWait;
  467. ErrorCodeEnum Error = GetCheckCode(Req, spAsyncWait, dwTimeout);
  468. if (Error == Error_Succeed) {
  469. bool bEnd = false;
  470. CSimpleString str;
  471. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  472. LOG_ASSERT(Error || bEnd);
  473. }
  474. return Error;
  475. }
  476. ErrorCodeEnum GetDevInfo(PinPadService_GetDevInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
  477. {
  478. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  479. CAutoBuffer Buf = SpObject2Buffer(Req);
  480. if (m_context.checkEmpty())
  481. {
  482. m_context.AutoGenerate();
  483. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  484. m_context = m_context.upgradeLink();
  485. }
  486. auto ret = pFunc->AsyncRequest(PinPadService_Method_GetDevInfo, PinPadService_MethodSignature_GetDevInfo, Buf, spAsyncWait, m_context, dwTimeout);
  487. m_context.clear();
  488. return ret;
  489. }
  490. ErrorCodeEnum GetDevInfo(PinPadService_GetDevInfo_Req &Req, PinPadService_GetDevInfo_Ans &Ans, DWORD dwTimeout)
  491. {
  492. CSmartPointer<IAsynWaitSp> spAsyncWait;
  493. ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout);
  494. if (Error == Error_Succeed) {
  495. bool bEnd = false;
  496. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
  497. LOG_ASSERT(Error || bEnd);
  498. }
  499. return Error;
  500. }
  501. ErrorCodeEnum GetDevInfo(PinPadService_GetDevInfo_Req &Req, PinPadService_GetDevInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
  502. {
  503. CSmartPointer<IAsynWaitSp> spAsyncWait;
  504. ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout);
  505. if (Error == Error_Succeed) {
  506. bool bEnd = false;
  507. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  508. LOG_ASSERT(Error || bEnd);
  509. }
  510. return Error;
  511. }
  512. ErrorCodeEnum GetDevInfo(PinPadService_GetDevInfo_Req &Req, PinPadService_GetDevInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
  513. {
  514. CSmartPointer<IAsynWaitSp> spAsyncWait;
  515. ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout);
  516. if (Error == Error_Succeed) {
  517. bool bEnd = false;
  518. CSimpleString str;
  519. Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
  520. LOG_ASSERT(Error || bEnd);
  521. }
  522. return Error;
  523. }
  524. bool SafeDelete()
  525. {
  526. if (!m_bSysManaged) {
  527. delete this;
  528. }
  529. return m_bSysManaged;
  530. }
  531. protected:
  532. bool m_bSysManaged;
  533. CEntityBase *m_pEntityBase;
  534. linkContext m_context;
  535. bool bSessionClosed;
  536. };
  537. ///////////////////////////
  538. } // namespace PinPad
  539. #endif // __PINPAD_CLIENT_G_H