Example #1
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 public LogMessageItem(
     LogFileConnection connection,
     int index,
     string name,
     DateTime timestamp,
     MessageDirection direction,
     ArbitrationIdType type,
     uint arbitrationId,
     bool remote,
     byte[] data,
     string documentation,
     string description
     )
 {
     _connection    = connection;
     Index          = index;
     Name           = name;
     Timestamp      = timestamp;
     Direction      = direction;
     Type           = type;
     Remote         = remote;
     ArbitrationId  = arbitrationId;
     Data           = data;
     _documentation = documentation;
     _description   = description;
 }
Example #2
0
        /// <summary>
        /// Egy sor beszurása a Message táblába.
        /// </summary>
        void AddToTable(
            string name,
            DateTime timestamp,
            MessageDirection direction,
            ArbitrationIdType type,
            uint arbitrationId,
            bool isRemote,
            byte[] data,
            string documentation,
            string description)
        {
            string query = "INSERT INTO Messages " +
                           "(Name, Timestamp, Direction, Type, ArbitrationId, IsRemote, Data, Documentation, Description)" +
                           " values " +
                           "( '" + name + "', '" +
                           timestamp.Ticks + "', '" +
                           direction + "', '" +
                           type + "', '" +
                           arbitrationId.ToString() + "', '" +
                           (isRemote ? 1 : 0) + "', '" +
                           CustomDataConversion.ByteArrayToStringHighSpeed(data) + "', '" +
                           documentation + "', '" +
                           description + "')";

            var command = new SQLiteCommand(query, _connection.SqLiteConnection);

            command.ExecuteNonQuery();
        }
        /// <summary>
        /// Üzenet hozzá adása a statisztikához
        /// </summary>
        /// <param name="name">Üzenet neve.</param>
        /// <param name="direction">Iránya.</param>
        /// <param name="type">ArbId típusa</param>
        /// <param name="arbitrationId">Arbitációs azonosító.</param>
        /// <param name="remote">Távli adat volt?</param>
        /// <param name="data">Adatkert.</param>
        /// <param name="timestamp">Időbélyeg.</param>
        public void InsertMessage(string name,
                                  MessageDirection direction,
                                  ArbitrationIdType type,
                                  uint arbitrationId,
                                  bool remote,
                                  byte[] data,
                                  DateTime timestamp)
        {
            var targetItem = ((MessageStatisticsCollection)_messages).FirstOrDefault(n =>
            {
                return
                (n.ArbitrationId == arbitrationId &&
                 n.Direction == direction &&
                 n.Type == type &&
                 n.ArbitrationId == arbitrationId &&
                 n.Remote == remote);
            });

            if (targetItem == null)
            {
                _messages.Add(new MessageStatisticsItem(name, arbitrationId, direction, type, remote, data, timestamp));
            }
            else
            {
                targetItem.Increment(timestamp, data);
            }
        }
Example #4
0
 public MessageFilterItem(string name, bool enabled, MaskOrArbId maskOrArbId, uint maskOrArbIdValue, ArbitrationIdType type, bool remote, MessageDirection direction, MessageFilterMode mode)
 {
     _name             = name;
     _enabled          = enabled;
     _maskOrArbId      = maskOrArbId;
     _maskOrArbIdValue = maskOrArbIdValue;
     _type             = type;
     _remote           = remote;
     _direction        = direction;
     _mode             = mode;
 }
        /// <summary>
        /// Üzenet keresése paraméterek alapján.
        /// </summary>
        /// <param name="arbitrationId"></param>
        /// <param name="type"></param>
        /// <param name="isRemote"></param>
        /// <returns></returns>
        public CanTxMessageItem GetMsg(uint arbitrationId, ArbitrationIdType type, bool isRemote)
        {
            var item = this.FirstOrDefault(n =>
            {
                return(n.ArbitrationId == arbitrationId &&
                       n.Type == type &&
                       n.Remote == isRemote);
            });

            return(item);
        }
