Example #1
0
        private FunNum01RequestDataBase CovertToSingleFunNum01RequestDataBase(FunNum01CustomerRequestData funNumCustomerRequestData)
        {
            FunNum01RequestDataBase funNumRequestDataBase = new FunNum01RequestDataBase();

            funNumRequestDataBase.DeviceAddress = funNumCustomerRequestData.DeviceAddress;
            funNumRequestDataBase.FunctionNum   = Convert.ToByte(Convert.ToInt32(funNumCustomerRequestData.FunctionNum));
            funNumRequestDataBase.StartingRegisterAddressHigh = (byte)(funNumCustomerRequestData.StartingRegister / 256);
            funNumRequestDataBase.StartingRegisterAddressLow  = (byte)(funNumCustomerRequestData.StartingRegister % 256);
            funNumRequestDataBase.NumOfRegisterToReadHigh     = (byte)(funNumCustomerRequestData.NumOfRegisterToRead / 256);
            funNumRequestDataBase.NumOfRegisterToReadLow      = (byte)(funNumCustomerRequestData.NumOfRegisterToRead % 256);

            return(funNumRequestDataBase);
        }
Example #2
0
        }                                                               //将要读取的寄存器的个数

        public List <FunNum01RequestDataBase> CovertToFunNum01RequestDataBases()
        {
            List <FunNum01RequestDataBase> requestDataBases = new List <FunNum01RequestDataBase>();

            List <FunNum01CustomerRequestData> customerRequestDatas = Splite();

            foreach (FunNum01CustomerRequestData item in customerRequestDatas)
            {
                FunNum01RequestDataBase requestDataBase = CovertToSingleFunNum01RequestDataBase(item);
                requestDataBases.Add(requestDataBase);
            }

            return(requestDataBases);
        }