Vehicle data recording method and device, data recording equipment and storage medium
Patent Information
- Application Number
- CN202411628851.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, when a vehicle data recording device suddenly loses power, the recorded data files may cause disorder, resulting in invalid files and inability to parse, resulting in the loss of key data. How to ensure the integrity of data records is an urgent problem.
When the data recording device is powered on, obtain the real-time data files of the real-time folder and the historical files in the history folder. Use the preset number of data packet bytes to determine whether the file is corrupt and repair it to ensure the integrity of the data file and Analyticity.
This method can repair data disorder caused by sudden power failure, ensure that the data files can be parsed normally, and do not lose normal data, avoid conflicts between writing and file compression, and improve the reliability of data records.
Smart Images

Figure CN119445698A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicles, and in particular to a method, apparatus, data recording device and storage medium for recording vehicle data. Background Art
[0002] With the development of automotive electronic technology, the number of on-board controllers continues to increase. In order to analyze vehicle driving problems, vehicle data recording devices have become an indispensable function. While the data recorder effectively tracks the vehicle driving behavior, it also generates a large amount of data records, which brings new challenges to the security, integrity and accessibility of the recorded data files of the accident vehicle.
[0003] The vehicle data recording device suddenly loses power due to internal failure or external factors, and the working data during this period is very important and needs to be saved and recorded. In the existing technical solutions, sudden power failure may cause the recorded data file to be disordered, making the entire recorded file invalid and unable to be parsed, resulting in the loss of key data.
[0004] Therefore, how to ensure the integrity of data records is an urgent problem to be solved. Summary of the invention
[0005] The present application provides a vehicle data recording method, apparatus, data recording device and storage medium to ensure the integrity of data recording.
[0006] In a first aspect, the present application provides a method for recording vehicle data, comprising:
[0007] When the data recording device is powered on, a real-time data file in a real-time folder and a history file in a history folder are obtained; wherein the real-time data file includes at least one data packet of collected vehicle data, and the history file includes a compressed package of historical real-time data files;
[0008] Determining whether the real-time data file is damaged according to a preset number of bytes of a data packet, wherein the number of bytes of the data packet is the number of bytes of a data packet in the real-time data file;
[0009] Determine whether the historical file contains a non-compressed file;
[0010] If there is a non-compressed file, determine whether the non-compressed file is damaged according to the number of bytes in the data packet;
[0011] If any file is damaged, the damaged file is repaired to obtain a repaired data file.
[0012] Optionally, determining whether the real-time data file is damaged according to a preset number of bytes of the data packet includes:
[0013] Determine whether the real-time data file is an integer multiple of the number of bytes of the data packet; if the real-time data file is not an integer multiple of the number of bytes of the data packet, determine that the real-time data file is damaged.
[0014] Optionally, the method further includes:
[0015] Obtain the last target data packet of the real-time data file;
[0016] The data integrity of the target data packet is verified, and if the data verification fails, it is determined that the real-time data file is damaged.
[0017] Optionally, determining whether the non-compressed file is damaged according to the number of bytes of the data packet includes:
[0018] Determining whether the uncompressed file is an integer multiple of the number of bytes of the data packet;
[0019] If the non-compressed file is not an integral multiple of the number of bytes of the data packet, it is determined that the historical data file is damaged.
[0020] Optionally, repairing the damaged file to obtain a repaired data file includes:
[0021] Determine the maximum integer multiple of the number of bytes in the data packet corresponding to the damaged file;
[0022] Deleting the data in the damaged file that is greater than the maximum integer multiple to obtain a process file;
[0023] Obtain the last data packet of the process file;
[0024] If the data verification of the last data packet succeeds, the process file is used as the repaired data file;
[0025] If the data verification of the last data packet fails, the last data packet is deleted to obtain a new process file, until the last data packet of the new process file is verified successfully.
[0026] Optionally, if the repaired data file is a real-time data file, the method further includes:
[0027] Get vehicle data;
[0028] Writing the vehicle data into the real-time data file;
[0029] When the number of bytes of the real-time data file exceeds a preset threshold, the real-time data file is transferred to the history folder and compressed.
[0030] Optionally, if the repaired data file is a non-compressed file in the historical file, the method further includes:
[0031] Compress the repaired data file to obtain a compressed file.
[0032] In a second aspect, the present application further provides a vehicle data recording device, comprising:
[0033] An acquisition unit, used to acquire a real-time data file in a real-time folder and a history file in a history folder when the data recording device is powered on; wherein the real-time data file includes at least one data packet of collected vehicle data, and the history file includes a compressed package of historical real-time data files;
[0034] Damage determination unit for:
[0035] Determining whether the real-time data file is damaged according to a preset number of bytes of a data packet, wherein the number of bytes of the data packet is the number of bytes of a data packet in the real-time data file;
[0036] Determine whether the historical file contains a non-compressed file;
[0037] If there is a non-compressed file, determine whether the non-compressed file is damaged according to the number of bytes in the data packet;
[0038] The data repair unit is used to repair the damaged file if any file is damaged, and obtain a repaired data file.
[0039] In a third aspect, the present application also provides a data recording device, including: a memory, a processor;
[0040] The memory stores computer-executable instructions;
[0041] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method as described in any one of the first aspects.
[0042] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described in any one of the first aspects.
[0043] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0044] The vehicle data recording method, device, data recording device and storage medium provided by the present application include: when the data recording device is powered on, the real-time data file of the real-time folder and the historical file of the historical folder are obtained; wherein, the real-time data file includes at least one data packet of the collected vehicle data, and the historical file includes a compressed package of the historical real-time data file; according to the preset number of data packet bytes, determine whether the real-time data file is damaged, wherein the number of data packet bytes is the number of bytes of a data packet in the real-time data file; determine whether there is a non-compressed package file in the historical file; if there is a non-compressed package file, determine whether the non-compressed file is damaged according to the number of data packet bytes; if any file is damaged, repair the damaged file to obtain the repaired data file. In this way, the data file is checked for damage, and the data file with disordered data is repaired when damaged, so as to ensure that the data file can be parsed normally without losing the normal data therein; in addition, by setting the real-time folder and the historical folder, the conflict between writing and file compression can be avoided. The real-time data is mainly stored in the real-time folder. When the power-on check is performed, the non-compressed file is mainly checked for damage, so as to improve the speed of inspection and repair. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0046] Figure 1 A flow chart of a vehicle data recording method provided in this application;
[0047] Figure 2 A schematic diagram of a single data packet structure provided for this application;
[0048] Figure 3 A flowchart of the file repair process provided for this application;
[0049] Figure 4 A schematic diagram of the vehicle topology provided for this application;
[0050] Figure 5 Schematic diagram of modular design of event recorder provided for this application;
[0051] Figure 6 A schematic diagram of the structure of the device for recording vehicle data provided by this application;
[0052] Figure 7 This is a schematic diagram of the structure of the data recording device provided in this application.
[0053] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0054] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0055] In automotive applications, a large amount of status data before and after a controller failure needs to be recorded so that the staff can optimize the vehicle control system parameters and analyze and diagnose the failure.
[0056] In the existing black box technology solution, there is a situation where the previous period of operation data cannot be recorded under sudden power failure. In many cases, sudden power failure is caused by internal failure or external factors, and the working data during this period is very important and needs to be saved and recorded. At the same time, sudden power failure may cause the recorded data file to be disordered. If it is not repaired in time, the entire recorded file will be invalid and cannot be parsed, which will also cause the loss of key data.
[0057] In view of the above problems, the vehicle data recording method provided by this application can determine whether the file is damaged under special working conditions (such as sudden power failure or voltage fluctuation causing the recorder system to restart). If damaged, it can be repaired and the damaged data packets can be deleted to ensure the correctness of other data packets in the recorded file and that key data is not lost.
[0058] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0059] Figure 1 A flow chart of a vehicle data recording method provided in this application Figure 1 ,like Figure 1 As shown, the method includes:
[0060] S101. When the data recording device is powered on, a real-time data file in a real-time folder and a historical file in a historical folder are obtained; wherein the real-time data file includes at least one data packet of collected vehicle data, and the historical file includes a compressed package of historical real-time data files.
[0061] The data recording device reads the vehicle data, and when the read data reaches the threshold (a predetermined number of data packets are read or the time threshold is reached), it is written to the real-time data file in the real-time folder. Alternatively, the vehicle data is read in real time and the read vehicle data is written to the real-time data file in the real-time folder until a predetermined number of data packets are recorded in the real-time data file or the time threshold is reached. To avoid conflicts between real-time writing of files and file compression, data recording is recorded in two folders on the disk, a real-time folder and a history folder. The real-time folder is used to record real-time data. When the file size reaches the threshold, the cached data is written to a new file, and the previous file is transferred to the history folder to wait for compression.
[0062] The data recording device obtains the real-time data files in the real-time folder and the history files in the history folder each time it is powered on and restarted.
[0063] The real-time data file includes multiple data packets, and the message structure of each data packet is the same. For example, Figure 2 A schematic diagram of a single data packet structure provided for this application, such as Figure 2 As shown in the figure, the data packet content includes: data header, standard time, data content, data check and data tail. Each data packet has a fixed length. Among them, the data content is the minimum unit of the bus acquisition signal plus the data source. For example, for the CAN2.0 bus, the data content is 8 bytes of message content, plus 4 bytes of message ID, plus 1 byte of CAN channel number.
[0064] S102: Determine whether the real-time data file is damaged according to a preset number of bytes of the data packet, wherein the number of bytes of the data packet is the number of bytes of a data packet in the real-time data file.
[0065] After setting the data packet structure, in the actual data recording process, each data packet is of fixed length, so the number of bytes in each data packet is fixed. Under normal circumstances, the size of the data packet in the real-time data file is an integer multiple of the number of bytes in a single data packet. Therefore, it is possible to determine whether the real-time data file is damaged based on the number of bytes in the data packet.
[0066] Specifically, if the size of the real-time data file is not an integral multiple of the number of bytes of a single data packet, it is determined that the real-time data file is damaged.
[0067] Optionally, the last data packet can be further verified. The integrity and legitimacy of the data packet are confirmed by the data header, data tail and data verification of the last data packet. If the file size is an integer multiple of the number of bytes in the data packet and the last data packet verification passes, it is determined that the real-time data file is not damaged, otherwise it is determined that the real-time data file is damaged.
[0068] S103: Determine whether there is a non-compressed file in the history file.
[0069] For historical files, compressed packages of historical real-time data files are stored in historical files. However, it is possible that when the real-time data files are transferred to the historical files, the power is cut off before they are compressed. Therefore, it is necessary to query the historical files after powering on to determine whether there are non-compressed files in them.
[0070] S104: If there is a non-compressed file, determine whether the non-compressed file is damaged according to the number of bytes in the data packet.
[0071] If there is a non-compressed file, it means that it is a real-time data file that needs to be compressed, and it also needs to be judged for damage to determine whether it is damaged. The judgment method is the same as the judgment method for real-time data files, which will not be repeated here.
[0072] S105: If any file is damaged, repair the damaged file to obtain a repaired data file.
[0073] When any file is damaged, it is necessary to repair the file to prevent the recorded file from being unable to be parsed due to damage and losing all the data recorded in the file. Specifically, the damaged data packets of the file are determined, the damaged data packets are deleted, and the normal data packets are retained.
[0074] This embodiment provides a method for recording vehicle data, the method comprising: when the data recording device is powered on, obtaining a real-time data file in a real-time folder and a historical file in a historical folder; wherein the real-time data file includes at least one data packet of the collected vehicle data, and the historical file includes a compressed package of the historical real-time data file; determining whether the real-time data file is damaged according to the preset number of data packet bytes, wherein the number of data packet bytes is the number of bytes of a data packet in the real-time data file; determining whether there is a non-compressed package file in the historical file; if there is a non-compressed package file, determining whether the non-compressed file is damaged according to the number of data packet bytes; if any file is damaged, repairing the damaged file to obtain a repaired data file. This method can repair data files with disordered data caused by sudden power failure, ensure that the data files can be parsed normally, and do not lose normal data therein; in addition, by setting the real-time folder and the historical folder, the conflict between writing and file compression can be avoided. The real-time data is mainly stored in the real-time folder. When the power-on check is performed, the non-compressed files are mainly checked for damage, which improves the speed of inspection and repair.
[0075] The following is an introduction to the process of how to repair a file using an embodiment.
[0076] Figure 3 The flowchart of the file repair provided for this application is as follows: Figure 3 shown.
[0077] After booting, check whether there are uncompressed files in the history folder. If there are uncompressed files, perform file repair. The file repair process is as follows: Figure 3 As shown in the dashed line diagram on the right side of the figure. After the repair is completed, the repaired data file is compressed to obtain a compressed file, which is stored in the history folder. Continue to determine whether there are uncompressed files in the history folder until there are no uncompressed files in it.
[0078] When there is no uncompressed file in the history folder, it is determined whether there is a file in the real-time folder. If there is no file in the real-time folder, it ends. If there is a file in the real-time folder, it is determined whether the file polling is completed, that is, whether the file has been completely written or whether a complete data packet has been generated. If the file polling is completed, it means that the file data packet is normal, and it ends, otherwise the file is repaired.
[0079] The file repair process is as follows: first read the size of the file to be repaired and determine whether the file size is an integer multiple of the size of a single data packet.
[0080] If the file size is not an integer multiple of the size of a single data packet, it means that the file is damaged. Then determine that the integer obtained by dividing the file size by the size of a single data packet is the maximum integer multiple. Delete the data after the maximum integer multiple of the size of a single data packet in the file to obtain the process file.
[0081] Read the last data packet of the process file and perform data verification on the last data packet. If the data verification passes, the file repair is complete. If the data verification fails, delete the last data packet in the file and get a new process file. Re-read the last data packet of the new process file and perform verification until the file repair is complete.
[0082] If the file size is an integer multiple of the size of a single data packet, the last data packet of the file is also verified. If the data verification fails, the last data packet in the file is deleted to obtain a new process file. The last data packet in the new process file is re-read and verified until the file is repaired.
[0083] The real-time file data in the repaired real-time folder can continue to be written into the real-time file, and the non-compressed files in the repaired historical folder are compressed into compressed files by executing the compression step.
[0084] This method can be used to repair damaged data files by deleting only damaged data packets, ensuring the accuracy of the content of the data packets in the data files. It can also avoid the situation where the entire data file cannot be parsed due to garbled characters generated after a power outage.
[0085] The topological structure of the vehicle data recording device in the vehicle is introduced below.
[0086] Figure 4 The vehicle topology diagram provided for this application is as follows: Figure 4 As shown, an event recorder is taken as an example as a vehicle data recording device.
[0087] (1) The event recorder is connected to the vehicle bus of the car. The vehicle bus can be any one or more combinations such as CAN / LIN / Ethernet. The event recorder collects all data of all vehicle controllers through the vehicle bus.
[0088] (2) The event recorder collects the vehicle's hard-wired signals through hard-wired signals.
[0089] (3) The event recorder is connected to the gateway via Ethernet, and the gateway is connected to the Internet. The recorder is connected to the cloud service platform through the gateway and receives instructions from the cloud server. It can be awakened by platform instructions at any time and upload designated record files to the cloud service platform.
[0090] (4) The gateway provides Internet access services. At the same time, the gateway's antenna can obtain standard time and positioning information from GPS / BD and broadcast this information to the vehicle bus.
[0091] (5) The ECU (Electronic Control Unit) is connected to the vehicle bus and broadcasts the controller's raw data to the bus. ECU1, ECU2 to ECUn are general terms for controllers on the vehicle.
[0092] The event recorder adopts modular design, such as Figure 5 As shown, Figure 5 The schematic diagram of the modular design of the event recorder provided in this application. The event recorder is a specific vehicle data recording device, which consists of a data acquisition module, a data recording module, a data compression module, a file management module, a remote download module and a data repair module, and each module is independent of each other.
[0093] The data acquisition module is mainly responsible for the data acquisition of the vehicle bus (CAN / Ethernet / LIN, etc.) and hard-wired signals, and uses the collected standard time information to calibrate the recorder itself (once every day at 2 a.m. or later with the standard time). When the collected standard time is valid, the standard time is used (that is, the standard time check bit is normal). When the standard time is invalid, the recorder's own time is used. The collected real-time vehicle data plus the time information, data header, data tail and check information are packaged into a data packet and added to the first-in-first-out data cache queue. The data structure of each data packet is as follows: Figure 2 As shown, the length is fixed, and the data verification part is a verification algorithm private to the host manufacturer, which is used to determine whether the data has been illegally modified.
[0094] By unifying the data recording time into a standard time, relevant vehicle problems can be located through joint analysis of data from multiple controllers.
[0095] The data content is the smallest unit of the bus acquisition signal plus the data source. For example, for the CAN2.0 bus, the data content is 8 bytes of message content, 4 bytes of message ID, and 1 byte of CAN channel number. Each data packet has a fixed length, and the integrity and legitimacy of the data packet are confirmed through the data header, data tail, and data verification to prevent illegal tampering of data.
[0096] The data recording module is responsible for reading data from the cache queue. When the read data reaches the threshold (a predetermined number of data packets are read or the time threshold has been reached), the data file is written to the real-time folder. To avoid conflicts between real-time writing and file compression, data is recorded in two folders on the disk, the real-time folder and the history folder. The real-time folder is used to record real-time data. When the file size reaches the threshold, the cached data is written to a new file and the previous file is transferred to the history folder to wait for compression by the compression module.
[0097] The data compression module is responsible for compressing the historical data files in the history folder. When polling for non-compressed files, the files will be compressed. After the compression is successful, the source files will be deleted to improve the utilization of disk space and store more vehicle data files.
[0098] The file management module periodically queries the disk space. When the remaining disk space is less than the threshold (such as less than 15% of the disk space), the oldest file in the history folder is deleted according to the last modification time of the file. The disk files are managed according to the first-in-first-out rule to ensure the record of the latest data files.
[0099] The remote download module interacts with the cloud platform, responds to the platform's wake-up command and data download command, and uploads the file at the specified time to the cloud platform, making it convenient to obtain vehicle data anytime and anywhere. By interacting with the cloud, it supports remote wake-up of the cloud service platform and remotely obtains data record files at a specified time, providing a more convenient way to obtain vehicle data record files anytime and anywhere.
[0100] Data repair module: Scan the non-compressed files in the real-time folder and the history folder at startup, and repair the files by determining whether the file size is an integer multiple of the data packet and verifying the legitimacy of the last packet recorded in the file. The specific algorithm process is as follows: Figure 3 As shown, the garbled part at the end of the file is removed to ensure the correctness and integrity of the file. The repaired file can continue to be modified in an appending manner.
[0101] Through the above method, a large amount of status data before and after the controller failure can be recorded, so that the staff can optimize the parameters of the vehicle control system and analyze and diagnose the failure. The amount of data that can be recorded by the existing recorder is relatively small. The event recorder of this application can upload the stored compressed files to the cloud, delete the oldest files in the history folder, and manage the disk files according to the first-in-first-out rule to ensure the recording of the latest data files. This method can solve the shortcomings of the existing technical solutions such as the small amount of recorded data, the short time of recording the operation process, and the inconvenient access to the recorded files.
[0102] The event recorder device itself has three protection functions: fireproof, waterproof and explosion-proof, ensuring the safety and accessibility of data recording files after sudden extreme accidents.
[0103] Figure 6 A schematic diagram of the structure of the vehicle data recording device provided by this application, such as Figure 6 As shown in the above Figure 5 Based on the structure shown, the data repair module in the event recorder includes:
[0104] An acquisition unit, used to acquire a real-time data file in a real-time folder and a history file in a history folder when the data recording device is powered on; wherein the real-time data file includes at least one data packet of collected vehicle data, and the history file includes a compressed package of historical real-time data files;
[0105] Damage determination unit for:
[0106] Determining whether the real-time data file is damaged according to a preset number of bytes of a data packet, wherein the number of bytes of the data packet is the number of bytes of a data packet in the real-time data file;
[0107] Determine whether the historical file contains a non-compressed file;
[0108] If there is a non-compressed file, determine whether the non-compressed file is damaged according to the number of bytes in the data packet;
[0109] The data repair unit is used to repair the damaged file if any file is damaged, and obtain a repaired data file.
[0110] Optionally, the damage determination unit is specifically used to:
[0111] Determine whether the real-time data file is an integer multiple of the number of bytes of the data packet; if the real-time data file is not an integer multiple of the number of bytes of the data packet, determine that the real-time data file is damaged.
[0112] Optionally, the damage determination unit is further used for:
[0113] Obtain the last target data packet of the real-time data file;
[0114] The data integrity of the target data packet is verified, and if the data verification fails, it is determined that the real-time data file is damaged.
[0115] Optionally, the damage determination unit is further used for:
[0116] Determining whether the uncompressed file is an integer multiple of the number of bytes of the data packet;
[0117] If the non-compressed file is not an integral multiple of the number of bytes of the data packet, it is determined that the historical data file is damaged.
[0118] Optionally, the data repair unit is specifically used for:
[0119] Determine the maximum integer multiple of the number of bytes in the data packet corresponding to the damaged file;
[0120] Deleting the data in the damaged file that is greater than the maximum integer multiple to obtain a process file;
[0121] Obtain the last data packet of the process file;
[0122] If the data verification of the last data packet succeeds, the process file is used as the repaired data file;
[0123] If the data verification of the last data packet fails, the last data packet is deleted to obtain a new process file, until the last data packet of the new process file is verified successfully.
[0124] Optionally, if the repaired data file is a real-time data file, the data recording module is further used to:
[0125] Get vehicle data;
[0126] Writing the vehicle data into the real-time data file;
[0127] When the number of bytes of the real-time data file exceeds a preset threshold, the real-time data file is transferred to the history folder and compressed.
[0128] Optionally, if the repaired data file is a non-compressed file in the historical file, the data compression module is used to
[0129] Compress the repaired data file to obtain a compressed file.
[0130] The event recorder provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be described in detail here.
[0131] Figure 7 This is a schematic diagram of the structure of the data recording device provided in this application. Figure 7 As shown, the data recording device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.
[0132] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.
[0133] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0134] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.
[0135] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0136] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0137] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0138] The present application also provides a vehicle, comprising the event recorder described in the above embodiment.
[0139] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0140] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0141] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0142] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0143] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0144] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0145] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0146] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0147] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for recording vehicle data, characterized in that: include: When the data recording device is powered on, a real-time data file in a real-time folder and a history file in a history folder are obtained; wherein the real-time data file includes at least one data packet of collected vehicle data, and the history file includes a compressed package of historical real-time data files; Determining whether the real-time data file is damaged according to a preset number of bytes of a data packet, wherein the number of bytes of the data packet is the number of bytes of a data packet in the real-time data file; Determine whether the historical file contains a non-compressed file; If there is a non-compressed file, determine whether the non-compressed file is damaged according to the number of bytes in the data packet; If any file is damaged, the damaged file is repaired to obtain a repaired data file.
2. The method according to claim 1, characterized in that: Determining whether the real-time data file is damaged according to a preset number of bytes of the data packet includes: Determine whether the real-time data file is an integer multiple of the number of bytes of the data packet; if the real-time data file is not an integer multiple of the number of bytes of the data packet, determine that the real-time data file is damaged.
3. The method according to claim 2, characterized in that The method further comprises: Obtain the last target data packet of the real-time data file; The data integrity of the target data packet is verified, and if the data verification fails, it is determined that the real-time data file is damaged.
4. The method according to claim 1, characterized in that: The step of determining whether the non-compressed file is damaged according to the number of bytes of the data packet includes: Determining whether the uncompressed file is an integer multiple of the number of bytes of the data packet; If the non-compressed file is not an integral multiple of the number of bytes of the data packet, it is determined that the historical data file is damaged.
5. The method according to any one of claims 1 to 4, characterized in that: The method of repairing the damaged file to obtain the repaired data file includes: Determine the maximum integer multiple of the number of bytes in the data packet corresponding to the damaged file; Deleting the data in the damaged file that is greater than the maximum integer multiple to obtain a process file; Obtain the last data packet of the process file; If the data verification of the last data packet succeeds, the process file is used as the repaired data file; If the data verification of the last data packet fails, the last data packet is deleted to obtain a new process file, until the last data packet of the new process file is verified successfully.
6. The method according to claim 5, characterized in that If the repaired data file is a real-time data file, the method further includes: Get vehicle data; Writing the vehicle data into the real-time data file; When the number of bytes of the real-time data file exceeds a preset threshold, the real-time data file is transferred to the history folder and compressed.
7. The method according to claim 5, characterized in that If the repaired data file is a non-compressed file in the historical file, the method further includes: Compress the repaired data file to obtain a compressed file.
8. A vehicle data recording device, characterized in that: include: An acquisition unit, used to acquire a real-time data file in a real-time folder and a history file in a history folder when the data recording device is powered on; wherein the real-time data file includes at least one data packet of collected vehicle data, and the history file includes a compressed package of historical real-time data files; Damage determination unit for: Determining whether the real-time data file is damaged according to a preset number of bytes of a data packet, wherein the number of bytes of the data packet is the number of bytes of a data packet in the real-time data file; Determine whether the historical file contains a non-compressed file; If there is a non-compressed file, determine whether the non-compressed file is damaged according to the number of bytes in the data packet; The data repair unit is used to repair the damaged file if any file is damaged, and obtain a repaired data file.
9. A data recording device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.