Data encapsulation method, apparatus, device, and storage medium

CN116389575BActive Publication Date: 2026-10-27CHONGQING CHANGAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310377904.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-10
Publication Date
2026-10-27
Estimated Expiration
2043-04-10

AI Technical Summary

Technical Problem

[0004]鉴于以上所述现有技术的缺点,本申请提供一种数据封装方法、装置、设备及存储介质,用以解决车端现有的数据封装方式中,不能对配置模板进行内容与顺序的灵活调整,使得数据封装的效率较低,无法确保封装报文的有效性的技术问题

Benefits of technology

[0038]通过监测信息上报的第一协议报文,对第一协议报文的更新状况进行判断,若确定第一协议报文的更新状况为已更新,则根据更新后的第二协议报文对初始配置模板进行更新,获得待转换配置模板,然后根据预先编译的模板转换脚本,将待转换配置模板进行格式转换,确定第一模板,第一模板包括Json格式模板,再根据预先编译的模板缓存脚本,加载该第一模板,以对第一模板进行解析并缓存解析结果后获得第二模板,最后基于第二模板对目标对象采集的数据进行封装,获得数据报文,在协议报文发生变化时,能够对初始配置模板的配置信息进行更新,在进行数据封装时不会存在大量的配置信息调整,加快了数据封装的效率,确保了数据封装的有效性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116389575B_ABST
    Figure CN116389575B_ABST
Patent Text Reader

Abstract

The application provides a data encapsulation method and device, equipment and a storage medium, wherein the method comprises the following steps: monitoring a first protocol message of information reporting, judging an update state of the first protocol message; if the update state of the first protocol message is updated, updating an initial configuration template according to a second protocol message after the update to obtain a to-be-converted configuration template; converting the format of the to-be-converted configuration template according to a pre-compiled template conversion script to determine a first template, wherein the first template comprises a Json format template; loading the first template according to a pre-compiled template cache script, analyzing the first template and caching the analysis result to obtain a second template; and encapsulating data collected by a target object based on the second template to obtain a data message. When the protocol message changes, the initial configuration template can be updated, and when data is encapsulated, there is no need to adjust a large amount of configuration information, the efficiency of data encapsulation is improved, and the effectiveness of data encapsulation is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data communication technology, specifically to a data encapsulation method, apparatus, device, and storage medium. Background Technology

[0002] Based on the guiding standards for communication between vehicle remote service platforms, the vehicle-side needs to interact with the automaker's private cloud platform via the vehicle-cloud protocol. The automaker's private cloud platform then connects to the national platform to upload the vehicle's data packets. There are two main methods for uploading vehicle-side data packets to the national platform: First, the vehicle uploads signal data to the automaker's private cloud platform, which periodically encapsulates the signal data into national standard protocol packets, then connects with the national platform and uploads them. Second, the vehicle caches signal data, then directly generates national standard protocol packets and periodically uploads them to the automaker's private cloud platform. This cloud platform does not process the packets further; after connecting with the national platform, it directly uploads them. Because the vehicle-side signal data is massive and some signals have high frequencies, directly uploading the signal data to the cloud platform would consume significant network bandwidth. Therefore, the vehicle-side directly encapsulates the data signals.

[0003] In related technologies, on the one hand, the vehicle-side uses a splicing method to encapsulate signal data; on the other hand, the vehicle-side has multiple methods for acquiring data signals, but there are inconsistencies in the naming of the same target signal. Moreover, if the national standard protocol message changes in the future, or when the vehicle-side connects to other platforms, the configuration template for data encapsulation on the vehicle-side cannot be flexibly adjusted in terms of content and order, resulting in a large amount of configuration information adjustment during data encapsulation. This leads to low efficiency in data encapsulation and makes it impossible to ensure the validity of the encapsulated message. Summary of the Invention

[0004] In view of the shortcomings of the prior art described above, this application provides a data encapsulation method, apparatus, device and storage medium to solve the technical problem that the existing data encapsulation method on the vehicle side cannot flexibly adjust the content and order of the configuration template, resulting in low data encapsulation efficiency and inability to ensure the validity of the encapsulated message.

[0005] In a first aspect, the present invention provides a data encapsulation method, the method comprising:

[0006] The first protocol message of the monitoring information is reported, and the update status of the first protocol message is judged;

