Browse Source

Z991239-5365 #comment 增加pinpad的JS接口

oilyang 1 year ago
parent
commit
8ed258adab

+ 49 - 0
Module/mod_pinpad/PinPad_client_g.h

@@ -150,6 +150,55 @@ public:
 		return Error;
 	}
 
+	ErrorCodeEnum InputCancelJS(PinPadService_InputCancelJS_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(PinPadService_Method_InputCancelJS, PinPadService_MethodSignature_InputCancelJS, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum InputCancelJS(PinPadService_InputCancelJS_Req &Req, PinPadService_InputCancelJS_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = InputCancelJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum InputCancelJS(PinPadService_InputCancelJS_Req &Req, PinPadService_InputCancelJS_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = InputCancelJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum InputCancelJS(PinPadService_InputCancelJS_Req &Req, PinPadService_InputCancelJS_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = InputCancelJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
 	ErrorCodeEnum GetInputSM(PinPadService_GetInputSM_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();

+ 21 - 0
Module/mod_pinpad/PinPad_def_g.h

@@ -16,6 +16,7 @@ namespace PinPad {
 #define PinPadService_Method_InputCancel 2
 #define PinPadService_Method_Exit 3
 #define PinPadService_Method_GetInputJS 4
+#define PinPadService_Method_InputCancelJS 5
 #define PinPadService_Method_GetInputSM 6
 #define PinPadService_Method_LoadKeysSM 7
 #define PinPadService_Method_EncryptDataSM 8
@@ -27,6 +28,7 @@ namespace PinPad {
 #define PinPadService_MethodSignature_InputCancel 1552926476
 #define PinPadService_MethodSignature_Exit -1158854104
 #define PinPadService_MethodSignature_GetInputJS -1183236923
+#define PinPadService_MethodSignature_InputCancelJS 955728257
 #define PinPadService_MethodSignature_GetInputSM -1531281659
 #define PinPadService_MethodSignature_LoadKeysSM -2091559314
 #define PinPadService_MethodSignature_EncryptDataSM 1251510330
@@ -38,6 +40,7 @@ namespace PinPad {
 #define PinPadService_LogCode_InputCancel "QLR040220602"
 #define PinPadService_LogCode_Exit "QLR040220603"
 #define PinPadService_LogCode_GetInputJS "QLR040220604"
+#define PinPadService_LogCode_InputCancelJS "QLR040220605"
 #define PinPadService_LogCode_GetInputSM "QLR040220606"
 #define PinPadService_LogCode_LoadKeysSM "QLR040220607"
 #define PinPadService_LogCode_EncryptDataSM "QLR040220608"
@@ -111,6 +114,24 @@ struct PinPadService_GetInputJS_Ans
 
 };
 
+struct PinPadService_InputCancelJS_Req
+{
+
+	void Serialize(SpBuffer &Buf)
+	{
+	}
+
+};
+
+struct PinPadService_InputCancelJS_Ans
+{
+
+	void Serialize(SpBuffer &Buf)
+	{
+	}
+
+};
+
 struct PinPadService_GetInputSM_Req
 {
 	int timeout;

+ 15 - 0
Module/mod_pinpad/PinPad_msg_g.h

@@ -10,8 +10,10 @@
 
 namespace PinPad {
 #define eMsg_InputContent 0
+#define eMsg_InputContentJS 1
 
 #define eMsgSig_InputContent -1171779670
+#define eMsgSig_InputContentJS -1687407804
 
 struct InputContent
 {
@@ -26,5 +28,18 @@ struct InputContent
 
 ///////////////////////////
 
+struct InputContentJS
+{
+	CSimpleStringA data;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & data;
+	}
+
+};
+
+///////////////////////////
+
 } // namespace PinPad
 #endif // __PINPAD_MSG_G_H

+ 27 - 0
Module/mod_pinpad/PinPad_server_g.h

@@ -58,6 +58,13 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case PinPadService_Method_InputCancelJS:
+			if (dwSignature == PinPadService_MethodSignature_InputCancelJS) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		case PinPadService_Method_GetInputSM:
 			if (dwSignature == PinPadService_MethodSignature_GetInputSM) {
 				bOverlap = true;
@@ -131,6 +138,11 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case PinPadService_Method_InputCancelJS:
+			if (dwSignature != PinPadService_MethodSignature_InputCancelJS) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		case PinPadService_Method_GetInputSM:
 			if (dwSignature != PinPadService_MethodSignature_GetInputSM) {
 				Error = Error_MethodSignatureFailed;
@@ -188,6 +200,11 @@ public:
 	/// override by user
 	}
 
+	virtual void Handle_InputCancelJS(SpReqAnsContext<PinPadService_InputCancelJS_Req, PinPadService_InputCancelJS_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
 	virtual void Handle_GetInputSM(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctx)
 	{
 	/// override by user
@@ -274,6 +291,16 @@ public:
 						Handle_GetInputJS(ctx);
 					}
 					break;
+				case PinPadService_Method_InputCancelJS:
+					{
+						SpReqAnsContext<PinPadService_InputCancelJS_Req,PinPadService_InputCancelJS_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<PinPadService_InputCancelJS_Req,PinPadService_InputCancelJS_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_InputCancelJS(ctx);
+					}
+					break;
 				case PinPadService_Method_GetInputSM:
 					{
 						SpReqAnsContext<PinPadService_GetInputSM_Req,PinPadService_GetInputSM_Ans>::Pointer ctx;

+ 10 - 1
Module/mod_pinpad/pinpad.xml

@@ -32,7 +32,13 @@
 				<param name="reserved4" type="string" />
 			</res>			
 		</twoway>
-		<twoway name="GetInputSM" overlap="true" method_id="6">
+    <twoway name="InputCancelJS" overlap="true" method_id="5">
+      <req>
+      </req>
+      <res>
+      </res>
+    </twoway>
+    <twoway name="GetInputSM" overlap="true" method_id="6">
 			<req>
 				<param name="timeout" type="int" />
 				<param name="length" type="int" />
@@ -135,4 +141,7 @@
 	<message name="InputContent">
 			<param name="data" type="string"/>
 	</message>
+  <message name="InputContentJS">
+    <param name="data" type="string"/>
+  </message>  
 </entity>