public void InitializeAllReadRegisterCommands(List <DataPoint> dataPoints) { if (null == dataPoints) { return; } List <List <DataPoint> > dataPointsGroupedForRead = DataPointGrouper.GroupingDataPointsForReadRegister(dataPoints); foreach (var dataPointsGroup in dataPointsGroupedForRead) { List <List <byte> > requestCommadBytes = RequestCommandByteStreamCreater.CreateRequestCommandByteStreamForReadRegisterBy(dataPointsGroup); foreach (var requestCommadByte in requestCommadBytes) { ReadRegisterCommand readRegisterCommand = new ReadRegisterCommand(); //请求唯一性,用guid标示唯一性 List <byte> guidBytes = Guid.NewGuid().ToByteArray().ToList(); requestCommadByte.AddRange(guidBytes); readRegisterCommand.ReadCommand = requestCommadByte; //把所有的读命令保存在内存中,换取速度 this.allReadRegisterCommands.Enqueue(readRegisterCommand); } } }
private void InitializeAllReadRegisterCommands(List <DataPoint> dataPoints) { if (null != dataPoints) { return; } List <List <DataPoint> > dataPointsGroupedForRead = DataPointGrouper.GroupingDataPointsForReadRegister(dataPoints); foreach (var dataPointsGroup in dataPointsGroupedForRead) { List <List <byte> > requestCommadBytes = RequestCommandByteStreamCreater.CreateRequestCommandByteStreamForReadRegisterBy(dataPointsGroup); foreach (var requestCommadByte in requestCommadBytes) { ReadRegisterCommand readRegisterCommand = new ReadRegisterCommand(); readRegisterCommand.ReadCommand = requestCommadByte; //把所有的读命令保存在内存中,换取速度 this.allReadRegisterCommands.Enqueue(readRegisterCommand); } } }