exceeddata-sdk-vdata 2.9.7__tar.gz → 2.9.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: exceeddata-sdk-vdata
3
- Version: 2.9.7
3
+ Version: 2.9.9
4
4
  Summary: ExceedData vData SDK for Python
5
5
  Home-page: http://www.smartsct.com
6
6
  Author: Nick Xie
@@ -32,6 +32,6 @@
32
32
 
33
33
  name = 'vdata'
34
34
 
35
- __version__ = "2.9.7"
35
+ __version__ = "2.9.9"
36
36
  __author__ = 'Nick Xie'
37
37
  __credits__ = 'Smart Software for Car Technologies Inc'
@@ -61,6 +61,9 @@ LOG_CONTAINER_STRUCT = struct.Struct("<H6xL4x")
61
61
  # channel, flags, dlc, arbitration id, data
62
62
  CAN_MSG_STRUCT = struct.Struct("<HBBL8s")
63
63
 
64
+ # channel, arbitration id, dlc, data
65
+ LIN_MSG_STRUCT = struct.Struct("<HBB64s")
66
+
64
67
  # channel, flags, dlc, arbitration id, frame length, bit count, FD flags,
65
68
  # valid data bytes, data
66
69
  CAN_FD_MSG_STRUCT = struct.Struct("<HBBLLBBB5x64s")
@@ -81,6 +84,7 @@ GLOBAL_MARKER_STRUCT = struct.Struct("<LLL3xBLLL12x")
81
84
 
82
85
 
83
86
  CAN_MESSAGE = 1
87
+ LIN_MESSAGE = 11
84
88
  LOG_CONTAINER = 10
85
89
  CAN_ERROR_EXT = 73
86
90
  CAN_MESSAGE2 = 86
@@ -445,7 +449,7 @@ class BLFWriter(FileIOMessageWriter):
445
449
  # Pad to header size
446
450
  self.file.write(b"\x00" * (FILE_HEADER_SIZE - FILE_HEADER_STRUCT.size))
447
451
 
448
- def on_message_received(self, msg):
452
+ def on_message_received(self, msg, msg_type=CAN_MESSAGE):
449
453
  channel = channel2int(msg.channel)
450
454
  if channel is None:
451
455
  channel = self.channel
@@ -460,6 +464,11 @@ class BLFWriter(FileIOMessageWriter):
460
464
  if not msg.is_rx:
461
465
  flags |= DIR
462
466
  can_data = bytes(msg.data)
467
+
468
+ if msg_type == LIN_MESSAGE:
469
+ data = LIN_MSG_STRUCT.pack(channel, arb_id, msg.dlc, can_data)
470
+ self._add_object(LIN_MESSAGE, data, msg.timestamp)
471
+ return
463
472
 
464
473
  if msg.is_error_frame:
