Vehicle-mounted screen communication protocol implementation method and device
By abstracting the model in the on-board screen communication protocol and storing it in the protocol pool, the problem of redundancy and complex maintenance of communication protocols in the prior art is solved, and unified management and protocol reuse of multi-screen and multi-car manufacturers are realized, reducing development and maintenance costs.
Patent Information
- Application Number
- CN202411944626.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-15
AI Technical Summary
The implementation of existing on-board screen communication protocols is redundant, complex in maintenance, and difficult to reuse, resulting in high development costs and messy management.
By abstracting a model for each communication protocol, storing it in the protocol pool to form a protocol cluster, and directly finding the corresponding communication protocol from the protocol pool according to the user's naming, realizing unified management of multi-screen and multi-car manufacturers.
It realizes unified management of different communication protocols of multiple screens and multi-vehicle manufacturers, reduces maintenance and management difficulties, reduces development cycle and cost, and uses unified interfaces to achieve decoupling.
Smart Images

Figure CN119835341A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle computer technology, and more specifically, to a method and device for implementing a vehicle screen communication protocol. Background Art
[0002] With the development of automobile intelligence, multi-screen display in automobiles is becoming more and more popular. Different screens can be divided into instrument screen, central control entertainment screen, air conditioning screen, auxiliary driver screen, HUD screen, etc. according to their functional definitions, which involves the communication of different screens. Different communication protocols need to be defined for different interactive requirements of different screens. Even for the same screen, different car manufacturers have different communication protocols for it. Even for the same car manufacturer and the same screen, different projects are likely to have some differences in detail control.
[0003] At present, it is mainly implemented separately for different car manufacturers, different projects and different types of screen protocols, and maintained and managed separately.
[0004] However, the current communication protocol implementation is redundant, complex to maintain, messy to manage and use, has high development costs, and is difficult to reuse. Summary of the invention
[0005] In view of this, the purpose of the present application is to provide a method and device for implementing a vehicle-mounted screen communication protocol. A communication protocol model is abstracted for each communication protocol, stored in a protocol pool to form a protocol cluster, and according to the name of the communication protocol to be used sent by the user, the corresponding communication protocol is directly found from the protocol pool and returned to the user. This achieves unified management of different communication protocols for multiple screens and multiple car manufacturers, allows reuse of protocol items, reduces the difficulty of maintenance and management, and reduces the development cycle, thereby reducing maintenance and development costs. At the same time, a unified interface is used to achieve decoupling from the protocol.
[0006] In a first aspect, an embodiment of the present application provides a method for implementing a vehicle-mounted screen communication protocol, the method comprising:
[0007] Uniformly acquiring a basic communication protocol model based on the communication protocol characteristics, and acquiring a communication protocol model of each communication protocol based on the basic communication protocol model;
[0008] Determine a storage space in the memory of the vehicle computer as a protocol pool, and add the communication protocol model of each communication protocol to the protocol pool to implement storage of each communication protocol model;
[0009] In response to receiving the name of the communication protocol to be used sent by the user, finding a corresponding communication protocol from the protocol pool according to the name of the communication protocol;
[0010] A memory space is applied in the memory, the communication protocol is copied to the memory space, and the corresponding memory address is returned to the user, so that the user can obtain the required communication protocol.
[0011] In a possible implementation, the communication protocol model includes attributes, a protocol scheduling method, and a user method; the communication protocol model of the communication protocol includes a plurality of protocol items, each protocol item includes a protocol item id and a protocol item processing method;
[0012] The attributes include at least protocol name, real-time data, total number of protocol items, protocol item id set, and protocol item set;
[0013] The user method at least includes starting the protocol, closing the protocol, outputting protocol information and querying protocol content, commands issued by the user, controls issued by the user, and upgrading the interface.
[0014] In a possible implementation manner, there are common protocol items and unique protocol items between different communication protocols; the acquiring of the communication protocol model of each communication protocol based on the basic communication protocol model includes:
[0015] For a first communication protocol, determining a plurality of protocol items corresponding to the first communication protocol, and determining a communication protocol model corresponding to the first communication protocol according to the plurality of protocol items;
[0016] Determine multiple protocol items corresponding to the second communication protocol, and compare them with multiple protocol items of the first communication protocol to determine common protocol items and unique protocol items; wherein the common protocol items represent the same protocol items of the second communication protocol and the first communication protocol; and the unique protocol items represent the unique protocol items of the second communication protocol;
[0017] A communication protocol model corresponding to the common protocol items of the first communication protocol and the unique protocol items of the second communication protocol.
[0018] In a possible implementation, the protocol scheduling method includes multiple methods, and the method further includes:
[0019] If the protocol name of the attribute is unnamed and / or the number of protocol items is inconsistent with the protocol item ID set and / or the protocol item set is empty, it is determined that the description of the communication protocol is incorrect, and the communication protocol is removed from the protocol pool;
[0020] If a method definition in the user methods is empty, it is determined that the description of the communication protocol is wrong, and the communication protocol model of the communication protocol is removed from the protocol pool.
[0021] In a possible implementation, the method further includes:
[0022] The preset default protocol scheduling method is obtained. If a method in the protocol scheduling method is empty, the corresponding protocol scheduling method is assigned to the default protocol scheduling method.
[0023] In a possible implementation, the method further includes:
[0024] In response to the communication protocol running, reading the original data sent by the screen, and parsing the original data according to the data format of the original data to obtain corresponding protocol data;
[0025] A corresponding protocol package is formed according to the protocol package id input by the user and the protocol data.
[0026] In a possible implementation, the method further includes:
[0027] Matching the corresponding protocol item id based on the protocol package id of the protocol package, and determining the protocol item matched by the protocol package according to the protocol item id;
[0028] The protocol packet is processed based on the protocol item matched by the protocol packet.
[0029] In a second aspect, an embodiment of the present application further provides a device for implementing a vehicle-mounted screen communication protocol, the device comprising:
[0030] An acquisition module, used to uniformly acquire a basic communication protocol model based on the communication protocol characteristics, and acquire a communication protocol model of each communication protocol based on the basic communication protocol model;
[0031] A storage module, used to determine a storage space in the memory of the vehicle computer as a protocol pool, and add the communication protocol model of each communication protocol to the protocol pool to realize the storage of each communication protocol model;
[0032] A query module, configured to, in response to receiving a name of a communication protocol to be used sent by a user, find a corresponding communication protocol from the protocol pool according to the name of the communication protocol;
[0033] The return module is used to apply for a memory space in the memory, copy the communication protocol to the memory space, and return the corresponding memory address to the user so that the user can obtain the required communication protocol.
[0034] In a possible implementation, the communication protocol model includes attributes, a protocol scheduling method, and a user method; the communication protocol model of the communication protocol includes a plurality of protocol items, each protocol item includes a protocol item id and a protocol item processing method;
[0035] The attributes include at least protocol name, real-time data, total number of protocol items, protocol item id set, and protocol item set;
[0036] The user method at least includes starting the protocol, closing the protocol, outputting protocol information and querying protocol content, commands issued by the user, controls issued by the user, and upgrading the interface.
[0037] In a possible implementation manner, there are common protocol items and unique protocol items between different communication protocols; the acquisition module is specifically used to:
[0038] For a first communication protocol, determining a plurality of protocol items corresponding to the first communication protocol, and determining a communication protocol model corresponding to the first communication protocol according to the plurality of protocol items;
[0039] Determine multiple protocol items corresponding to the second communication protocol, and compare them with multiple protocol items of the first communication protocol to determine common protocol items and unique protocol items; wherein the common protocol items represent the same protocol items of the second communication protocol and the first communication protocol; and the unique protocol items represent the unique protocol items of the second communication protocol;
[0040] A communication protocol model corresponding to the common protocol items of the first communication protocol and the unique protocol items of the second communication protocol.
[0041] In a possible implementation, the protocol scheduling method includes multiple methods, and the vehicle-mounted screen communication protocol implementation device further includes:
[0042] A first judgment module is used to determine that the description of the communication protocol is wrong and remove the communication protocol from the protocol pool if the protocol name of the attribute is unnamed and / or the number of the protocol items is inconsistent with the protocol item ID set and / or the protocol item set is empty;
[0043] The second judgment module is used to determine that the description of the communication protocol is wrong if a method definition in the user methods is empty, and remove the communication protocol model of the communication protocol from the protocol pool.
[0044] In a possible implementation manner, the vehicle-mounted screen communication protocol implementation device further includes:
[0045] The third judgment module is used to obtain a preset default protocol scheduling method. If a method in the protocol scheduling method is empty, the corresponding protocol scheduling method is assigned as the default protocol scheduling method.
[0046] In a possible implementation manner, the vehicle-mounted screen communication protocol implementation device further includes:
[0047] A parsing module, for responding to the operation of the communication protocol, reading the original data sent by the screen, and parsing the original data according to the data format of the original data to obtain corresponding protocol data;
[0048] A composition module is used to compose a corresponding protocol package according to the protocol package ID input by the user and the protocol data.
[0049] In a possible implementation manner, the vehicle-mounted screen communication protocol implementation device further includes:
[0050] A determination module, used to match the corresponding protocol item id based on the protocol package id of the protocol package, and determine the protocol item matched by the protocol package according to the protocol item id;
[0051] A processing module is used to process the protocol packet based on the protocol item matched by the protocol packet.
[0052] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the vehicle-mounted screen communication protocol implementation method as described in any one of the first aspects.
[0053] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for implementing the in-vehicle screen communication protocol described in any one of the first aspects are executed.
[0054] The embodiment of the present application provides a method and device for implementing a vehicle screen communication protocol. Based on the characteristics of the communication protocol, a basic communication protocol model is uniformly obtained, and the communication protocol model of each communication protocol is obtained based on the basic communication protocol model. A storage space is determined in the memory of the vehicle computer as a protocol pool, and the communication protocol model of each communication protocol is added to the protocol pool to realize the storage of each communication protocol model. In response to receiving the name of the communication protocol to be used sent by the user, the corresponding communication protocol is found from the protocol pool according to the name of the communication protocol, a memory space is applied in the memory, the communication protocol is copied to the memory space, and the corresponding memory address is returned to the user, so that the user can obtain the required communication protocol. In the present application, a communication protocol model is abstracted for each communication protocol, stored in the protocol pool to form a protocol cluster, and according to the name of the communication protocol to be used sent by the user, the corresponding communication protocol is directly found from the protocol pool and returned to the user, realizing the unified management of different communication protocols of multiple screens and multiple car factories, and the protocol items can be reused, which reduces the difficulty of maintenance and management, and also reduces the development cycle, thereby reducing the maintenance and development costs. At the same time, a unified interface is used to achieve decoupling with the protocol.
[0055] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0057] Figure 1 It is a flowchart of a method for implementing a vehicle-mounted screen communication protocol provided in an embodiment of the present application;
[0058] Figure 2 It is a schematic diagram of the composition structure of the communication protocol;
[0059] Figure 3 It is a schematic diagram of common protocol items and unique protocol items of different communication protocols;
[0060] Figure 4 It is a schematic diagram of the protocol pool;
[0061] Figure 5 It is a schematic diagram of protocol cluster management;
[0062] Figure 6 This is a schematic diagram of the processing flow of the default protocol scheduling method. Figure 1 ;
[0063] Figure 7 This is a schematic diagram of the processing flow of the default protocol scheduling method. Figure 2 ;
[0064] Figure 8 It is a structural schematic diagram of a vehicle-mounted screen communication protocol implementation device provided according to an embodiment of the present application;
[0065] Fig. 9 It is a structural schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0066] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0067] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0068] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0069] Considering that with the development of automobile intelligence, multi-screen display of automobiles is becoming more and more popular. Different screens can be divided into instrument screen, central control entertainment screen, air conditioning screen, auxiliary driver screen, HUD screen, etc. according to their functional definitions, which involves the communication of different screens. Different communication protocols need to be defined for different interactive requirements of different screens. Even for the same screen, different car manufacturers have different communication protocols for it. Even for the same car manufacturer and the same screen, different projects are likely to have some differences in detail control.
[0070] At present, different car manufacturers, different projects, and different types of screen protocols are implemented separately and maintained and managed separately. However, the current communication protocol implementation is redundant, maintenance is complex, management and use are messy, development costs are high, and it is difficult to reuse.
[0071] To address this problem, the present application provides a method and device for implementing a vehicle-mounted screen communication protocol. A communication protocol model is abstracted for each communication protocol, stored in a protocol pool to form a protocol cluster, and based on the name of the communication protocol to be used sent by the user, the corresponding communication protocol is directly found from the protocol pool and returned to the user. This achieves unified management of different communication protocols for multiple screens and multiple car manufacturers, allows reuse of protocol items, reduces the difficulty of maintenance and management, and reduces the development cycle, thereby reducing maintenance and development costs. At the same time, a unified interface is used to achieve decoupling from the protocol.
[0072] Figure 1 1 is a flow chart of a method for implementing a vehicle-mounted screen communication protocol according to an embodiment of the present application. Figure 1 As shown, the vehicle screen communication protocol implementation method of the embodiment of the present application may specifically include:
[0073] S101. uniformly obtain a basic communication protocol model based on communication protocol characteristics, and obtain a communication protocol model of each communication protocol based on the basic communication protocol model.
[0074] S102: Determine a storage space in the memory of the vehicle computer as a protocol pool, and add the communication protocol model of each communication protocol to the protocol pool to implement storage of each communication protocol model.
[0075] S103: In response to receiving the name of the communication protocol to be used sent by the user, find a corresponding communication protocol from a protocol pool according to the name of the communication protocol.
[0076] S104, applying for a memory space in the memory, copying the communication protocol to the memory space, and returning the corresponding memory address to the user, so that the user can obtain the required communication protocol.
[0077] In the above-mentioned vehicle screen communication protocol implementation method, a communication protocol model is abstracted for each communication protocol, stored in a protocol pool to form a protocol cluster, and according to the name of the communication protocol to be used sent by the user, the corresponding communication protocol is directly found from the protocol pool and returned to the user, thereby realizing unified management of different communication protocols of multiple screens and multiple car manufacturers, and the protocol items can be reused, which reduces the difficulty of maintenance and management, and also reduces the development cycle, thereby reducing maintenance and development costs. At the same time, a unified interface is used to achieve decoupling from the protocol.
[0078] The above exemplary steps of the embodiment of the present application are described below with reference to specific examples:
[0079] S101, uniformly acquiring a basic communication protocol model based on communication protocol characteristics, and acquiring a communication protocol model of each communication protocol based on the basic communication protocol model.
[0080] In the embodiment of the present application, each communication protocol represents various screens, including screens of different car manufacturers, different projects, and different types. The communication protocol characteristics are the characteristics of the vehicle screen communication protocol. The basic communication protocol model is a framework of a specific communication protocol model abstracted according to the communication protocol characteristics, or a unified abstract description model of the communication protocol, for example, as shown in Table 1 below; a basic communication protocol model is uniformly obtained based on the communication protocol characteristics, and the communication protocol model of each communication protocol is obtained based on the basic communication protocol model. Specifically, each communication protocol is supplemented with the basic communication protocol model to obtain the communication protocol model of each communication protocol. The communication protocol model and the communication protocol are one-to-one corresponding to each other for subsequent processing. For example, the basic communication protocol model is shown in Table 1 below. After supplementing Table 1 below, the communication protocol model of the communication protocol can be obtained.
[0081] Here, by abstracting the communication protocols into a unified description model, different communication protocols need to fill in the specific details of the protocol according to the definitions of protocol attributes and methods in the description model in the following table, so as to describe a specific communication protocol model.
[0082] It should be noted that the communication protocol model includes attributes, protocol scheduling methods and user methods (user methods); the communication protocol model of the communication protocol includes multiple protocol items, each of which includes a protocol item id and a protocol item processing method; the attributes include at least the protocol name, real-time data, the total number of protocol items, a protocol item id set, and a protocol item set; the user method includes at least starting the protocol, closing the protocol, outputting protocol information and querying the protocol content, commands issued by the user, controls issued by the user, and upgrade interfaces. Specifically, as shown in Table 1, it will not be repeated here.
[0083] Among them, in the user method, enable means starting the protocol. At this time, you can apply for a piece of memory to store real-time protocol data, and do some initialization work according to the specific situation; disable means closing the protocol, releasing the applied memory, and doing some de-initialization work; dump means outputting relevant information of the protocol according to the specific content of the protocol; query means that some protocol status can be returned to the user according to the query requirements; command means a command in the form of a string, which is issued by the user and is used to control the protocol and the screen; control means a control instruction in the form of a command id, which is issued by the user and is used to control the protocol and the screen; upgrade means the interface for initiating a screen upgrade.
[0084] Table 1
[0085]
[0086]
[0087] Obviously, from Table 1, it can be seen that a communication protocol model specifically includes three types of content: attributes, protocol scheduling, and user methods.
[0088] It should be noted that, for a specific communication protocol, this application subdivides it into multiple specific protocol items (protocol objects). For each protocol item, two attributes, item id and item processing method, constitute a specific protocol item. For example, Figure 2 As shown, id represents the item id and method represents the item processing method.
[0089] It should be noted that there are common protocol items and unique protocol items among different communication protocols.
[0090] Optionally, when obtaining the communication protocol model of each communication protocol based on the basic communication protocol model, for the first communication protocol, multiple protocol items corresponding to the first communication protocol are determined, and the communication protocol model corresponding to the first communication protocol is determined based on the multiple protocol items; multiple protocol items corresponding to the second communication protocol are determined, and compared with the multiple protocol items of the first communication protocol to determine the common protocol items and the unique protocol items; the communication protocol model corresponding to the common protocol items of the first communication protocol and the unique protocol items of the second communication protocol is determined. Among them, the common protocol items represent the same protocol items of the second communication protocol and the first communication protocol; the unique protocol items represent the protocol items unique to the second communication protocol.
[0091] For example, Figure 3As shown, for the same car manufacturer and the same type of screen, in different projects, the protocol has some common content, and there may also be project-specific definitions. In view of this situation, this application defines the common parts as common components (i.e., common protocol items) and defines the project-specific content as unique parts (i.e., unique protocol items). Therefore, a specific communication protocol is composed of common parts and unique parts, i.e., common protocol items and unique protocol items.
[0092] It can be seen that when obtaining the protocol models of various communication protocols, if the protocol items of the protocol model of a communication protocol exist in the protocol model that has been created for another communication protocol, then there is no need to repeatedly develop the protocol items, and the protocol items that already exist on the other communication protocol model can be directly used.
[0093] Therefore, the communication protocol is defined by abstracting a communication protocol model based on the communication protocol. At the same time, the compatibility is better by registering and managing multiple communication protocols at the same time.
[0094] S102, determining a storage space in the memory of the vehicle computer as a protocol pool, and adding the communication protocol model of each communication protocol to the protocol pool to implement storage of each communication protocol model.
[0095] In the embodiment of the present application, during operation, a storage space is allocated in the memory of the vehicle computer as a protocol pool (for example, Figure 4 As shown in FIG. 1 ), it is used to store the specific content of the protocol (i.e., the communication protocol). At this time, the communication protocol model of each communication protocol is added to the protocol pool to realize the storage of each communication protocol model. In short, for example, Figure 4 As shown in the figure, after the developer describes a complete communication protocol model, it is added to the protocol pool, and n communication protocols can be stored in the memory. Each specific protocol storage finally stores the memory address of the next protocol for subsequent processing.
[0096] Among them, in the protocol pool, each communication protocol model stores the memory address where the next communication protocol model is last stored.
[0097] It should be noted that the protocol scheduling method includes multiple methods.
[0098] Optionally, when adding the communication protocol model of each communication protocol to the protocol pool, determine whether the protocol name of the attribute is named, whether the number of protocol items is consistent with the protocol item id set, and whether the protocol item set is empty; if the protocol name of the attribute is not named and / or the number of protocol items is inconsistent with the protocol item id set and / or the protocol item set is empty, it is determined that the description of the communication protocol is incorrect, and the communication protocol is removed from the protocol pool; if a method definition in the user method is empty, it is determined that the description of the communication protocol is incorrect, and the communication protocol model of the communication protocol is removed from the protocol pool.
[0099] For example, when each protocol is added to the protocol pool, check whether the attribute name is unnamed, whether the number of protocol items is consistent with the id set, and whether the protocol item set is empty. If it is found that the protocol name of the attribute is unnamed and / or the number of protocol items is inconsistent with the protocol item id set and / or the protocol item set is empty, it is determined that the attribute is abnormal. At this time, it means that the communication protocol description is incorrect and the communication protocol is removed from the protocol pool; check whether the user method is defined as empty. If the attribute is abnormal (as long as one user method is empty), it means that the protocol description is incorrect and the protocol is removed from the protocol pool.
[0100] S103, in response to receiving the name of the communication protocol to be used sent by the user, find a corresponding communication protocol from a protocol pool according to the name of the communication protocol.
[0101] In the embodiment of the present application, the name of the communication protocol to be used is received from the user, and the communication protocol corresponding to the name of the communication protocol is searched from the protocol pool according to the name of the communication protocol, thereby finding the communication protocol. Figure 5 As shown, after storing multiple communication protocol models in the protocol pool, a protocol cluster is formed. The user passes the name of the communication protocol to be used to the muxer (multiplexer), and the muxer finds the protocol from the protocol pool according to the name.
[0102] Therefore, the communication protocol can be directly found according to its name, and the specific implementation of the protocol can be decoupled without worrying about the specific processing details of the protocol. The user uses a unified interface to directly call the protocol interface to obtain the communication protocol.
[0103] S104, applying for a memory space in the memory, copying the communication protocol to the memory space, and returning the corresponding memory address to the user, so that the user can obtain the required communication protocol.
[0104] In the embodiment of the present application, after finding the corresponding communication protocol from the protocol pool, a memory space is applied in the memory, the communication protocol is copied to the memory space, and the corresponding memory address is returned to the user so that the user can obtain the required communication protocol. Figure 4 As shown in the figure, the muxer finds the protocol from the protocol pool according to the name, then applies for a space in the memory, copies the protocol model to the memory space, and finally returns the memory address to the user, so that the user can get the desired protocol.
[0105] The in-vehicle screen communication protocol implementation method provided by the embodiment of the present application obtains a basic communication protocol model based on the communication protocol characteristics, and obtains the communication protocol model of each communication protocol based on the basic communication protocol model, determines a storage space in the memory of the vehicle computer as a protocol pool, and adds the communication protocol model of each communication protocol to the protocol pool to realize the storage of each communication protocol model, and in response to receiving the name of the communication protocol to be used sent by the user, finds the corresponding communication protocol from the protocol pool according to the name of the communication protocol, applies for a memory space in the memory, copies the communication protocol to the memory space, and returns the corresponding memory address to the user, so that the user can obtain the required communication protocol. The in-vehicle screen communication protocol implementation method of the present application abstracts a communication protocol model for each communication protocol, stores it in the protocol pool to form a protocol cluster, and directly finds the corresponding communication protocol from the protocol pool according to the name of the communication protocol to be used sent by the user, and returns it to the user, realizing the unified management of different communication protocols of multiple screens and multiple car manufacturers, and can reuse protocol items, reducing the difficulty of maintenance and management, and also reducing the development cycle, thereby reducing maintenance and development costs. At the same time, a unified interface is used to achieve decoupling with the protocol.
[0106] Further, the preset default protocol scheduling method is obtained. If one of the protocol scheduling methods is empty, the corresponding protocol scheduling method is assigned to the default protocol scheduling method. Among them, the default protocol scheduling method is the default protocol scheduling method set in advance. In short, when the method of checking the protocol scheduling method in the communication protocol model is empty, the protocol scheduling method (recv_packet and digest) is assigned to the default protocol scheduling method. This is because scheduling is a necessary condition for the operation of a protocol. Therefore, when the definition is empty, in order to ensure the operation of the protocol, an alternative protocol scheduling method is required.
[0107] It should be noted that the present application defines two default protocol scheduling methods (recv_packet2 and digest2) to replace the protocol scheduling methods recv_packet and digest in the above communication protocol model.
[0108] Among them, the processing flow of recv_packet2 is as follows Figure 6As shown, first check whether the space buffer for storing data is ready; if not, prompt err to end; if ready, go to the next step; read the original data on the screen, and then determine whether the reading is successful; if the reading fails, retry the reading, if the number of retries exceeds 5, prompt err to end; if the number of retries is less than 5, continue to retry the reading; if the reading is successful, go to the next step; check whether the first byte of the read data is all 0 or all 0xff; if so, it means that the data is invalid, prompt err to end; if not, prompt the data is valid, and go to the next step; according to the first byte of the data, use it as the protocol item id to assemble a protocol frame; in most cases, the first byte of the data is different and is used to identify the attributes of the current data; call the digest method to process the protocol frame data; the recv_packet2 method ends;
[0109] The processing flow of digest 2 is as follows Figure 7 As shown, no further description is given here.
[0110] Furthermore, in response to the operation of the communication protocol, the original data sent by the screen is read, and the original data is parsed according to the data format of the original data to obtain the corresponding protocol data; the corresponding protocol package is composed according to the protocol package id and protocol data input by the user.
[0111] Specifically, in the two protocol scheduling methods of recv_packet / recv_shock, the vehicle receives the original data sent from the screen, and parses it according to the format of the original data to form a specific protocol packet (the user fills in the protocol packet id), protocol packet = id (identifier) + protocol data, and the protocol packet is obtained. Among them, the protocol packet id and the protocol item id are corresponding and consistent.
[0112] Further, the corresponding protocol item id is matched based on the protocol package id of the protocol package, and the protocol item matched by the protocol package is determined according to the protocol item id; and the protocol package is processed based on the protocol item matched by the protocol package.
[0113] Specifically, the protocol package id of the protocol package is matched with the corresponding required protocol item id, the protocol item is determined according to the protocol item id, and the protocol package is processed using the protocol item.
[0114] It should be noted that the protocol item is a method for processing a protocol packet. Usually, after receiving the original data to form a protocol packet, the digest protocol scheduling method will be called. The digest method is to find the corresponding protocol item from the protocol for the received protocol packet, and then use the protocol item to process the protocol packet.
[0115] Therefore, this application defines a set of unified interfaces to separate the protocol from the user. The user directly calls the protocol interface to obtain the desired protocol without having to worry about the specific processing details of the protocol. In this way, using different protocols is the same for the user, and the specific interface implementation requires the developer of each protocol to implement it. In short, this application implements a management framework that can achieve unified management of different protocols for multiple screens and multiple car manufacturers, reuse multiple projects, shorten the development cycle, and reduce maintenance costs.
[0116] In general, this application can register and manage multiple protocols at the same time, has good compatibility, and users use a unified interface to decouple from the specific implementation of the protocol. Different projects can reuse protocol items, reducing redundancy.
[0117] Figure 8 is a structural diagram of a vehicle-mounted screen communication protocol implementation device provided according to an embodiment of the present application; Figure 8 As shown, the vehicle-mounted screen communication protocol implementation device 800 of the embodiment of the present application may specifically include:
[0118] The acquisition module 801 is used to uniformly acquire a basic communication protocol model based on the communication protocol characteristics, and acquire the communication protocol model of each communication protocol based on the basic communication protocol model.
[0119] The storage module 802 is used to determine a storage space in the memory of the vehicle computer as a protocol pool, and add the communication protocol model of each communication protocol to the protocol pool to implement the storage of each communication protocol model.
[0120] The query module 803 is used to find a corresponding communication protocol from a protocol pool according to the name of the communication protocol in response to receiving the name of the communication protocol to be used sent by the user.
[0121] The return module 804 is used to apply for a memory space in the memory, copy the communication protocol to the memory space, and return the corresponding memory address to the user so that the user can obtain the required communication protocol.
[0122] In a possible implementation, the communication protocol model includes attributes, a protocol scheduling method, and a user method; the communication protocol model of the communication protocol includes a plurality of protocol items, each protocol item includes a protocol item id and a protocol item processing method;
[0123] The attributes include at least the protocol name, real-time data, the total number of protocol items, the protocol item ID set, and the protocol item set;
[0124] The user method at least includes starting the protocol, closing the protocol, outputting protocol information and querying protocol content, commands issued by the user, controls issued by the user, and upgrading the interface.
[0125] In a possible implementation manner, there are common protocol items and unique protocol items between different communication protocols; the acquisition module is specifically used to:
[0126] For a first communication protocol, determining a plurality of protocol items corresponding to the first communication protocol, and determining a communication protocol model corresponding to the first communication protocol according to the plurality of protocol items;
[0127] Determine multiple protocol items corresponding to the second communication protocol, and compare them with multiple protocol items of the first communication protocol to determine common protocol items and unique protocol items; wherein the common protocol items represent the same protocol items as the first communication protocol; and the unique protocol items represent the unique protocol items of the second communication protocol;
[0128] A communication protocol model corresponding to the common protocol items of the first communication protocol and the unique protocol items of the second communication protocol.
[0129] In a possible implementation, the protocol scheduling method includes multiple methods, and the vehicle-mounted screen communication protocol implementation device also includes:
[0130] A first judgment module is used to determine that the description of the communication protocol is wrong and remove the communication protocol from the protocol pool if the protocol name of the attribute is unnamed and / or the number of protocol items is inconsistent with the protocol item ID set and / or the protocol item set is empty;
[0131] The second judgment module is used to determine that the description of the communication protocol is wrong if a method definition in the user method is empty, and remove the communication protocol model of the communication protocol from the protocol pool.
[0132] In a possible implementation, the vehicle-mounted screen communication protocol implementation device further includes:
[0133] The third judgment module is used to obtain a preset default protocol scheduling method. If a method in the protocol scheduling method is empty, the corresponding protocol scheduling method is assigned as the default protocol scheduling method.
[0134] In a possible implementation, the vehicle-mounted screen communication protocol implementation device further includes:
[0135] The parsing module is used to read the original data sent by the screen in response to the operation of the communication protocol, and parse the original data according to the data format of the original data to obtain the corresponding protocol data;
[0136] The composition module is used to compose the corresponding protocol package according to the protocol package ID and protocol data input by the user.
[0137] In a possible implementation, the vehicle-mounted screen communication protocol implementation device further includes:
[0138] A determination module, used to match the corresponding protocol item id based on the protocol package id of the protocol package, and determine the protocol item matched by the protocol package according to the protocol item id;
[0139] The processing module is used to process the protocol packet based on the protocol item matched by the protocol packet.
[0140] The in-vehicle screen communication protocol implementation device provided in the embodiment of the present application obtains a basic communication protocol model based on the communication protocol characteristics, and obtains the communication protocol model of each communication protocol based on the basic communication protocol model, determines a storage space in the memory of the vehicle computer as a protocol pool, and adds the communication protocol model of each communication protocol to the protocol pool to realize the storage of each communication protocol model, and in response to receiving the name of the communication protocol to be used sent by the user, finds the corresponding communication protocol from the protocol pool according to the name of the communication protocol, applies for a memory space in the memory, copies the communication protocol to the memory space, and returns the corresponding memory address to the user, so that the user can obtain the required communication protocol. The in-vehicle screen communication protocol implementation device of the present application abstracts a communication protocol model for each communication protocol, stores it in the protocol pool to form a protocol cluster, and directly finds the corresponding communication protocol from the protocol pool according to the name of the communication protocol to be used sent by the user, and returns it to the user, realizing the unified management of different communication protocols of multiple screens and multiple car manufacturers, and can reuse protocol items, reducing the difficulty of maintenance and management, and also reducing the development cycle, thereby reducing maintenance and development costs. At the same time, a unified interface is used to achieve decoupling with the protocol.
[0141] like Fig. 9 As shown, an electronic device 900 provided in an embodiment of the present application includes: a processor 901, a memory 902 and a bus, wherein the memory 902 stores machine-readable instructions executable by the processor 901. When the electronic device is running, the processor 901 communicates with the memory 902 through the bus, and the processor 901 executes the machine-readable instructions to perform the steps of the above-mentioned vehicle-mounted screen communication protocol implementation method.
[0142] Specifically, the above-mentioned memory 902 and processor 901 can be general-purpose memory and processor, which are not specifically limited here. When the processor 901 runs the computer program stored in the memory 902, it can execute the above-mentioned vehicle-mounted screen communication protocol implementation method.
[0143] Corresponding to the above-mentioned method for implementing the vehicle-mounted screen communication protocol, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, the steps of the above-mentioned method for implementing the vehicle-mounted screen communication protocol are executed.
[0144] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0145] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0146] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0147] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the deployment method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0148] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for implementing a vehicle-mounted screen communication protocol, characterized in that: The method comprises: Uniformly acquiring a basic communication protocol model based on the communication protocol characteristics, and acquiring a communication protocol model of each communication protocol based on the basic communication protocol model; Determine a storage space in the memory of the vehicle computer as a protocol pool, and add the communication protocol model of each communication protocol to the protocol pool to implement storage of each communication protocol model; In response to receiving the name of the communication protocol to be used sent by the user, find the corresponding communication protocol from the protocol pool according to the name of the communication protocol; A memory space is applied in the memory, the communication protocol is copied to the memory space, and the corresponding memory address is returned to the user, so that the user can obtain the required communication protocol.
2. The method according to claim 1, characterized in that The communication protocol model includes attributes, protocol scheduling methods and user methods; the communication protocol model of the communication protocol includes multiple protocol items, each protocol item includes a protocol item id and a protocol item processing method; The attributes include at least protocol name, real-time data, total number of protocol items, protocol item id set, and protocol item set; The user method at least includes starting the protocol, closing the protocol, outputting protocol information and querying protocol content, commands issued by the user, controls issued by the user, and upgrading the interface.
3. The method according to claim 2, characterized in that There are common protocol items and unique protocol items between different communication protocols; the communication protocol model of each communication protocol is obtained based on the basic communication protocol model, including: For a first communication protocol, determining a plurality of protocol items corresponding to the first communication protocol, and determining a communication protocol model corresponding to the first communication protocol according to the plurality of protocol items; Determine multiple protocol items corresponding to the second communication protocol, and compare them with multiple protocol items of the first communication protocol to determine common protocol items and unique protocol items; wherein the common protocol items represent the same protocol items of the second communication protocol and the first communication protocol; and the unique protocol items represent the unique protocol items of the second communication protocol; A communication protocol model corresponding to the common protocol items of the first communication protocol and the unique protocol items of the second communication protocol.
4. The method according to claim 3, characterized in that: The protocol scheduling method includes multiple methods, and the method also includes: If the protocol name of the attribute is unnamed and / or the number of protocol items is inconsistent with the protocol item ID set and / or the protocol item set is empty, it is determined that the description of the communication protocol is incorrect, and the communication protocol is removed from the protocol pool; If a method definition in the user methods is empty, it is determined that the description of the communication protocol is wrong, and the communication protocol model of the communication protocol is removed from the protocol pool.
5. The method according to claim 4, characterized in that The method further comprises: The preset default protocol scheduling method is obtained. If a method in the protocol scheduling method is empty, the corresponding protocol scheduling method is assigned to the default protocol scheduling method.
6. The method according to claim 5, characterized in that The method further comprises: In response to the communication protocol running, reading the original data sent by the screen, and parsing the original data according to the data format of the original data to obtain corresponding protocol data; A corresponding protocol package is formed according to the protocol package id input by the user and the protocol data.
7. The method according to claim 6, characterized in that The method further comprises: Matching the corresponding protocol item id based on the protocol package id of the protocol package, and determining the protocol item matched by the protocol package according to the protocol item id; The protocol packet is processed based on the protocol item matched by the protocol packet.
8. A vehicle-mounted screen communication protocol implementation device, characterized in that: The device comprises: An acquisition module, used to uniformly acquire a basic communication protocol model based on the communication protocol characteristics, and acquire a communication protocol model of each communication protocol based on the basic communication protocol model; A storage module, used to determine a storage space in the memory of the vehicle computer as a protocol pool, and add the communication protocol model of each communication protocol to the protocol pool to realize the storage of each communication protocol model; A query module, configured to, in response to receiving a name of a communication protocol to be used sent by a user, find a corresponding communication protocol from the protocol pool according to the name of the communication protocol; The return module is used to apply for a memory space in the memory, copy the communication protocol to the memory space, and return the corresponding memory address to the user so that the user can obtain the required communication protocol.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the vehicle screen communication protocol implementation method as described in any one of claims 1 to 7 are performed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the method for implementing the vehicle-mounted screen communication protocol as described in any one of claims 1 to 7.