Example #6
0
 /// <summary>
 ///
 /// </summary>
 public void AddToStorage(
     string name,
     DateTime timestamp,
     MessageDirection direction,
     ArbitrationIdType type,
     uint arbitrationId,
     bool isRemote,
     byte[] data,
     string documentation,
     string description)
 {
     AddToTable(name, timestamp, direction, type, arbitrationId, isRemote, data, documentation, description);
 }
Example #7
0
        public bool DoAddToLog(uint arbitrationId, ArbitrationIdType type, bool remote, MessageDirection direction)
        {
            foreach (var filter in this)
            {
                if (filter.Enabled)
                {
                    if (filter.MaskOrArbId == MaskOrArbId.ArbId)
                    {
                        if (filter.MaskOrArbIdValue == arbitrationId && filter.Type == type && filter.Remote == remote && filter.Direction == direction)
                        {
                            if (filter.Mode == MessageFilterMode.InsertToLog || filter.Mode == MessageFilterMode.InsertToTraceAndLog)
                            {
                                if (filter.AcceptanceCount == null)
                                {
                                    filter.AcceptanceCount = 1;
                                }
                                else
                                {
                                    filter.AcceptanceCount++;
                                }
                                return(true);
                            }
                        }
                    }

                    if (filter.MaskOrArbId == MaskOrArbId.Mask)
                    {
                        if ((arbitrationId & filter.MaskOrArbIdValue) == arbitrationId)
                        {
                            if (filter.Type == type && filter.Remote == remote && filter.Direction == direction)
                            {
                                if (filter.Mode == MessageFilterMode.InsertToLog || filter.Mode == MessageFilterMode.InsertToTraceAndLog)
                                {
                                    if (filter.AcceptanceCount == null)
                                    {
                                        filter.AcceptanceCount = 1;
                                    }
                                    else
                                    {
                                        filter.AcceptanceCount++;
                                    }
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }
Example #8
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="name">Az oszlop neve</param>
 /// <param name="type">Üzenet típusa</param>
 /// <param name="shift">Sift értéke</param>
 /// <param name="startBit">StartBit értéke</param>
 /// <param name="lengthBit"></param>
 /// <param name="format">Fomázó karakterek: "X2"</param>
 /// <param name="description">leírás</param>
 public CustomArbIdColumnItem(string name,
                              ArbitrationIdType type,
                              int startBit,
                              int lengthBit,
                              int shift,
                              string format,
                              string description)
 {
     Name        = name;
     Type        = type;
     StartBit    = startBit;
     LengthBit   = lengthBit;
     Shift       = shift;
     Format      = format;
     Description = description;
 }
 public MessageTraceItem(string name,
                         DateTime timestamp,
                         MessageDirection direction,
                         ArbitrationIdType type,
                         bool remote,
                         uint arbitrationId,
                         byte[] data,
                         string documentation,
                         string description)
 {
     Name          = name;
     Timestamp     = timestamp;
     Direction     = direction;
     Type          = type;
     Remote        = remote;
     ArbitrationId = arbitrationId;
     Data          = data;
     Documentation = documentation;
     Description   = description;
 }
        /// <summary>
        /// Konstructor
        /// </summary>
        public CanTxMessageItem(string name,
                                string key,
                                int periodTime,
                                ArbitrationIdType type,
                                bool remote,
                                uint arbitrationId,
                                byte[] data,
                                string documentation,
                                string description

                                ) : this()
        {
            Name          = name;
            Key           = key;
            PeriodTime    = periodTime;
            Type          = type;
            Remote        = remote;
            ArbitrationId = arbitrationId;
            Data          = data;
            Description   = description;
            Documentation = documentation;
        }
Example #11
0
        public MessageStatisticsItem(string name,
                                     uint arbitrationId,
                                     MessageDirection direction,
                                     ArbitrationIdType type,
                                     bool remote,
                                     byte[] data,
                                     DateTime timestamp)
        {
            Name          = name;
            Type          = type;
            Direction     = direction;
            ArbitrationId = arbitrationId;
            Remote        = remote;
            _timestamp    = timestamp;
            Data          = data;
            PeriodTime    = null;
            DeltaMinTime  = null;
            DeltaMaxTime  = null;
            _deltaT       = null;
            Count         = 1;

            _watch = new Stopwatch();
        }