465
474
  data = CAN_ERROR_EXT_STRUCT.pack(
@@ -37,9 +37,9 @@ class VswToBlfConverter:
37
37
  #这里用来保留信号列与channel_id, message_id之间的对应关系,第一列总是为时间,所以会少一列
38
38
  can_info= []
39
39
  for signal in vdf.cols():
40
- channel_id, message_id = colParserFun(signal)
40
+ channel_id, message_id, frame_type = colParserFun(signal)
41
41
 
42
- can_info.append([channel_id,message_id])
42
+ can_info.append([channel_id,message_id, frame_type])
43
43
  #if (len(arr)!= 2):
44
44
  # can_info.append(None)
45
45
  #else:
@@ -67,8 +67,11 @@ class VswToBlfConverter:
67
67
  #如果信号非空,则生成相应的数据
68
68
  if row[i] != None and isinstance (row[i], list) and can_info[i-1][0]!=-1:
69
69
  msg = Message(timestamp=row[0]/1000.0, channel=can_info[i-1][0] -1 ,arbitration_id=can_info[i-1][1],data= row[i], is_fd=True, is_extended_id = False)
70
+ frame_type = 0
71
+ if (can_info[i-1][2] ==2 ):
72
+ frame_type = 11 #LIN_MESSAGE_TYPE in blf
70
73
  #写入BLF文件
71
- blfwriter.on_message_received(msg)
74
+ blfwriter.on_message_received(msg, frame_type)
72
75
 
73
76
 
74
77
  elif row[i] != None and can_info[i-1][0]!=-1:
@@ -108,9 +111,12 @@ class VswToAscConverter:
108
111
  can_info= []
109
112
  cols = vdf.cols()
110
113
  for signal in vdf.cols():
111
- channel_id, message_id = colParserFun(signal)
112
-
113
- can_info.append([channel_id,message_id])
114
+ channel_id, message_id, frame_type = colParserFun(signal)
115
+ if frame_type!=2:
116
+ can_info.append([channel_id,message_id&0x7fffffff, message_id&0x8000000 != 0])
117
+ else:
118
+ can_info.append([-1,-1, -1])
119
+
114
120
 
115
121
  current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
116
122
  print(" " + current_time)
@@ -125,16 +131,16 @@ class VswToAscConverter:
125
131
  #store the signal byte array for not null column data.
126
132
  #如果信号非空,则生成相应的数据
127
133
  if row[i] != None and isinstance(row[i], (list)) and can_info[i-1][0]!=-1:
128
- msg = Message(timestamp=row[0]/1000.0, channel=can_info[i-1][0]-1,arbitration_id=can_info[i-1][1],data= row[i], is_fd=True, is_extended_id =False)
134
+ msg = Message(timestamp=row[0]/1000.0, channel=can_info[i-1][0]-1,arbitration_id=can_info[i-1][1],data= row[i], is_fd=True, is_extended_id =can_info[i-1][2])
129
135
  #写入ASC文件
130
136
  writer.on_message_received(msg)
131
137
  elif row[i] != None and can_info[i-1][0]!=-1:
132
138
  data=[1]
133
139
  data[0] =row[i]
134
- msg = Message(timestamp=row[0]/1000.0, channel=can_info[i-1][0] -1 ,arbitration_id=can_info[i-1][1],data= data, is_fd=True, is_extended_id = False)
135
- #写入BLF文件
140
+ msg = Message(timestamp=row[0]/1000.0, channel=can_info[i-1][0] -1 ,arbitration_id=can_info[i-1][1],data= data, is_fd=True, is_extended_id = can_info[i-1][2])
141
+ #写入ASC文件
136
142
  writer.on_message_received(msg)
137
143
 
138
- #finalize the BLF file and flush to disk
144
+ #finalize the ASC file and flush to disk
139
145
  #将ASC文件终结,写入磁盘
140
146
  writer.stop()
@@ -31,7 +31,7 @@
31
31
  # of the copyright holder.
32
32
  #
33
33
  # Author: Nick Xie
34
- # Version: 2.9.7
34
+ # Version: 2.9.9
35
35
  #
36
36
  # Note: for specification flag compatibility, it is rare that vsw uses snappy.
37
37
  # Uncomment the following if used and python-snappy is installed.
@@ -159,7 +159,7 @@ class VDataMeta:
159
159
  >>> meta = VDataReader.getMeta(file)
160
160
  >>> info = meta.extendedInfo()
161
161
  '''
162
- def __init__(self, formatVersion=0, compressMethod=0, encryptMethod=0, blocksCount=0, storageStartTime=0, storageEndTime=0, queryStartTime=0, queryEndTime=0, extendedInfo=None, pageSizeCode=0):
162
+ def __init__(self, formatVersion=0, compressMethod=0, encryptMethod=0, blocksCount=0, storageStartTime=0, storageEndTime=0, queryStartTime=0, queryEndTime=0, extendedInfo=None, pageSizeCode=0, keyTypeCode=0):
163
163
  '''
164
164
  The constructor for the meta info. For valid values see VData format specification.
165
165
 
@@ -184,6 +184,7 @@ class VDataMeta:
184
184
  self._queryEndTime = queryEndTime
185
185
  self._extendedInfo = extendedInfo
186
186
  self._pageSizeCode = pageSizeCode
187
+ self._keyTypeCode = keyTypeCode
187
188
 
188
189
 
189
190
  def __repr__(self):
@@ -304,7 +305,12 @@ class VDataMeta:
304
305
  return 5
305
306
  else:
306
307
  return 6
307
-
308
+
309
+ def getSeriesTimestampLength (self):
310
+ if (self._keyTypeCode & 0x0f ==1 ):
311
+ return 43
312
+ else:
313
+ return 41
308
314
 
309
315
  class VDataBucket(object):
310
316
  def __init__(self):
@@ -2055,13 +2061,15 @@ class VDataStructDecode:
2055
2061
  return vals
2056
2062
 
2057
2063
  class VDataTimeDeltaDecode:
2058
- def __init__(self, _page, _bitTracker):
2064
+ def __init__(self, _page, _bitTracker, timestampLength):
2059
2065
  self.page = _page
2060
2066
  self.bitTracker = _bitTracker
2061
2067
  self.timeTracker = TimestampTracker()
2068
+ self.timestampLength = timestampLength
2062
2069
 
2063
2070
  def first(self):
2064
- self.timeTracker.setTimestamp(VDataDecodeUtils.readValueFromBitString(self.page, VDataConstants.TIMESTAMP_FIRST_VALUE_BITS, self.bitTracker))
2071
+ #VDataConstants.TIMESTAMP_FIRST_VALUE_BITS
2072
+ self.timeTracker.setTimestamp(VDataDecodeUtils.readValueFromBitString(self.page, self.timestampLength, self.bitTracker))
2065
2073
  self.timeTracker.setTimestampDelta(VDataConstants.TIMESTAMP_INIT_DELTA)
2066
2074
 
2067
2075
  def next(self):
@@ -2101,13 +2109,14 @@ class VDataTimeDeltaDecode:
2101
2109
  return self.timeTracker.getTimestamp()
2102
2110
 
2103
2111
  class VDataTimeMicrosDecode:
2104
- def __init__(self, _page, _bitTracker):
2112
+ def __init__(self, _page, _bitTracker, timestampLength):
2105
2113
  self.page = _page
2106
2114
  self.bitTracker = _bitTracker
2107
2115
  self.timeTracker = TimeMicrosTracker()
2116
+ self._timestampLength = timestampLength
2108
2117
 
2109
2118
  def first(self):
2110
- self.timeTracker.setTimestamp(VDataDecodeUtils.readValueFromBitString(self.page, VDataConstants.TIMESTAMP_FIRST_VALUE_BITS, self.bitTracker))
2119
+ self.timeTracker.setTimestamp(VDataDecodeUtils.readValueFromBitString(self.page, self._timestampLength, self.bitTracker))
2111
2120
  self.timeTracker.setTimestampDelta(VDataConstants.TIMESTAMP_INIT_DELTA)
2112
2121
 
2113
2122
  if (VDataDecodeUtils.readValueFromBitOne(self.page, self.bitTracker) != 0):
@@ -2393,6 +2402,7 @@ class VDataSeriesBucket(object):
2393
2402
  self.itemCount = 0
2394
2403
  self.firstTime = None
2395
2404
  self.blobData = None
2405
+ self.timestampLength =41
2396
2406
 
2397
2407
  def getFormatVersion(self):
2398
2408
  return self.formatVersion
@@ -2464,6 +2474,12 @@ class VDataSeriesBucket(object):
2464
2474
 
2465
2475
  def getBlobData(self):
2466
2476
  return self.blobData
2477
+
2478
+ def setSeriesTimestampLength(self, length):
2479
+ self.timestampLength = length
2480
+
2481
+ def getSeriesTimestampLength(self):
2482
+ return self.timestampLength
2467
2483
 
2468
2484
  class VDataSeriesDecode(object):
2469
2485
  def __init__(self, data, offset, dtype):
@@ -2480,7 +2496,7 @@ class VDataSeriesDecode(object):
2480
2496
 
2481
2497
  self.bitTracker = BitTracker()
2482
2498
  self.bitTracker.setNumBits(offset)
2483
- self.timeDecode = VDataTimeDeltaDecode(self.page, self.bitTracker)
2499
+ self.timeDecode = VDataTimeDeltaDecode(self.page, self.bitTracker, data.getSeriesTimestampLength())
2484
2500
 
2485
2501
  self.readCount = 0
2486
2502
  self.emptied = 1
@@ -2574,10 +2590,10 @@ class VDataSeriesDecodeNumber(VDataSeriesDecode):
2574
2590
  self.emptied = 1
2575
2591
 
2576
2592
  class VDataSeriesDecodeNumberArray(VDataSeriesDecode):
2577
- def __init__(self, data, offset, dtype, encoder, length, matchLength=False):
2593
+ def __init__(self, data, offset, dtype, encoder, length , matchLength=False):
2578
2594
  super().__init__(data, offset, DType.Array)
2579
2595
 
2580
- self.timeDecode = VDataTimeMicrosDecode(self.page, self.bitTracker)
2596
+ self.timeDecode = VDataTimeMicrosDecode(self.page, self.bitTracker, data.getSeriesTimestampLength())
2581
2597
  self.valueDecode = VDataNumberArrayDecode(self.page, dtype, encoder, length, matchLength, self.formula, self.bitTracker)
2582
2598
 
2583
2599
  if (self.readCount < self.itemCount):
@@ -2605,10 +2621,10 @@ class VDataSeriesDecodeNumberArray(VDataSeriesDecode):
2605
2621
 
2606
2622
 
2607
2623
  class VDataSeriesDecodeStringArray(VDataSeriesDecode):
2608
- def __init__(self, data, offset, dtype, encoder, length, matchLength=False):
2624
+ def __init__(self, data, offset, dtype, encoder, length, matchLength=False):
2609
2625
  super().__init__(data, offset, DType.Array)
2610
2626
 
2611
- self.timeDecode = VDataTimeMicrosDecode(self.page, self.bitTracker)
2627
+ self.timeDecode = VDataTimeMicrosDecode(self.page, self.bitTracker, data.getSeriesTimestampLength())
2612
2628
  self.valueDecode = VDataStringArrayDecode(self.page, dtype, encoder, length, matchLength, self.formula, self.bitTracker)
2613
2629
 
2614
2630
  if (self.readCount < self.itemCount):
@@ -2638,7 +2654,7 @@ class VDataSeriesDecodeNamedArray(VDataSeriesDecode):
2638
2654
  def __init__(self, data, offset, dtype, encoder, length):
2639
2655
  super().__init__(data, offset, DType.Array)
2640
2656
 
2641
- self.timeDecode = VDataTimeMicrosDecode(self.page, self.bitTracker)
2657
+ self.timeDecode = VDataTimeMicrosDecode(self.page, self.bitTracker, data.getSeriesTimestampLength())
2642
2658
  if (dtype != DType.String):
2643
2659
  self.valueDecode = VDataNumberArrayDecode(self.page, dtype, encoder, length, False, self.formula, self.bitTracker)
2644
2660
  else:
@@ -2708,7 +2724,7 @@ class VDataSeriesDecodeStruct(VDataSeriesDecode):
2708
2724
  def __init__(self, data, offset, dtypes, encoders, length):
2709
2725
  super().__init__(data, offset, DType.Struct)
2710
2726
 
2711
- self.timeDecode = VDataTimeMicrosDecode(self.page, self.bitTracker)
2727
+ self.timeDecode = VDataTimeMicrosDecode(self.page, self.bitTracker, data.getSeriesTimestampLength())
2712
2728
  self.valueDecode = VDataStructDecode(self.page, dtypes, encoders, length, self.formula, self.bitTracker)
2713
2729
  self.dtypes = dtypes
2714
2730
 
@@ -3907,6 +3923,7 @@ class VDataDecoder:
3907
3923
  seriesBucket.setBucketCycle(bucketCycle)
3908
3924
  seriesBucket.setBucketStartTime(bucketStartTime)
3909
3925
  seriesBucket.setBucketEndTime(bucketEndTime)
3926
+ seriesBucket.setSeriesTimestampLength(self._meta.getSeriesTimestampLength())
3910
3927
  if (mt.getSeriesId() in sid_to_blob_idx):
3911
3928
  idx = sid_to_blob_idx[mt.getSeriesId()]
3912
3929
  seriesBucket.setBlobData(blobDatabytes [blobOffsetVec[idx]:blobOffsetVec[idx]+blobLengthVec[idx]])
@@ -5032,6 +5049,7 @@ class VDataReader:
5032
5049
  qetime = 0 # query end time
5033
5050
  extlength = 0
5034
5051
  pageSizeCode = 0
5052
+ keyTypeCode = 0
5035
5053
 
5036
5054
  if (formatVersion > 0):
5037
5055
  if (formatVersion < 26):
@@ -5041,12 +5059,13 @@ class VDataReader:
5041
5059
  extlength = _struct.unpack('<H', _reader.read(2))[0]
5042
5060
  if (formatVersion > 26):
5043
5061
  pageSizeCode = _reader.read(1)[0]
5044
- _reader.read(5) # reserved
5062
+ keyTypeCode = _reader.read(1)[0]
5063
+ _reader.read(4) # reserved
5045
5064
  else:
5046
5065
  _reader.read(6) # reserved
5047
5066
 
5048
5067
  extbytes = _reader.read(extlength) if (extlength > 0) else []
5049
- return VDataMeta(formatVersion=formatVersion, compressMethod=compressMethod, encryptMethod=encryptMethod, blocksCount=blocksCount, storageStartTime=sstime, storageEndTime=setime, queryStartTime=qstime, queryEndTime=qetime, extendedInfo=extbytes, pageSizeCode = pageSizeCode)
5068
+ return VDataMeta(formatVersion=formatVersion, compressMethod=compressMethod, encryptMethod=encryptMethod, blocksCount=blocksCount, storageStartTime=sstime, storageEndTime=setime, queryStartTime=qstime, queryEndTime=qetime, extendedInfo=extbytes, pageSizeCode = pageSizeCode , keyTypeCode= keyTypeCode)
5050
5069
 
5051
5070
 
5052
5071
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: exceeddata-sdk-vdata
3
- Version: 2.9.7
3
+ Version: 2.9.9
4
4
  Summary: ExceedData vData SDK for Python
5
5
  Home-page: http://www.smartsct.com
6
6
  Author: Nick Xie
@@ -33,7 +33,7 @@
33
33
  from setuptools import setup
34
34
 
35
35
  setup(name='exceeddata-sdk-vdata',
36
- version='2.9.7',
36
+ version='2.9.9',
37
37
  description='ExceedData vData SDK for Python',
38
38
  url='http://www.smartsct.com',
39
39
  author='Nick Xie',