Data storage method, device and system
By introducing a cache area mechanism in the on-board terminal, the problem of untimely uploading data in the signal-free area is solved, the data upload efficiency and memory life are improved, and the user experience is improved.
Patent Information
- Application Number
- CN202111012627.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-31
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-08-31
AI Technical Summary
When the on-board terminal uploads data in real time, if the vehicle is in a signal-free area, NANDFLASH writes require a sector, resulting in untimely uploading of blind spot data, affecting the user experience.
The first cache area and the second cache area are introduced in the vehicle terminal, which are respectively used to store the data to be uploaded and record the uploaded data. When the communication is interrupted, the data is stored in the first cache area and directly from the second cache area when the communication is restored. Uploading a cache area to the server delays the erasing life of the memory and avoids the problem of untimely data transmission.
It improves the timeliness of uploading blind spot data, delays the erase life of memory, and avoids the problem of untimely data transmission caused by uploading only when the data reaches one sector, improving the user experience.
Smart Images

Figure CN113703686B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic information technology, and in particular to a data storage method, device and system. Background Art
[0002] When the vehicle terminal uploads data in real time, the data is usually stored in a storage medium, and then the server reads the data from the storage medium. Storage media, such as SD, NANDFLASH, etc., have certain erase and write life requirements.
[0003] Among them, when writing to NANDFLASH, an entire sector needs to be written. If the vehicle reaches an area where there is no signal and cannot exchange data with the server, it enters a blind spot. When the blind spot data is not enough for a sector, if you insist on reading data from NANDFLASH, it will cause the blind spot data to be uploaded untimely. Summary of the invention
[0004] In view of this, the present application provides a data storage method, device and system, and its specific solutions are as follows:
[0005] A data storage method, applied to a vehicle-mounted terminal, comprising:
[0006] If the data communication between the vehicle terminal and the server is interrupted for a preset time, the first data to be uploaded obtained from the communication interruption is stored in the first buffer area;
[0007] If the data communication between the vehicle-mounted terminal and the server is restored, the first data to be uploaded in the first buffer area is transmitted to the server;
[0008] storing the first data to be uploaded into a second buffer area, where the second buffer area is used to record the data uploaded to the server;
[0009] When the length of the data stored in the second buffer area reaches a preset length, the data stored in the second buffer area is transferred to the memory.
[0010] Furthermore, it also includes:
[0011] When data communication between the vehicle-mounted terminal and the server is in an interrupted state, determining whether there is stored data in the second buffer area;
[0012] If it is determined that the second buffer area does not include stored data, and the length of the first data to be uploaded stored in the first buffer area reaches a preset length, the first data to be uploaded stored in the first buffer area is transferred to the memory.
[0013] Furthermore, it also includes:
[0014] If it is determined that the second buffer area includes stored data, transferring the stored data in the second buffer area to the memory;
[0015] When it is determined that the length of the first data to be uploaded stored in the first buffer area reaches a preset length, the first data to be uploaded stored in the first buffer area is transferred to the memory.
[0016] Furthermore, it also includes:
[0017] If the data communication between the vehicle terminal and the server is restored, determining whether there is second data to be uploaded in the memory;
[0018] If there is second data to be uploaded to the server in the memory, the second data to be uploaded is uploaded to the server.
[0019] Further, the transmitting the first to-be-uploaded data in the first buffer area to the server includes:
[0020] If the memory does not contain the second data to be uploaded to the server, and the first data to be uploaded to the server is contained in the first buffer, the first data to be uploaded in the first buffer is transmitted to the server.
[0021] Furthermore, transferring the data stored in the second buffer area to a memory includes:
[0022] The stored data of a preset length in the second buffer area is transferred to the memory, and the length of the data stored in the memory is recorded.
[0023] Furthermore, the data communication interruption between the vehicle-mounted terminal and the server reaches a preset time, including:
[0024] The time period for which data has not been uploaded to the server reaches a preset time period.
[0025] A data storage device, comprising:
[0026] A first storage unit is used to store first data to be uploaded obtained from the communication interruption to a first buffer area when the data communication interruption between the vehicle-mounted terminal and the server reaches a preset time length;
[0027] an uploading unit, configured to transmit the first to-be-uploaded data in the first buffer area to the server when data communication between the vehicle-mounted terminal and the server is restored;
[0028] A second storage unit, used for storing the first data to be uploaded into a second buffer area, wherein the second buffer area is used for recording the data uploaded to the server;
[0029] The transfer unit is used to transfer the data stored in the second buffer area to the memory when the length of the data stored in the second buffer area reaches a preset length.
[0030] A data storage system, comprising:
[0031] server;
[0032] A vehicle-mounted terminal is used to store first data to be uploaded obtained from the communication interruption to a first cache area when the data communication between the vehicle-mounted terminal and the server is interrupted for a preset period of time; if the data communication between the vehicle-mounted terminal and the server is restored, the first data to be uploaded in the first cache area is transmitted to the server; the first data to be uploaded is stored in a second cache area, and the second cache area is used to record the data uploaded to the server; when the length of the data stored in the second cache area reaches a preset length, the data stored in the second cache area is transferred to the memory.
[0033] A storage medium for storing at least one set of instructions;
[0034] The instruction set is used to be called and at least execute any one of the above data storage methods.
[0035] It can be seen from the above technical scheme that the data storage method, device and system disclosed in the present application, if the data communication interruption between the vehicle terminal and the server reaches a preset time, the first data to be uploaded obtained from the communication interruption is stored in the first buffer area, if the data communication between the vehicle terminal and the server is restored, the first data to be uploaded in the first buffer area is transmitted to the server, and the first data to be uploaded is stored in the second buffer area, the second buffer area is used to record the data uploaded to the server, when the length of the data stored in the second buffer area reaches the preset length, the data stored in the second buffer area is transferred to the memory. In this scheme, the first buffer area and the second buffer area are added, and when the communication is interrupted, the data to be uploaded is stored in the first buffer area, so that after the communication is restored, the data to be uploaded can be directly uploaded to the server from the first buffer area without passing through the memory, which prolongs the erase and write life of the memory. At the same time, without passing through the memory, there is no need to upload the data only when the data storage reaches a sector, which causes the problem of untimely data transmission, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 A flowchart of a data storage method disclosed in an embodiment of the present application;
[0038] Figure 2 A flowchart of a data storage method disclosed in an embodiment of the present application;
[0039] Figure 3 A flowchart of a data storage method disclosed in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of the structure of a data storage device disclosed in an embodiment of the present application;
[0041] Figure 5 A schematic diagram of the structure of a data storage system disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0043] The present application discloses a data storage method, which is applied to a vehicle-mounted terminal. Figure 1 As shown, including:
[0044] Step S11: if the data communication interruption between the vehicle-mounted terminal and the server reaches a preset time, the first data to be uploaded obtained since the communication interruption is stored in the first buffer area;
[0045] Step S12: if the data communication between the vehicle terminal and the server is restored, the first data to be uploaded in the first buffer area is transmitted to the server;
[0046] Step S13, storing the first data to be uploaded in the second buffer area, where the second buffer area is used to record the data uploaded to the server;
[0047] Step S14: When the length of the data stored in the second buffer area reaches a preset length, the data stored in the second buffer area is transferred to the memory.
[0048] When the vehicle is in operation, the vehicle terminal is connected to the server, and the vehicle terminal uploads data to the server once at a predetermined interval, so that the server can obtain the vehicle's operation data in real time. The predetermined interval can be 1 second, 2 seconds, or 100 milliseconds.
[0049] When the vehicle is in operation, but the connection between the vehicle terminal and the server is disconnected, that is, the vehicle terminal cannot upload data to the server in real time, this indicates that the vehicle is in a blind spot, that is, the vehicle is in an area with no signal. In this area, the vehicle terminal and the server cannot be connected and data communication cannot be performed.
[0050] In this state, the data to be uploaded that the on-board terminal needs to upload to the server when the vehicle is in a blind spot is usually stored in the server, such as NANDFLASH. However, NANDFLASH writing requires writing an entire sector. If the blind spot data is not enough for a sector, it is necessary to wait until the blind spot data reaches a sector before uploading the data to be uploaded. This will cause the server to obtain the data from the on-board terminal untimely, thus affecting the user experience.
[0051] In order to solve this problem, a first buffer area and a second buffer area are added in this solution.
[0052] The first buffer area is used to store blind area data to be uploaded to the server, and the second buffer area is used to record data that has been uploaded to the server.
[0053] The first buffer area and the second buffer area are both first-in-first-out buffer queues. The first buffer area may be a FIFO, the size of which is set to 4K, and the second buffer area may be a BackUp_FIFO, the size of which is set to 4K.
[0054] By setting the first buffer area, when the vehicle is in a blind spot and the data cannot be uploaded to the server in real time, the data to be uploaded to the server is stored in the first buffer area FIFO, and when the vehicle drives out of the blind spot and the on-board terminal is able to communicate data with the server, the data to be uploaded is directly uploaded to the server from the first buffer area FIFO. In this process, it is not necessary to determine whether the length of the data stored in the first buffer area FIFO reaches a sector. As long as the on-board terminal and the server resume communication, the data that was not uploaded to the server when the vehicle was in the blind spot can be uploaded to the server. There is no need to wait for the length of the cache data to be stored, thereby improving the timeliness of uploading blind spot data.
[0055] Specifically, after the data communication between the vehicle-mounted terminal and the server is restored, the data in the first buffer area is first read, and then the data in the first buffer area is uploaded to the server. At the same time, the data uploaded to the server needs to be stored in the second buffer area BackUp_FIFO, so that the second buffer area can record the data that has been uploaded to the server but has not yet been stored in the memory.
[0056] In addition, it is necessary to further determine whether the data length stored in the second buffer area BackUp_FIFO reaches the preset length. The preset length can be the data length of a sector. If the data length stored in the second buffer area does not reach the preset length, continue to wait until the data length stored in the second buffer area reaches the preset length, and then transfer the data stored in the second buffer area to the memory NANDFLASH, so as to store relevant data during the operation of the vehicle in the memory NANDFLASH.
[0057] Furthermore, the data stored in the second cache area will only be transferred to the memory NANDFLASH when the data stored in the second cache area reaches a preset length, ensuring that the data length of a sector will only be written to the memory NANDFLASH when the data length of a sector is reached, avoiding the problem of erasing the memory when the amount of data is small, thereby affecting the life of the memory.
[0058] The length of a sector is generally 2K or 4K, that is, the preset length can be 2K or 4K.
[0059] The data storage method disclosed in this embodiment is that if the data communication interruption between the vehicle terminal and the server reaches a preset time, the first data to be uploaded obtained from the communication interruption is stored in the first cache area. If the data communication between the vehicle terminal and the server is restored, the first data to be uploaded in the first cache area is transmitted to the server, and the first data to be uploaded is stored in the second cache area. The second cache area is used to record the data uploaded to the server. When the length of the data stored in the second cache area reaches a preset length, the data stored in the second cache area is transferred to the memory. In this solution, the first cache area and the second cache area are added. When the communication is interrupted, the data to be uploaded is stored in the first cache area, so that after the communication is restored, the data to be uploaded can be directly uploaded to the server from the first cache area without passing through the memory, thereby delaying the erase and write life of the memory. At the same time, without passing through the memory, there is no need to upload the data only when the data storage reaches a sector, which causes the problem of untimely data transmission, thereby improving the user experience.
[0060] This embodiment discloses a data storage method, which is applied to a vehicle-mounted terminal. Figure 2 As shown, including:
[0061] Step S21: if the data communication interruption between the vehicle-mounted terminal and the server reaches a preset time, the first data to be uploaded obtained since the communication interruption is stored in the first buffer area;
[0062] Step S22: if the data communication between the vehicle-mounted terminal and the server is in an interrupted state, determine whether there is stored data in the second buffer area;
[0063] Step S23: if it is determined that the second buffer area does not include stored data, and the length of the first data to be uploaded stored in the first buffer area reaches a preset length, the first data to be uploaded stored in the first buffer area is transferred to the memory;
[0064] Step S24: if the data communication between the vehicle terminal and the server is restored, the first data to be uploaded in the first buffer area is transmitted to the server;
[0065] Step S25, storing the first data to be uploaded in the second buffer area, where the second buffer area is used for data that has been uploaded to the server;
[0066] Step S26: When the length of the data stored in the second buffer area reaches a preset length, the data stored in the second buffer area is transferred to the memory.
[0067] If the data communication between the vehicle terminal and the server is interrupted, the vehicle driving data obtained when the communication is interrupted is determined as the data to be uploaded and stored in the first cache area. In the process of storing the data to be uploaded in the first cache area, it is determined whether there is data stored in the second cache area.
[0068] If there is no data stored in the second buffer area, when it is determined that the length of the data to be uploaded in the first buffer area reaches the preset length, the data in the first buffer area is directly stored in the memory NANDFLASH without passing through the second buffer area. That is, no matter whether the data stored in the memory is stored from the first buffer area or the second buffer area, as long as the data length in the buffer area reaches the data size of a sector, it can be directly stored in the memory, avoiding the impact on the memory erase and write life caused by writing to the memory when one sector is not satisfied;
[0069] If there is no data stored in the second buffer area, and the length of the data to be uploaded in the first buffer area does not reach the preset length, then continue to wait until the length of the data in the first buffer area reaches the preset length, and then directly transfer the data in the first buffer area to the memory; or, when the length of the data in the first buffer area does not reach the preset length, the data communication between the vehicle terminal and the server is restored, and then directly upload the data in the first buffer area to the server;
[0070] If the second cache area includes stored data, the stored data in the second cache area is transferred to the memory; and when it is determined that the length of the first data to be uploaded stored in the first cache area reaches a preset length, the first data to be uploaded stored in the first cache area is transferred to the memory.
[0071] Specifically, if the data communication between the vehicle-mounted terminal and the server is in an interrupted state, the first cache area stores data to be uploaded, and the second cache area also stores data, then due to pre-set rules, the data in the second cache area needs to be stored first to ensure that the time sequence of the data stored in the memory is consistent with the time sequence of uploading, to ensure that the data uploaded to the server first will be stored in the memory first, and the data uploaded to the server later will be stored in the memory later.
[0072] Therefore, when data to be uploaded is stored in the first cache area and data is also stored in the second cache area, the data in the second cache area will be stored first. After the data in the second cache area is stored in the memory, when the data length in the first cache area reaches a preset length, the data in the first cache area will be stored in the memory.
[0073] Alternatively, the data to be uploaded may be first stored in the first buffer area, and when the length of the data stored in the first buffer area reaches a preset length, it is determined whether the second buffer area includes the stored data.
[0074] When storing data in the memory, whether it is stored from the first cache area to the memory or from the second cache area to the memory, the relevant information of the data stored in the memory will be recorded, wherein the relevant information of the recorded data can be the data length, or a mark, that is, marking which data has been uploaded and does not need to be uploaded repeatedly, and which data has not been uploaded and needs to be uploaded to the server.
[0075] The data storage method disclosed in this embodiment is that if the data communication interruption between the vehicle terminal and the server reaches a preset time, the first data to be uploaded obtained from the communication interruption is stored in the first cache area. If the data communication between the vehicle terminal and the server is restored, the first data to be uploaded in the first cache area is transmitted to the server, and the first data to be uploaded is stored in the second cache area. The second cache area is used to record the data uploaded to the server. When the length of the data stored in the second cache area reaches a preset length, the data stored in the second cache area is transferred to the memory. In this solution, the first cache area and the second cache area are added. When the communication is interrupted, the data to be uploaded is stored in the first cache area, so that after the communication is restored, the data to be uploaded can be directly uploaded to the server from the first cache area without passing through the memory, thereby delaying the erase and write life of the memory. At the same time, without passing through the memory, there is no need to upload the data only when the data storage reaches a sector, which causes the problem of untimely data transmission, thereby improving the user experience.
[0076] This embodiment discloses a data storage method, which is applied to a vehicle-mounted terminal. Figure 3 As shown, including:
[0077] Step S31: if the data communication interruption between the vehicle-mounted terminal and the server reaches a preset time, the first data to be uploaded obtained since the communication interruption is stored in the first buffer area;
[0078] Step S32: if the data communication between the vehicle terminal and the server is restored, determine whether there is second data to be uploaded in the memory;
[0079] Step S33: if there is second data to be uploaded to the server in the memory, upload the second data to be uploaded to the server;
[0080] Step S34: if there is no second data to be uploaded to the server in the memory, the first data to be uploaded in the first buffer area is transmitted to the server;
[0081] Step S35, storing the first data to be uploaded in the second buffer, the second buffer is used to record the data uploaded to the server;
[0082] Step S36: When the length of the data stored in the second buffer area reaches a preset length, the data stored in the second buffer area is transferred to the memory.
[0083] When data communication between the vehicle-mounted terminal and the server is restored, that is, the vehicle drives out of the blind spot, or the vehicle-mounted terminal and the server are always in communication, that is, the vehicle has not entered the blind spot, it is necessary to first determine whether there is data to be uploaded in the memory, that is, the second data to be uploaded. If there is second data to be uploaded in the memory, it is necessary to first upload the second data to be uploaded in the memory to the server to ensure that the transmitted data order matches the stored data order.
[0084] The second data to be uploaded in the memory may be the first data to be uploaded directly stored in the memory from the first storage area when the vehicle is in the blind spot. Of course, the memory includes not only the second data to be uploaded, but also various data that have been uploaded to the server during the vehicle's driving process. These data that have been uploaded to the server do not need to be uploaded again, but only need to be stored in the memory.
[0085] When data transmission can be carried out between the vehicle-mounted terminal and the server, and no data to be uploaded is detected in the memory, it is necessary to determine whether there is first data to be uploaded in the first storage area. If there is first data to be uploaded in the first storage area, the first data to be uploaded is directly uploaded from the first storage area to the server, so that the data to be uploaded can be uploaded directly from the first storage area without passing through the memory, thereby avoiding the process of first storing the data to be uploaded from the first storage area to the memory and then uploading it from the memory, reducing the erase and write operations of the memory and improving the service life of the memory.
[0086] Furthermore, while directly uploading the first data to be uploaded in the first storage area to the server, the first data to be uploaded will also be stored in the second storage area, so as to record through the second storage area and determine which data has been uploaded to the server and which data has not been uploaded to the server, thereby achieving the purpose of final storage in the memory; and when the length of the data stored in the second storage area reaches a preset length, that is, when a sector is full, all the data of a full sector in the second storage area will be transferred to the memory, and the length of the data will be recorded accordingly in the memory, thereby recording in the memory which data has been uploaded to the server and which data has not yet been uploaded to the server, so as to avoid repeated uploading.
[0087] The data storage method disclosed in this embodiment is that if the data communication interruption between the vehicle terminal and the server reaches a preset time, the first data to be uploaded obtained from the communication interruption is stored in the first cache area. If the data communication between the vehicle terminal and the server is restored, the first data to be uploaded in the first cache area is transmitted to the server, and the first data to be uploaded is stored in the second cache area. The second cache area is used to record the data uploaded to the server. When the length of the data stored in the second cache area reaches a preset length, the data stored in the second cache area is transferred to the memory. In this solution, the first cache area and the second cache area are added. When the communication is interrupted, the data to be uploaded is stored in the first cache area, so that after the communication is restored, the data to be uploaded can be directly uploaded to the server from the first cache area without passing through the memory, thereby delaying the erase and write life of the memory. At the same time, without passing through the memory, there is no need to upload the data only when the data storage reaches a sector, which causes the problem of untimely data transmission, thereby improving the user experience.
[0088] This embodiment discloses a data storage device, and its structural diagram is shown in FIG. Figure 4 As shown, including:
[0089] A first storage unit 41 , an upload unit 42 , a second storage unit 43 and a transfer unit 44 .
[0090] The first storage unit 41 is used to store the first data to be uploaded obtained from the communication interruption to the first buffer area when the data communication interruption between the vehicle terminal and the server reaches a preset time;
[0091] The uploading unit 42 is used to transmit the first data to be uploaded in the first buffer area to the server when the data communication between the vehicle-mounted terminal and the server is restored;
[0092] The second storage unit 43 is used to store the first data to be uploaded into the second buffer area, and the second buffer area is used to record the data uploaded to the server;
[0093] The transfer unit 44 is used for transferring the data stored in the second buffer area to the memory when the length of the data stored in the second buffer area reaches a preset length.
[0094] When the vehicle is in operation, the vehicle terminal is connected to the server, and the vehicle terminal uploads data to the server once at a predetermined interval, so that the server can obtain the vehicle's operation data in real time. The predetermined interval can be 1 second, 2 seconds, or 100 milliseconds.
[0095] When the vehicle is in operation, but the connection between the vehicle terminal and the server is disconnected, that is, the vehicle terminal cannot upload data to the server in real time, this indicates that the vehicle is in a blind spot, that is, the vehicle is in an area with no signal. In this area, the vehicle terminal and the server cannot be connected and data communication cannot be performed.
[0096] In this state, the data to be uploaded that the on-board terminal needs to upload to the server when the vehicle is in a blind spot is usually stored in the server, such as NANDFLASH. However, NANDFLASH writing requires writing an entire sector. If the blind spot data is not enough for a sector, it is necessary to wait until the blind spot data reaches a sector before uploading the data to be uploaded. This will cause the server to obtain the data from the on-board terminal untimely, thus affecting the user experience.
[0097] In order to solve this problem, a first buffer area and a second buffer area are added in this solution.
[0098] The first buffer area is used to store blind area data to be uploaded to the server, and the second buffer area is used to record data that has been uploaded to the server.
[0099] The first buffer area and the second buffer area are both first-in-first-out buffer queues. The first buffer area may be a FIFO, the size of which is set to 4K, and the second buffer area may be a BackUp_FIFO, the size of which is set to 4K.
[0100] By setting the first buffer area, when the vehicle is in a blind spot and the data cannot be uploaded to the server in real time, the data to be uploaded to the server is stored in the first buffer area FIFO, and when the vehicle drives out of the blind spot and the on-board terminal is able to communicate data with the server, the data to be uploaded is directly uploaded to the server from the first buffer area FIFO. In this process, it is not necessary to determine whether the length of the data stored in the first buffer area FIFO reaches a sector. As long as the on-board terminal and the server resume communication, the data that was not uploaded to the server when the vehicle was in the blind spot can be uploaded to the server. There is no need to wait for the length of the cache data to be stored, thereby improving the timeliness of uploading blind spot data.
[0101] Specifically, after the data communication between the vehicle-mounted terminal and the server is restored, the data in the first buffer area is first read, and then the data in the first buffer area is uploaded to the server. At the same time, the data uploaded to the server needs to be stored in the second buffer area BackUp_FIFO, so that the second buffer area can record the data that has been uploaded to the server but has not yet been stored in the memory.
[0102] In addition, it is necessary to further determine whether the data length stored in the second buffer area BackUp_FIFO reaches the preset length. The preset length can be the data length of a sector. If the data length stored in the second buffer area does not reach the preset length, continue to wait until the data length stored in the second buffer area reaches the preset length, and then transfer the data stored in the second buffer area to the memory NANDFLASH, so as to store relevant data during the operation of the vehicle in the memory NANDFLASH.
[0103] Furthermore, the data stored in the second cache area will only be transferred to the memory NANDFLASH when the data stored in the second cache area reaches a preset length, ensuring that the data length of a sector will only be written to the memory NANDFLASH when the data length of a sector is reached, avoiding the problem of erasing the memory when the amount of data is small, thereby affecting the life of the memory.
[0104] The length of a sector is generally 2K or 4K, that is, the preset length can be 2K or 4K.
[0105] Furthermore, the data storage device disclosed in this embodiment may also include: a first determining unit,
[0106] The first determination unit is used to determine whether there is stored data in the second cache area when the data communication between the vehicle-mounted terminal and the server is in an interrupted state; if it is determined that the second cache area does not include stored data, and the length of the first data to be uploaded stored in the first cache area reaches a preset length, the first data to be uploaded stored in the first cache area is transferred to the memory.
[0107] If the data communication between the vehicle terminal and the server is interrupted, the vehicle driving data obtained when the communication is interrupted is determined as the data to be uploaded and stored in the first cache area. In the process of storing the data to be uploaded in the first cache area, it is determined whether there is data stored in the second cache area.
[0108] If there is no data stored in the second buffer area, when it is determined that the length of the data to be uploaded in the first buffer area reaches the preset length, the data in the first buffer area is directly stored in the memory NANDFLASH without passing through the second buffer area. That is, no matter whether the data stored in the memory is stored from the first buffer area or the second buffer area, as long as the data length in the buffer area reaches the data size of a sector, it can be directly stored in the memory, avoiding the impact on the memory erase and write life caused by writing to the memory when one sector is not satisfied;
[0109] If there is no data stored in the second buffer area, and the length of the data to be uploaded in the first buffer area does not reach the preset length, then continue to wait until the length of the data in the first buffer area reaches the preset length, and then directly transfer the data in the first buffer area to the memory; or, when the length of the data in the first buffer area does not reach the preset length, the data communication between the vehicle terminal and the server is restored, and then directly upload the data in the first buffer area to the server;
[0110] If the second cache area includes stored data, the stored data in the second cache area is transferred to the memory; and when it is determined that the length of the first data to be uploaded stored in the first cache area reaches a preset length, the first data to be uploaded stored in the first cache area is transferred to the memory.
[0111] Specifically, if the data communication between the vehicle-mounted terminal and the server is in an interrupted state, the first cache area stores data to be uploaded, and the second cache area also stores data, then due to pre-set rules, the data in the second cache area needs to be stored first to ensure that the time sequence of the data stored in the memory is consistent with the time sequence of uploading, to ensure that the data uploaded to the server first will be stored in the memory first, and the data uploaded to the server later will be stored in the memory later.
[0112] Therefore, when data to be uploaded is stored in the first cache area and data is also stored in the second cache area, the data in the second cache area will be stored first. After the data in the second cache area is stored in the memory, when the data length in the first cache area reaches a preset length, the data in the first cache area will be stored in the memory.
[0113] Alternatively, the data to be uploaded may be first stored in the first buffer area, and when the length of the data stored in the first buffer area reaches a preset length, it is determined whether the second buffer area includes the stored data.
[0114] When storing data in the memory, whether it is stored from the first cache area to the memory or from the second cache area to the memory, the relevant information of the data stored in the memory will be recorded, wherein the relevant information of the recorded data can be the data length, or a mark, that is, marking which data has been uploaded and does not need to be uploaded repeatedly, and which data has not been uploaded and needs to be uploaded to the server.
[0115] Furthermore, the data storage device disclosed in this embodiment may further include: a second determining unit,
[0116] The second determination unit is used to determine whether there is second data to be uploaded in the memory when data communication between the vehicle-mounted terminal and the server is restored; if there is second data to be uploaded to the server in the memory, upload the second data to be uploaded to the server.
[0117] When data communication between the vehicle-mounted terminal and the server is restored, that is, the vehicle drives out of the blind spot, or the vehicle-mounted terminal and the server are always in communication, that is, the vehicle has not entered the blind spot, it is necessary to first determine whether there is data to be uploaded in the memory, that is, the second data to be uploaded. If there is second data to be uploaded in the memory, it is necessary to first upload the second data to be uploaded in the memory to the server to ensure that the transmitted data order matches the stored data order.
[0118] The second data to be uploaded in the memory may be the first data to be uploaded directly stored in the memory from the first storage area when the vehicle is in the blind spot. Of course, the memory includes not only the second data to be uploaded, but also various data that have been uploaded to the server during the vehicle's driving process. These data that have been uploaded to the server do not need to be uploaded again, but only need to be stored in the memory.
[0119] When data transmission can be carried out between the vehicle-mounted terminal and the server, and no data to be uploaded is detected in the memory, it is necessary to determine whether there is first data to be uploaded in the first storage area. If there is first data to be uploaded in the first storage area, the first data to be uploaded is directly uploaded from the first storage area to the server, so that the data to be uploaded can be uploaded directly from the first storage area without passing through the memory, thereby avoiding the process of first storing the data to be uploaded from the first storage area to the memory and then uploading it from the memory, reducing the erase and write operations of the memory and improving the service life of the memory.
[0120] Furthermore, while directly uploading the first data to be uploaded in the first storage area to the server, the first data to be uploaded will also be stored in the second storage area, so as to record through the second storage area and determine which data has been uploaded to the server and which data has not been uploaded to the server, thereby achieving the purpose of final storage in the memory; and when the length of the data stored in the second storage area reaches a preset length, that is, when a sector is full, all the data of a full sector in the second storage area will be transferred to the memory, and the length of the data will be recorded accordingly in the memory, thereby recording in the memory which data has been uploaded to the server and which data has not yet been uploaded to the server, so as to avoid repeated uploading.
[0121] The data storage device disclosed in this embodiment stores the first data to be uploaded obtained from the communication interruption to the first buffer area if the data communication between the vehicle terminal and the server is interrupted for a preset time. If the data communication between the vehicle terminal and the server is restored, the first data to be uploaded in the first buffer area is transmitted to the server, and the first data to be uploaded is stored in the second buffer area. The second buffer area is used to record the data uploaded to the server. When the length of the data stored in the second buffer area reaches the preset length, the data stored in the second buffer area is transferred to the memory. In this solution, the first buffer area and the second buffer area are added. When the communication is interrupted, the data to be uploaded is stored in the first buffer area, so that after the communication is restored, the data to be uploaded can be directly uploaded to the server from the first buffer area without passing through the memory, thereby delaying the erase and write life of the memory. At the same time, without passing through the memory, there is no need to upload the data only when the data storage reaches a sector, which causes the problem of untimely data transmission, thereby improving the user experience.
[0122] This embodiment discloses a data storage system, and its structural diagram is as follows: Figure 5 As shown, including:
[0123] A server 51 and an in-vehicle terminal 52 .
[0124] Among them, the vehicle-mounted terminal 52 is used to store the first data to be uploaded obtained from the communication interruption to the first cache area when the data communication between the vehicle-mounted terminal and the server is interrupted for a preset period of time; if the data communication between the vehicle-mounted terminal and the server is restored, the first data to be uploaded in the first cache area is transmitted to the server; the first data to be uploaded is stored in the second cache area, and the second cache area is used to record the data uploaded to the server; when the length of the data stored in the second cache area reaches the preset length, the data stored in the second cache area is transferred to the memory.
[0125] Furthermore, the vehicle-mounted terminal is also used to: determine whether there is stored data in the second cache area when the data communication between the vehicle-mounted terminal and the server is in an interrupted state; if it is determined that the second cache area does not include stored data, and the length of the first data to be uploaded stored in the first cache area reaches a preset length, the first data to be uploaded stored in the first cache area is transferred to the memory.
[0126] Furthermore, the vehicle-mounted terminal is also used to: if it is determined that the second cache area includes stored data, transfer the stored data in the second cache area to the memory; and when it is determined that the length of the first data to be uploaded stored in the first cache area reaches a preset length, transfer the first data to be uploaded stored in the first cache area to the memory.
[0127] Furthermore, the vehicle terminal is also used to: if the data communication between the vehicle terminal and the server is restored, determine whether there is second data to be uploaded in the memory; if there is second data to be uploaded to the server in the memory, upload the second data to be uploaded to the server.
[0128] Furthermore, the vehicle-mounted terminal transmits the first data to be uploaded in the first buffer area to the server, including:
[0129] If the vehicle terminal determines that there is no second data to be uploaded to the server in the memory, and there is first data to be uploaded to the server in the first buffer area, the first data to be uploaded in the first buffer area is transmitted to the server.
[0130] Furthermore, the vehicle-mounted terminal transfers the data stored in the second buffer area to the memory, including:
[0131] The vehicle-mounted terminal transfers the stored data of a preset length in the second buffer area to the memory, and records the length of the data stored in the memory.
[0132] Furthermore, the data communication interruption between the vehicle terminal and the server reaches a preset time, including:
[0133] The vehicle terminal has not uploaded data to the server for a preset period of time.
[0134] The data storage system disclosed in this embodiment is implemented based on the data storage method disclosed in the above embodiments, which will not be described in detail here.
[0135] The data storage system disclosed in this embodiment stores the first data to be uploaded obtained from the communication interruption to the first buffer area if the data communication between the vehicle terminal and the server is interrupted for a preset time. If the data communication between the vehicle terminal and the server is restored, the first data to be uploaded in the first buffer area is transmitted to the server, and the first data to be uploaded is stored in the second buffer area. The second buffer area is used to record the data uploaded to the server. When the length of the data stored in the second buffer area reaches the preset length, the data stored in the second buffer area is transferred to the memory. In this solution, the first buffer area and the second buffer area are added. When the communication is interrupted, the data to be uploaded is stored in the first buffer area, so that after the communication is restored, the data to be uploaded can be directly uploaded to the server from the first buffer area without passing through the memory, thereby delaying the erase and write life of the memory. At the same time, without passing through the memory, there is no need to upload the data only when the data storage reaches a sector, which causes the problem of untimely data transmission, thereby improving the user experience.
[0136] This embodiment discloses a storage medium for storing at least one set of instructions, wherein the instruction set is used to be called and to execute at least any one of the above data storage methods.
[0137] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0138] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0139] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0140] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data storage method, applied to a vehicle-mounted terminal, characterized in that: include: If the data communication between the vehicle terminal and the server is interrupted for a preset time, the first data to be uploaded obtained from the communication interruption is stored in the first buffer area; If the data communication between the vehicle-mounted terminal and the server is restored, the first data to be uploaded in the first buffer area is transmitted to the server; While transmitting the first data to be uploaded in the first buffer area to the server, storing the data uploaded to the server in a second buffer area, wherein the second buffer area is used to record the data that has been uploaded to the server but has not yet been stored in the memory; When the length of the data stored in the second buffer area reaches a preset length, transferring the data stored in the second buffer area to a memory; When data communication between the vehicle-mounted terminal and the server is in an interrupted state, determining whether there is stored data in the second buffer area; If it is determined that the second buffer area does not include stored data, and the length of the first data to be uploaded stored in the first buffer area reaches a preset length, the first data to be uploaded stored in the first buffer area is transferred to the memory without being stored in the second buffer area; If it is determined that the second buffer area includes stored data, firstly transferring the stored data in the second buffer area to the memory; When it is determined that the length of the first data to be uploaded stored in the first cache area reaches a preset length, the first data to be uploaded stored in the first cache area is transferred to the memory to ensure that the time sequence of the data stored in the memory is consistent with the time sequence of the data uploaded to the server.
2. The method according to claim 1, characterized in that: Also includes: If the data communication between the vehicle terminal and the server is restored, determining whether there is second data to be uploaded in the memory; If there is second data to be uploaded to the server in the memory, the second data to be uploaded is uploaded to the server.
3. The method according to claim 2, characterized in that The transmitting the first to-be-uploaded data in the first buffer area to a server includes: If the memory does not contain the second data to be uploaded to the server, and the first data to be uploaded to the server is contained in the first buffer, the first data to be uploaded in the first buffer is transmitted to the server.
4. The method according to claim 1, characterized in that: The transferring the data stored in the second buffer area to the memory includes: The stored data of a preset length in the second buffer area is transferred to the memory, and the length of the data stored in the memory is recorded.
5. The method according to claim 1, characterized in that The data communication interruption between the vehicle terminal and the server reaches a preset time, including: The time period for which data has not been uploaded to the server reaches a preset time period.
6. A data storage device, characterized in that: include: The first storage unit is used to store the first to-be-uploaded data obtained from the communication interruption to the first buffer area when the data communication interruption between the vehicle-mounted terminal and the server reaches a preset time length; an uploading unit, configured to transmit the first to-be-uploaded data in the first buffer area to the server when data communication between the vehicle-mounted terminal and the server is restored; a second storage unit, configured to store the data uploaded to the server in a second buffer area while transmitting the first data to be uploaded in the first buffer area to the server, wherein the second buffer area is used to record the data uploaded to the server but not yet stored in the memory; A transfer unit, configured to transfer the data stored in the second buffer area to a memory when the length of the data stored in the second buffer area reaches a preset length; The data storage device is also used for: When data communication between the vehicle-mounted terminal and the server is in an interrupted state, determining whether there is stored data in the second buffer area; If it is determined that the second buffer area does not include stored data, and the length of the first data to be uploaded stored in the first buffer area reaches a preset length, the first data to be uploaded stored in the first buffer area is transferred to the memory without being stored in the second buffer area; If it is determined that the second buffer area includes stored data, firstly transferring the stored data in the second buffer area to the memory; When it is determined that the length of the first data to be uploaded stored in the first cache area reaches a preset length, the first data to be uploaded stored in the first cache area is transferred to the memory to ensure that the time sequence of the data stored in the memory is consistent with the time sequence of the data uploaded to the server.
7. A data storage system, characterized in that: include: server; The vehicle-mounted terminal is used to store the first data to be uploaded obtained from the communication interruption to the first buffer area when the data communication interruption between the vehicle-mounted terminal and the server reaches a preset time; If the data communication between the vehicle terminal and the server is restored, the first to-be-uploaded data in the first buffer area is transmitted to the server; While transmitting the first data to be uploaded in the first buffer area to the server, storing the data uploaded to the server in a second buffer area, wherein the second buffer area is used to record the data that has been uploaded to the server but has not yet been stored in the memory; When the length of the data stored in the second buffer area reaches a preset length, transferring the data stored in the second buffer area to a memory; When the data communication between the vehicle-mounted terminal and the server is in an interrupted state, determining whether there is stored data in the second buffer area; if it is determined that the second buffer area does not include stored data, and the length of the first data to be uploaded stored in the first buffer area reaches a preset length, transferring the first data to be uploaded stored in the first buffer area to the memory without being stored in the second buffer area; if it is determined that the second buffer area includes stored data, first transferring the stored data in the second buffer area to the memory; When it is determined that the length of the first data to be uploaded stored in the first cache area reaches a preset length, the first data to be uploaded stored in the first cache area is transferred to the memory to ensure that the time sequence of the data stored in the memory is consistent with the time sequence of the data uploaded to the server.
8. A storage medium for storing at least one set of instruction sets; The instruction set is used to be called and at least execute the data storage method as described in any one of claims 1 to 5 above.