[0007] If the update status of the first protocol message is "updated", the initial configuration template is updated according to the updated second protocol message to obtain the configuration template to be converted;

[0008] According to the pre-compiled template conversion script, the configuration template to be converted is formatted to determine the first template, which includes a JSON format template;

[0009] Based on the pre-compiled template caching script, the first template is loaded, the first template is parsed and the parsing result is cached to obtain the second template;

[0010] The data collected from the target object is encapsulated based on the second template to obtain a data message.

[0011] In one embodiment of the present invention, obtaining the initial configuration template includes:

[0012] Parse the first protocol message to obtain the first data format of the first protocol message. The first data format includes at least one information body and corresponding configuration information. The configuration information includes information body name, English description, information body encoding, data type, signal name, coefficient factor and offset.

[0013] For each signal name, retrieve its corresponding information body name, English description, information body code, data type, coefficient factor, and offset from the data cache library and configure them to obtain the initial configuration template.

[0014] In one embodiment of the present invention, updating the initial configuration template according to the updated second protocol message to obtain the configuration template to be converted includes:

[0015] Parse the second protocol message to obtain the second data format of the second protocol message;

[0016] According to the second data format, adjust the number of information bodies and signals in the configuration information of the initial configuration template to obtain the configuration template to be converted.

[0017] In one embodiment of the present invention, the step of encapsulating the data collected from the target object based on the second template to obtain a data packet includes:

[0018] Cache the data information of each signal to obtain a data information set;

[0019] The latest data information of each signal is retrieved from the data information set, and a data snapshot is generated;

[0020] The data snapshot is encapsulated into the data packet according to the second template.

[0021] In one embodiment of the present invention, the data types corresponding to each information body in the initial configuration template include BYTE, WORD, DWORD, N_BYTE, N_WORD, N_DWORD, N_LISTBODY, and UNION. The data format of the protocol message also includes the information type flag of each information body. Different information types correspond to different data types.

[0022] In one embodiment of the present invention, BYTE and WORD represent corresponding to one signal, DWORD represents corresponding to two signals of the same data type, N_BYTE, N_WORD and N_DWORD respectively represent N signals of the same data type, N_LISTBODY represents an arrangement of N sub-information bodies including the signals in the N sub-information bodies; UNION represents the flag bits of several signals.

[0023] In one embodiment of the present invention, after encapsulating the data collected from the target object based on the second template to obtain a data packet, the method further includes:

[0024] The data packet is uploaded to the enterprise platform so that the enterprise platform can upload the data packet to the public platform.

[0025] In one embodiment of the present invention, before obtaining the configuration template to be converted, the method further includes:

[0026] When the target object interfaces with different transmission protocols, the configuration information in the initial configuration template is adjusted according to different data formats to obtain different configuration templates to be converted.

[0027] Secondly, embodiments of the present invention provide a data encapsulation apparatus, the apparatus comprising:

[0028] The judgment module is used to monitor the first protocol message reported by the information and judge the update status of the first protocol message;

[0029] An update module is used to update the initial configuration template according to the updated second protocol message if the update status of the first protocol message is updated, so as to obtain the configuration template to be converted.

[0030] The conversion module is used to convert the configuration template to be converted according to a pre-compiled template conversion script, and determine a first template, the first template including a JSON format template;

[0031] The parsing module is used to load the first template according to the pre-compiled template caching script, parse the first template and cache the parsing result to obtain the second template;

[0032] The encapsulation module is used to encapsulate the data collected from the target object based on the second template to obtain a data packet.

[0033] Thirdly, the present invention provides an electronic device, comprising:

[0034] One or more processors;

[0035] A storage device for storing one or more programs, which, when executed by one or more processors, cause the electronic device to implement the data encapsulation method described in the first aspect.

[0036] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer's processor, causes the computer to perform the data encapsulation method described in the first aspect.

[0037] As described above, the data encapsulation method, apparatus, device, and storage medium provided by the embodiments of the present invention have the following beneficial effects:

