Beispiel #1
0
 public PsnChannelDataHandler(IPsnDataHandler dataHandler, IPsnProtocolCommandPartConfiguration psnCommandPart, IPsnProtocolParameterConfiguration psnParameterConfig, IPsnProtocolConfiguration configuration)
 {
     _psnDataHandler     = dataHandler;
     _psnCommandPart     = psnCommandPart;
     _psnParameterConfig = psnParameterConfig;
     _configuration      = configuration;
 }
 public PsnChannelTrendLoaderSimple(IPsnProtocolParameterConfiguration signalConfiguration, IPsnProtocolCommandPartConfiguration commandPartConfiguration, IPsnData psnData, IPsnProtocolConfiguration psnConfiguration, IPsnDataInformation psnDataInformation)
 {
     _signalConfiguration      = signalConfiguration;
     _commandPartConfiguration = commandPartConfiguration;
     _psnData            = psnData;
     _psnConfiguration   = psnConfiguration;
     _psnDataInformation = psnDataInformation;
 }
        public void GetDataPoints(IPsnProtocolConfiguration protocol, IPsnProtocolCommandPartConfiguration commandPart,
                                  IPsnProtocolParameterConfiguration paramInfo, DateTime beginTime, Action <DataPoint> nextPointLoaded)
        {
            // Если конфигурация была изменена:
            if (_lastPsnProtocolId != null && _lastPsnProtocolId.IdentyString != protocol.Information.Id.IdentyString)
            {
                FreeResources();
            }

            if (_areResourcesFree)
            {
                FillResources(protocol, beginTime, protocol.CycleCommandParts, protocol.CommandParts);
            }

            bool isWatchForRequestNeeded;
            Func <IPsnMapRecord, IPsnMapSubrecord> funcGetPart;

            if (commandPart.PartType == PsnProtocolCommandPartType.Request)
            {
                funcGetPart             = FuncGetPartRequest;
                isWatchForRequestNeeded = false;
            }
            else if (commandPart.PartType == PsnProtocolCommandPartType.Reply)
            {
                funcGetPart             = FuncGetPartReply;
                isWatchForRequestNeeded = false;
            }
            else /*if (commandPart.PartType == PsnProtocolCommandPartType.ReplyWithRequiredRequest)*/
            {
                funcGetPart             = FuncGetPartReply;
                isWatchForRequestNeeded = true;
            }

            // поток данных нужен для извлечения самих данных (т.к. изначально их нет в карте (есть только информация о местоположении и времени команд протокола ПСН)
            // можно разделить алгоритм на две части: выборку из карты инфомрации об интересующем сигнале, а затем - заполнение значений из потока данных
            for (int i = 0; i < _commandsMap.Count; ++i)
            {
                if (_commandsMap[i].CommandId.IdentyString == commandPart.CommandId.IdentyString)
                {
                    IPsnMapSubrecord needRec = funcGetPart.Invoke(_commandsMap[i]);

                    if (needRec != null)
                    {
                        if (isWatchForRequestNeeded && _commandsMap[i].RequestRecordInfo != null ||
                            !isWatchForRequestNeeded)
                        {
                            // CRC ok
                            int positionInGoodData = needRec.LocationInfo.Position;
                            nextPointLoaded.Invoke(new DataPoint(
                                                       paramInfo.GetValue(_goodPagesOnlyGoodBytes, positionInGoodData),
                                                       needRec.LocationInfo.Time, true, positionInGoodData));
                        }
                    }
                }
            }
        }
Beispiel #4
0
 public static bool IsEqualTo(this IPsnProtocolParameterConfiguration param1, IPsnProtocolParameterConfiguration param2)
 {
     if (param1.IsBitSignal != param2.IsBitSignal)
     {
         return(false);
     }
     if (param1.Name != param2.Name)
     {
         return(false);
     }
     return(true);
 }
Beispiel #5
0
        public void LoadTrend(IPsnProtocolConfiguration configuration, IPsnProtocolCommandPartConfiguration psnCommandPart, IPsnProtocolParameterConfiguration psnParameterConfig, DateTime beginTime, Action <DataPoint> nextPointLoaded)
        {
            if (_loadedTrendsCount == 0)
            {
                _psnDataHandler.FillResources(configuration, beginTime, configuration.CycleCommandParts, configuration.CommandParts);
            }

            new PsnChannelDataHandler(_psnDataHandler, psnCommandPart, psnParameterConfig, configuration).GetDataPoints(beginTime, nextPointLoaded);
            _loadedTrendsCount++;
        }
Beispiel #6
0
        public List <DataPoint> LoadTrend(IPsnProtocolConfiguration configuration, IPsnProtocolCommandPartConfiguration psnCommandPart, IPsnProtocolParameterConfiguration psnParameterConfig, DateTime beginTime)
        {
            if (_loadedTrendsCount == 0)
            {
                _psnDataHandler.FillResources(configuration, beginTime, configuration.CycleCommandParts, configuration.CommandParts);
            }

            var result = new PsnChannelDataHandler(_psnDataHandler, psnCommandPart, psnParameterConfig, configuration).GetDataPoints(beginTime);

            _loadedTrendsCount++;

            return(result);
        }
 public PsnSignalAddressSimple(IPsnProtocolParameterConfiguration parameterConfiguration, IPsnProtocolCommandPartConfiguration commandPart)
 {
     _parameterConfiguration = parameterConfiguration;
     _commandPart            = commandPart;
 }
Beispiel #8
0
 public PsnParameterConfigurationBasedOnLowLevel(IPsnProtocolParameterConfiguration cfg)
 {
     _cfg = cfg;
 }