private void QueueMsg(VibrationDataSet vDataSet) { if (msgQueue != null) { msgQueue.Enqueue(vDataSet); msgQueueLength++; } }
private void SendQueueMsgToPort() { if (msgQueue != null && msgQueueLength > 0) { //lock (msgQueue) { for (int i = 0; i < msgQueueLength; i++) { VibrationDataSet vDataset = msgQueue.Dequeue(); VibrationSerialPort port = GetSerialPortByHandIndex(vDataset.handIndex); if (!string.IsNullOrEmpty(vDataset.content) && port != null && port.isReady) { //Debug.Log("Send Content : " + vDataset.content); port.SendBinary(vDataset.content); } } msgQueueLength = 0; //} } }