[0038] By monitoring the first protocol message reported by the information, the update status of the first protocol message is judged. If it is determined that the first protocol message has been updated, the initial configuration template is updated according to the updated second protocol message to obtain the configuration template to be converted. Then, according to the pre-compiled template conversion script, the configuration template to be converted is formatted to determine the first template, which includes a JSON format template. Then, according to the pre-compiled template caching script, the first template is loaded, parsed, and the parsing result is cached to obtain the second template. Finally, the data collected from the target object is encapsulated based on the second template to obtain a data message. When the protocol message changes, the configuration information of the initial configuration template can be updated. There is no large amount of configuration information adjustment during data encapsulation, which speeds up the efficiency of data encapsulation and ensures the effectiveness of data encapsulation.

[0039] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0040] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0041] Figure 1This is a schematic diagram illustrating the implementation environment of a data encapsulation device as an exemplary embodiment of this application;

[0042] Figure 2 This is a flowchart illustrating a data encapsulation method in an exemplary embodiment of this application;

[0043] Figure 3 This is a schematic diagram illustrating an initial configuration template as shown in an exemplary embodiment of this application;

[0044] Figure 4 This is a block diagram illustrating a data encapsulation device in an exemplary embodiment of this application;

[0045] Figure 5 This is a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of this application. Detailed Implementation

[0046] The embodiments of this application will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be understood that the preferred embodiments are only for illustrating this application and are not intended to limit the scope of protection of this application.

[0047] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0048] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the present application. However, it will be apparent to those skilled in the art that embodiments of the present application may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the present application.

[0049] According to GB / T32960 "Technical Specification for Remote Service and Management System of Electric Vehicles", a three-level monitoring platform at the national, governmental, and enterprise levels is proposed to achieve real-time data collection and transmission. The new energy vehicle monitoring platform can utilize on-board terminals to obtain vehicle status data and fault status on the Controller Area Network (CAN bus) in real time, and combine it with positioning information obtained from GPS sensors. Finally, the data is transmitted to the platform via GPRS / 3G / 4G networks to achieve vehicle safety monitoring, thereby ensuring public safety and improving application effectiveness. At the same time, it can also provide new energy vehicle users with services such as charging, vehicle status inquiry, and remote diagnostics.

[0050] Because the vehicle-mounted signal data is massive and some signals have high frequencies, directly uploading the signal data to the cloud platform would consume significant network bandwidth. Therefore, the vehicle-mounted system directly encapsulates the data signals. The vehicle-mounted system uses various methods to acquire data signals. Traditionally, signal data encapsulation on the vehicle-mounted system uses a splicing method, but this results in inconsistencies in naming the same target signal. Furthermore, if subsequent national standard protocol messages change, or if the vehicle-mounted system interfaces with other platforms, the data encapsulation configuration template cannot be flexibly adjusted in terms of content and order. This leads to extensive adjustments to configuration information during data encapsulation, resulting in low efficiency and compromising the validity of the encapsulated messages.

[0051] To address the above problems, this application provides a data encapsulation method. Please refer to [link to relevant documentation]. Figure 1 , Figure 1 This is a schematic diagram illustrating the implementation environment of a data encapsulation device as shown in an exemplary embodiment of this application. Figure 1As shown, this implementation environment includes an electric vehicle's onboard terminal, an enterprise platform, and a public platform. The onboard terminal and the enterprise platform are connected via a network and communicate using a vehicle-to-platform communication protocol. The enterprise platform and the public platform are also connected via a network and communicate using a platform exchange communication protocol. The specific network connection method is not limited; for example, it can be connected via wireless networks such as 3G (third-generation mobile information technology), 4G (fourth-generation mobile information technology), and 5G (fifth-generation mobile information technology). In this implementation environment, the onboard terminal monitors whether the protocol messages for uploading information to the public platform have been updated. This determines whether the initial configuration template for data encapsulation needs to be updated, and then the template format is converted. The converted template is parsed and cached. Finally, based on the cached template, the vehicle-side data is encapsulated into data packets. This data encapsulation process avoids extensive configuration adjustments, accelerating efficiency and ensuring effectiveness. The data packets are then uploaded to the public platform via the enterprise platform, enabling real-time monitoring of the vehicle by the public platform.

[0052] Please see Figure 2 , Figure 2 This is a flowchart illustrating a data encapsulation method in an exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown is specifically executed by the association resolution module within that implementation environment. It should be understood that this method can also be applied to other exemplary implementation environments and executed by devices in other implementation environments; this embodiment does not limit the implementation environment to which the method is applicable. To address these issues, embodiments of this application propose a data encapsulation method, a data encapsulation device, an electronic device, and a computer-readable storage medium, which will be described in detail below.

