CN110750531B - Data processing method and related equipment - Google Patents

Data processing method and related equipment Download PDF

Info

Publication number
CN110750531B
CN110750531B CN201910871634.7A CN201910871634A CN110750531B CN 110750531 B CN110750531 B CN 110750531B CN 201910871634 A CN201910871634 A CN 201910871634A CN 110750531 B CN110750531 B CN 110750531B
Authority
CN
China
Prior art keywords
data
database
preset frequency
circular queue
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910871634.7A
Other languages
Chinese (zh)
Other versions
CN110750531A (en
Inventor
刘均
于超峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN201910871634.7A priority Critical patent/CN110750531B/en
Publication of CN110750531A publication Critical patent/CN110750531A/en
Application granted granted Critical
Publication of CN110750531B publication Critical patent/CN110750531B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a data processing method and related equipment. The method is applied to the terminal, and comprises the following steps: data acquisition is carried out according to a first preset frequency; storing the acquired data into a database according to a second preset frequency, synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transferring the data in the circular queue into the database according to the first preset frequency, wherein the first frequency is larger than the second frequency; when an abnormality occurs, all data in the circular queue are transferred to the database for one time; and storing the data acquired after the abnormality to the database according to the first preset frequency. Therefore, by implementing the embodiment of the application, the collected data is stored through the circular queue and the database, which is beneficial to realizing the 3-level alarming function of the vehicle and saving the cost.

Description

Data processing method and related equipment
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a data processing method and related devices.
Background
Currently, an electric automobile is an important development object of new energy automobile strategic planning in China, and aiming at the development and planning of the electric automobile, china pushes out the national standard document GBT 32960-2016 electric automobile remote service and management System technical Specification, and the following regulations are made for data storage and transmission of a vehicle-mounted terminal in the 2 nd part and the 3 rd part:
firstly, when a 3-level alarm occurs to a vehicle, the vehicle-mounted terminal transmits vehicle real-time data of 30 seconds before and after a fault occurrence time point to the platform, and the sampling period of the vehicle real-time data is not more than 1 second, wherein the vehicle real-time data before the fault occurrence is transmitted to the platform in a reissue mode; in addition, the grade 1 alarm described in GBT 32960-2016 electric automobile remote service and management system technical specification does not influence the running of the vehicle, the grade 2 alarm is a fault which influences the performance and requires the driver to limit the running, and the grade 3 alarm is that the vehicle cannot run when stopping immediately.
Secondly, the vehicle-mounted terminal stores the acquired real-time data in an internal storage medium according to a time interval of not more than 30 seconds at maximum and then transmits the acquired real-time data to the platform.
Thirdly, the vehicle-mounted terminal can still independently operate to transmit the real-time data of the vehicle to the platform after the external power supply is abnormally disconnected, and at least the collected real-time data of the vehicle 10 minutes before the external power supply is disconnected is ensured to be transmitted to the platform.
Disclosure of Invention
The embodiment of the application provides a data processing method and related equipment, which are beneficial to realizing the 3-level alarming function of a vehicle without adopting an external FLASH storage device by using a circulation queue and a database and storing acquired data, thereby saving cost.
In a first aspect, an embodiment of the present application provides a data processing method, applied to a terminal, where the method includes:
data acquisition is carried out according to a first preset frequency;
storing the acquired data into a database according to a second preset frequency, synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transferring the data in the circular queue into the database according to the first preset frequency, wherein the first frequency is larger than the second frequency;
when an abnormality occurs, all data in the circular queue are transferred to the database for one time;
and storing the data acquired after the abnormality to the database according to the first preset frequency.
Optionally, at least one enqueue pointer is set in the circular queue, and storing the collected data that is not stored in the circular queue according to the first preset frequency includes:
Determining a data type of the acquired data which is not stored;
and storing the non-stored collected data to a designated position in the circular queue according to the first preset frequency by the enqueue pointer according to the data type.
Optionally, a preset number of dequeue pointers are provided in the circular queue, a data type corresponding to each dequeue pointer is correspondingly provided in the database, and transferring all the data in the circular queue to the database once includes:
indexing a storage position of data corresponding to each dequeue pointer in the circular queue according to the data type corresponding to each dequeue pointer;
the data stored in the corresponding storage position in the circular queue are all read out through the corresponding dequeue pointer;
and transferring all the read data to the database once.
Optionally, the method further comprises:
reading data which are not uploaded to a server from the database according to an uploading zone bit in the database, wherein the uploading zone bit is used for marking the uploaded data in the database;
carrying out data processing on the data read from the database to obtain a data packet with a preset data format, wherein the preset data format is a data format identifiable by the server;
And sending the data packet with the preset data format to the server.
Optionally, the terminal is provided with a T-BOX device, and the data acquisition according to the first preset frequency includes:
and acquiring data according to a first preset frequency through the T-BOX equipment.
Optionally, the first preset frequency is equal to 1 second/packet, and the second preset frequency is greater than 30 seconds/packet and less than 1 second/packet.
Optionally, the database includes SQlite3, and the circular queue is capable of storing 30 packets of data.
In a second aspect, an embodiment of the present application provides a data processing apparatus, applied to a terminal, where the apparatus includes:
the acquisition module is used for acquiring data according to a first preset frequency;
the storage module is used for storing the acquired data into a database according to a second preset frequency, synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transferring the data in the circular queue into the database according to the first preset frequency, wherein the first frequency is larger than the second frequency;
the storage module is further used for transferring all data in the circular queue to the database once when an abnormality occurs;
The storage module is further used for storing the data acquired after the abnormality occurs to the database according to the first preset frequency.
Optionally, at least one enqueue pointer is set in the circular queue, and the storage module includes:
a determining submodule for determining a data type of the acquired data which is not stored;
and the storage sub-module is used for storing the acquired data which is not stored to a designated position in the circular queue according to the first preset frequency by the enqueue pointer according to the data type.
Optionally, a preset number of dequeue pointers are provided in the circular queue, a data type corresponding to each dequeue pointer is correspondingly provided in the database, and the storage module further includes:
an index sub-module, configured to index to a storage position of data corresponding to each dequeue pointer in the circular queue according to a data type corresponding to each dequeue pointer;
the reading submodule is used for reading all data stored in the corresponding storage position in the circular queue through the corresponding dequeue pointer;
and the transfer sub-module is used for transferring all the read data to the database once.
Optionally, the apparatus further comprises:
the reading module is used for reading the data which are not uploaded to the server from the database according to the uploading flag bit in the database, wherein the uploading flag bit is used for marking the data which are uploaded in the database;
the processing module is used for carrying out data processing on the data read from the database to obtain a data packet with a preset data format, wherein the preset data format is a data format which can be identified by the server;
and the sending module is used for sending the data packet with the preset data format to the server.
Optionally, the terminal is internally provided with a T-BOX device, and the acquisition module is further configured to perform data acquisition according to a first preset frequency through the T-BOX device.
Optionally, the first preset frequency is equal to 1 second/packet, and the second preset frequency is greater than 30 seconds/packet and less than 1 second/packet.
Optionally, the database includes SQlite3, and the circular queue is capable of storing 30 packets of data.
In a third aspect, an embodiment of the present application provides a terminal, the terminal including a processor, a memory, a communication interface, and one or more programs, the one or more programs being stored in the memory and configured to be executed by the processor, the programs including instructions for performing steps in the method of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program causes a computer to perform some or all of the steps described in the method according to the first aspect of the embodiments of the present application.
In a fifth aspect, embodiments of the present application provide a computer program product, wherein the computer program product comprises a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in the method of the first aspect of the embodiments of the present application, the computer program product may be a software installation package.
It can be seen that in the technical scheme provided by the embodiment of the application, data acquisition is performed according to the first preset frequency; storing the acquired data into a database according to a second preset frequency, synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transferring the data in the circular queue into the database according to the first preset frequency, wherein the first frequency is larger than the second frequency; when an abnormality occurs, all data in the circular queue are transferred to the database for one time; and storing the data acquired after the abnormality to the database according to the first preset frequency. Therefore, by implementing the embodiment of the application, the collected data is stored through the circular queue and the database, the 3-level alarm function of the vehicle can be realized without adopting an external FLASH storage device, and the cost is saved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a schematic diagram of a data processing system according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a data processing method according to an embodiment of the present application;
FIG. 3-1 is a flow chart of another data processing method according to an embodiment of the present application;
fig. 3-2 is a schematic flow chart of storing vehicle data by the vehicle-mounted terminal according to an embodiment of the present application;
FIG. 4 is a flowchart of another data processing method according to an embodiment of the present application;
FIG. 5 is a block diagram showing functional blocks of a data processing apparatus according to an embodiment of the present application;
fig. 6 is a schematic diagram of a physical architecture of a terminal according to an embodiment of the present application.
Detailed Description
In order to enable those skilled in the art to better understand the present application, the following description will make clear and complete descriptions of the technical solutions according to the embodiments of the present application with reference to the accompanying drawings. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms first, second, third and the like in the description and in the claims and in the above drawings, are used for distinguishing between different objects and not necessarily for describing a particular sequential or chronological order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or modules is not limited to only those steps or modules but may include other steps or modules not expressly listed or inherent to such process, method, article, or apparatus.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the described embodiments of the application may be combined with other embodiments.
Referring to FIG. 1, FIG. 1 is a block diagram illustrating an architecture of a data processing system according to an embodiment of the present application. As shown in fig. 1, the data processing system includes: terminal 101, network 102, server 103.
Wherein the terminal 101 may include, but is not limited to: the embodiments of the present application are not limited to devices with a communication function, smart phones, tablet computers, notebook computers, desktop computers, portable digital players, smart bracelets, smart watches, and the like.
The division of the network 102 may be: the 2G network, the 3G network, the 4G network, and the 5G network may be a local area network, a metropolitan area network, a wide area network, a wired network, a wireless network, or a common network, or a decentralised blockchain network, which is not limited by the embodiments of the present application.
Wherein the server 103 may include, but is not limited to: the embodiments of the present application are not limited to conventional servers, large storage systems, desktop computers, blockchain node servers, notebook computers, tablet computers, palm computers, smart phones, portable digital players, smart watches, and smart bracelets.
In a specific implementation scenario of the embodiment of the present application, the terminal 101 is a vehicle-mounted terminal, and a communication module, such as a queue EC20 module, a middle-aged or Chinese 4G chip, etc., is built in the terminal, so that the terminal may be networked. In addition, the vehicle-mounted terminal is also internally provided with a data acquisition device, the data acquisition device can be used for acquiring data of a vehicle in real time, and the data of the vehicle acquired in real time can be stored specifically and sent to the server 103.
It should be noted that the data processing system shown in fig. 1 may be used to implement the data processing method according to other embodiments of the present application.
Referring to fig. 2, fig. 2 is a flow chart of a data processing method according to an embodiment of the application. As shown in fig. 2, the data processing method is applied to a terminal, and the data processing method includes:
s201, the terminal collects data according to a first preset frequency.
Wherein, the terminal is provided with a built-in T-BOX device, and the data acquisition according to a first preset frequency comprises: and acquiring data according to a first preset frequency through the T-BOX equipment.
It should be noted that the terminal may be built with a data acquisition device, and the terminal may perform data acquisition through the data acquisition device, where the acquired data may be usage data of the terminal or usage data of other devices detected by the terminal.
S202, the terminal stores the acquired data into a database according to a second preset frequency, synchronously stores the non-stored acquired data into a circulation queue according to the first preset frequency, and sequentially transfers the data in the circulation queue into the database according to the first preset frequency, wherein the first frequency is larger than the second frequency.
The data volume which can be stored in the circular queue can be set according to the requirement.
It should be noted that, when the terminal transfers the data stored in the circular queue to the data, the rule of "first in first out" is followed, that is, the data in the first in queue is transferred to the database first.
And S203, when an abnormality occurs, the terminal transfers all the data in the circular queue to the database once.
It can be understood that when an abnormality occurs, the data in the circular queue is the data collected before the abnormality occurs, and all the data are transferred to the database at a time, so that the loss of the data can be effectively avoided.
S204, the terminal stores the data acquired after the abnormality occurs in the database according to the first preset frequency.
Wherein the method further comprises: reading data which are not uploaded to a server from the database according to an uploading zone bit in the database, wherein the uploading zone bit is used for marking the uploaded data in the database; carrying out data processing on the data read from the database to obtain a data packet with a preset data format, wherein the preset data format is a data format identifiable by the server; and sending the data packet with the preset data format to the server.
It can be seen that in the technical scheme provided by the embodiment of the application, data acquisition is performed according to the first preset frequency; storing the acquired data into a database according to a second preset frequency, synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transferring the data in the circular queue into the database according to the first preset frequency, wherein the first frequency is larger than the second frequency; when an abnormality occurs, all data in the circular queue are transferred to the database for one time; and storing the data acquired after the abnormality to the database according to the first preset frequency. Therefore, by implementing the embodiment of the application, the collected data is stored through the circular queue and the database, the 3-level alarm function of the vehicle can be realized without adopting an external FLASH storage device, and the cost is saved.
Referring to fig. 3-1, fig. 3-1 is a flow chart of another data processing method according to an embodiment of the application. As shown in fig. 3-1, the data processing method is applied to a terminal, preferably a vehicle-mounted terminal, and includes:
S301, the vehicle-mounted terminal collects vehicle data at the frequency of 1 second/packet.
Wherein, T-BOX equipment is built-in to the on-vehicle terminal, on-vehicle terminal gathers vehicle data with the frequency of 1 second/package includes: the vehicle-mounted terminal collects vehicle data through the T-BOX device at the frequency of 1 second/packet.
The vehicle-mounted terminal comprises a communication module for transmitting and receiving data, and can be a Quectol EC20 module of Shanghai remote company, a 4G chip of Zhongxing or Huazheng, and the like.
Wherein the vehicle data includes, but is not limited to, vehicle speed, rotational speed, fault code, vehicle position, etc.
S302, the vehicle-mounted terminal judges whether a 3-level alarm occurs to the vehicle or not.
And S303, when the 3-level alarm does not occur, the vehicle-mounted terminal stores the collected vehicle data into the SQlite3 database at a frequency of more than 30 seconds/packet and less than 1 second/packet, synchronously stores the vehicle data which is not stored in the circulation queue at a frequency of 1 second/packet, and then transfers the vehicle data in the circulation queue into the SQlite3 database at a frequency of 1 second/packet.
It will be appreciated that data stored in the SQlite3 database at a real-time data storage frequency (i.e., a frequency greater than 30 seconds/packet and less than 1 second/packet) is not stored in a circular queue in which data of 30 packets in size can be stored is fixedly set.
The SQLite3 database is developed in LINUX environment, and has the advantages of convenience in data import and export and code transplanting.
And S304, when the 3-level alarm occurs, the vehicle-mounted terminal transfers all the vehicle data in the circulation queue to the SQlite3 database for one time, and stores the vehicle data acquired after the 3-level alarm occurs to the SQlite3 database at the frequency of 1 second/packet.
It should be noted that the vehicle-mounted terminal has an external battery function, so that when a 3-level alarm occurs, data in the queue can be written into the database.
It can be understood that the frequency of the vehicle data collected by the vehicle-mounted terminal before and after the 3-level alarm is unchanged.
Referring to fig. 3-2 together, fig. 3-2 is a schematic flow chart of storing vehicle data by the vehicle-mounted terminal according to an embodiment of the application. As shown in fig. 3-2, the vehicle data collected by the vehicle-mounted terminal are stored in two lines, one line stores the data directly into the SQLite3 database at a frequency of more than 30 seconds per packet and less than 1 second per packet, and the other line stores the data into the circulation queue at a frequency of 1 second per packet. The data which is already stored in the Sqlite3 database is not repeatedly stored in the circular queue, namely, the data which is not stored in the SQLite3 database and is not stored in the circular queue is discarded and not stored. The function of the data stored in the circulation queue is to ensure that the collected data in the 30S before the alarm is stored in the SQLite3 database.
S305, the vehicle-mounted terminal reads data which are not uploaded to a server from the SQlite3 database according to an uploading zone bit in the SQlite3 database, wherein the uploading zone bit is used for marking the uploaded data in the database.
It can be understood that the vehicle data in the SQlite3 database is uploaded to the server, and if the vehicle data is not transmitted, the vehicle data is continuously uploaded after the next vehicle-mounted terminal is powered on or connected, the SQlite3 database has an uploading flag bit, and if the data uploaded to the server in the SQlite3 database is not transmitted again.
S306, the vehicle-mounted terminal carries out data processing on the data read from the SQlite3 database to obtain a data packet with a preset data format, wherein the preset data format is a data format identifiable by the server.
S307, the vehicle-mounted terminal sends the data packet with the preset data format to the server.
The data packet with the preset data format sent to the server by the vehicle-mounted terminal can be realized through a built-in permission module.
It can be understood that the vehicle-mounted terminal creates two threads, one is used for processing and receiving the collected vehicle data, and the data is stored in the SQLite3 database according to the method shown in the figure 3-2; the other thread is used for fetching data from the SQLite3 database and sending the data to the server after processing. The data of 30 seconds before and after the 3-level alarm are stored in the SQLite3 database, and the data can be uploaded to the platform with the help of the standby battery.
In addition, related terms or explanations of the embodiments of the present application may be described with reference to the above-described embodiments.
It can be seen that in the technical scheme provided by the embodiment of the application, the vehicle-mounted terminal collects vehicle data at the frequency of 1 second/packet, before 3-level alarming occurs, the collected vehicle data is directly stored in the database at the frequency of more than 30 seconds/packet and less than 1 second/packet, and the non-stored data is synchronously stored in the circulation queue at the frequency of 1 second/packet and is transferred to the database; when the 3-level alarm occurs, an external standby battery can be connected to supply power, the vehicle-mounted terminal can transfer the data in the stored circulation queue to a database once, and vehicle data can be collected continuously at the frequency of 1 second/packet; the collected vehicle data is directly stored in the database at the frequency of 1 second/packet, so that the data of 30 seconds before and after the 3-level alarm can be stored in the database; and the data stored in the database is sent to the platform again, so that the 3-level alarm function is realized.
Referring to fig. 4, fig. 4 is a flowchart illustrating another data processing method according to an embodiment of the application. As shown in fig. 4, the data processing method is applied to a terminal, and the data processing method includes:
S401, the terminal collects data according to a first preset frequency.
S402, the terminal stores the acquired data into a database according to a second preset frequency, wherein the first frequency is larger than the second frequency.
S403, the terminal synchronously determines the data type of the non-stored collected data, the non-stored collected data is stored to a designated position in a circular queue according to the first preset frequency through an enqueuing pointer, then the data in the circular queue is transferred to the database in sequence according to the first preset frequency, and at least one enqueuing pointer is arranged in the circular queue.
The data types include, but are not limited to, vehicle brake types, vehicle security types, vehicle location types, and the like.
S404, a preset number of dequeue pointers are arranged in the circular queue, data types corresponding to the dequeue pointers are correspondingly arranged in the database, and when an abnormality occurs, the terminal indexes the storage position of the data corresponding to the dequeue pointers in the circular queue according to the data types corresponding to the dequeue pointers.
It can be understood that when an abnormality occurs, the vehicle-mounted terminal needs to transfer all data in the circular queue to the database, so as to ensure that the data collected before the abnormality occurs is not lost. Accordingly, the corresponding relevant data may be indexed in the circular queue by the type of data in the database.
And S405, the terminal reads all the data stored in the corresponding storage position in the circular queue through the corresponding dequeue pointer.
S406, the terminal transfers all the read data to the database once.
S407, the terminal stores the acquired data after the abnormality occurs in the database according to the first preset frequency.
In addition, related terms or explanations of the embodiments of the present application may be described with reference to the above-described embodiments.
It can be seen that in the technical scheme provided by the embodiment of the application, the terminal performs data acquisition according to the first preset frequency; the terminal stores the acquired data into a database according to a second preset frequency, synchronously stores the acquired data into a designated position in a circular queue according to a first preset frequency through an enqueuing pointer, and then transfers the acquired data into the database according to the first preset frequency; when an abnormality occurs, the terminal can index different types of data in the circular queue through the corresponding data types in the database, and then the corresponding dequeue pointer is used for reading all the indexed data out and transferring the indexed data to the database, so that the data before the abnormality occurs can be stored in the database.
The foregoing description of the embodiments of the present application has been presented primarily in terms of a method-side implementation. It will be appreciated that the electronic device, in order to achieve the above-described functions, includes corresponding hardware structures and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application can divide the functional modules of the electronic device according to the method example, for example, each functional module can be divided corresponding to each function, and two or more functions can be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
Referring to fig. 5, fig. 5 is a functional block diagram of a data processing apparatus according to an embodiment of the present application. As shown in fig. 5, the data processing apparatus 500 is applied to a terminal, and the data processing apparatus 500 includes the following logic modules:
the acquisition module 501 is configured to perform data acquisition according to a first preset frequency;
the storage module 502 is configured to store acquired data into a database according to a second preset frequency, store the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transfer the data in the circular queue into the database according to the first preset frequency, where the first frequency is greater than the second frequency;
the storage module 502 is further configured to transfer all data in the circular queue to the database once when an exception occurs;
the storage module 502 is further configured to store the data collected after the abnormality to the database according to the first preset frequency.
Optionally, at least one enqueue pointer is set in the circular queue, and the storage module 502 includes:
a determining submodule for determining a data type of the acquired data which is not stored;
And the storage sub-module is used for storing the acquired data which is not stored to a designated position in the circular queue according to the first preset frequency by the enqueue pointer according to the data type.
Optionally, a preset number of dequeue pointers are provided in the circular queue, a data type corresponding to each dequeue pointer is correspondingly provided in the database, and the storage module 502 further includes:
an index sub-module, configured to index to a storage position of data corresponding to each dequeue pointer in the circular queue according to a data type corresponding to each dequeue pointer;
the reading submodule is used for reading all data stored in the corresponding storage position in the circular queue through the corresponding dequeue pointer;
and the transfer sub-module is used for transferring all the read data to the database once.
Optionally, the data processing apparatus 500 further includes:
the reading module is used for reading the data which are not uploaded to the server from the database according to the uploading flag bit in the database, wherein the uploading flag bit is used for marking the data which are uploaded in the database;
The processing module is used for carrying out data processing on the data read from the database to obtain a data packet with a preset data format, wherein the preset data format is a data format which can be identified by the server;
and the sending module is used for sending the data packet with the preset data format to the server.
Optionally, a T-BOX device is built in the terminal, and the acquisition module 501 is further configured to perform data acquisition according to a first preset frequency through the T-BOX device.
Optionally, the first preset frequency is equal to 1 second/packet, and the second preset frequency is greater than 30 seconds/packet and less than 1 second/packet.
Optionally, the database includes SQlite3, and the circular queue is capable of storing 30 packets of data.
It should be noted that, the logic module in this embodiment may perform the method described in the method embodiment. In addition, it can be understood that, since the method embodiment and the apparatus embodiment are different presentation forms of the same technical concept, the content of the method embodiment portion in the present application should be synchronously adapted to the apparatus embodiment portion, which is not described herein.
It can be seen that, in the data processing device provided by the embodiment of the application, the acquisition module performs data acquisition according to the first preset frequency; the storage module stores the acquired data into a database according to a second preset frequency, synchronously stores the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transfers the data in the circular queue into the database according to the first preset frequency, wherein the first frequency is larger than the second frequency; when an abnormality occurs, the storage module transfers all data in the circular queue to the database for one time; and then, the storage module stores the data acquired after the abnormality to the database according to the first preset frequency. Therefore, by implementing the embodiment of the application, the collected data is stored through the circular queue and the database, the 3-level alarm function of the vehicle can be realized without adopting an external FLASH storage device, and the cost is saved.
In accordance with the embodiment shown in fig. 5, please refer to fig. 6, fig. 6 is a schematic diagram of a physical architecture of a terminal according to an embodiment of the present application. As shown in fig. 6, the terminal 600 includes an application processor 610, a memory 620, a communication interface 630, and one or more programs 621, wherein the one or more programs 621 are stored in the memory 620 and configured to be executed by the application processor 610, and when the one or more programs 621 are executed, the processor 610 performs the following operations:
data acquisition is carried out according to a first preset frequency;
storing the acquired data into a database according to a second preset frequency, synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transferring the data in the circular queue into the database according to the first preset frequency, wherein the first frequency is larger than the second frequency;
when an abnormality occurs, all data in the circular queue are transferred to the database for one time;
and storing the data acquired after the abnormality to the database according to the first preset frequency.
Optionally, at least one enqueue pointer is set in the circular queue, and the processor 610 further performs the following operations:
determining a data type of the acquired data which is not stored;
and storing the non-stored collected data to a designated position in the circular queue according to the first preset frequency by the enqueue pointer according to the data type.
Optionally, a preset number of dequeue pointers are disposed in the circular queue, a data type corresponding to each dequeue pointer is disposed in the database, and the processor 610 further performs the following operations:
indexing a storage position of data corresponding to each dequeue pointer in the circular queue according to the data type corresponding to each dequeue pointer;
the data stored in the corresponding storage position in the circular queue are all read out through the corresponding dequeue pointer;
and transferring all the read data to the database once.
Optionally, the processor 610 further performs the following operations:
reading data which are not uploaded to a server from the database according to an uploading zone bit in the database, wherein the uploading zone bit is used for marking the uploaded data in the database;
Carrying out data processing on the data read from the database to obtain a data packet with a preset data format, wherein the preset data format is a data format identifiable by the server;
and sending the data packet with the preset data format to the server.
Optionally, the terminal has a built-in T-BOX device, and the processor 610 further performs the following operations: and acquiring data according to a first preset frequency through the T-BOX equipment.
Optionally, the first preset frequency is equal to 1 second/packet, and the second preset frequency is greater than 30 seconds/packet and less than 1 second/packet.
Optionally, the database includes SQlite3, and the circular queue is capable of storing 30 packets of data.
It should be noted that, the terminal 600 described in this embodiment may perform the method described in the method embodiment.
It can be seen that the terminal provided by the embodiment of the application performs data acquisition according to the first preset frequency; storing the acquired data into a database according to a second preset frequency, synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, and sequentially transferring the data in the circular queue into the database according to the first preset frequency; when an abnormality occurs, all data in the circular queue are transferred to the database for one time, wherein the first frequency is greater than the second frequency; and storing the data acquired after the abnormality to the database according to the first preset frequency. Therefore, by implementing the embodiment of the application, the terminal stores the acquired data through the circular queue and the database, thereby being beneficial to realizing the 3-level alarm function of the vehicle without adopting an external FLASH storage device and saving the cost.
The embodiment of the application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program makes a computer execute part or all of the steps of any one of the above method embodiments, and the computer includes an electronic device.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform part or all of the steps of any one of the methods described in the method embodiments above. The computer program product may be a software installation package, said computer comprising an electronic device.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, such as the division of the modules described above, are merely a logical function division, and may be implemented in other manners, such as multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical or other forms.
The modules described above as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
The integrated modules described above, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a memory, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the above-mentioned method of the various embodiments of the present application. And the aforementioned memory includes: a U-disk, a read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those of ordinary skill in the art will appreciate that all or a portion of the steps in the various methods of the above embodiments may be implemented by a program that instructs associated hardware, and the program may be stored in a computer readable memory, which may include: flash disk, read-Only Memory (ROM), random access Memory (RanPom Access Memory, RAM), magnetic disk or optical disk.
The foregoing has outlined rather broadly the more detailed description of embodiments of the application in order that the detailed description may be better understood, and in order that the present principles and embodiments of the application may be better understood, and in order that the present principles and embodiments may be better understood; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. A data processing method, applied to a terminal, the method comprising:
data acquisition is carried out according to a first preset frequency;
storing the acquired data into a database according to a second preset frequency, and synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, wherein the first preset frequency is larger than the second preset frequency;
And then transferring the data in the circular queue to the database in turn according to the first preset frequency, including: sequentially transferring to the database according to the sequence stored in the circular queue;
when an abnormality occurs, if the power supply is normal, all the data in the circulation queue are transferred to the database once, and if the power supply is interrupted, the external standby battery is connected to supply power to transfer all the data in the circulation queue to the database once;
and storing the data acquired at the first preset frequency after the abnormality occurs into the database according to the first preset frequency.
2. The method of claim 1, wherein at least one enqueue pointer is provided in the circular queue, and wherein storing the collected data that is not stored in the circular queue according to the first preset frequency comprises:
determining a data type of the acquired data which is not stored;
and storing the non-stored collected data to a designated position in the circular queue according to the first preset frequency by the enqueue pointer according to the data type.
3. The method according to claim 1, wherein a preset number of dequeue pointers are provided in the circular queue, and a data type corresponding to each dequeue pointer is correspondingly provided in the database, and the transferring all data in the circular queue to the database at a time includes:
Indexing a storage position of data corresponding to each dequeue pointer in the circular queue according to the data type corresponding to each dequeue pointer;
the data stored in the corresponding storage position in the circular queue are all read out through the corresponding dequeue pointer;
and transferring all the read data to the database once.
4. The method according to claim 1, wherein the method further comprises:
reading data which are not uploaded to a server from the database according to an uploading zone bit in the database, wherein the uploading zone bit is used for marking the uploaded data in the database;
carrying out data processing on the data read from the database to obtain a data packet with a preset data format, wherein the preset data format is a data format identifiable by the server;
and sending the data packet with the preset data format to the server.
5. The method according to any one of claims 1-4, wherein the terminal has a T-BOX device built therein, and the data acquisition according to the first preset frequency includes:
and acquiring data according to a first preset frequency through the T-BOX equipment.
6. The method of any one of claims 1-4, wherein the first preset frequency is equal to 1 second/packet and the second preset frequency is greater than 30 seconds/packet and less than 1 second/packet.
7. The method of any of claims 1-4, wherein the database comprises SQlite3 and the circular queue is capable of storing 30 packets of data.
8. A data processing apparatus for use in a terminal, the apparatus comprising:
the acquisition module is used for acquiring data according to a first preset frequency;
the storage module is used for storing the acquired data into a database according to a second preset frequency, and synchronously storing the non-stored acquired data into a circular queue according to the first preset frequency, wherein the first preset frequency is larger than the second preset frequency;
the storage module is further configured to transfer the data in the circular queue to the database in sequence according to the first preset frequency, and includes: sequentially transferring to the database according to the sequence stored in the circular queue;
the storage module is further used for transferring all the data in the circular queue to the database once if the power supply is normal when the abnormality occurs, and accessing an external standby battery to supply power to transfer all the data in the circular queue to the database once if the power supply is interrupted;
The storage module is further configured to store the data acquired at the first preset frequency after the abnormality occurs to the database according to the first preset frequency.
9. A terminal comprising a processor and a memory, the processor being adapted to implement the steps of the method according to any of claims 1-7 when executing a computer program stored in the memory.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of claims 1-7.
CN201910871634.7A 2019-09-16 2019-09-16 Data processing method and related equipment Active CN110750531B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910871634.7A CN110750531B (en) 2019-09-16 2019-09-16 Data processing method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910871634.7A CN110750531B (en) 2019-09-16 2019-09-16 Data processing method and related equipment

Publications (2)

Publication Number Publication Date
CN110750531A CN110750531A (en) 2020-02-04
CN110750531B true CN110750531B (en) 2023-09-08

Family

ID=69276469

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910871634.7A Active CN110750531B (en) 2019-09-16 2019-09-16 Data processing method and related equipment

Country Status (1)

Country Link
CN (1) CN110750531B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112329983A (en) * 2020-09-30 2021-02-05 联想(北京)有限公司 Data processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893279A (en) * 2016-03-30 2016-08-24 北京经纬恒润科技有限公司 Data transmission method and system based on cycle queue
CN108710531A (en) * 2018-04-20 2018-10-26 深圳市文鼎创数据科技有限公司 Method for writing data, device, terminal device and the storage medium of round-robin queue
CN108961462A (en) * 2018-07-24 2018-12-07 重庆长安汽车股份有限公司 Data recording equipment, system and the vehicle of duty are sentenced for automatic Pilot people's vehicle accident
CN109710624A (en) * 2018-12-19 2019-05-03 泰康保险集团股份有限公司 Data processing method, device, medium and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6534103B2 (en) * 2016-03-18 2019-06-26 パナソニックIpマネジメント株式会社 Recording apparatus and image reproduction method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893279A (en) * 2016-03-30 2016-08-24 北京经纬恒润科技有限公司 Data transmission method and system based on cycle queue
CN108710531A (en) * 2018-04-20 2018-10-26 深圳市文鼎创数据科技有限公司 Method for writing data, device, terminal device and the storage medium of round-robin queue
CN108961462A (en) * 2018-07-24 2018-12-07 重庆长安汽车股份有限公司 Data recording equipment, system and the vehicle of duty are sentenced for automatic Pilot people's vehicle accident
CN109710624A (en) * 2018-12-19 2019-05-03 泰康保险集团股份有限公司 Data processing method, device, medium and electronic equipment

Also Published As

Publication number Publication date
CN110750531A (en) 2020-02-04

Similar Documents

Publication Publication Date Title
US10102174B2 (en) Smart harness
CN107733720B (en) Portable firmware upgrading method and device
CN110806960B (en) Information processing method and device and terminal equipment
CN111179466B (en) Vehicle state data storage method, vehicle state data storage device, vehicle-mounted instrument system and vehicle
CN111323646A (en) System and method for reading ammeter
CN110750531B (en) Data processing method and related equipment
CN202713533U (en) TV diagnosis and maintenance system and TV
CN104678920A (en) Data acquisition and analysis method
CN201910823U (en) Networking terminal for Internet of Things
KR101425699B1 (en) Remote Communication Method for Digital Protective Relay
CN103810769A (en) Data recorder based on HDLC (high-level data link control) and recording method
CN110707824A (en) Redundancy configuration method, device, equipment and storage medium of measurement and control device
CN205283256U (en) Circuit based on battery package system information is acquireed to GSM short message
CN103475936A (en) Method for remote monitoring of digital television receiving terminal
KR20140110358A (en) Remote Monitoring System of Ship Equipment
CN108805741B (en) Fusion method, device and system of power quality data
CN202870803U (en) Data loading device and aviation electric device based on the same
CN202652235U (en) Microcontroller Internet device with embedded TCP/IP protocol stack module
CN207968072U (en) A kind of high Prudential Master system for starting sensitivity
CN202218271U (en) Middleware device and system based on time division-synchronization code division multiple access (TD-SCDMA)
CN103532992A (en) Electric energy quality transient data transmission method and transmission apparatus
CN210310392U (en) Communication data monitoring equipment for subway train control system
CN107528758A (en) A kind of high-speed CAN bus data conversion device and its conversion method
CN214376632U (en) Communication message recorder
CN114498570B (en) Energy storage battery protection device and protection method based on energy storage system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant