void Awake() { fingerDataDict = ConstructFindgerDataDict(); milliSecond = 1f / fps; msgQueue = new Queue <VibrationDataSet>(); msgQueueLength = 0; LeftHandPort = new VibrationSerialPort(LComPort, true); RightHandPort = new VibrationSerialPort(RComPort, true); }
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; //} } }