[0053] like Figure 2 As shown, in an exemplary embodiment, the data encapsulation method includes at least steps S201 to S205, which are described in detail below:

[0054] Step S201: Monitor the first protocol message reported by the monitoring information and determine the update status of the first protocol message.

[0055] It should be noted that the vehicle terminal needs to encapsulate the vehicle data according to the protocol message of the information report. Therefore, the vehicle terminal needs to monitor the first protocol message of the information report and judge the update status of the first protocol message. The first protocol message here can be regarded as the standard protocol message of the data message uploaded by the vehicle terminal to the public platform, that is, the national standard protocol. However, the first protocol message may change, that is, be updated. In order to ensure the accuracy of the data message it encapsulates, the vehicle terminal needs to judge whether the first protocol message has been updated.

[0056] For example, the standard protocol messages for uploading data packets between the vehicle terminal and the public platform are shown in Table 1:

[0057] Table 1: Standard Protocol Message Structure and Definitions

[0058]

[0059] Table 1 shows the structure, definition, and corresponding data types of standard protocol messages. When the standard protocol message changes, the data format in the message will be updated, and the vehicle terminal should encapsulate its data messages according to the updated protocol message. In Table 1, the data unit, as the basic unit of vehicle terminal data information, includes vehicle login, real-time information reporting, supplementary information reporting, vehicle logout, platform login, platform logout, terminal data reservation, uplink data system reservation, downlink data system reservation, and platform exchange custom data. This data is determined based on the guiding standards for communication between vehicle remote service platforms and will not be elaborated further here. See Table 2 for details.

[0060] Table 2: Data Units in Data Messages

