Method for acquiring vehicle control data, vehicle and storage medium
Patent Information
- Application Number
- CN202211288576.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-20
- Publication Date
- 2026-10-13
- Estimated Expiration
- 2042-10-20
AI Technical Summary
[0002]在通常实现方案中,车辆端应用程序若想获取方向盘事件,一般通过图1所示的方法,由应用程序通过汽车应用程序接口(CarAPI)或者以回调的方式获取到,该流程复杂,耗时长
[0026]本发明实施方式的附加方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本发明的实践了解到。
Smart Images

Figure CN115599073B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent vehicle technology, and in particular to a method for acquiring vehicle control data, a vehicle, and a storage medium. Background Technology
[0002] In typical implementations, if the vehicle-side application wants to obtain steering wheel events, it generally does so through... Figure 1 The method shown is obtained by the application through the Car API or via callback, a complex and time-consuming process. Summary of the Invention
[0003] The present invention provides a method for acquiring vehicle control data, a vehicle, and a storage medium.
[0004] This invention provides a method for acquiring vehicle control data. The method includes: establishing a virtual input device corresponding to a vehicle control component and configuring the virtual device parameters; reporting an event message in response to detecting vehicle attribute encoding information corresponding to the vehicle control component; parsing the event message to obtain input event information; and, if the input event information meets certain conditions, writing standard input event data into the virtual input device according to the input event information, so that the vehicle system can acquire the vehicle control data from the virtual input device.
[0005] Thus, this invention simulates the vehicle control components as a standard virtual input device connected to the Android system on the vehicle side, and writes standard input event data into the nodes of the virtual input device according to the input event information, so that the vehicle system can obtain vehicle control data from the virtual input device, simplifying the process of the vehicle-side application obtaining input events.
[0006] After the step of establishing a virtual input device corresponding to the vehicle control component and configuring the virtual device parameters, the acquisition method includes: establishing a data connection between the event management process and the vehicle hardware abstraction layer to listen to the vehicle attribute encoding information.
[0007] Thus, by establishing a data connection between the event management process and the vehicle hardware abstraction layer, the present invention monitors vehicle attribute encoding information, enabling the vehicle hardware abstraction layer to successfully report event messages and parse the event messages to obtain input event information, which is then reported to the event management process.
[0008] The step of responding to the detection of vehicle attribute encoding information corresponding to the vehicle control component and reporting an event message includes: responding to the detection of vehicle attribute encoding information corresponding to the vehicle control component, generating the event message with a preset data carrier structure according to a first correspondence between the vehicle control component and the vehicle attribute encoding information and a second correspondence between the operation event of the vehicle control component and the preset encoding information; and reporting the event message to the event management process.
[0009] This simplifies the process for vehicle-side applications to obtain operational events from vehicle control components.
[0010] The acquisition method includes: receiving data packets reported by the vehicle control component through a preset protocol; in response to listening to vehicle attribute encoding information corresponding to the vehicle control component, generating an event packet with a preset data carrier structure according to a first correspondence between the vehicle control component and the vehicle attribute encoding information and a second correspondence between the operation event of the vehicle control component and the preset encoding information, including: converting the data packet into the event packet with the preset data carrier structure according to the first correspondence and the second correspondence.
[0011] In this way, the vehicle hardware abstraction layer can convert data packets into event packets and report them to the event management process, enabling the vehicle-side application to obtain operation events of vehicle control components.
[0012] After the step of establishing a virtual input device corresponding to the vehicle control component and configuring the virtual device parameters, the acquisition method includes: determining a third correspondence between the operation events of the vehicle control component and the Code key value; parsing the event message to obtain input event information includes: if the event message includes reported data, then parsing the event message according to the third correspondence to obtain the corresponding Code key value.
[0013] Thus, if the event message includes reported data, the corresponding Code key value can be obtained by parsing the event message according to the third correspondence between the operation events of the vehicle control components and the Code key values.
[0014] The vehicle control component includes control buttons and a scroll wheel. The step of writing standard input event data into the virtual input device according to the input event information when the input event information meets the conditions includes: if the input event information belongs to a short press event, then writing the corresponding Code key value of one press and one release to the virtual input device.
[0015] In this way, it is possible to simulate the short-press event of a button in the vehicle control unit when the vehicle hardware abstraction layer reports data to the event management process.
[0016] The vehicle control component includes control buttons and a scroll wheel. The step of writing standard input event data to the virtual input device based on the input event information when the input event information meets the conditions includes: if the input event information is a long press event, then writing a press and a release of the corresponding Code key value to the virtual input device; writing a long press event of the corresponding Code key value to the virtual input device after a preset time interval, until the corresponding input button reports a no-press event or a short-press event.
[0017] In this way, it is possible to simulate the long press event of a button in the vehicle control unit when the vehicle hardware abstraction layer reports data to the event management process.
[0018] The step of writing a long-press event corresponding to the Code key value to the virtual input device after a preset time interval, until the corresponding input button reports a no-press event or a short-press event, includes: if the event message does not include the reported data, the data last reported by the corresponding input button is the long-press event, and the time elapsed since the last reported long-press event was written to the virtual input device exceeds the preset time, then writing a long-press event corresponding to the Code key value to the virtual input device, until the corresponding input button reports a no-press event or a short-press event.
[0019] Thus, the present invention can simulate a long press event when the directed event management process of the vehicle hardware abstraction layer does not report data.
[0020] The vehicle control component includes control buttons and a scroll wheel. The step of writing standard input event data into the virtual input device according to the input event information when the input event information meets the conditions includes: if the input event information belongs to the scroll wheel event, then cyclically writing one press and one release of the corresponding Code key value to the virtual input device, wherein the number of cycles is determined according to the scroll wheel's scroll scale value.
[0021] Thus, the present invention can simulate the roller event when the vehicle hardware abstraction layer reports data to the event management process.
[0022] This invention provides a vehicle. The vehicle includes a processor and a memory, the memory storing a computer program. When the computer program is executed by the processor, it implements the vehicle control data acquisition method described in any of the above embodiments.
[0023] Thus, the vehicle application of the present invention uses the above-described method for acquiring vehicle control data to simulate the vehicle control component as a standard virtual input device connected to the Android system on the vehicle side. Based on the input event information, standard input event data is written to the node of the virtual input device, so that the vehicle system can acquire vehicle control data from the virtual input device, simplifying the process of the vehicle-side application acquiring input events.
[0024] The present invention also provides a non-volatile computer-readable storage medium containing a computer program. When the computer program is executed by one or more processors, it implements the method for acquiring vehicle control data as described in any of the above embodiments.
[0025] Thus, the storage medium of the present invention uses the above-described method for acquiring vehicle control data to simulate the vehicle control component as a standard virtual input device connected to the Android system on the vehicle side. Based on the input event information, standard input event data is written to the node of the virtual input device, so that the vehicle system can acquire vehicle control data from the virtual input device, simplifying the process of the vehicle-side application acquiring input events.
[0026] Additional aspects and advantages of embodiments of the present invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0027] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, wherein:
[0028] Figure 1 This is a schematic diagram of the structural framework in related technologies where the APP obtains steering wheel events through the CarAPI interface or by callback;
[0029] Figure 2 This is a flowchart illustrating the method for acquiring vehicle control data according to the present invention;
[0030] Figure 3 This is a schematic diagram of the steering wheel structure in the vehicle control data acquisition method of the present invention;
[0031] Figure 4 This is a schematic diagram of the structural framework for the vehicle control data acquisition method of the present invention to acquire steering wheel events;
[0032] Figure 5 This is a flowchart illustrating the method for acquiring vehicle control data according to the present invention;
[0033] Figure 6 This is a schematic diagram of the VehiclePropValue data structure of the present invention;
[0034] Figure 7 This is a flowchart illustrating the method for acquiring vehicle control data according to the present invention;
[0035] Figure 8 This is a flowchart illustrating the method for acquiring vehicle control data according to the present invention;
[0036] Figure 9 This is a schematic diagram of the SWSKeyManager implementation process in the vehicle control data acquisition method of the present invention;
[0037] Figure 10 This is a schematic diagram of the control unit data conversion in the vehicle control data acquisition method of the present invention. Detailed Implementation
[0038] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present invention, and should not be construed as limiting the embodiments of the present invention.
[0039] Please see Figure 2 This invention provides a method for acquiring vehicle control data. The method includes:
[0040] 01: Establish virtual input devices corresponding to vehicle control components and configure virtual device parameters;
[0041] 03: In response to the detection of vehicle attribute encoding information corresponding to the vehicle control component, an event message is reported;
[0042] 05: Parse the event message to obtain the input event information;
[0043] 07: When the input event information meets the conditions, write the standard input event data into the virtual input device according to the input event information, so that the vehicle system can obtain vehicle control data from the virtual input device.
[0044] The present invention also provides a vehicle. The vehicle includes a processor and a memory, the memory storing a computer program. The processor is used to establish a virtual input device corresponding to a vehicle control component and configure virtual device parameters; in response to listening to vehicle attribute encoding information corresponding to the vehicle control component, it reports an event message; it parses the event message to obtain input event information; and when the input event information meets the conditions, it writes standard input event data into the virtual input device according to the input event information, so that the vehicle system can obtain vehicle control data from the virtual input device.
[0045] Specifically, taking the steering wheel as an example of a vehicle component, the vehicle control components are the buttons or scroll wheels on the steering wheel. This invention uses the steering wheel as an example of a vehicle component for explanation, and the corresponding input event is the steering wheel input event.
[0046] When vehicle parts are as follows Figure 3 When using the steering wheel as shown, the corresponding steering wheel actions are as shown in Table 1. Button actions can be divided into short press, long press, and no press; scroll wheel actions can be divided into scrolling up and scrolling a certain number of increments, and scrolling down and scrolling a certain number of increments. Each steering wheel action can be mapped to different functions. For example, the left 1 button can be a user-defined button; a short press is used for parking, and a short press of the right 1 button is used to skip to the next track in music. A left scroll wheel scrolling down can represent lowering the air conditioning temperature, with the number of increments representing the degree of temperature reduction. A right scroll wheel scrolling down can represent lowering the volume, with the number of increments representing the volume reduction. Of course, each event can be mapped to, but is not limited to, the specific functions mentioned above.
[0047] Table 1
[0048]
[0049] Establish a virtual input device corresponding to the vehicle control components and configure its parameters. This involves simulating the steering wheel as a standard virtual input device on the vehicle and connecting it to the Android system. The virtual device parameters include the device name and connection method. For example, the device name for the virtual input device corresponding to the vehicle's steering wheel can be "sws-keys". The InputManagerService can then use this name to locate the node of the virtual input device corresponding to the steering wheel and retrieve vehicle control data (such as...) from the input event data. Figure 4 (As shown). The connection method for the virtual input device corresponding to the vehicle's steering wheel to the Android system lock settings can be BUS_VIRTUAL, which means connecting the virtual input device to the virtual bus.
[0050] Then, in response to the detection of vehicle attribute encoding information corresponding to the vehicle control unit, an event message is reported. The vehicle attribute encoding information can be user-defined encoding information, such as ID0, ID1, ID2…IDn. Specifically, taking the vehicle control unit as… Figure 3 Taking the steering wheel in the middle as an example, Figure 3The steering wheel shown has four physical buttons and two physical scroll wheels. When at least one of the buttons or scroll wheels is triggered, the corresponding action is sent to the microcontroller (MCU) via the LIN bus. The MCU then sends data packets in a predefined format to the Vehicle Hardware Abstraction (VHA) layer on the vehicle side via the UART protocol. The VHA layer listens for the vehicle attribute encoding information corresponding to the steering wheel event and reports the event packet to the Steering Wheel Event Management (SWSKeyManager) process.
[0051] Next, the event message is parsed to obtain the input event information. Specifically, the vehicle hardware abstraction layer can parse the event message using the UART protocol to obtain the input event information, and then convert this input event information into a data carrier structure (VehiclePropValue) in the Hardware Abstraction Layer Interface Definition Language (HIDL) for interaction within HIDL, which is then sent to the event management process. Taking a steering wheel event as an example, the vehicle hardware abstraction layer can parse the steering wheel event message to obtain the steering wheel input event information, and then send this steering wheel input event information directly to the steering wheel event management process.
[0052] Finally, if the input event information meets the conditions, standard input event data is written to the virtual input device based on the input event information, enabling the vehicle system to obtain vehicle control data from the virtual input device. The condition that the input event information meets the conditions refers to the input event being a standard input event. Only when the input event is a standard input event can the standard input event data in the input event information be written to the virtual input device. That is, at this point, the steering wheel event management process can convert the input event data in the input event information into standard button events and write them to the node of the virtual input device.
[0053] In detail, for example, such as Figure 4 As shown, this invention utilizes an existing framework, with a custom steering wheel event management process acting as the user end to obtain vehicle attribute encoding information corresponding to steering wheel events from the vehicle hardware abstraction layer service. When a steering wheel event occurs, the vehicle hardware abstraction layer service reports an event message and parses the message to obtain input event information, which is then reported to the steering wheel event management process. The steering wheel event management process processes this input event information and writes standard input event data into the virtual input device node, enabling the in-vehicle system to obtain vehicle control data from the virtual input device.
[0054] Thus, this invention simulates the vehicle control components as a standard virtual input device connected to the Android system on the vehicle side, and writes standard input event data into the nodes of the virtual input device according to the input event information, so that the vehicle system can obtain vehicle control data from the virtual input device, simplifying the process of the vehicle-side application obtaining input events.
[0055] After step 01, the acquisition method includes:
[0056] 011: Establish a data connection between the event management process and the vehicle hardware abstraction layer to monitor vehicle attribute coding information.
[0057] The processor is used to establish a data connection between the event management process and the vehicle hardware abstraction layer to listen for vehicle attribute encoding information.
[0058] Understandably, by Figure 4 As can be seen, in this invention, a custom event management process acts as the user terminal to obtain vehicle hardware abstraction layer services and thus monitor vehicle attribute encoding information corresponding to vehicle control components. Therefore, it is necessary to first establish a data connection between the event management process and the vehicle hardware abstraction layer. The event management process is an event management process that corresponds one-to-one with a vehicle component, including a steering wheel event management process, an air conditioning event management process, or other management processes, which are not limited here. When the vehicle component is a steering wheel, a data connection is established between the steering wheel event management process and the vehicle hardware abstraction layer.
[0059] The data connection can be established between the event management process and the vehicle hardware abstraction layer through the interactive data carrier structure in HIDL. For example, the interactive data carrier structure in HIDL can be a data carrier structure used for interaction within HIDL (VehiclePropValue).
[0060] Thus, by establishing a data connection between the event management process and the vehicle hardware abstraction layer, the present invention monitors vehicle attribute encoding information, enabling the vehicle hardware abstraction layer to successfully report event messages and parse the event messages to obtain input event information, which is then reported to the event management process.
[0061] Please see Figure 5 Step 03 includes:
[0062] 031: In response to the detection of vehicle attribute coding information corresponding to the vehicle control component, an event message with a preset data carrier structure is generated based on the first correspondence between the vehicle control component and the vehicle attribute coding information, and the second correspondence between the operation event of the vehicle control component and the preset coding information.
[0063] 032: Report the event message to the event management process.
[0064] The processor is used to respond to the vehicle attribute coding information corresponding to the vehicle control component, generate an event message with a preset data carrier structure according to the first correspondence between the vehicle control component and the vehicle attribute coding information and the second correspondence between the operation event of the vehicle control component and the preset coding information, and report the event message to the event management process.
[0065] When vehicle parts are as follows Figure 3 When the steering wheel is shown, the prop in the VehiclePropValue data carrier structure represents the vehicle attribute, which is represented by a unique code for the steering wheel button or scroll wheel. The specific vehicle attribute coding information is shown in Table 2. That is, the first correspondence between the corresponding vehicle control component and the vehicle attribute coding information is shown in Table 2.
[0066] Additionally, the array `value.int32Values` in the `VehiclePropValue` data carrier structure represents specific events. A structural diagram of the `VehiclePropValue` data carrier structure is shown below. Figure 6 As shown in the diagram. In button events, a value of 0 in the `value.int32Values` array indicates that the button is not pressed, 1 indicates a short press, and 2 indicates a long press. In scroll wheel events, a value of 0 in the first element of the `value.int32Values` array indicates scrolling upwards, a value of 1 indicates scrolling downwards, and the second element represents the number of increments scrolled. The `value.int32Values` event mapping is shown in Table 3, which illustrates the second correspondence between the operation events of the vehicle control components and the preset encoded information. The operation events of the vehicle control components include, but are not limited to, button events and scroll wheel events.
[0067] Specifically, when the event is triggered by a short press of the left button, the VehiclePropValue data is represented as follows:
[0068]
[0069]
[0070] When the left scroll wheel scrolls up 3 increments to trigger the event, the VehiclePropValue data is as follows:
[0071]
[0072] Table 2
[0073] Left 1 button ID0 Left 2 button ID1 Left 3 buttons ID2 Right button ID3 Right 2 button ID4 Right 3 button ID5 Left scroll wheel button ID6 Right scroll wheel button ID7 Left scroll wheel ID8 Right scroll wheel ID9
[0074] Table 3
[0075]
[0076] In other words, the vehicle hardware abstraction layer can respond to the vehicle attribute encoding information corresponding to the vehicle control component of the steering wheel, generate a steering wheel event message with a preset data carrier structure based on the first correspondence between the vehicle control component and the vehicle attribute encoding information and the second correspondence between the operation event of the vehicle control component and the preset encoding information, and report the steering wheel event message to the steering wheel event management (SWSKeyManager) process.
[0077] This simplifies the process for vehicle-side applications to obtain operational events from vehicle control components.
[0078] Please see Figure 7 The methods for obtaining this information include:
[0079] 02: Receive data packets reported by the vehicle control unit through a preset protocol;
[0080] Step 031 includes:
[0081] 0311: Convert the data message into an event message with a preset data carrier structure according to the first and second correspondence relationships.
[0082] The processor is used to receive data packets reported by vehicle control components through a preset protocol; and to convert the data packets into event packets with a preset data carrier structure according to the first correspondence and the second correspondence.
[0083] The default protocols include UART and SPI protocols, or other protocols, which are not limited here.
[0084] The preset data carrier structure includes the data carrier structure (VehiclePropValue) used for interaction in HIDL, or other data carrier structures, which are not limited here.
[0085] The vehicle hardware abstraction layer first receives data packets reported by the vehicle control unit through the UART protocol, SPI protocol, or other protocols. Then, the vehicle hardware abstraction layer parses the data packets according to the first correspondence and the second correspondence, and converts the data packets into event packets with a preset data carrier structure.
[0086] In this way, the vehicle hardware abstraction layer can convert data packets into event packets and report them to the event management process, enabling the vehicle-side application to obtain operation events of vehicle control components.
[0087] After step 01, the acquisition method includes:
[0088] 012: Determine the third correspondence between the operation events of the vehicle control components and the Code key values;
[0089] Step 05 includes:
[0090] 051: If the event message includes reported data, then the corresponding Code key value is obtained by parsing the event message according to the third correspondence relationship.
[0091] The processor is used to determine the third correspondence between the operation events of the vehicle control components and the Code key values; if the event message includes reported data, the corresponding Code key value is obtained by parsing the event message.
[0092] In this invention, a third correspondence between the operation events of the vehicle control components and the Code key values can be determined first. For example, each steering wheel event is assigned a unique code key value, and the steering wheel physical event is set as a system keyboard action. The third correspondence between the code key values and the steering wheel events can be shown in Table 4.
[0093] Table 4
[0094] code1 Left button not pressed code2 Short press of the left button code3 Long press the left button code4 Scroll the left scroll wheel upwards code5 Scroll left and scroll down .. ...
[0095] Thus, if the event message includes reported data, the corresponding Code key value can be obtained by parsing the event message according to the third correspondence between the operation events of the vehicle control components and the Code key values. For example, when the vehicle hardware abstraction layer parses the reported data and determines which specific event was triggered by the steering wheel, it can obtain the Code key value corresponding to the steering wheel event according to the third correspondence between the Code key values and the steering wheel events in Table 4.
[0096] When the event is a steering wheel event, SWSKeyManager can query VehicleHal to see if there is reported data. If there is reported data, it will proceed to the following steps of simulating short button press event and long button press event.
[0097] In other words, when the vehicle hardware abstraction layer reports data to the event management process, the following steps are executed. For the simulation of a short button press event, step 07 includes:
[0098] 071: If the input event information is a short key press event, then write the corresponding Code key value for one press and one release to the virtual input device.
[0099] The processor is used to write the corresponding Code key value for one press and one release to the virtual input device if the input event information is a short key press event.
[0100] When the event management process writes standard input event data to the virtual input device, if the Code key value corresponds to a short key press event, it sequentially writes one press and one release event of the Code key value to the virtual input device, thereby simulating vehicle input events.
[0101] When the control button of the vehicle control unit is Figure 3 When pressing the buttons on the steering wheel, you can write the Code values corresponding to the short press events of the steering wheel buttons in Table 4 to the virtual input device for one press and one release.
[0102] In this way, it is possible to simulate the short-press event of a button in the vehicle control unit when the vehicle hardware abstraction layer reports data to the event management process.
[0103] For the simulation of long-press events, please refer to [link / reference]. Figure 8 The vehicle control components include control buttons and a scroll wheel. Step 07 includes:
[0104] 072: If the input event information is a key press event, then write the corresponding Code key value for one press and one release to the virtual input device;
[0105] 073: Write the corresponding Code key value long press event to the virtual input device after a preset interval, until the corresponding input key reports a key not pressed event or a key short press event.
[0106] The processor is used to: if the input event information is a key press event, write the corresponding Code key value for one press and one release to the virtual input device; write the corresponding Code key value for a long press event to the virtual input device after a preset interval, until the corresponding input key reports a key press event or a key release event.
[0107] In other words, when the Code key value corresponds to a long press event, the event management process sequentially writes one press and one release event of the corresponding Code key value to the virtual input device, and sets a timer. Subsequently, long press events of the corresponding Code key value are written to the virtual input device at preset intervals until the corresponding input key reports a key release or short press event. The preset time can be, for example, 100ms, or other values, and is not limited here.
[0108] In this way, it is possible to simulate the long press event of a button in the vehicle control unit when the vehicle hardware abstraction layer reports data to the event management process.
[0109] Understandably, since a long press of a button can last for an indeterminate amount of time, the event management process will only acquire the long press event once when it occurs. If the event management process does not acquire the corresponding button not pressed or button short press event, it can write the long press event to the virtual input device node after a preset interval.
[0110] When the event is a steering wheel event, if SWSKeyManager can query whether VehicleHal has reported any data, and if no data is reported, the following steps will be taken to simulate a long press event.
[0111] That is, when the vehicle hardware abstraction layer fails to report data to the event management process, the following steps are executed, including step 073:
[0112] 0731: If the event message does not include reported data, the data reported by the corresponding input button last time was a long press event, and the time elapsed since the last long press event was written to the virtual input device exceeds a preset time, then write the corresponding Code key value long press event to the virtual input device until the corresponding input button reports a no-press event or a short press event.
[0113] If the event message does not include reported data, the data previously reported by the corresponding input key is a long press event, and the time elapsed since the last long press event was written to the virtual input device exceeds a preset time, then the processor writes the corresponding Code key value long press event to the virtual input device until the corresponding input key reports a no-press event or a short press event.
[0114] Understandably, it can be assumed that if there is no data reported but there is data reported from the last input button press, it is a long press event.
[0115] Because a long press of a button will result in an indeterminate event, during the occurrence of a long press event, long press events will continuously arrive at the event management process. If the last reported data of an input button is a long press event and the time elapsed since the last reported long press event was written to the virtual input device exceeds a preset time, then the corresponding Code key value long press event will be written to the virtual input device until the corresponding input button reports a no-press event or a short-press event.
[0116] The preset time can also be 100ms or other values, which are not limited here.
[0117] Thus, the present invention can simulate a long press event when the directed event management process of the vehicle hardware abstraction layer does not report data.
[0118] Since the vehicle control components include control buttons and a scroll wheel, when the input event information pertains to a scroll wheel event, the scroll wheel event can also be simulated. That is, step 07 also includes:
[0119] 074: If the input event information belongs to the scroll wheel event, then write the corresponding Code key value to the virtual input device once pressed and once released in a loop. The number of loops is determined according to the scroll wheel's scroll scale value.
[0120] The processor is used to repeatedly write the corresponding Code key value to the virtual input device for one press and one release if the input event information belongs to the scroll wheel event. The number of loops is determined according to the scroll wheel's scroll scale value.
[0121] Specifically, when the input event information belongs to the scroll wheel event, the corresponding Code key value will be written to the virtual input device one press and one release event in turn. The number of cycles is determined according to the scroll wheel's scale value, that is, the number of cycles can be the number of scale divisions of the scroll wheel. For example, if the scroll wheel has 10 scale divisions, the number of cycles is 10.
[0122] Thus, the present invention can simulate the roller event when the vehicle hardware abstraction layer reports data to the event management process.
[0123] When the input event is a steering wheel event, the implementation flowchart of the SWSKeyManager process in the vehicle control data acquisition method of this invention is as follows: Figure 9 As shown. At this point, conforming to the Android Automotive architecture specification, the steering wheel can be used as a standard input device. Short press, long press, and scroll wheel events are written as virtual button events to the virtual device node, and processed and distributed by the InputManagerService. The data format conversion process for each control unit in the entire system is as follows: Figure 10 As shown.
[0124] The present invention also provides a non-volatile computer-readable storage medium containing a computer program. When the computer program is executed by one or more processors, it implements the method for acquiring vehicle control data as described in any of the above embodiments.
[0125] For example, when a computer program is executed by a processor, it implements the following steps for acquiring vehicle control data:
[0126] 01: Establish virtual input devices corresponding to vehicle control components and configure virtual device parameters;
[0127] 03: In response to the detection of vehicle attribute encoding information corresponding to the vehicle control component, an event message is reported;
[0128] 05: Parse the event message to obtain the input event information;
[0129] 07: When the input event information meets the conditions, write the standard input event data into the virtual input device according to the input event information, so that the vehicle system can obtain vehicle control data from the virtual input device.
[0130] It is understood that a computer program includes computer program code. Computer program code can be in the form of source code, object code, executable files, or some intermediate form. Computer-readable storage media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, external hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution media, etc.
[0131] The storage medium of the present invention applies the above-described method for acquiring vehicle control data to simulate the vehicle control component as a standard virtual input device connected to the Android system on the vehicle side. Based on the input event information, standard input event data is written to the node of the virtual input device, so that the vehicle system can acquire vehicle control data from the virtual input device, simplifying the process of the vehicle-side application acquiring input events.
Claims
1. A method for acquiring vehicle control data, characterized in that, include: Establish virtual input devices corresponding to vehicle control components and configure virtual device parameters; In response to detecting the vehicle attribute encoding information corresponding to the vehicle control component, an event message is reported; The input event information is obtained by parsing the event message; When the input event information meets the conditions, standard input event data is written to the virtual input device according to the input event information, so that the vehicle system can obtain the vehicle control data from the virtual input device.
2. The acquisition method according to claim 1, characterized in that, After the step of establishing a virtual input device corresponding to the vehicle control component and configuring the virtual device parameters, the acquisition method includes: Establish a data connection between the event management process and the vehicle hardware abstraction layer to monitor the vehicle attribute encoding information.
3. The acquisition method according to claim 2, characterized in that, The response to detecting the vehicle attribute encoding information corresponding to the vehicle control component and reporting an event message includes: In response to the detection of vehicle attribute coding information corresponding to the vehicle control component, an event message with a preset data carrier structure is generated according to the first correspondence between the vehicle control component and the vehicle attribute coding information and the second correspondence between the operation event of the vehicle control component and the preset coding information. The event message is reported to the event management process.
4. The acquisition method according to claim 3, characterized in that, The acquisition method includes: Receive data packets reported by the vehicle control unit through a preset protocol; The step of responding to the detection of vehicle attribute encoding information corresponding to the vehicle control component, and generating an event message with a preset data carrier structure based on a first correspondence between the vehicle control component and the vehicle attribute encoding information, and a second correspondence between the operation events of the vehicle control component and preset encoding information, includes: The data packet is converted into the event packet with the preset data carrier structure according to the first correspondence and the second correspondence.
5. The acquisition method according to claim 3, characterized in that, After the step of establishing a virtual input device corresponding to the vehicle control component and configuring the virtual device parameters, the acquisition method includes: Determine the third correspondence between the operation events and Code key values of the vehicle control component; The process of parsing the event message to obtain input event information includes: If the event message includes reported data, the corresponding Code key value is obtained by parsing the event message according to the third correspondence.
6. The acquisition method according to claim 5, characterized in that, The vehicle control component includes control buttons and a scroll wheel. The step of writing standard input event data into the virtual input device based on the input event information, when the input event information meets the conditions, includes: If the input event information is a short key press event, then write the corresponding Code key value for one press and one release to the virtual input device.
7. The acquisition method according to claim 5, characterized in that, The vehicle control component includes control buttons and a scroll wheel. The step of writing standard input event data into the virtual input device based on the input event information, when the input event information meets the conditions, includes: If the input event information is a key press event, then write the corresponding Code key value of one press and one release to the virtual input device; After a preset time interval, a long press event corresponding to the Code key value is written to the virtual input device until the corresponding input key reports a no-press event or a short press event.
8. The acquisition method according to claim 7, characterized in that, The step of writing the corresponding Code key value to the virtual input device after a preset time interval for a long press event, until the corresponding input key reports a key not pressed event or a key short press event, includes: If the event message does not include the reported data, and the data previously reported by the corresponding input button is a long press event of the button, and the time elapsed since the last reported long press event of the button was written to the virtual input device exceeds the preset time, then the corresponding long press event of the Code key value is written to the virtual input device until the corresponding input button reports a no-press event or a short press event of the button.
9. The acquisition method according to claim 5, characterized in that, The vehicle control component includes control buttons and a scroll wheel. The step of writing standard input event data into the virtual input device based on the input event information, when the input event information meets the conditions, includes: If the input event information is a scroll wheel event, then the corresponding Code key value is repeatedly pressed and released to the virtual input device, wherein the number of cycles is determined according to the scroll wheel's scroll scale value.
10. A vehicle, characterized in that, The vehicle includes a processor and a memory, the memory storing a computer program that, when executed by the processor, implements the method for acquiring vehicle control data as described in any one of claims 1-9.
11. A non-volatile computer-readable storage medium containing a computer program, characterized in that, When the computer program is executed by one or more processors, it implements the method for acquiring vehicle control data as described in any one of claims 1-9.
Citation Information
Patent Citations
Control method for vehicle, vehicle and non-temporary computer readable storage medium
CN110203147A
Vehicle event and event file data management method and system and storage medium
CN112165528A