Exemplo n.º 1
0
        public FileCall(ApplicationLayerParameters parameters, byte[] msg, int startIndex) : base(parameters, msg, startIndex)
        {
            startIndex += 2; /* skip IOA */
            startIndex += 1; /* skip AdditionalPacketType */

            if ((msg.Length - startIndex) < GetEncodedSize())
            {
                throw new ASDUParsingException("Message too small");
            }

            startIndex += 1; /* skip OPT */

            _folderId  = msg[startIndex++];
            _folderId += msg[startIndex++] * 0x100;
            _folderId += msg[startIndex++] * 0x10000;
            _folderId += msg[startIndex++] * 0x1000000;

            _folderNameLength = msg[startIndex++];

            for (int i = 0; i < _folderNameLength; i++)
            {
                _folderName += (char)msg[startIndex++];
            }

            if ((msg.Length - startIndex) < 15)
            {
                throw new ASDUParsingException("Message too small");
            }

            _callFlag = (CallFlag)msg[startIndex++];

            _startTime  = new CP56Time2a(msg, startIndex);
            startIndex += 7;
            _endTime    = new CP56Time2a(msg, startIndex);
        }
Exemplo n.º 2
0
 public FileCall(int objectAddress, int folderId, string folderName, CallFlag callFlag, CP56Time2a startTime, CP56Time2a endTime) : base(objectAddress, AdditionalPacketType.FILE_TRANSFER, OptionID.CALL_FILES)
 {
     _folderId         = folderId;
     _folderNameLength = (byte)(folderName == null ? 0 : folderName.Length);
     _folderName       = folderName;
     _callFlag         = callFlag;
     _startTime        = startTime;
     _endTime          = endTime;
 }
Exemplo n.º 3
0
        private IEnumerable <TestResult> GetResult(string methodName, CallFlag flag, int[] testCountArray = null)
        {
            if (testCountArray == null)
            {
                testCountArray = new[] { DEFAULT_LIST_SIZE }
            }
            ;

            MethodInfo method = GetMethodInfoOfTestEngine(methodName);

            foreach (int currentCount in testCountArray)
            {
                List <object> argumentList = new List <object> {
                    currentCount
                };
                if (_usingReflectionMethods.ContainsKey(methodName))
                {
                    argumentList.Add(_usingReflectionMethods[methodName]);
                }

                //Get middle estimation of several times calling
                long timeOfAllInvoketionsMs = 0;
                int  countOfInvokations     = 3;

                for (int i = 0; i < countOfInvokations; i++)
                {
                    if (flag == CallFlag.ClearTestCollection)
                    {
                        ClearList();
                    }
                    if (flag == CallFlag.FillTestCollection)
                    {
                        FillList();
                    }

                    timeOfAllInvoketionsMs += MeasureEngine.MeasureMethod(this, method, argumentList);
                }

                yield return(new TestResult(currentCount, timeOfAllInvoketionsMs / countOfInvokations));
            }
        }
Exemplo n.º 4
0
 public TestArguments(string methodName, CallFlag flag, int[] testCountArray)
 {
     MethodName = methodName;
     TestCountArray = testCountArray;
     CallFlag = flag;
 }
Exemplo n.º 5
0
 public TestArguments(string methodName, CallFlag flag, int[] testCountArray)
 {
     MethodName = methodName;
     TestCountArray = testCountArray;
     CallFlag = flag;
 }