91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 15KB
    文件類型: .cs
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-01
  • 語言: C#
  • 標簽: CRT_591_M001??

資源簡介

由于官方給出的案例寫的比較模糊,自己對協議也研究了一兩天,所以在此貢獻c#版的操作類,方便需要的同學用到,在此我這邊讀寫位數可以20位,我存的是單號:比如:20180518205402123456 這樣位數,如果需要長度更長,需要更改,讀寫方法里面的長度

資源截圖

代碼片段和文件信息

using?System;
using?System.Runtime.InteropServices;

namespace?Common.ICCard4442
{
????public?class?ICCard4442
????{
????????//打開串口
????????[DllImport(“CRT_591_M001.dll“)]
????????public?static?extern?UInt32?CRT591MROpen(string?port);
????????//按指定的波特率打開串口
????????[DllImport(“CRT_591_M001.dll“)]
????????public?static?extern?UInt32?CRT591MROpenWithBaut(string?port?UInt32?Baudrate);
????????//關閉串口
????????[DllImport(“CRT_591_M001.dll“)]
????????public?static?extern?int?CRT591MRClose(UInt32?ComHandle);

????????//int?APIENTRY?ExecuteCommand(HANDLE?ComHandleBYTE?TxAddrBYTE?TxCmCodeBYTE?TxPmCodeint?TxDataLenBYTE?TxData[]BYTE?*RxReplyTypeBYTE?*RxStCode0BYTE?*RxStCode1BYTE?*RxStCode2int?*RxDataLenBYTE?RxData[]);
????????[DllImport(“CRT_591_M001.dll“)]
????????public?static?extern?int?RS232_ExeCommand(UInt32?ComHandle?byte?TxAddr?byte?TxCmCode?byte?TxPmCode?UInt16?TxDataLen?byte[]?TxData?ref?byte?RxReplyType?ref?byte?RxStCode0?ref?byte?RxStCode1?ref?byte?RxStCode2?ref?UInt16?RxDataLen?byte[]?RxData);
????}

????public?class?ICCardHelper
????{
????????private?static?UInt32?_hdle;
????????public?static?UInt32?Hdle
????????{
????????????get
????????????{
????????????????if?(_hdle?==?0)
????????????????{
????????????????????_hdle?=?ICCard4442.CRT591MROpen(“COM1“);
????????????????????return?_hdle;
????????????????}

????????????????else
????????????????????return?_hdle;
????????????}
????????????set
????????????{
????????????????value?=?_hdle;
????????????}
????????}

????????private?static?byte?_addr;

????????public?static?byte?Addr
????????{
????????????get
????????????{
????????????????if?(_addr?==?0)
????????????????{
????????????????????_addr?=?Convert.ToByte(0X00);
????????????????????return?_addr;
????????????????}

????????????????else
????????????????????return?_addr;
????????????}
????????}

????????///?
????????///?驗證密碼
????????///?

????????///?
????????public?static?bool?VerificationPassWord()
????????{
????????????bool?isSuccess?=?false;

????????????byte?Cm?Pm;
????????????UInt16?TxDataLen?RxDataLen;
????????????byte[]?TxData?=?new?byte[1024];
????????????byte[]?RxData?=?new?byte[1024];
????????????byte?ReType?=?0;
????????????byte?St0?St1?St2;
????????????string?PasswordStr?=?“FF?FF?FF“;

????????????Cm?=?0x53;
????????????Pm?=?0x33;
????????????St0?=?St1?=?St2?=?0;

????????????TxData[0]?=?0x00;
????????????TxData[1]?=?0x20;
????????????TxData[2]?=?0x03;
????????????TxData[3]?=?0x01;
????????????TxData[4]?=?0x03;???//length?of?Password?6?Bytes
????????????TxData[5]?=?(byte)Convert.ToInt32(PasswordStr.Substring(0?2)?16);//0xff;
????????????TxData[6]?=?(byte)Convert.ToInt32(PasswordStr.Substring(3?2)?16);//0xff;?
????????????TxData[7]?=?(byte)Convert.ToInt32(PasswordStr.Substring(6?2)?16);//?0xff;?
????????????//TxData[8]?=?(byte)Convert.ToInt32(PasswordStr.Substring(9?2)?16);//?0xff

評論

共有 條評論

相關資源