I am new to C # and am currently working on internal code to support PIN pads. Basically, my code
OpenDevice() -> RequestPIN()
-> key in PIN on PIN PAD -> GetResultPIN()
-> ConsolePrintOutPIN() -> Print keyed PIN on the Console
I don’t know how to write a stream for this, so after pressing the Enter key on the device after the PIN code, the system will automatically switch to the function GetResultPIN(). So, with my basic knowledge, I wrote the following codes, using Console.ReadLine()to separate each procedure:
static void Main(string[] args)
{
OpenDevice();
Console.ReadLine();
RequestPIN();
Console.ReadLine();
GetResultPIN();
ConsolePrintOutPIN();
Console.ReadLine();
}
Question: Can someone give me any suggestions on using streaming / event / delegate that can avoid using Console.ReadLine()?
, Console.ReadLine() ( ...). Console.ReadLine(), RequestPIN() GetResult(), , PIN- PIN- ( USB, ), , Console.ReadLine() GetResultPIN() PIN- PIN-..... , , , - Console.ReadLine() .....
, . , , RequestPIN() PIN- PIN-, - Enter PIN-, , , GetResultPIN() , PIN- ... `
PIN-, 30 GetResultPIN() "0000"
, , .... !
: RequestPin() GetResultPIN :
mIPAD.requestPIN(waitTime, pinMsg, minLen, maxLen, tone, option, ",");
waitTime: , , PIN-
pinMsg: , " PIN-", "PIN- ", " PIN-" ..
minLen maxLen: PIN-
:
: PIN-, PIN-, ISO0 FOrmat, ISO3
: , 0: , :
public void GetResultPIN()
{
StringBuilder sb = new StringBuilder();
sb.Append(mIPAD.pin.KSN);
sb.Append("," + mIPAD.pin.EPB);
sb.Append("," + mIPAD.getStatusCode());
sb.Append("\r\n");
result = sb.ToString();
}
, GetResultPIN() , :
9A00030000047A2000AB,AD781711481B08A2,0, PIN- . , ,,0.