[0061] 0x01 Vehicle Login Up 0x02 Real-time information reporting Up 0x03 Reporting of supplementary information Up 0x04 Vehicle logout Up 0x05 Platform Login Up 0x06 Platform Logout Up 0x07~0x08 Terminal data reservation Up 0x09~0x7F Uplink data system reserved Up 0x80`0x82 Terminal data reservation Downward 0x83~0xBF Downlink data system reserved Downward 0xC0~0xFE Platform exchanges custom data Custom

[0062] In Table 2, uplink indicates the data transmission direction from the vehicle to the server, and downlink indicates the data transmission direction from the server to the client. The custom direction can include either uplink or downlink. In this embodiment, the main focus is on the real-time information reporting and retransmission data reporting of the vehicle terminal. Therefore, the first protocol message is specifically an information reporting protocol message.

[0063] For example, the data format of real-time information reporting is shown in Table 3:

[0064] Table 3: Real-time Reporting Information Data Format

[0065] Data collection time 6 BYTE[6] Information type flag (1) 1 BYTE Information body (1) — — …… — — Information type flag (n) 1 BYTE Information body (n) — —

[0066] Table 3 shows the real-time reported information data format, which includes the data acquisition time, multiple information bodies, and the information type identifier corresponding to each information body. It is composed of a timestamp and several information bodies. It should be noted that each information body involves a series of vehicle-side signals, which are arranged according to certain rules and order. The message bodies include vehicle data, drive motor data, fuel cell data, engine data, vehicle location data, extreme value data, alarm data, terminal data reservations, platform exchange custom data reservations, and user-defined data. The specific information type identifiers, i.e., type codes, corresponding to each information body are shown in Table 4.

[0067] Table 4: Definition of Information Type Flags

[0068] 0x01 Vehicle status data 0x02 Drive motor data 0x03 Fuel cell data 0x04 Engine data 0x05 Vehicle location data 0x06 Extreme value data 0x07 Alarm data 0x08~0x09 Terminal data reservation 0x0A~0x2F Platform exchanges custom data 0x30~0x7F Reserved 0xC0~0xFE User-defined

[0069] Step S202: If the update status of the first protocol message is updated, update the initial configuration template according to the updated second protocol message to obtain the configuration template to be converted.

[0070] The vehicle terminal determines the update status of the first protocol message. If it determines that the update status of the first protocol message is not updated, the initial configuration template does not need to be updated. Instead, the initial configuration template is used as the configuration template to be converted, and the format of the initial configuration template is directly converted. However, if the vehicle terminal determines that the update status of the first protocol message is updated, the previously cached initial configuration template needs to be updated. The updated configuration template is used as the configuration template to be converted, and its format is converted.

[0071] In one embodiment, obtaining the initial configuration template includes:

[0072] Parse the first protocol message to obtain the first data format of the first protocol message. The first data format includes at least one information body and corresponding configuration information. The configuration information includes information body name, English description, information body encoding, data type, signal name, coefficient factor and offset.

[0073] For each signal name, retrieve its corresponding information body name, English description, information body code, data type, coefficient factor, and offset from the data cache and configure them to obtain the initial configuration template.

[0074] The initial configuration template is obtained based on the configuration of the first protocol message. Specifically, the first protocol message is parsed to obtain its first data format, i.e., the data format corresponding to the first protocol message, as shown in Table 3 above for real-time reporting information data format. The first data format includes at least one information body. It should be noted that each information body corresponds to configuration information, which includes the information body name, English description, information body code, data type, signal name, coefficient factor, and offset. After obtaining the first data format of the first protocol message, the vehicle terminal retrieves the corresponding information body name, English description, information body code, data type, coefficient factor, and offset from the vehicle's data cache library for each signal name, and configures the initial configuration template to obtain the initial configuration template.

[0075] It should be understood that the initial configuration template can be considered a collection of information and its configuration details, and its storage format can be varied, such as Excel format. Please refer to [link / reference]. Figure 3 , Figure 3 This is a schematic diagram illustrating an initial configuration template as shown in an exemplary embodiment of this application. Figure 3As shown, the initial configuration template is in Excel format. It should be noted that... Figure 3 The system comprises two information bodies: vehicle status data and alarm data. Each information body corresponds to multiple signals; for example, the vehicle status data corresponds to eight signals. Each signal contains signal data, and an information body is formed based on each signal and configuration information. Figure 3 Each line in the table shows the configuration information for each information body, including the information body name, English description, information body code, data type, signal name, coefficient factor, and offset. It should be understood that... Figure 3 The number and types of information bodies in the text are only examples, and the various signals corresponding to each type of information body are not listed one by one.

[0076] Specifically, the data types corresponding to each information body in the initial configuration template include BYTE, WORD, DWORD, N_BYTE, N_WORD, N_DWORD, N_LISTBODY, and UNION. The data format of the protocol message also includes the information type flag for each information body. Different information types correspond to different data types.

[0077] For example, please continue to see Figure 3 The displayed vehicle status data corresponds to eight data types: BYTE, WORD, DWORD, N_BYTE, N_WORD, N_DWORD, N_LISTBODY, and UNION. Each corresponds to a different signal, indicating a different information type. For example, when the signal in the vehicle status data is "AAAAA," the corresponding data type is BYTE; when the signal is "BBBBB," the corresponding data type is WORD. It should be noted that while the name of each signal can be flexibly chosen during the initial configuration template setup, the name of the same target signal must remain consistent, even if the target signal was acquired using different acquisition methods, to represent the same target signal.

[0078] Specifically, BYTE and WORD represent one signal, DWORD represents two signals of the same data type, N_BYTE, N_WORD and N_DWORD represent N signals of the same data type, N_LISTBODY represents an arrangement of N sub-information bodies, including the signals in the N sub-information bodies; UNION represents the flag bits of several signals.

[0079] BYTE, WORD, and DWORD are basic data types, indicating that the information body corresponds to only one signal, and its signal name can be used directly; N_BYTE, N_WORD, and N_DWORD are N data signals of the same data type. When configuring the initial configuration template, the data signals can be arranged arbitrarily to form a signal. The signal name can be named by separating each signal data with a comma, or it can be obtained by adding a suffix to the basic signal name; N_LISTBODY is an arrangement of N sub-information bodies. There are several signals in the sub-information bodies. Each signal can be obtained by adding a prefix or suffix to the basic signal name; UNION is a flag bit for several signals. If it is a 32-bit integer, each item can be used as a flag indicating whether several signals have occurred.

[0080] In one embodiment, updating the initial configuration template according to the updated second protocol message to obtain the configuration template to be converted includes:

[0081] Parse the second protocol message to obtain the second data format of the second protocol message;

[0082] Based on the second data format, adjust the number of information bodies and signals in the configuration information of the initial configuration template to obtain the configuration template to be converted.

[0083] The initial configuration template is configured based on the first data format of the first protocol message. When the protocol message is updated, the corresponding data format will change. The vehicle terminal determines that updating the initial configuration template according to the second protocol message specifically involves first parsing the second protocol message to obtain its second data format. This second data format differs from the first data format, requiring an update to the initial configuration template. This involves adjusting the information configuration in the initial configuration template, specifically the number of information bodies and signals, to obtain a new configuration template, which serves as the configuration template to be converted, ensuring that the data messages encapsulated by the vehicle terminal conform to the protocol message requirements.

[0084] Step S203: Based on the pre-compiled template conversion script, the configuration template to be converted is formatted to determine the first template, which includes a JSON format template.

[0085] Considering that JSON format templates are not conducive to manual maintenance—that is, when the first protocol message is updated, the configuration information in the updated second protocol message template cannot be reflected in the JSON format template—the vehicle terminal first caches initial configuration templates in other formats locally to cope with updates to the first protocol message. The configuration template to be converted obtained by the vehicle terminal contains various information bodies and their configuration information. Based on a pre-compiled template conversion script, the configuration template to be converted is format-converted. Specifically, the pre-compiled template conversion script is called to parse the configuration template to be converted, extract the configuration information, and obtain a first template. This first template includes a JSON format template, enabling subsequent encapsulation of data collected by the vehicle terminal using the configuration information in the JSON format template.

[0086] The template conversion script shown below is only a part of the complete conversion script, representing the conversion of one information body configuration information:

[0087]

[0088]

[0089] The JSON format template obtained from the template conversion script described above is as follows:

[0090]

[0091]

[0092] Step S204: Based on the pre-compiled template caching script, load the first template, parse the first template and cache the parsing result to obtain the second template.

[0093] After obtaining the first template, i.e. the JSON format template, the first template will be cached. Specifically, the vehicle terminal parses the configuration information in the first format template. That is, according to the pre-compiled template caching script, the first template is loaded, the configuration information in the first template is parsed, the parsing result is obtained, and the parsing result is cached to obtain the second template. The second template includes the specific data information that needs to be encapsulated during data encapsulation.

[0094] The template caching script is shown below, and is only a part of the complete caching script:

[0095]

[0096]

[0097] The second template obtained from the template caching script described above is as follows:

[0098]

[0099]

[0100] Step S205: Encapsulate the data collected from the target object based on the second template to obtain a data packet.

[0101] Since the second template includes the specific data information that needs to be encapsulated during data encapsulation, the vehicle terminal directly collects data based on the second template, fills the collected data into the second template, and then encapsulates it to obtain the final data message that needs to be uploaded to the public platform.

[0102] In one embodiment, data collected from the target object is encapsulated based on a second template to obtain a data packet, including:

[0103] Cache the data information of each signal to obtain a data information set;

[0104] The latest data information of each signal is retrieved from the data information center, and a data snapshot is generated.

[0105] Based on the second template, the data snapshot is encapsulated into a data packet.

[0106] It should be understood that the vehicle-mounted terminal stores all data information from various signals generated by the vehicle, forming a data information set. Based on the configuration information in the second template, the vehicle-mounted terminal queries and retrieves the latest corresponding data information from the data information set, generates a data snapshot, and then, using the second template as a base, fills the second template with the data from the data snapshot, encapsulating the data into a data packet. It should be noted that the national standard protocol message packets are normally uploaded to the national platform once every 10 seconds. The vehicle-mounted terminal needs to upload a data packet every 10 seconds. However, when a level 3 alarm occurs on the vehicle side, to prevent data packet upload failure, it is necessary to resend the data packets from the previous 30 seconds. Therefore, the vehicle side needs to cache one data packet per second as a cache snapshot, requiring a total of 30 cache snapshots. Thus, the vehicle-mounted terminal can cache a maximum of 30 cache snapshots.

[0107] In one embodiment, after encapsulating the data collected from the target object based on the second template to obtain a data packet, the method further includes:

[0108] Upload the data message to the enterprise platform so that the enterprise platform can then upload the data message to the public platform.

[0109] After the vehicle-mounted terminal completes the data packet encapsulation, it uploads the data packet to the enterprise platform based on the vehicle-to-platform communication protocol. The enterprise platform then uploads the data packet to the public platform via the platform exchange communication protocol with the public platform, thereby enabling vehicle monitoring. This avoids the problem of high network channel usage caused by the vehicle directly uploading signal data to the cloud platform due to the large volume of signal data and the high frequency of some signals.

[0110] In one embodiment, before obtaining the configuration template to be converted, the method further includes:

[0111] When the target object interfaces with different transmission protocols, the configuration information in the initial configuration template is adjusted according to different data formats to obtain different configuration templates to be converted.

[0112] The initial configuration template obtained by the vehicle-mounted terminal can also be used when interfacing with other platforms. Faced with different transmission protocols, the vehicle-mounted terminal only needs to parse the protocol messages of that transmission protocol to obtain its data format. Then, based on the specific changes in the data format, the configuration information in the initial configuration template is adjusted accordingly to obtain the configuration template to be converted for interfacing with different platforms, before subsequent data encapsulation. For the vehicle-mounted terminal, this reduces data configuration information and improves the efficiency of data packet encapsulation.

[0113] The data encapsulation method provided in the above embodiments judges the update status of the first protocol message by monitoring the first protocol message reported by the information. If it is determined that the update status of the first protocol message is updated, the initial configuration template is updated according to the updated second protocol message to obtain the configuration template to be converted. Then, according to the pre-compiled template conversion script, the configuration template to be converted is format-converted to determine the first template, which includes a JSON format template. Then, according to the pre-compiled template caching script, the first template is loaded, the first template is parsed, and the parsing result is cached to obtain the second template. Finally, the data collected from the target object is encapsulated based on the second template to obtain a data message. When the protocol message changes, the configuration information of the initial configuration template can be updated. There is no large amount of configuration information adjustment during data encapsulation, which speeds up the efficiency of data encapsulation and ensures the effectiveness of data encapsulation.

[0114] Please see Figure 4 , Figure 4 This is a block diagram illustrating a data encapsulation device in an exemplary embodiment of this application, such as Figure 4 As shown, this embodiment provides a data encapsulation device 400, which includes:

[0115] The judgment module 401 is used to monitor the first protocol message reported by the information and judge the update status of the first protocol message;

[0116] The update module 402 is used to update the initial configuration template according to the updated second protocol message if the update status of the first protocol message is updated, so as to obtain the configuration template to be converted.

[0117] The conversion module 403 is used to convert the configuration template to be converted according to the pre-compiled template conversion script, and determine the first template, which includes a JSON format template.

[0118] Parsing module 404 is used to load the first template according to the pre-compiled template caching script, parse the first template and cache the parsing result to obtain the second template;

[0119] The encapsulation module 405 is used to encapsulate the data collected from the target object based on the second template to obtain a data message.

[0120] It should be noted that the data encapsulation device and the data encapsulation method provided in the above embodiments belong to the same concept. The specific ways in which each module and unit performs operations have been described in detail in the method embodiments and will not be repeated here. In practical applications, the digital goods rights management device provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.

[0121] Embodiments of this application also provide an electronic device, including:

[0122] One or more processors;

[0123] A storage device for storing one or more programs, which, when executed by one or more processors, cause an electronic device to implement the data encapsulation methods provided in the above embodiments.

[0124] Please see Figure 5 , Figure 5 This is a schematic diagram illustrating the structure of an electronic device suitable for implementing the embodiments of this application. It should be noted that... Figure 5 The electronic device 500 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0125] like Figure 5As shown, the electronic device 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on a program stored in Read-Only Memory (ROM) 502 or a program loaded from storage portion 508 into Random Access Memory (RAM) 503. The RAM 503 also stores various programs and data required for system operation. The CPU 1001, ROM 502, and RAM 1003 are interconnected via a bus 504. An Input / Output (I / O) interface 505 is also connected to the bus 504.

[0126] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. Removable media 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 510 as needed so that computer programs read from them can be installed into storage section 508 as needed.

[0127] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs various functions defined in the system of this application.

[0128] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0129] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0130] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0131] Another aspect of this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer's processor, causes the computer to perform the data encapsulation method as described above. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.

[0132] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. A data encapsulation method, characterized in that, The method includes: The first protocol message reported by the monitoring information is used to determine the update status of the first protocol message; If the update status of the first protocol message is updated, the initial configuration template is updated according to the updated second protocol message to obtain the configuration template to be converted. The initial configuration template is a collection of information body and configuration information of the information body. According to the pre-compiled template conversion script, the configuration template to be converted is formatted to determine the first template, which includes a JSON format template. The initial configuration template has a different format from the first template. Based on the pre-compiled template caching script, the first template is loaded, the first template is parsed and the parsing result is cached to obtain the second template; Encapsulating the data collected from the target object based on the second template to obtain a data message; the encapsulation of the data collected from the target object based on the second template to obtain a data message includes: caching the data information of each signal to obtain a data information set; querying and obtaining the latest data information of each signal from the data information set to generate a data snapshot; encapsulating the data snapshot into the data message according to the second template; and resending the data message of the previous 30 seconds according to the data snapshot when a level 3 alarm occurs at the vehicle end. The step of updating the initial configuration template according to the updated second protocol message to obtain the configuration template to be converted includes: parsing the second protocol message to obtain the second data format of the second protocol message; and adjusting the number of information bodies and signals in the configuration information of the initial configuration template according to the second data format to obtain the configuration template to be converted.

2. The data encapsulation method according to claim 1, characterized in that, Obtaining the initial configuration template includes: Parse the first protocol message to obtain the first data format of the first protocol message. The first data format includes at least one information body and corresponding configuration information. The configuration information includes information body name, English description, information body encoding, data type, signal name, coefficient factor and offset. For each signal name, retrieve its corresponding information body name, English description, information body code, data type, coefficient factor, and offset from the data cache library and configure them to obtain the initial configuration template.

3. The data encapsulation method according to claim 1, characterized in that, The data types corresponding to each information body in the initial configuration template include BYTE, WORD, DWORD, N_BYTE, N_WORD, N_DWORD, N_LISTBODY, and UNION. The data format of the protocol message also includes the information type flag for each information body. Different information types correspond to different data types.

4. The data encapsulation method according to claim 3, characterized in that, The BYTE and WORD represent corresponding to one signal, the DWORD represents corresponding to two signals of the same data type, the N_BYTE, N_WORD and N_DWORD represent N signals of the same data type, the N_LISTBODY represents an arrangement of N sub-information bodies, including the signals in the N sub-information bodies; the UNION represents the flag bits of several signals.

5. The data encapsulation method according to any one of claims 1 to 4, characterized in that, After encapsulating the data collected from the target object based on the second template to obtain a data packet, the method further includes: The data packet is uploaded to the enterprise platform so that the enterprise platform can upload the data packet to the public platform.

6. The data encapsulation method according to any one of claims 1 to 4, characterized in that, Before obtaining the configuration template to be converted, the method further includes: When the target object interfaces with different transmission protocols, the configuration information in the initial configuration template is adjusted according to different data formats to obtain different configuration templates to be converted.

7. A data encapsulation device, characterized in that, The device includes: The judgment module is used to monitor the first protocol message reported by the information and judge the update status of the first protocol message; The update module is used to update the initial configuration template according to the updated second protocol message if the update status of the first protocol message is updated, so as to obtain the configuration template to be converted. The initial configuration template is a collection of information body and configuration information of the information body. The conversion module is used to convert the configuration template to be converted according to a pre-compiled template conversion script, determine a first template, the first template including a JSON format template, and the initial configuration template has a different format from the first template; The parsing module is used to load the first template according to the pre-compiled template caching script, parse the first template and cache the parsing result to obtain the second template; The encapsulation module is used to encapsulate the data collected from the target object based on the second template to obtain a data packet; the encapsulation of the data collected from the target object based on the second template to obtain a data packet includes: caching the data information of each signal to obtain a data information set; querying and obtaining the latest data information of each signal from the data information set to generate a data snapshot; encapsulating the data snapshot into the data packet according to the second template; and resending the data packet of the previous 30 seconds according to the data snapshot when a level 3 alarm occurs at the vehicle end. The update module is specifically used to parse the second protocol message to obtain the second data format of the second protocol message; and adjust the number of information bodies and signals in the configuration information of the initial configuration template according to the second data format to obtain the configuration template to be converted.

8. An electronic device, characterized in that, The electronic device includes: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the electronic device to implement the data encapsulation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by the computer's processor, causes the computer to perform the data encapsulation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and system for updating communication protocol, and terminal device

    CN109388417A

  • Data updating method and device of Internet of Things equipment and storage medium

    CN115766785A