一、握手成功
public static void Init()
{
websocket = new WebSocket("127.0.0.1:61231");
websocket.Opened += new EventHandler(websocket_Opened);
websocket.Error += new EventHandler<SuperSocket.ClientEngine.ErrorEventArgs>(websocket_Error);
websocket.Closed += new EventHandler(websocket_Closed);
websocket.MessageReceived += websocket_MessageReceived;
websocket.Open();
}
二、读卡
/// <summary>
/// GetCardUserInfoAll
/// </summary>
/// <returns></returns>
public static string GetCardUserInfoAll(string pwd, string method)
{
dynamic send = new ExpandoObject();
send._id = i;
send._method = method;
dynamic args = new ExpandoObject();
args.userpin = pwd;
send.args = args;
var sendMess = JsonHelper.Instance.Serialize(send);
websocket.Send(sendMess);
i++;
while (res.IndexOf(method) < 0)
{
Thread.Sleep(3000);
}
return res.ToString(); //icCard
}
三、签名
/// <summary>
/// SpcSignData
/// </summary>
/// <returns></returns>
public static string SignData(string pwd, string signData, string method)
{
dynamic send = new ExpandoObject();
send._id = i;
send._method = method;
dynamic args = new ExpandoObject();
args.passwd = pwd;
args.inputData = signData;
send.args = args;
var sendMess = JsonHelper.Instance.Serialize(send);
websocket.Send(sendMess);
i++;
while (res.IndexOf(method) < 0)
{
Thread.Sleep(500);
}
return res.ToString();
}
有需要可以私信我或留下邮箱