public void Start()// deleUserHandleRecv _userHandleRecv, deleUserHandleSend _userHandleSend) { DriverS.StartRead((rx_data) => { Message m = new Message(); m.FromData(rx_data); OnMsg(m); }); System.Threading.Thread t = new System.Threading.Thread(() => { bExit = false; StartSendQueue(); }); t.Start(); }
public void Start(deleUserHandleRecv _userHandleRecv, deleUserHandleSend _userHandleSend) { lock (this) { userHandleRecv = _userHandleRecv; userHandleSend = _userHandleSend; } USBHIDDriver.StartRead((data) => { Message m = new Message(); m.FromData(data); OnMsg(m); }); System.Threading.Thread t = new System.Threading.Thread(() => { bExit = false; StartSendQueue(); }); t.Start(); }
public void Start(IWatcher watcher = null)// deleUserHandleRecv _userHandleRecv, deleUserHandleSend _userHandleSend) { if (watcher != null) { watcherColl.AddWatcher(watcher); } DriverS.StartRead((rx_data) => { Message m = new Message(); m.FromData(rx_data); OnMsg(m); }); System.Threading.Thread t = new System.Threading.Thread(() => { bExit = false; StartSendQueue(); }); t.Start(); }
public bool Send(byte[] bs) { if (!bActive) { return(false); } byte[] data = new byte[64]; Array.Copy(bs, data, Math.Min(bs.Length, 64)); NeoDun.Message msg = new NeoDun.Message(); msg.FromData(data); NeoDun.Message srcmsg = null; if (msg.tag1 == 0x00 || msg.tag2 >= 0xa0)//如果是一条回复消息,找原始消息 { srcmsg = this.needBackMessage[msg.msgid]; } if (_msg != null) { _msg(msg, srcmsg); } return(true); }