[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN118426873A - Data processing method, electronic device, storage medium and chip - Google Patents

Data processing method, electronic device, storage medium and chip Download PDF

Info

Publication number
CN118426873A
CN118426873A CN202410845764.4A CN202410845764A CN118426873A CN 118426873 A CN118426873 A CN 118426873A CN 202410845764 A CN202410845764 A CN 202410845764A CN 118426873 A CN118426873 A CN 118426873A
Authority
CN
China
Prior art keywords
data
acceleration sensor
value
electronic device
parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410845764.4A
Other languages
Chinese (zh)
Inventor
王昭
牛群超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202410845764.4A priority Critical patent/CN118426873A/en
Publication of CN118426873A publication Critical patent/CN118426873A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01CMEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
    • G01C19/00Gyroscopes; Turn-sensitive devices using vibrating masses; Turn-sensitive devices without moving masses; Measuring angular rate using gyroscopic effects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4494Execution paradigms, e.g. implementations of programming paradigms data driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Computational Mathematics (AREA)
  • Algebra (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Telephone Function (AREA)

Abstract

The application discloses a data processing method, electronic equipment, a storage medium and a chip. The method is applied to the electronic equipment comprising an acceleration sensor, an acceleration sensor driver and a virtual gyroscope driver, wherein the acceleration sensor driver is used for reporting acceleration data reported by the acceleration sensor to the virtual gyroscope driver, and the virtual gyroscope driver is used for generating angular velocity data based on the acceleration data, and comprises the following steps: when a first application of the electronic equipment drives the subscription angular velocity data to the virtual gyroscope, setting a value of a first parameter to be a first numerical value, wherein the value of the first parameter represents the data amount of acceleration data which is transmitted to the acceleration sensor every time by the acceleration sensor, and the first numerical value is the data amount of the acceleration data which is acquired every time by the acceleration sensor; or when the first application drives the virtual gyroscope to unsubscribe from the angular velocity data, setting the value of the first parameter to a second value, wherein the second value is larger than the first value. The method can improve the data processing performance.

Description

Data processing method, electronic device, storage medium and chip
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a data processing method, an electronic device, a storage medium, and a chip.
Background
The virtual gyroscope (virtual gyroscope) in the electronic device is a virtual sensor fused by Acceleration (ACC) data and geomagnetic (MAG) data through a gesture estimation algorithm. The virtual gyroscope realized through the algorithm does not need to increase the hardware cost of the electronic equipment, so that the virtual gyroscope is widely applied to various application scenes such as games, navigation, flight simulation, virtual reality and the like of the electronic equipment. However, the virtual gyroscope realized based on the algorithm in the traditional technology has the problem of poor data processing capability, so that the user experience is poor.
Therefore, how to improve the data processing capability is a problem that needs to be solved.
Disclosure of Invention
The application provides a data processing method, electronic equipment, a storage medium and a chip, which can improve the data processing performance and improve the user experience.
In a first aspect, a data processing method is provided, applied to an electronic device including an acceleration sensor, an acceleration sensor driver, and a virtual gyroscope driver, where the acceleration sensor driver is configured to report acceleration data reported by the acceleration sensor to the virtual gyroscope driver, and the virtual gyroscope driver is configured to generate angular velocity data based on the acceleration data reported by the acceleration sensor driver, the method includes: setting a parameter value of a first parameter of the acceleration sensor as a first numerical value under the condition that a first application in the electronic equipment drives the subscription angular velocity data to the virtual gyroscope, wherein the parameter value of the first parameter represents the data quantity of acceleration data which is sent to the acceleration sensor every time by the acceleration sensor, and the first numerical value is the data quantity of acceleration data which is acquired every time by the acceleration sensor; or setting the parameter value of the first parameter to a second value under the condition that the first application drives the virtual gyroscope to unsubscribe from the angular velocity data, wherein the second value is larger than the first value.
The first application subscribes angular velocity data to the virtual gyroscope drive, namely the first application needs to acquire the angular velocity data output by the virtual gyroscope. The first application does not need to acquire angular velocity data output by the virtual gyroscope.
Angular velocity data may refer to angle data including heading, pitch and roll angles.
After the electronic device sets the parameter value of the first parameter of the acceleration sensor to the first value, that is, the acceleration data of which the data amount is the first value collected by the acceleration sensor is directly reported to the acceleration sensor for driving.
In the above technical solution, when the first application of the electronic device subscribes to the angular velocity data to the virtual gyroscope driver of the electronic device, the electronic device sets the data amount of the acceleration data (i.e., the parameter value of the first parameter) sent by the acceleration sensor to the acceleration sensor driver each time, which is the same as the data amount of the acceleration data (i.e., the first value) acquired by the acceleration sensor each time, i.e., the acceleration sensor can report the acceleration data with the acquired data amount being the first value to the acceleration sensor driver in real time, so that the timeliness of the acceleration data transmission can be improved. Then, under the condition that the acceleration sensor drives to transmit acceleration data reported from the acceleration sensor to the virtual gyroscope in real time, the virtual gyroscope can obtain angular velocity data based on the acceleration data, so that timeliness of the angular velocity data of the virtual gyroscope can be improved, and user experience is improved. In addition, when the first application unsubscribes angular velocity data from the virtual gyroscope, the electronic device sets the data amount (i.e. the parameter value of the first parameter) of the acceleration data sent by the acceleration sensor to the acceleration sensor drive each time, which is larger than the data amount (i.e. the first value) of the acceleration data collected by the acceleration sensor each time, namely the acceleration sensor caches the acceleration data with the collected data amount smaller than the second value, until the data amount of the acceleration data cached by the acceleration sensor is the second value, the acceleration sensor can report the acceleration data with the data amount of the second value to the acceleration sensor drive, so that the energy consumption of data transmission can be reduced. In summary, the data processing method provided by the application can improve the data processing performance (timeliness of data transmission or reduce the energy consumption of data transmission) so as to improve the user experience.
In one possible implementation, in a case where the first application in the electronic device drives the subscription angular velocity data to the virtual gyroscope, setting a parameter value of the first parameter of the acceleration sensor to a first numerical value includes: in the case where the first application drives the subscription angular velocity data to the virtual gyroscope and determines that the parameter value of the first parameter is not the first numerical value, the parameter value of the first parameter is set to the first numerical value.
For example, the first application in the above implementation is an application in the electronic device that drives the subscription angular velocity data to the virtual gyroscope for the first time, i.e., no other application in the electronic device drives the subscription angular velocity data to the virtual gyroscope before the first application drives the subscription angular velocity data to the virtual gyroscope.
For example, the first application in the above implementation is an application in the electronic device that does not subscribe to the angular velocity data for the first time to the virtual gyroscope, and in this implementation, other applications in the electronic device subscribe to the angular velocity data for the virtual gyroscope before the first application subscribes to the angular velocity data for the virtual gyroscope, and then unsubscribe from the angular velocity data, so that the parameter value of the first parameter is not the first numerical value.
In the above technical solution, the electronic device may set the parameter value of the first parameter to the first value only when the first application drives the subscription angular velocity data to the virtual gyroscope and determines that the first parameter is not the first value. In other words, in the case that the first application drives the subscription angular velocity data to the virtual gyroscope and determines that the first parameter is not the first value, the electronic device does not perform the operation of setting the parameter value of the first parameter to the first value, so that the repeated execution of the operation of setting the value of the first parameter to the first value is avoided, which is beneficial to improving the data processing performance and reducing the energy consumption of the electronic device.
In another possible implementation manner, after setting the parameter value of the first parameter of the acceleration sensor to the first value, the method further includes: and controlling the acceleration sensor to report the acceleration data with the acquired data quantity of the first value to the acceleration sensor for driving.
In the above technical solution, after the first application drives the subscription angular velocity data to the virtual gyroscope, the electronic device sets the value of the first parameter to the first numerical value. And then, the electronic equipment controls the acceleration sensor to report the acquired acceleration data with the data quantity of a first value to the acceleration sensor for driving, so that the timeliness of acceleration data transmission can be improved. And then, the acceleration sensor drives to transmit acceleration data reported by the acceleration sensor in real time to the virtual gyroscope, so that the timeliness of angular velocity data generated by the virtual gyroscope can be improved, and the user experience is improved.
In another possible implementation, in a case where the first application in the electronic device drives the subscription angular velocity data to the virtual gyroscope, setting a parameter value of the first parameter of the acceleration sensor to a first numerical value includes: acquiring a first registration subscription message, wherein the first registration subscription message is used for representing that a first application subscribes angular velocity data to a virtual gyroscope driver; the parameter value of the first parameter is set to a first value based on the first registration subscription message.
In the above technical solution, the electronic device may set the parameter of the first parameter of the acceleration sensor to the first value based on a subscription message (i.e., a first registration subscription message) that the first application subscribes to angular velocity data to the virtual gyroscope driver.
In another possible implementation, the electronic device further includes a sensor manager at the application framework layer; and obtaining a first registration subscription message, including: the sensor manager receives a first registration subscription message sent by a first application; setting, based on the first registration subscription message, a parameter value of the first parameter to a first value, including: the sensor manager sends a first enabling message to the virtual gyroscope driver based on the first registration subscription message; in response to receiving the first enabling message, the virtual gyroscope driver sends a second enabling message to the acceleration sensor driver; the acceleration sensor driver sets a parameter value of the first parameter to a first value according to the second enabling message.
Optionally, the electronic device in the foregoing implementation further includes a sensor module located at a hardware abstraction layer, and the sensor manager sends a first enabling message to the virtual gyroscope driver based on the first registration subscription message, including: the sensor manager sends a first enabling message to the virtual gyroscope driver by invoking the sensor module.
In another possible implementation, the electronic device further includes a magnetic sensor and a magnetic sensor drive; and, the method further comprises: in response to receiving the first enabling message, the virtual gyroscope driver registers acceleration data with the acceleration sensor driver and registers magnetic data with the magnetic sensor driver; after registering acceleration data to the acceleration sensor driver by the virtual gyroscope driver, the virtual gyroscope driver receives first acceleration data, the data amount of which is acquired from the acceleration sensor by the acceleration sensor driver, and the first acceleration data is a first numerical value; after registering magnetic data with the magnetic sensor drive, the virtual gyroscope drive receives first magnetic data, the data amount of which is acquired by the magnetic sensor drive from the magnetic sensor, and the first magnetic data is a first numerical value; the virtual gyroscope driver generates first angular velocity data according to the first acceleration data and the first magnetic data; the virtual gyroscope driver sends the first angular velocity data to the first application through the sensor manager.
It should be noted that, after receiving the first enabling message, the virtual gyroscope driver automatically triggers the virtual gyroscope driver to execute the following three operations: the method includes sending a second enable message to the acceleration sensor driver, registering acceleration data with the acceleration sensor driver, and registering magnetic data with the magnetic sensor driver.
The type of the magnetic sensor is not particularly limited, and for example, the magnetic sensor may be a geomagnetic sensor.
Optionally, the electronic device in the foregoing implementation further includes a sensor module located at a hardware abstraction layer, and the virtual gyroscope driver sends the first angular velocity data to the first application through a sensor manager, including: the virtual gyroscope driver sends the first angular velocity data to the send sensor manager by invoking the sensor module.
In another possible implementation manner, in a case that the first application drives the unsubscribed angular velocity data to the virtual gyroscope, setting the parameter value of the first parameter to the second value includes: acquiring a first de-registration subscription message, wherein the first de-registration subscription message is used for representing that a first application drives a virtual gyroscope to cancel subscription angular velocity data; the parameter value of the first parameter is set to a second value based on the first de-registration subscription message.
In the above technical solution, the electronic device may be capable of setting the parameter of the first parameter of the acceleration sensor to the second value based on an unsubscribe message (i.e., a first unsubscribe message) that the first application drives unsubscribe angular velocity data to the virtual gyroscope.
In another possible implementation, the electronic device further includes a sensor manager at the application framework layer; and obtaining a first de-registration subscription message, including: the sensor manager receives a first de-registration subscription message sent by a first application; setting, based on the first de-registration subscription message, a parameter value of the first parameter to a second value, including: the sensor manager sends a first non-enabling message to the virtual gyroscope driver based on the first de-registration subscription message; in response to receiving the first disable message, the virtual gyroscope driver sends a second disable message to the acceleration sensor driver; the acceleration sensor driver sets the parameter value of the first parameter to a second value according to the second disable message.
In another possible implementation, an electronic device includes a first processor to run a first application, an acceleration sensor drive, a magnetic sensor drive, and a virtual gyroscope drive; or the electronic device comprises a first processor and a second processor, wherein the first processor is used for running a first application, and the second processor is used for running an acceleration sensor driver, a magnetic sensor driver and a virtual gyroscope driver; or the electronic device includes a first processor for running the first application and the first processor is further for running at least one of the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive, and a second processor for running a drive other than the at least one of the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive.
When the first processor is to run any one of the acceleration sensor driver, the magnetic sensor driver, or the virtual gyroscope driver, the any one of the drivers may be located in a kernel layer of the electronic device.
When the first processor is not used to run the acceleration sensor driver, the magnetic sensor driver, and the virtual gyroscope driver, the kernel layer of the electronic device does not include these three drivers.
In another possible implementation, the first processor is an application processor and the second processor is a system control processor, a sensor hub, an audio digital signal processor, or an enhancement digital signal processor.
In another possible implementation, after setting the parameter value of the first parameter to the second value, the method further includes: and controlling the acceleration sensor to store the acquired acceleration data into a buffer of the acceleration sensor, wherein the buffer capacity threshold of the buffer is a second value.
The buffer capacity threshold of the buffer may be a maximum buffer capacity of the buffer, or the buffer capacity threshold of the buffer may be a predefined threshold that is smaller than the maximum buffer capacity of the buffer.
In the technical scheme, after the first application cancels the drive of subscribing angular velocity data to the virtual gyroscope and sets the value of the first parameter as the second value, the acceleration sensor caches the acceleration data of which the acquired data quantity is smaller than the second value, so that the energy consumption of data transmission can be reduced.
In another possible implementation, the first value is 1 and the second value is an integer of [2,10 ].
In a second aspect, there is provided a data processing method applied to an electronic device including an acceleration sensor and an acceleration sensor drive, the method including: under the condition that a first application in the electronic equipment subscribes acceleration data to the acceleration sensor, setting a parameter value of a first parameter of the acceleration sensor as a first numerical value, wherein the parameter value of the first parameter represents the data amount of the acceleration data which is sent to the acceleration sensor by the acceleration sensor every time, and the first numerical value is the data amount of the acceleration data which is acquired by the acceleration sensor every time; or setting the parameter value of the first parameter to a second value under the condition that the first application unsubscribes the acceleration sensor from the acceleration data, wherein the second value is larger than the first value.
In the above technical scheme, when the first application subscribes the acceleration data to the acceleration sensor, the electronic device sets the data amount of the acceleration data (i.e. the parameter value of the first parameter) sent by the acceleration sensor to the acceleration sensor drive each time, equal to the data amount of the acceleration data (i.e. the first numerical value) collected by the acceleration sensor each time, that is, the acceleration sensor can report the collected acceleration data to the first application in real time through the acceleration sensor drive, so that timeliness of the acceleration data transmission can be improved, and user experience can be improved. When a first application in the electronic device unsubscribes the acceleration data from the acceleration sensor, the electronic device sets the data quantity (namely the parameter value of the first parameter) of the acceleration data which is sent by the acceleration sensor to the acceleration sensor drive each time and is larger than the data quantity (namely the first numerical value) of the acceleration data which is collected by the acceleration sensor each time, the acceleration sensor caches the acceleration data of which the collected data quantity is smaller than the second numerical value until the data quantity of the acceleration data cached by the acceleration sensor is the second numerical value, and the acceleration sensor can transmit the acceleration data of which the data quantity is the second numerical value to the first application through the acceleration sensor drive, so that the energy consumption of data transmission can be reduced. In conclusion, the data processing method provided by the application can improve the data processing performance so as to improve the user experience.
In one possible implementation, in a case that a first application in the electronic device subscribes acceleration data to the acceleration sensor, setting a parameter value of a first parameter of the acceleration sensor to a first numerical value includes: in the case where the first application subscribes to the acceleration data from the acceleration sensor and determines that the parameter value of the first parameter is not the first numerical value, the parameter value of the first parameter is set to the first numerical value.
For example, the first application in the above implementation is an application in the electronic device that subscribes acceleration data to the acceleration sensor for the first time, that is, no other application in the electronic device subscribes acceleration data to the acceleration sensor before the first application subscribes acceleration data to the acceleration sensor.
For example, the first application in the above implementation is an application in the electronic device that subscribes to the acceleration sensor for the first time, and in this implementation, before the first application subscribes to the acceleration sensor for the acceleration data, other applications in the electronic device subscribe to the acceleration sensor for the acceleration data first and then unsubscribe from the acceleration data, so that the parameter value of the first parameter is not the first numerical value.
In the above technical solution, the electronic device may set the parameter value of the first parameter to the first value only when the first application subscribes the acceleration data to the acceleration sensor and determines that the first parameter is not the first value. In other words, in the case that the first application subscribes the acceleration data to the acceleration sensor and determines that the first parameter is not the first value, the electronic device does not perform the operation of setting the parameter value of the first parameter to the first value, so that repeated execution of the operation of setting the value of the first parameter to the first value is avoided, which is beneficial to improving the data processing performance and reducing the energy consumption of the electronic device.
In another possible implementation manner, after setting the parameter value of the first parameter of the acceleration sensor to the first value, the method further includes: and controlling the acceleration sensor to report the acceleration data with the acquired data quantity of the first value to the acceleration sensor for driving.
In the above technical solution, after the first application subscribes the acceleration data to the acceleration sensor, the electronic device sets the value of the first parameter to the first numerical value. And then, the electronic equipment controls the acceleration sensor to report the acquired acceleration data with the data quantity of a first value to the acceleration sensor for driving, so that the timeliness of acceleration data transmission can be improved, and the user experience is improved.
In another possible implementation manner, in a case that a first application in the electronic device subscribes acceleration data to the acceleration sensor, setting a parameter value of a first parameter of the acceleration sensor to a first value, including acquiring a second registration subscription message, where the second registration subscription message is used to indicate that the first application subscribes acceleration data to the acceleration sensor; the parameter value of the first parameter is set to a first value based on the second registration subscription message.
In the above technical solution, the electronic device may set the parameter of the first parameter of the acceleration sensor to the first value based on the subscription message (i.e., the second registration subscription message) that the first application subscribes the acceleration sensor to the acceleration data.
In another possible implementation manner, in a case that the first application unsubscribes from the acceleration sensor to the acceleration data, setting the parameter value of the first parameter to the second value includes: acquiring a second de-registration subscription message, wherein the second de-registration subscription message is used for indicating that the first application unsubscribes from acceleration data to the acceleration sensor; the parameter value of the first parameter is set to a second value based on the second de-registration subscription message.
In the above technical solution, the electronic device may be capable of setting the parameter of the first parameter of the acceleration sensor to the second value based on an unsubscribe message (i.e., a second unsubscribe message) that the first application unsubscribes from the acceleration data to the acceleration sensor.
In another possible implementation, the first value is 1 and the second value is an integer of [2,10 ].
In a third aspect, a data processing apparatus is provided, comprising a processing unit for performing any one of the data processing methods of the first or second aspects.
In a fourth aspect, there is provided an electronic device comprising means for performing any of the methods of the first or second aspects. The electronic device may be a terminal device or a chip in the terminal device. The electronic device may include an input unit and a processing unit.
When the electronic device is a terminal device, the processing unit may be a processor and the input unit may be a communication interface; the terminal device may further comprise a memory for storing computer program code which, when executed by the processor, causes the terminal device to perform any of the methods of the first or second aspects.
When the electronic device is a chip in the terminal device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin, a circuit, or the like; the chip may also include memory, which may be memory within the chip (e.g., registers, caches, etc.), or memory external to the chip (e.g., read-only memory, random access memory, etc.); the memory is for storing computer program code which, when executed by the processor, causes the chip to perform any one of the methods of the first or second aspects.
In one possible implementation, the memory is used to store computer program code; a processor executing the computer program code stored by the memory, the processor being operative to perform any one of the methods of the first or second aspects when the computer program code stored by the memory is executed.
In a fifth aspect, there is provided a computer readable storage medium storing computer program code which, when executed by an electronic device, causes the electronic device to perform any one of the data processing methods of the first or second aspects.
In a sixth aspect, there is provided a computer program product comprising: computer program code which, when run by an electronic device, causes the electronic device to perform any one of the data processing methods of the first or second aspects.
It will be appreciated that the advantages of the third to sixth aspects may be found in the relevant description of the first or second aspects, and are not described here again.
It should be appreciated that the description of technical features, aspects, benefits or similar language in the present application does not imply that all of the features and advantages may be realized with any single embodiment. Conversely, it should be understood that the description of features or advantages is intended to include, in at least one embodiment, the particular features, aspects, or advantages. Therefore, the description of technical features, technical solutions or advantageous effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and advantageous effects described in the present embodiment may also be combined in any appropriate manner. Those of skill in the art will appreciate that an embodiment may be implemented without one or more particular features, aspects, or benefits of a particular embodiment. In other embodiments, additional features and advantages may be recognized in certain embodiments that may not be present in all embodiments.
Drawings
Fig. 1 is a schematic diagram of a hardware architecture of an electronic device 100 according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a software system of the electronic device 100 according to an embodiment of the present application.
Fig. 3 is a schematic diagram of an operation of a processor in the electronic device 100 according to an embodiment of the present application.
Fig. 4 is a schematic diagram of an operation of a processor in the electronic device 100 according to an embodiment of the present application.
Fig. 5 is a schematic diagram of an operation of a processor in the electronic device 100 according to an embodiment of the present application.
Fig. 6 is a schematic diagram of a data processing method according to an embodiment of the present application.
Fig. 7 is a schematic diagram of a data processing method according to an embodiment of the present application.
Fig. 8 is a schematic diagram of a data processing apparatus according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms first, second and the like in the description and in the claims and drawings are used for distinguishing between different objects and should not be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a definition of "a first", "a second" feature may explicitly or implicitly include one or more of such features.
In embodiments of the application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g." in an embodiment should not be taken as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
Gyroscopes (gyroscillopes) are one of the important sensors of electronic devices, such as cell phones or tablet computers. Real-time angular velocity of the electronic device can be obtained through the gyroscope, so that various functions such as Virtual Reality (VR) video, games (such as shooting games and racing games) and navigation positioning and the like in the electronic device are realized, wherein the functions depend on motion changes of the mobile terminal. In some application scenarios, the electronic device may not be able to use the physical gyroscope due to hardware limitations or other reasons, and at this time, the data of the gyroscope may be simulated using the virtual gyroscope. The virtual gyroscope is a virtual sensor fused by ACC data and MAG data through a gesture estimation algorithm. Because the virtual gyroscope realized by the algorithm does not need to increase hardware cost, the virtual gyroscope is widely applied to various application scenes such as games, navigation, flight simulation, virtual reality and the like of electronic equipment. For example, the virtual gyroscope can be used for scenes such as running, action games and the like in a mobile phone game, and a player can control the direction and action of a game character through the gesture of the mobile phone. In navigation application, the virtual gyroscope can realize smooth compass rotation effect and can realize functions of real-time marking, path tracking, positioning tracking, map navigation and the like. In a flight simulation scene, the virtual gyroscope can simulate a real flight attitude, so that a user can feel the pleasure of flight more vividly. In a virtual reality scene, the virtual gyroscope can realize gesture detection and dynamic presentation of equipment, so that a user can be more truly integrated into the virtual reality world.
Currently, data (i.e., angular velocity data) of a virtual gyroscope in an electronic device is obtained by fusing virtual gyroscope driving in the electronic device through an attitude estimation algorithm based on ACC data and MAG data. The geomagnetic sensor of the electronic equipment can transmit the collected MAG data to the virtual gyroscope in real time, namely, after the geomagnetic sensor collects MAG data with a certain data quantity, the collected MAG data with the certain data quantity is directly transmitted to the virtual gyroscope through the geomagnetic sensor driver. In order to reduce the power consumption of the electronic device, a first-in first-out (FIRST IN FIRST out) data buffer is arranged in an acceleration sensor of the electronic device, namely, the acceleration sensor firstly buffers the ACC data into the FIFO buffer in the acceleration sensor after collecting the ACC data, and when the FIFO buffer is full or the data buffered in the FIFO buffer reaches a software setting threshold, the acceleration sensor transmits all the ACC data buffered in the FIFO buffer to a virtual gyroscope for driving and processing so as to achieve the purpose of reducing the power consumption. Due to the fact that the FIFO buffer memory is arranged in the acceleration sensor, the timeliness of the acceleration sensor for transmitting collected ACC data to the virtual gyroscope is low, and therefore the timeliness of the data of the virtual gyroscope is reduced. In summary, the conventional technology has a problem of poor data processing capability, resulting in poor user experience.
Therefore, in order to solve the above-described problems. The application provides a data processing method, electronic equipment, a storage medium and a chip. The data processing method provided by the application is applied to electronic equipment comprising an acceleration sensor, an acceleration sensor driver and a virtual gyroscope driver, wherein the acceleration sensor driver is used for reporting acceleration data reported by the acceleration sensor to the virtual gyroscope driver, and the virtual gyroscope driver is used for generating angular velocity data based on the acceleration data, and comprises the following steps: on the one hand, when the first application of the electronic device subscribes to angular velocity data to the virtual gyroscope driver of the electronic device, the electronic device sets the data amount of the acceleration data (i.e. the parameter value of the first parameter) sent by the acceleration sensor to the acceleration sensor driver each time, which is the same as the data amount of the acceleration data (i.e. the first numerical value) collected by the acceleration sensor each time, i.e. the acceleration sensor can report the acceleration data with the collected data amount being the first numerical value to the acceleration sensor driver in real time, so that the timeliness of the acceleration data transmission can be improved. Then, under the condition that the acceleration sensor drives to transmit acceleration data reported from the acceleration sensor to the virtual gyroscope in real time, the virtual gyroscope can obtain angular velocity data based on the acceleration data, so that timeliness of the angular velocity data of the virtual gyroscope can be improved, and user experience is improved. On the other hand, when the first application unsubscribes angular velocity data from the virtual gyroscope, the electronic device sets the data amount (i.e. the parameter value of the first parameter) of the acceleration data sent by the acceleration sensor to the acceleration sensor drive each time, which is larger than the data amount (i.e. the first value) of the acceleration data collected by the acceleration sensor each time, namely, the acceleration sensor firstly caches the acceleration data with the collected data amount smaller than the second value until the data amount of the acceleration data cached by the acceleration sensor is the second value, and the acceleration sensor can report the acceleration data with the data amount being the second value to the acceleration sensor drive, so that the energy consumption of data transmission can be reduced. In summary, the data processing method provided by the application can improve the data processing performance (timeliness of data transmission or reduce the energy consumption of data transmission) so as to improve the user experience.
The data processing method provided by the embodiment of the application can be applied to electronic equipment. By way of example, the electronic device may be, but is not limited to, at least one of a smart phone, a tablet, a wearable device (e.g., a smart watch), a game console, an augmented reality (augmented reality, AR)/VR device, and an in-vehicle device.
The hardware structure and software structure of the electronic device and the operation of the processor in the electronic device, which are suitable for the data processing method provided by the embodiment of the application, are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of a hardware architecture of an electronic device 100 according to an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a power management module 140, a communication management module 150, a display 160, and a sensor module 170, among others.
It should be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the hardware structure of the electronic device 100. In other embodiments, electronic device 100 may include more or fewer components than shown in FIG. 1, or certain components may be combined, certain components may be split, or a different arrangement of components may be provided. The components shown in fig. 1 may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may implement the functions of a processor in various possible implementations of the electronic device 100.
In an embodiment of the present application, the processor 110 may include a first processor 111 (shown in solid lines in fig. 1). Optionally, the processor 110 may also include a second processor 112 (shown in phantom in FIG. 1). In some implementations, the processor 110 includes a first processor 111 and a second processor 112, the first processor 111 may be an application processor (application processor, AP) for taking charge of running an application in the electronic device 100, and the second processor 112 may be a coprocessor or a low-power processor. For example, the second processor 112 may be, in particular, a system control processor (system control processor, SCP), a sensor hub (sensorhub), an audio digital signal processor (audio DIGITAL SIGNAL processor), an enhancement digital signal processor (ADVANCED DIGITAL SIGNAL processor). In other implementations, the processor 110 includes a first processor 111, the first processor 111 having the capabilities of the first processor 111 and the capabilities of a second processor 112, the first processor 111 may be an AP.
Optionally, the processor 110 may also include other processing units, which may be, but are not limited to, at least one of the following: a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (IMAGE SIGNAL processor, ISP), a controller, a video codec, a digital signal processor (DIGITAL SIGNAL processor, DSP), a baseband processor, a neural-Network Processor (NPU). The controller may be a neural hub and a command center of the electronic device 100, among others. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution. It will be appreciated that the processing units in the processor 110 may be stand-alone devices or may be integrated devices.
In some implementations, the electronic device 100 in which the processor 110 is located includes an acceleration sensor, an acceleration sensor driver, and a virtual gyroscope driver, the acceleration sensor driver is configured to report acceleration data reported by the acceleration sensor to the virtual gyroscope driver, the virtual gyroscope driver is configured to generate angular velocity data based on the acceleration data reported by the acceleration sensor driver, and the processor 110 is configured to perform the following steps: setting a parameter value of a first parameter of the acceleration sensor as a first numerical value under the condition that a first application in the electronic equipment drives the subscription angular velocity data to the virtual gyroscope, wherein the parameter value of the first parameter represents the data quantity of acceleration data which is sent to the acceleration sensor every time by the acceleration sensor, and the first numerical value is the data quantity of acceleration data which is acquired every time by the acceleration sensor; or setting the parameter value of the first parameter to a second value under the condition that the first application drives the virtual gyroscope to unsubscribe from the angular velocity data, wherein the second value is larger than the first value.
A memory (not shown in fig. 1) may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an I2C interface, an integrated circuit built-in audio (inter-INTEGRATED CIRCUIT SOUND, I2S) interface, a pulse code modulation (pulsecode modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a GPIO interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a USB interface, among others.
In some embodiments, the processor 110 may be a System On Chip (SOC) on which the first processor 111 and the second processor 112 are integrated processors, the first processor 111 and the second processor 112 cooperating to process sensor data.
The sensor module 170 includes a plurality of sensor hardware, which may include the acceleration sensor 171A and the geomagnetic sensor 171B shown in fig. 1. The acceleration sensor 171A may detect the magnitude of acceleration of the electronic device 100 in various directions (typically, x-axis, y-axis, and z-axis). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The acceleration sensor 171A may also be used to recognize the gesture of the electronic device 100 as an input parameter for applications such as landscape switching and pedometer. The geomagnetic sensor 171B is used for sensing a change in the earth magnetic field and outputting corresponding geomagnetic data, and determining the orientation of the electronic apparatus 100. Optionally, the sensor module 170 may also include other sensor hardware, which may be, but is not limited to, at least one of the following sensors: a gyroscope sensor, a temperature sensor, a humidity sensor, a pressure sensor, a barometric pressure sensor, a distance sensor, a proximity sensor, a fingerprint sensor, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor, and the like.
The power management module 140 is used to power the electronic device 100. The power management module 140 is coupled to the processor 110. The power management module 140 receives input of external power to power the processor 110, the internal memory 121, the external memory, the display screen 160, the communication management module 150, and the like.
The communication management module 150 may provide a communication solution for application on the electronic device 100. Optionally, the communication management module 150 may be a wireless communication module, which provides solutions for wireless communication including WLAN (e.g., WIFI), bluetooth, global navigation satellite system (global navigation SATELLITE SYSTEM, GNSS), frequency modulation (frequencymodulation, FM), near Field Communication (NFC), infrared (IR), etc. applied on the electronic device 100.
The communication management module 150 may be one or more devices that integrate at least one communication processing module. The communication management module 150 receives electromagnetic waves via an antenna, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The communication management module 150 may also receive signals to be transmitted from the processor 110, frequency modulate them, amplify them, and convert them to electromagnetic waves via an antenna for radiation.
The electronic device 100 implements display functions through a GPU, a display screen 160, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 160 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 160 is used to display map application interfaces, VR video application interfaces, game application interfaces, and the like. The display screen 160 includes a display panel. In some embodiments, the electronic device 100 may include 1 or L displays, L being an integer greater than 1.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to enable expansion of the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. For example, in an embodiment of the present application, the processor 110 may include a storage program area and a storage data area by executing instructions stored in the internal memory 121. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universalflash storage, UFS), and the like.
It should be understood that the connection relationships between the modules shown in fig. 1 are only illustrative, and do not constitute a limitation on the connection relationships between the modules of the electronic device 100. Alternatively, the modules of the electronic device 100 may also use a combination of the various connection manners in the foregoing embodiments.
The software system of the above-described electronic device 100 is described below. The software system may employ a layered architecture, an event driven architecture, a microkernel architecture, a micro-service architecture, or a cloud architecture, and the embodiment of the present application exemplarily describes the software system of the electronic device 100.
Fig. 2 is a schematic diagram of a software system of the electronic device 100 according to an embodiment of the present application. Referring to fig. 2, the software system employs a layered architecture. The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android systems are respectively an application layer 210, an application framework layer 220, an Android Runtime (Android run) and core library layer 230, a hardware abstraction layer (hardware abstract layer, HAL) 240 and a kernel layer 250 from top to bottom.
The application layer 210 may include a series of application packages. For example, the application packages may include applications for navigation, VR video, maps, calendars, gallery, talk, camera, bluetooth, etc. Each application in the application layer 210 may generate application data, such as VR video, for generating panoramic video data.
The application framework layer 220 provides an application programming interface (application programming interface, API) and programming framework for applications in the application layer 210. The application framework layer 220 includes a number of predefined functions.
The application framework layer 220 may include a sensor manager, an activity manager, an input manager, a resource manager, a notification manager, a view system, a content provider, and the like.
The sensor manager is a core component of the sensor framework of the Android system, is an entry for an application program (e.g., a navigation application, VR video application, or map application, etc.) to access sensor data, is responsible for managing all sensors on the electronic device 100, and provides APIs for the application program to access sensor data. In some implementations, the sensor manager may be understood as a separate thread.
Android Runtime (Android run) includes a core library and virtual machines. Android run is responsible for scheduling and management of the Android system.
The core library consists of two parts: some programming languages (such as java) require called function functions, and the other part is the core library of android.
The application layer 210 and the application framework layer 220 run in virtual machines. The virtual machine executes the programming files (e.g., java files) of the application layer 210 and the application framework layer 220 as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The core library layer 230 may include a plurality of functional modules, which may be, but are not limited to, surface manager (surface manager), media frame (media frame), libc, SQLite, and the like. The surface manager is used to manage the display subsystem and provides a fusion of two-Dimensional (2D) and three-Dimensional (3D) layers for multiple applications. Media frames support a variety of commonly used audio, video format playback and recording, still image files, and the like. libc is a standard library of C language, libc is one of the lowest libraries in the system, and libc is implemented by a system call of Linux. For example, libc may be used to connect or disconnect camera services, set photographing parameters of a camera, start, stop previewing, take a photograph, etc.
The hardware abstraction layer (hardware abstraction layer, HAL) 240 is an interface layer between the operating system kernel and the upper software, the hardware abstraction layer 240 is used to abstract the hardware of the electronic device 100, providing a consistent interface for the upper software of the electronic device 100. As shown in FIG. 2, the hardware abstraction layer 240 includes a sensor module, also known as a hardware abstraction layer module for a sensor (i.e., sensorHAL). In some implementations, when the kernel layer 250 does not include the virtual gyroscope driver shown by the dashed line, and the shared memory stores angular velocity data generated by the virtual gyroscope driver, the sensor module obtains the angular velocity data stored in the shared memory by calling the shared memory interface, and provides the angular velocity data to the upper interface, so that the application program obtains the angular velocity data. In other implementations, when kernel layer 250 includes a virtual gyroscope drive, shown in phantom, the sensor module obtains angular velocity data transmitted by the virtual gyroscope drive by invoking the virtual gyroscope drive interface and providing the angular velocity data to the upper layer interface to cause the application to obtain the angular velocity data. Optionally, the hardware abstraction layer 240 may also include other modules, each of which implements an interface for a particular type of hardware component. For example, the other module may be, but is not limited to, a display module, which may provide an interface to access the display hardware components.
The kernel layer 250 is the basis of the Android operating system, and the final functions of the Android operating system are completed through the kernel layer. In some implementations, kernel layer 250 may include various communication interfaces (not shown in fig. 2) and shared memory shown in fig. 2 for caching data. In other implementations, the kernel layer 250 may also include at least one of the following sensor drivers, shown in phantom in FIG. 2: virtual gyroscope drive, acceleration sensor drive, magnetic sensor drive. The magnetic sensor drive is understood to be a drive program for the magnetic sensor, and the magnetic sensor is not particularly limited. For example, the magnetic sensor may be, but is not limited to, a geomagnetic sensor, in which case the magnetic sensor drive may be referred to as a geomagnetic sensor drive. Alternatively, kernel layer 250 may also include other drivers, such as, but not limited to, display drivers, camera drivers, audio drivers, and the like.
It should be noted that, the software structure schematic diagram of the electronic device 100 shown in fig. 2 provided by the present application is only used as an example, and is not limited to specific module division in different layers of the Android operating system, and the description of the software structure of the Android operating system in the conventional technology may be referred to specifically. In addition, the data processing method provided by the application can be implemented based on other operating systems (such as IOS or hong mo, etc.), and the application is not limited to examples.
The hardware structure and the software structure of the electronic device to which the data processing method provided by the application is applicable are described above with reference to fig. 1 and fig. 2, respectively. In practical applications, the software structure of the electronic device 100 shown in fig. 2 may be run in the hardware structure of the electronic device 100 shown in fig. 1. The following describes the operation of the processor in the electronic device 100 (i.e., cases one to three hereinafter) based on the hardware configuration of the electronic device 100 shown in fig. 1 described above and the software configuration of the electronic device 100 shown in fig. 2 described above.
In a first case, the processor 110 of the electronic device 100 shown in fig. 1 includes a first processor 111 and a second processor 112, where the first processor 111 is used to run an application, and the second processor 112 is used to run a virtual gyroscope drive, an acceleration sensor drive, and a magnetic sensor drive.
In case one, the first processor 111 and the second processor 112 are two different processors.
Fig. 3 is a schematic diagram illustrating an operation of a processor in the electronic device 100 according to an embodiment of the present application. It should be noted that, only a part of the hardware structures in fig. 1, that is, the first processor 111 and the second processor 112 in fig. 1, are shown in fig. 3. The kernel layer shown in fig. 3 includes shared memory in the kernel layer 250 shown in fig. 2 described above. It will be appreciated that the first processor 111 and the second processor 112 shown in fig. 3 may transmit data through a bus. The second processor 112 is electrically connected between any two of the drives, i.e., between the virtual gyroscope drive and the magnetic sensor drive, between the virtual gyroscope drive and the acceleration sensor drive, and between the acceleration sensor drive and the magnetic sensor drive.
The first processor 111 has an application layer 210, an application framework layer 220, a hardware abstraction layer 240, and a kernel layer 250 running therein. The application layer 210 includes applications that need to subscribe to data of the virtual gyroscope, such as the navigation application, VR video application, and map application shown in fig. 3. The application framework layer 220 includes a sensor manager. The hardware abstraction layer 240 includes a sensor module (i.e., sensorhal). Kernel layer 250 includes shared memory and various communication interfaces (not shown in fig. 3).
The second processor 112 has a plurality of sensor drivers running therein, including a virtual gyroscope driver, a magnetic sensor driver, and an acceleration sensor driver.
The hardware includes a plurality of sensor hardware, i.e., a magnetic sensor and an acceleration sensor.
The interaction between the software layers running in the first processor 111, the interaction between the drivers running in the second processor 112, and the interaction between the first processor 111 and the second processor 112 may be referred to as arrows shown in fig. 3, and the interaction steps of the modules shown in fig. 3 will be described in detail in conjunction with fig. 6, which will not be described in detail.
It should be understood that the architecture of the electronic device shown in fig. 3 is merely schematic, and is not limited in any way to the architecture of the electronic device to which the embodiment of the present application is applicable. For example, the application layer running in the first processor 111 may further include other applications, for example, the other applications may also be game applications, and the like. For example, the second processor 112 may also run other drives, such as, but not limited to, a gyroscope drive, and the like.
In case two, the processor 110 of the electronic device 100 shown in fig. 1 described above includes the first processor 111, where the first processor 111 is used to run applications, a virtual gyroscope drive, an acceleration sensor drive, and a magnetic sensor drive.
Fig. 4 is a schematic diagram illustrating an operation of a processor in the electronic device 100 according to an embodiment of the present application. As shown in fig. 4, the application layer 210 run by the first processor 111 of the electronic device 100 includes a plurality of applications (i.e., navigation, VR video, and map), that is, the first processor 111 is configured to run the plurality of applications. The kernel layer 250 operated by the first processor 111 of the electronic device 100 includes three drivers, i.e., a virtual gyroscope driver, an acceleration sensor driver, and a magnetic sensor driver, in which the first processor 111 is configured to operate the three drivers. The first processor 111 and the second processor 112 in the electronic device 100 shown in fig. 4 may transmit data through a bus.
It will be appreciated that only a portion of the hardware architecture described above in fig. 1, namely the first processor 111 in the electronic device 100 shown in fig. 1, is shown in fig. 4. It should also be understood that the kernel layer 250 running in the first processor 111 shown in fig. 4 is different from the kernel layer 250 running in the first processor 111 shown in fig. 3, but the application layer 210, the application framework layer 220, the hardware abstraction layer 240 and the hardware running in the first processor 111 shown in fig. 4 are the same as the application layer 210, the application framework layer 220, the hardware abstraction layer 240 and the hardware running in the first processor 111 shown in fig. 3, respectively, and are not repeated here.
In case three, the processor 110 of the electronic device 100 shown in fig. 1 includes a first processor 111 and a second processor 112, where the first processor 111 is used to run an application and at least one of a virtual gyroscope drive, an acceleration sensor drive, and a magnetic sensor drive; the second processor 112 is used to operate a drive other than the drive operated by the first processor 111 among the virtual gyro drive, the acceleration sensor drive, and the magnetic sensor drive.
In case three, the first processor 111 and the second processor 112 are two different processors.
In one implementation of case three, the first processor 111 is used to run the application and the virtual gyroscope drive, and the second processor 112 is used to run the acceleration sensor drive and the magnetic sensor drive.
Fig. 5 is a schematic diagram illustrating an operation of a processor in the electronic device 100 according to an embodiment of the present application. As shown in fig. 5, the application layer 210 executed by the first processor 111 in the electronic device 100 includes a plurality of applications (i.e., navigation, VR video, and map), that is, the first processor 111 is configured to execute the plurality of applications. The first processor 111 of the electronic device 100 shown in fig. 5 operates a virtual gyroscope driver included in the kernel layer 250, i.e. the first processor 111 is also configured to operate a virtual gyroscope driver configured to acquire acceleration data from an acceleration sensor driver in the second processor 112 and to acquire magnetic data from a magnetic sensor driver. The second processor 112 of the electronic device 100 is configured to operate with an acceleration sensor driver for acquiring acceleration data reported by the acceleration sensor from the acceleration sensor, and a magnetic sensor driver for acquiring magnetic data reported by the magnetic sensor from the magnetic sensor.
It will be appreciated that fig. 5 only shows a part of the hardware structure of the electronic device 100 shown in fig. 1 and described above, namely, the first processor 111 and the second processor 112 in fig. 1. It should also be understood that the kernel layer 250 running in the first processor 111 shown in fig. 5 is different from the kernel layer 250 running in the first processor 111 shown in fig. 3, and the application layer 210, the application framework layer 220, the hardware abstraction layer 240 and the hardware running in the first processor 111 shown in fig. 5 are the same as the application layer 210, the application framework layer 220, the hardware abstraction layer 240 and the hardware running in the first processor 111 shown in fig. 3, respectively, and are not repeated here.
In another implementation of case three, the first processor 111 is used to run applications, virtual gyroscope drives, and magnetic sensor drives, and the second processor 112 is used to run acceleration sensor drives; or the first processor 111 is used to run applications, virtual gyroscope drives and acceleration sensor drives, and the second processor 112 is used to run magnetic sensor drives; or the first processor 111 is used to run applications and acceleration sensor drives, and the second processor 112 is used to run virtual gyroscope drives and magnetic sensor drives; or the first processor 111 is used to run applications and magnetic sensor drives, and the second processor 112 is used to run virtual gyroscope drives and acceleration sensor drives; or the first processor 111 is used to run applications, acceleration sensors and magnetic sensor drives and the second processor 112 is used to run virtual gyroscope drives.
It should be understood that the operation of the processor in the electronic device 100 shown in fig. 3, 4 and 5 is merely illustrative, and is not meant to limit the present application.
Next, a data processing method provided by an embodiment of the present application will be described in detail with reference to fig. 6 and 7.
Fig. 6 is a schematic diagram of a data processing method according to an embodiment of the present application. It can be understood that, in fig. 6, taking the example that the electronic device a includes a map application, a VR video application, a sensor manager, a virtual gyroscope, an acceleration sensor driver, and a magnetic sensor driver, the interaction steps between the modules involved in the data processing method provided in the embodiment of the present application are described. The operation of the plurality of modules shown in fig. 6 in the processor of the electronic device a is not particularly limited. In some implementations, the plurality of modules shown in fig. 6 are modules that run by the same processor in electronic device a, which may be the first processor 111 in electronic device 100 shown in fig. 4 described above. In some implementations, the modules shown in fig. 6 are modules that run by multiple processors in electronic device a, which may include first processor 111 and second processor 112 in electronic device 100 shown in fig. 3 or 5 described above. It will be appreciated that the interaction flow of the plurality of modules in the electronic device a, which is not described in detail in fig. 6 below, may be referred to the related description in fig. 3, fig. 4 or fig. 5 above.
As shown in fig. 6, the data processing method includes steps S601 to S617. Next, steps S601 to S617 will be described in detail.
Before the electronic device a executes the data processing method provided by the embodiment of the present application, a value of a water line (watermark) of a FIFO buffer of an acceleration sensor of the electronic device a is F/n, where "/" indicates a divisor, F indicates a sampling rate of the acceleration sensor, n indicates a settable attribute of the FIFO buffer of the acceleration sensor, and the value of n is generally associated with the sampling rate of the acceleration sensor. The value of n may be defined by each manufacturer that produces the electronic device a, and the value of n is not particularly limited. It can be understood that when the value of the water line of the FIFO buffer of the acceleration sensor is F/n, the acceleration sensor will report ACC data with the data amount of F/n buffered in the FIFO buffer to the acceleration sensor driver, and the water line of the FIFO buffer may be less than or equal to the maximum buffering capacity of the FIFO buffer. F/n is any integer in the range of [2,10], for example, F/n may be 2,3,4,8 or 10, etc. It should be noted that, the value of the water line of the FIFO buffer of the acceleration sensor of the electronic device indicates the data amount of ACC data transmitted to the acceleration sensor drive at a time by the acceleration sensor. That is, before the data processing method provided by the embodiment of the present application is executed, the data amount of ACC data that is once transmitted to the acceleration sensor drive by the acceleration sensor of the electronic apparatus a is F/n (unit: frame).
In step S601, the VR video in electronic device a sends a registration message #1 to the sensor manager in electronic device a.
After the VR video executes step S601, the sensor manager receives the registration message #1 sent by the VR video. It will be appreciated that VR video is an application of the application layer of electronic device a and that the sensor manager is a module in the application framework layer of electronic device a.
The registration message #1 is used to indicate that the VR video requests subscription to the angular velocity data of the virtual gyroscope, and the content included in the registration message #1 is not particularly limited. In some implementations, registration message #1 may include an identification of the virtual gyroscope drive that is used to indicate the virtual gyroscope drive. In some implementations, the virtual gyroscope driver is a driver, and thus, the identification of the virtual gyroscope driver may be, but is not limited to, an identification of the driver.
For example, registration message #1 may be represented as register (virtual_gyro), which represents a virtual gyro drive.
The angular velocity data of the virtual gyroscope may refer to angular velocity data calculated based on ACC data and MAG data, and the angular velocity data refers to angle data including a heading angle, a pitch angle, and a roll angle.
It should be noted that, in the embodiment of the present application, before the VR video performs the above step S601, that is, before the VR video requests to subscribe to the data of the virtual gyroscope, no other application subscribes to the data of the virtual gyroscope. That is, before the VR video performs the above step S601, the sensor manager does not receive a registration message sent by other applications for requesting subscription to the data of the virtual gyroscope. That is, the VR video performs the above step S601, that is, the application in the electronic device a first subscribes to the angular velocity data of the virtual gyroscope.
In step S602, the sensor manager in the electronic device a transmits an enable message #0 to the virtual gyroscope driver in the electronic device a.
After the sensor manager executes the above step S602, the virtual gyroscope driver receives the enabling message #0 sent by the sensor manager. After receiving the registration message #1, the sensor manager knows that the VR video needs to subscribe to the data of the virtual gyroscope. Thereafter, the sensor manager transmits an enable message #0 to the virtual gyroscope driver, the enable message #0 being used to trigger the virtual gyroscope to automatically perform steps S603, S604 and S605 below.
In step S603, the virtual gyroscope driver in the electronic device a transmits an enable message #1 to the acceleration sensor driver in the electronic device a.
After the virtual gyroscope driver executes the step S603, the acceleration sensor driver receives the enabling message #1 sent by the virtual gyroscope driver.
The enabling message #1 may include an identification of the virtual gyroscope drive, an identification of the acceleration sensor, and a control command #1, where the control command #1 is used to indicate that the value of the water line of the FIFO buffer of the acceleration sensor is set to 1, that is, the control command #1 indicates that the data amount of ACC data that needs to be controlled to be transmitted to the acceleration sensor drive at one time by the acceleration sensor is 1 frame of ACC data.
For example, the ENABLE message #1 may be a MESSAGEID _enable message.
In step S604, the virtual gyroscope driver in the electronic device a transmits an ACC registration message #1 to the acceleration sensor driver in the electronic device a.
ACC registration message #1 is used to request acquisition of acceleration data. For example, ACC registration message #1 may be a sns_ suid _lookup_add (ACC) message.
After the virtual gyroscope driver sends an ACC registration message #1 to the acceleration sensor driver, a callback function exists at the virtual gyroscope driver. After the acceleration sensor driver acquires the ACC data from the acceleration sensor, the virtual gyroscope driver can acquire the ACC data acquired by the acceleration sensor from the acceleration sensor driver through the callback function.
In step S605, the virtual gyroscope driver in electronic device a sends MAG registration message #1 to the magnetic sensor driver in electronic device a.
After the virtual gyroscope driver executes the step S605, the magnetic sensor driver receives the MAG registration message #1 sent by the virtual gyroscope driver.
By way of example, the magnetic sensor may be a magnetic sensor and the magnetic sensor drive may be a magnetic sensor drive.
The MAG registration message #1 is used to request acquisition of MAG data. For example, MAG registration message #1 may be a sns_ suid _lookup_add (MAG) message.
In the embodiment of the present application, the execution order of executing the above step S604 and step S605 on the electronic device a is not particularly limited. For example, the electronic device a may execute step S604 first, and then execute step S605. As another example, the electronic device a may execute step S605 first, and then execute step S604.
The above steps S603 to S605 describe a process of triggering the execution of the virtual gyroscope driver after the virtual gyroscope driver receives the enabling message #0 sent by the sensor manager. The pseudo code for performing the above steps S603 to S605 by the virtual gyroscope driver is as follows:
if (register to get application) {
enable( ) {
Transmitting MESSAGEID _enable message to the acceleration sensor driver;
registering ACC data with an acceleration sensor drive;
registering MAG data with the magnetic sensor drive;
}
notifyevent( ){
acquiring ACC data from ACC and MAG data of MAG;
invoking an attitude estimation algorithm to process and calculate the angular velocity of ACC data and MAG data;
}
}
In the above pseudo code, one example of the register is the registration message #1, one example of the message id_enable is the enable message #1, and the notify () can be understood as a callback function.
In step S606, the acceleration sensor driver in the electronic device a sets the value of the water line of the FIFO buffer of the acceleration sensor in the electronic device a to 1 according to the enable message 1.
The acceleration sensor driver in the electronic device a sets the value of the water line of the FIFO buffer of the acceleration sensor in the electronic device a to 1 according to the enabling message 1, and may include the following steps: the acceleration sensor drive sends a control command #1 to the acceleration sensor of the electronic device A according to the enabling message 1; the acceleration sensor sets the value of the water line of the FIFO buffer of the acceleration sensor to 1 according to the control command # 1.
Before the electronic device a executes the above step S606, the ACC data with the data amount (F/n) of frames collected by the acceleration sensor is immediately sent to the acceleration sensor driver, where F/n is any integer of [2,10 ]. Since the minimum unit of ACC data is one frame, that is, before the electronic device a performs the above step S606, the acceleration sensor will buffer the collected ACC data in the FIFO buffer until FIIO the ACC data buffered in the buffer has the data size of (F/n) frame, and the acceleration sensor will not send the ACC data with the data size of (F/n) frame to the acceleration sensor driver. After the electronic device a executes the above step S606, the ACC data with one frame of data volume collected by the acceleration sensor is immediately sent to the acceleration sensor driver. Because the minimum unit of the ACC data is one frame, after the electronic device executes the step S606, the acceleration sensor can realize the purpose of transmitting the ACC data to the acceleration sensor in real time, that is, the acceleration sensor does not buffer the currently acquired ACC data, so that the timeliness of ACC data transmission can be effectively improved, and the timeliness of generating angular speed data transmission by the virtual gyroscope drive is improved.
For example, the pseudo code of the step performed by the acceleration sensor driving may be as follows:
func1 () { normal acquisition data watermark=F/n; }
If (obtain MSGID_ENABLE message) {
watermark = 1;
}
If (registration message to virtual gyroscope driver is acquired) {
Transmitting ACC data to the virtual gyroscope driver;
}
if (obtain MSGID_DISABLE message) {
watermark = F/n;
}
One example of the above pseudo code of the msgid_enable message is ENABLE message 1.watermark represents the water line of the FIFO buffer in the acceleration sensor, one example of the MSGID DISABLE message is DISABLE message 1 below.
In step S607, the acceleration sensor drive in the electronic apparatus a transmits one frame of ACC data #1 to the virtual gyroscope drive in the electronic apparatus a.
After the acceleration sensor driver performs the above step S607, the virtual gyroscope driver receives the ACC data #1 of one frame transmitted by the acceleration sensor driver.
In the embodiment of the present application, the transmission form of the acceleration sensor drive to transmit one frame of ACC data #1 to the virtual gyroscope drive is not particularly limited. For example, the acceleration sensor driver may carry one frame of ACC data #1 by a data packet transmitted to the virtual gyroscope driver so that the virtual gyroscope driver receives the one frame of ACC data #1.
The data packet carrying one frame of ACC data #1 is not particularly limited as to whether the data packet includes other information, for example, the data packet carrying one frame of ACC data #1 may further include at least one of the following information: sensor type, sensor data accuracy, or sensor data time stamp.
In step S608, the magnetic sensor drive in the electronic device a transmits one frame of ACC data #1 to the virtual gyroscope drive in the electronic device a.
After the magnetic sensor driver performs the above step S608, the virtual gyroscope driver receives the MAG data #1 of one frame sent by the magnetic sensor driver.
In the embodiment of the present application, the transmission form of the MAG data #1 of one frame transmitted from the magnetic sensor drive to the virtual gyroscope drive is not particularly limited. For example, the magnetic sensor drive may carry one frame of MAG data #1 by a data packet sent to the virtual gyroscope drive, such that the virtual gyroscope drive receives one frame of MAG data #1.
The method for determining whether the data packet carrying one frame of MAG data #1 includes other information is not particularly limited, for example, the data packet carrying one frame of MAG data #1 may further include at least one of the following information: sensor type, sensor data accuracy, or sensor data time stamp.
In step S609, the virtual gyroscope drive in the electronic apparatus a obtains one frame of angular velocity data #1 from one frame of ACC data #1 and one frame of MAG data #1.
Angular velocity data #1 includes heading angle, pitch angle, and roll angle.
It can be appreciated that, in the case where the VR video does not unsubscribe from the data of the virtual gyroscope, the virtual gyroscope driver may receive a frame of ACC data acquired in real time from the acceleration sensor by the acceleration sensor driver, and may receive a frame of MAG data acquired in real time from the magnetic sensor by the magnetic sensor driver, and calculate a frame of angular velocity data from the real-time acquired frame of ACC data and the frame of MAG data.
The virtual gyroscope drive processes one frame of ACC data #1 and one frame of MAG data #1 based on the attitude estimation algorithm, and one frame of angular velocity data #1 can be obtained. The posture estimation algorithm is not particularly limited, and an existing posture estimation algorithm can be adopted, and is not described herein.
Illustratively, the virtual gyroscope driver processes the one-frame ACC data #1 and the one-frame MAG data #1 based on the attitude estimation algorithm, so as to obtain one-frame angular velocity data #1, and may include the following steps: the virtual gyroscope driver respectively carries out data preprocessing on one frame of ACC data #1 and one frame of MAG data #1 to obtain corrected one frame of ACC data #1 and corrected one frame of MAG data #1; calculating real-time attitude information of the carrier according to a double-vector attitude determination principle by using the corrected one-frame ACC data #1 and the corrected one-frame MAG data #1; and calculating a course angle, a roll angle and a pitch angle according to the relation between the attitude angle and the attitude matrix to obtain one-frame angular speed data #1.
In the above implementation, the data preprocessing performed by the virtual gyroscope driver on one frame of ACC data #1 may include: the virtual gyroscope driver removes noise from one frame of ACC data #1 through a low-pass filter, filters high-frequency vibration information, and filters the influence of harmful acceleration through a mean value smoother to obtain corrected one frame of ACC data #1.
In the above implementation, the performing data preprocessing on one frame of MAG data #1 by the virtual gyroscope driver may include: the virtual gyroscope drive removes noise from one frame of MAG data #1 through a low-pass filter, eliminates soft magnetic and hard magnetic interference through a correction module, and maps magnetic data onto a standard sphere of space to obtain corrected one frame of MAG data #1.
In step S610, the virtual gyroscope driver in the electronic apparatus a transmits one frame of angular velocity data #1 to the sensor manager in the electronic apparatus a.
The virtual gyroscope driver sends a frame of angular velocity data #1 to the sensor manager, so that the sensor manager receives the frame of angular velocity data #1, and the data interaction process can be specifically referred to the related description in fig. 3, which is not described in detail herein.
In step S611, the sensor manager in the electronic device a transmits one frame of angular velocity data #1 to the VR video in the electronic device a.
Since the VR video requests the sensor manager for angular velocity data subscribed to the virtual gyroscope, the sensor manager may send one frame of angular velocity data #1 to the VR video after receiving the one frame of angular velocity data # 1.
It will be appreciated that, when the sensor manager sends a frame of angular velocity data #1 to the VR video, the electronic device a may be in a bright screen state or a dead screen state, which is not specifically limited in the embodiment of the present application.
It can be understood that after the sensor manager sends a frame of angular velocity data #1 to the VR video of the electronic device a, if the VR video does not unsubscribe from the data of the virtual gyroscope, the sensor manager will receive a frame of angular velocity data sent by the virtual gyroscope driver in real time, and the sensor manager will send the acquired frame of angular velocity data to the VR video in real time.
It should be noted that, the steps S601 to S611 are related steps of the electronic device a performing the registration procedure (i.e. the registration procedure 1 in fig. 6). Optionally, after the electronic device a performs the above steps S601 to S611, the map in the electronic device a may further send a registration message #2 to the sensor processor, where the registration message #2 is used to request to subscribe to the data of the virtual gyroscope. In this implementation, the electronic device a may also perform step S612 and step S613 shown in the registration flow 2 in fig. 6.
In step S612, the map in electronic device a sends a registration message #2 to the sensor manager in electronic device a.
After the map performs the above step S612, the sensor manager receives the registration message #2 sent by the map, accordingly. It will be appreciated that the map is an application of the application layer of the electronic device a.
Registration message #2 is used to indicate that the map requests subscription to angular velocity data of the virtual gyroscope, and registration message #2 may include a virtual gyroscope drive identification. Illustratively, registration message #2 is a register (virtual_gyro) message, which represents a virtual gyro drive.
In step S613, the sensor manager in the electronic device a transmits one frame of angular velocity data #2 to the map in the electronic device a.
After the electronic device a performs the above step S601 to the above step S612, that is, the VR video has successfully subscribed to the data of the virtual gyroscope (that is, the angular velocity data), that is, the VR video may acquire one frame of angular velocity data (for example, one frame of angular velocity data # 1) from the virtual gyroscope driver in real time by the sensor manager. Because the VR video does not send a request to the sensor manager to unsubscribe from the data of the virtual gyroscope, the sensor manager can acquire one frame of angular velocity data at the current moment from the virtual gyroscope driver in real time, and then the sensor manager can directly send the acquired one frame of angular velocity data at the current moment to the map after receiving requests of other applications (i.e., maps) requesting to subscribe to the data of the virtual gyroscope. That is, in this scenario, after the map transmits the registration message #2 to the sensor manager, the related flow similar to the above-described steps S602 to S606 need not be performed.
One frame of angular velocity data #1 may be angular velocity data obtained by the virtual gyroscope driver acquired by the sensor manager for one frame of ACC data and one frame of MAG data acquired at time 1, one frame of angular velocity data #2 may be angular velocity data obtained by the virtual gyroscope driver acquired by the sensor manager for one frame of ACC data and one frame of MAG data acquired at time 2, where time 1 is a time before time 2, one frame of angular velocity data #2 and one frame of angular velocity data #1 are angular velocity data transmitted by the sensor manager at different times, and one frame of angular velocity data #2 and one frame of angular velocity data #1 are different.
In the embodiment of the present application, in the case where the application (for example, VR video) in the electronic device a does not need to subscribe to the data of the virtual gyroscope, the electronic device a may further execute steps S614 to S617 corresponding to the de-registration procedure shown in fig. 6.
In step S614, the VR video in electronic device a sends a de-registration message #1 to the sensor manager in electronic device a.
After the VR video executes the above step S601, the sensor manager receives the deregistration message #1 sent by the VR video correspondingly.
The de-registration message #1 is used to request to unsubscribe from the data of the virtual gyroscope.
In step S615, the sensor manager in electronic device a sends a disable message #0 to the virtual gyroscope driver in electronic device a.
The disable message #0 is used to trigger the virtual gyroscope drive to automatically perform step S616 below.
The interaction flow between the sensor manager and the virtual gyroscope driver may be referred to the description of the interaction flow between the sensor manager and the virtual gyroscope driver in step S602, which is not described in detail herein.
In step S616, the virtual gyroscope driver in electronic device a sends a disable message #1 to the acceleration sensor driver in electronic device a.
After the virtual gyroscope driver performs step S616, the acceleration sensor driver receives the disabling message #1 sent by the virtual gyroscope driver.
The disable message #1 may include an identification of the virtual gyroscope drive, an identification of the acceleration sensor, and a control command #2, the control command #2 being used to instruct setting the value of the water line of the FIFO buffer of the acceleration sensor to F/n.
For example, the disable message #1 may be a MESSAGEID _ DISENABLE message.
In step S617, the acceleration sensor driver in the electronic device a sets the value of the water line of the FIFO buffer of the acceleration sensor of the electronic device a to F/n according to the disable message 1.
The acceleration sensor driver in the electronic device a sets the value of the water line of the FIFO buffer of the acceleration sensor of the electronic device a to F/n according to the disable message 1, and may include the following steps: the acceleration sensor driver sends a control command #2 to the acceleration sensor of the electronic device a according to the non-enabling message 1; the acceleration sensor sets the value of the water line of the FIFO buffer of the acceleration sensor to F/n according to the control command # 2.
After the electronic device a executes the above step S617, the acceleration sensor immediately sends the (F/n) frame ACC data to the acceleration sensor driver after the acceleration sensor collects the (F/n) frame ACC data, where F/n is an integer in the range of [2, 10], for example, F/n may be 2,3,4, 10, etc.
The above steps S616 and S617 describe the process of triggering the execution of the virtual gyroscope driver after the virtual gyroscope driver receives the disabling message #0 sent by the sensor manager. Illustratively, the pseudocode of steps S616 and S617 described above is as follows:
if (unregister to get application) {
disable( ) {
Sending an MSGID_DISABLE message to an acceleration sensor driver;
Registering ACC data;
}
}
In the above pseudo code, one example of the above unregister is a de-registration message #1, one example of the message id_disable is a disable message #1, and one example of disable () is a disable message #1.
It should be understood that the data processing method shown in fig. 6 is merely illustrative, and the data processing method provided in the embodiment of the present application is not limited in any way. For example, the electronic device a may directly end the data processing flow after executing the above step S601 to the above step S611. For example, the VR videos described above may also be replaced with other applications that require data for the virtual gyroscope, e.g., other applications may be, but are not limited to, gaming applications or navigation applications in electronic device a, etc.
In the embodiment of the application, when the VR video application of the electronic device subscribes angular velocity data to the virtual gyroscope drive of the electronic device, the electronic device sets the data volume of the ACC data (namely, the value of the water line of the FIFO buffer of the acceleration sensor) sent by the acceleration sensor to the acceleration sensor drive each time, which is the same as the data volume of the ACC data (namely, 1 frame) acquired by the acceleration sensor each time, namely, the acceleration sensor can report the ACC data with the acquired data volume of 1 frame to the acceleration sensor drive in real time, so that the timeliness of ACC data transmission can be improved. Then, under the condition that the acceleration sensor drives to transmit ACC data reported from the acceleration sensor to the virtual gyroscope in real time, the virtual gyroscope can obtain angular velocity data based on the ACC data, so that timeliness of the angular velocity data of the virtual gyroscope can be improved, and user experience is improved. In addition, when the VR video application cancels the subscription angular velocity data from the virtual gyroscope, the electronic device sets the data volume of the ACC data which is sent by the acceleration sensor to the acceleration sensor drive each time and is larger than the data volume of the ACC data which is collected by the acceleration sensor each time, that is, the acceleration sensor firstly caches the ACC data which is smaller than the (F/n) frame in the collected data volume, until the data volume of the ACC data cached by the acceleration sensor is the (F/n) frame, the acceleration sensor reports the ACC data which is the (F/n) frame to the acceleration sensor drive, so that the energy consumption of data transmission can be reduced. And, in the case that the VR video application successfully subscribes to the angular velocity data of the virtual gyroscope driver, that is, in the case that the value of the water line of the FIFO buffer of the acceleration sensor is set to 1, if the map application requests to subscribe to the angular velocity data of the virtual gyroscope driver again, the operation of updating the value of the water line of the FIFO buffer again is not required to be performed, so that the processing flow is simplified. In summary, the data processing method provided by the application can improve the data processing performance (timeliness of data transmission or reduce the energy consumption of data transmission) so as to improve the user experience.
Fig. 7 is a schematic diagram of a data processing method according to an embodiment of the present application. The data processing method provided by the embodiment of the application can be executed by the electronic equipment. It is understood that the electronic device may be implemented as software, or as a combination of software and hardware. By way of example, the electronic device in the embodiments of the present application may be, but not limited to, the electronic device 100 shown in fig. 3, 4, or 5. As shown in fig. 7, the data processing method provided by the embodiment of the present application includes step S710 and step S720. Next, step S710 and step S720 will be described in detail.
In step S710, in a case where the first application in the electronic device drives the subscription angular velocity data to the virtual gyroscope, a parameter value of a first parameter of the acceleration sensor is set to a first numerical value, where the parameter value of the first parameter represents a data amount of acceleration data that the acceleration sensor drives to the acceleration sensor each time, and the first numerical value is a data amount of acceleration data that the acceleration sensor collects each time.
The electronic equipment comprises an acceleration sensor, an acceleration sensor driver and a virtual gyroscope driver, wherein the acceleration sensor driver is used for reporting acceleration data reported by the acceleration sensor to the virtual gyroscope driver, and the virtual gyroscope driver is used for generating angular velocity data based on the acceleration data reported by the acceleration sensor driver.
Illustratively, the electronic device a in the data processing method provided in fig. 6 above is a specific example of the electronic device in the above step S710, the acceleration sensor in fig. 6 above is a specific example of the acceleration sensor drive in the above step S710, and the virtual gyroscope in fig. 6 above is a specific example of the virtual gyroscope drive in the above step S710.
In the embodiment of the application, the first application, each sensor and each driver in the electronic device are all running in the hardware processor of the electronic device, and the running conditions of the first application, each sensor and each driver in the processor of the electronic device are not particularly limited.
In some implementations, the electronic device includes a first processor to run a first application, an acceleration sensor drive, a magnetic sensor drive, and a virtual gyroscope drive.
The first application is an application in an application layer of the electronic device, and is not particularly limited, that is, an application in the electronic device that needs to subscribe to angular velocity data of the virtual gyroscope driver may be referred to as a first application. For example, the first application may be, but is not limited to, a map, a game, VR video, navigation. Optionally, the application layer of the electronic device may further include other applications besides the first application, which is not specifically limited in the embodiment of the present application. For example, the other application may be an application that requires subscription to virtual gyroscope driven angular velocity data, or may also be an application that does not require subscription to virtual gyroscope driven angular velocity data.
The acceleration sensor driver, the magnetic sensor driver, and the virtual gyroscope driver may be located in a kernel layer of the electronic device when the first processor runs the acceleration sensor driver, the magnetic sensor driver, and the virtual gyroscope driver.
By way of example, the electronic device in the above implementation is the electronic device 100 shown in fig. 4, the first processor is the first processor 111 shown in fig. 4, any one of the plurality of applications (map, VR video, and navigation) included in the application layer 210 run by the first processor 111 may be the first application described above, and the kernel layer 250 run by the first processor 111 includes an acceleration sensor driver, a magnetic sensor driver, and a virtual gyroscope driver.
In other implementations, the electronic device includes a first processor to run the first application and a second processor to run the acceleration sensor driver, the magnetic sensor driver, and the virtual gyroscope driver.
The first application is an application in an application layer of the electronic device.
When the first processor is not running the acceleration sensor driver, the magnetic sensor driver, and the virtual gyroscope driver, the kernel layer of the electronic device does not include these three drivers.
By way of example, the electronic device in the above implementation is the electronic device 100 shown in fig. 3, the first processor is the first processor 111 shown in fig. 3, any one of the plurality of applications (map, VR video, and navigation) included in the application layer 210 run by the first processor 111 may be the first application described above, and the kernel layer 250 run by the first processor 111 does not include an acceleration sensor driver, a magnetic sensor driver, and a virtual gyroscope driver. The second processor 112 runs acceleration sensor drives, magnetic sensor drives, and virtual gyroscope drives of the electronic device.
In still other implementations, the electronic device includes a first processor for running the first application and the first processor is further for running at least one of the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive, and a second processor for running a drive other than the at least one of the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive.
The first application is an application in an application layer of the electronic device, and an understanding of the first application may be found in the above description, and will not be repeated here.
When the first processor is to run at least one of the acceleration sensor driver, the magnetic sensor driver, and the virtual gyroscope driver, the kernel layer of the electronic device includes the at least one driver.
By way of example, the electronic device in the above implementation may be, but is not limited to, the electronic device 100 shown in fig. 5, the first processor is the first processor 111 shown in fig. 5, any one of a plurality of applications (map, VR video, and navigation) included in the application layer 210 run by the first processor 111 may be the first application in the above implementation, and the kernel layer 250 run by the first processor 111 includes a virtual gyroscope driver. The second processor 112 runs an acceleration sensor drive and a magnetic sensor drive.
The first processor and the second processor in each of the above-described implementations are not particularly limited. In some implementations, the first processor is an application processor and the second processor is a system control processor, a sensor hub, an audio digital signal processor, or an enhancement digital signal processor.
One processor in the electronic device may be integrated with the first processor and the second processor, and by way of example, the processor integrated with the first processor and the second processor may be, but is not limited to, an SOC.
The parameter value of the first parameter represents a data amount of acceleration data that the acceleration sensor drives each time the acceleration sensor sends, and in some implementations, the parameter value of the first parameter is equal to the first numerical value. In other implementations, the parameter value of the first parameter is equal to the second value. The second value is data larger than the first value, and the values of the second value and the first value are not particularly limited. In some implementations, the data amount of the acceleration data acquired by the acceleration sensor at a time is 1 (unit: frame), in which case the first value may be 1 and the second value may be an integer of [2,10 ]. For example, the second value may be, but is not limited to, 2,3,4,5, or 10, etc.
Illustratively, the water line of the FIFO buffer in the data processing method provided in fig. 6 may be a specific example of the first parameter, the water line of the FIFO buffer in the data processing method provided in fig. 6 may be a specific example of the parameter value of the first parameter, the value "F/n" in the data processing method provided in fig. 6 may be a specific example of the second value, and the value "1" in fig. 6 may be a specific example of the first value, which is not described in detail herein.
In the embodiment of the present application, the implementation method for executing the step S710 is not specifically limited.
In some implementations, the electronic device performs the step S710 described above, that is, in a case where the first application in the electronic device drives the subscription angular velocity data to the virtual gyroscope, setting the parameter value of the first parameter of the acceleration sensor to the first value includes: in the case where the first application drives the subscription angular velocity data to the virtual gyroscope and determines that the parameter value of the first parameter is not the first numerical value, the parameter value of the first parameter is set to the first numerical value.
Optionally, the first application in the implementation is an application in the electronic device that drives the subscription angular velocity data to the virtual gyroscope for the first time, that is, before the first application drives the subscription angular velocity data to the virtual gyroscope, no other application in the electronic device drives the subscription angular velocity data to the virtual gyroscope. Illustratively, the electronic device in such an implementation may be electronic device a in the data processing method provided above in fig. 6, and the first application may be VR video in fig. 6 above.
Optionally, the first application in the implementation is an application in the electronic device that does not subscribe angular velocity data to the virtual gyroscope for the first time, and in this scenario, before the first application subscribes angular velocity data to the virtual gyroscope, other applications in the electronic device subscribe angular velocity data to the virtual gyroscope first and then unsubscribe from angular velocity data, so that the parameter value of the first parameter is not the first numerical value.
In the above implementation, the electronic device may set the parameter value of the first parameter to the first value only when the first application drives the subscription angular velocity data to the virtual gyroscope and determines that the first parameter is not the first value. In other words, in the case that the first application drives the subscription angular velocity data to the virtual gyroscope and determines that the first parameter is the first value, the electronic device does not perform the operation of setting the parameter value of the first parameter to the first value, so that the data processing flow can be simplified and the energy consumption of the electronic device can be reduced.
In other implementations, the electronic device performs the step S710, where the setting, by the first application in the electronic device, the parameter value of the first parameter of the acceleration sensor to the first value in a case where the first application drives the virtual gyroscope to subscribe to the angular velocity data includes: the electronic equipment acquires a first registration subscription message, wherein the first registration subscription message is used for representing that a first application subscribes angular velocity data to a virtual gyroscope driver; the electronic device sets a parameter value of the first parameter to a first numerical value based on the first registration subscription message.
The first registration subscription message is used to indicate that the first application subscribes to angular velocity data with respect to the virtual gyroscope drive. In some implementations, the first registration subscription message may include an identification of the virtual gyroscope driver. Optionally, the first registration subscription message may also include other information, for example, the other information may be, but is not limited to, an identification of the first application.
For example, the registration message #1 or the registration message #2 in the data processing method provided in fig. 6 above is a specific example of the first registration subscription message, and details not described herein may be referred to in the related description in fig. 6 above.
The electronic device sets the parameter value of the first parameter to a first numerical value based on the first registration subscription message, i.e. the electronic device sets the parameter value of the first parameter to the first numerical value based on data generated by the first registration subscription message.
In the above technical solution, the electronic device sets the parameter of the first parameter to the first value based on the subscription message (i.e., the first registration subscription message) that the first application drives to subscribe to the angular velocity data to the virtual gyroscope.
Optionally, the electronic device in the above implementation further includes a sensor manager located at an application framework layer, and the first application is an application program layer located at the electronic device; and the electronic device obtaining a first registration subscription message, including: the sensor manager receives a first registration subscription message sent by a first application; the electronic device sets a parameter value of a first parameter to a first numerical value based on the first registration subscription message, including: the sensor manager sends a first enabling message to the virtual gyroscope driver based on the first registration subscription message; in response to receiving the first enabling message, the virtual gyroscope driver sends a second enabling message to the acceleration sensor driver; the acceleration sensor driver sets a parameter value of the first parameter to a first value according to the second enabling message.
The first enabling message is a message for triggering the virtual gyroscope driver to execute a preset operation, that is, after the virtual gyroscope driver receives the first enabling message, the electronic device controls the virtual gyroscope driver to automatically execute the preset operation, wherein the preset operation includes that the virtual gyroscope driver sends a second enabling message operation to the acceleration sensor driver, and the virtual gyroscope driver registers acceleration data to the acceleration sensor driver, and the virtual gyroscope driver registers magnetic data to the magnetic sensor driver. It should be noted that, after the virtual gyroscope driver sends the second enabling message to the acceleration sensor driver, the virtual gyroscope driver registers the acceleration data with the acceleration sensor driver and registers the magnetic data with the magnetic sensor driver.
The second enable message is used to indicate that the parameter value of the first parameter is set to a first value. In some implementations, the second enable message may include an identification of the virtual gyroscope drive, an identification of the acceleration sensor, and a first control command to indicate setting a parameter value of the first parameter to a first numerical value.
Illustratively, the sensor manager in the data processing method provided in fig. 6 above is a specific example of the sensor manager, the enabling message #1 in the data processing method provided in fig. 6 above is a specific example of the second enabling message, the enabling message #0 in fig. 6 above may be a specific example of the first enabling message, and details not described herein may be found in the related description in fig. 6 above.
Optionally, the electronic device further includes a sensor module located at a hardware abstraction layer, and in the step of sending, by the sensor manager, the first enabling message to the virtual gyroscope driver based on the first registration subscription message, the method includes: the sensor manager sends a first enabling message to the virtual gyroscope driver by invoking the sensor module.
Optionally, the electronic device in the above implementation further includes a magnetic sensor and a magnetic sensor driver; and, the method further comprises: in response to receiving the first enabling message, the virtual gyroscope driver registers acceleration data with the acceleration sensor driver and registers magnetic data with the magnetic sensor driver; after registering acceleration data to the acceleration sensor driver by the virtual gyroscope driver, the virtual gyroscope driver receives first acceleration data, the data amount of which is acquired from the acceleration sensor by the acceleration sensor driver, and the first acceleration data is a first numerical value; after registering magnetic data with the magnetic sensor drive, the virtual gyroscope drive receives first magnetic data, the data amount of which is acquired by the magnetic sensor drive from the magnetic sensor, and the first magnetic data is a first numerical value; the virtual gyroscope driver generates first angular velocity data according to the first acceleration data and the first magnetic data; the virtual gyroscope driver sends the first angular velocity data to the first application through the sensor manager.
The first angular velocity data may refer to angle data including heading angle, pitch angle, and roll angle.
The type of the magnetic sensor is not particularly limited, and for example, the magnetic sensor may be a geomagnetic sensor, and the magnetic sensor drive may be referred to as a magnetic sensor drive based on the time.
In the embodiment of the present application, the implementation method for generating the first angular velocity data according to the first acceleration data and the first magnetic data by the virtual gyroscope drive is not particularly limited.
In some implementations, the virtual gyroscope drive generates first angular velocity data based on a pose estimation algorithm, processing the first acceleration data and the first magnetic data. There is no limitation on the posture estimation algorithm, which may be an existing posture estimation algorithm.
In other implementations, the virtual gyroscope driver generates first angular velocity data from the first acceleration data and the first magnetic data, including: the virtual gyroscope drive carries out correction processing on the first acceleration data to obtain corrected first acceleration data; the virtual gyroscope drive carries out correction processing on the first magnetic data to obtain corrected first magnetic data; the virtual gyroscope driver generates first angular velocity data by processing the corrected first acceleration data and the corrected first magnetic data based on a posture estimation algorithm.
Illustratively, the magnetic sensor in the data processing method provided in fig. 6 above is one specific example of the magnetic sensor described above, one frame of ACC data #1 in fig. 6 above is one specific example of the first acceleration data in the above-described implementation, one frame of MAG data #1 in fig. 6 above is one specific example of the first magnetic data in the above-described implementation, and one frame of angular velocity data #1 in fig. 6 above is one specific example of the first angular velocity data in the above-described implementation.
Optionally, the electronic device further includes a sensor module located at a hardware abstraction layer, and in the step of sending, by the virtual gyroscope driver, the first angular velocity data to the first application through the sensor manager, the method includes: the virtual gyroscope driver sends the first angular velocity data to the send sensor manager by invoking the sensor module.
In the embodiment of the present application, after the first application subscribes the angular velocity data to the virtual gyroscope and the electronic device sets the parameter value of the first parameter to the first value, the electronic device may further execute the following steps: and controlling the acceleration sensor to report the acceleration data with the acquired data quantity of the first value to the acceleration sensor for driving.
In the above implementation manner, after the first application in the electronic device drives the subscription angular velocity data to the virtual gyroscope in the electronic device, the electronic device first sets a parameter value of the first parameter of the acceleration sensor to a first numerical value. And then, the electronic equipment controls the acceleration sensor to report the acquired acceleration data with the data quantity of a first value to the acceleration sensor for driving, so that the timeliness of acceleration data transmission can be improved. And then, the acceleration sensor drives to transmit acceleration data reported by the acceleration sensor in real time to the virtual gyroscope, so that the timeliness of angular velocity data generated by the virtual gyroscope can be improved, and the user experience is improved.
In step S710, a first application in the electronic device drives the subscription angular velocity data to the virtual gyroscope. Optionally, after the electronic device performs the step S710, if the second application in the electronic device drives the subscription angular velocity data to the virtual gyroscope, since the parameter value of the current first parameter is already set to the first value, that is, in this scenario, the electronic device will not perform the related step of setting the parameter value of the first parameter to the first value.
For example, VR video in the data processing method provided in fig. 6 above is a first application in the above scenario, and the map in the data processing method provided in fig. 6 above is a second application in the above scenario, which is not described in detail herein, refer to the related description in fig. 6 above.
In step S720, in the case that the first application drives the virtual gyroscope to unsubscribe from the angular velocity data, the electronic device sets a parameter value of the first parameter to a second value, where the second value is greater than the first value.
The electronic device executes the step S720, that is, when the first application in the electronic device unsubscribes the virtual gyroscope in the electronic device from the angular velocity data, the electronic device sets the data amount of the acceleration data (i.e., the parameter value of the first parameter) sent by the acceleration sensor to the acceleration sensor driver each time, which is greater than the data amount of the acceleration data (i.e., the first value) acquired by the acceleration sensor each time, and in this scenario, the acceleration sensor will buffer the acceleration data whose acquired data amount is smaller than the second value first until the data amount of the acceleration data buffered by the acceleration sensor is the second value, the acceleration sensor will report the acceleration data whose data amount is the second value to the acceleration sensor driver, so that the energy consumption of the data transmission can be reduced.
In the embodiment of the present application, the implementation method for executing the step S720 on the electronic device is not specifically limited.
In some implementations, the electronic device performs step S720 described above, that is, in a case where the first application drives the virtual gyroscope to unsubscribe from the angular velocity data, setting the parameter value of the first parameter to the second value includes: in the case where the first application drives the virtual gyroscope to unsubscribe from the angular velocity data and determines that the parameter value of the first parameter is not the second value, the parameter value of the first parameter is set to the second value.
In other implementations, the electronic device performs step S720, where the first application sets the parameter value of the first parameter to the second value in a case where the first application drives the virtual gyroscope to unsubscribe from the angular velocity data, including: the electronic equipment acquires a first de-registration subscription message, wherein the first de-registration subscription message is used for representing that a first application drives a virtual gyroscope to cancel subscription angular velocity data; the electronic device sets a parameter value of the first parameter to a second value based on the first de-registration subscription message.
The first de-registration subscription message is used to represent the first application to de-subscribe angular velocity data to the virtual gyroscope drive, and the first de-registration subscription message may include an identification of the virtual gyroscope drive.
Illustratively, the deregistration message #1 in step S614 in the data processing method provided in fig. 6 above is a specific example of the first deregistration subscription message described above, and details not described in detail herein may be referred to the relevant description in step S614 above.
Optionally, the electronic device in the above implementation further includes a sensor manager located at the application framework layer; and the electronic device obtaining a first de-registration subscription message, comprising: the sensor manager receives a first de-registration subscription message sent by a first application; the electronic device sets a parameter value of the first parameter to a second value based on the first de-registration subscription message, including: the sensor manager sends a first non-enabling message to the virtual gyroscope driver based on the first de-registration subscription message; in response to receiving the first disable message, the virtual gyroscope driver sends a second disable message to the acceleration sensor driver; the acceleration sensor driver sets the parameter value of the first parameter to a second value according to the second disable message.
The second disable message may include an identification of the virtual gyroscope drive, an identification of the acceleration sensor, and a second control command indicating that the parameter value of the first parameter is set to a second value.
Illustratively, the deregistration message #1 in the data processing method provided in fig. 6 above is a specific example of the first deregistration subscription message, the disable message #0 in fig. 6 above is a specific example of the first disable message, and the disable message #1 in fig. 6 above is a specific example of the second disable message, which are not described in detail herein, but related descriptions in fig. 6 above are omitted.
In the embodiment of the present application, after the first application in the electronic device cancels subscribing to the angular velocity data from the virtual gyroscope in the electronic device, and the electronic device sets the parameter value of the first parameter to the second value, the electronic device may further execute the following steps: the electronic equipment controls the acceleration sensor to store the acquired acceleration data into a buffer of the acceleration sensor, wherein the buffer capacity threshold of the buffer is a second value.
The buffer capacity threshold of the buffer may be a maximum buffer capacity of the buffer, or the buffer capacity threshold of the buffer may be a predefined threshold that is smaller than the maximum buffer capacity of the buffer.
The type of buffer of the acceleration sensor is not particularly limited, and for example, the buffer may be, but not limited to, a FIFO buffer in the method provided in fig. 6 above.
In the implementation manner, after the first application cancels the driving of the subscription angular velocity data to the virtual gyroscope and sets the value of the first parameter to the second value, the acceleration sensor caches the acceleration data of which the acquired data volume is smaller than the second value, so that the energy consumption of data transmission can be reduced.
The FIFO buffer of the acceleration sensor in step S606 in the data processing method provided in fig. 6 above is a specific example of the buffer of the acceleration sensor in the above-described implementation, for example.
It should be noted that, in fig. 7, the method of setting the parameter value of the first parameter of the acceleration sensor is described by taking the angular velocity data of the first application subscription virtual gyroscope as an example. Alternatively, in other possible implementations, the data processing method shown in fig. 7 may be replaced by the following steps: under the condition that a first application in the electronic equipment subscribes acceleration data to the acceleration sensor, setting a parameter value of a first parameter of the acceleration sensor as a first numerical value, wherein the parameter value of the first parameter represents the data amount of the acceleration data which is sent to the acceleration sensor by the acceleration sensor every time, and the first numerical value is the data amount of the acceleration data which is acquired by the acceleration sensor every time; or setting the parameter value of the first parameter to a second value under the condition that the first application unsubscribes the acceleration sensor from the acceleration data, wherein the second value is larger than the first value. In this implementation manner, the method of how to set the parameter value of the first parameter is described by taking the acceleration data of the first application subscribed to the acceleration sensor as an example, and it can be understood that the principle of setting the first parameter in the two implementation methods is the same, that is, when the first application needs to subscribe to the data, the parameter value of the first parameter is set to be equal to the first value by the electronic device, and when the first application does not need to subscribe to the data, the parameter value of the first parameter is set to be equal to the second value by the electronic device.
It should be understood that the data processing method shown in fig. 7 is merely illustrative, and does not limit the data processing method provided by the present application. For example, after the electronic device a performs the above steps S601 to S617, other applications in the electronic device may subscribe the angular velocity data to the virtual gyroscope, and in this scenario, since the parameter value of the current first parameter is the second value, the electronic device a may perform steps similar to those described in the above steps S601 to S617 again based on the subscription of the other applications, which are different two applications. For example, after the electronic device a performs the above steps S601 to S617, the first application may subscribe the angular velocity data to the virtual gyroscope, and in this scenario, since the parameter value of the current first parameter is the second value, the electronic device a may perform steps similar to those described in the above steps S601 to S617 again based on the subscription of the first application.
In the embodiment of the application, when the first application of the electronic device subscribes angular velocity data to the virtual gyroscope drive of the electronic device, the electronic device sets the data volume of the acceleration data (namely, the parameter value of the first parameter) which is sent by the acceleration sensor to the acceleration sensor drive each time and is the same as the data volume of the acceleration data (namely, the first numerical value) which is acquired by the acceleration sensor each time, namely, the acceleration sensor can report the acceleration data with the acquired data volume of the first numerical value to the acceleration sensor drive in real time, so that the timeliness of acceleration data transmission can be improved. Then, under the condition that the acceleration sensor drives to transmit acceleration data reported from the acceleration sensor to the virtual gyroscope in real time, the virtual gyroscope can obtain angular velocity data based on the acceleration data, so that timeliness of the angular velocity data of the virtual gyroscope can be improved, and user experience is improved. In addition, when the first application unsubscribes angular velocity data from the virtual gyroscope, the electronic device sets the data amount (i.e. the parameter value of the first parameter) of the acceleration data sent by the acceleration sensor to the acceleration sensor drive each time, which is larger than the data amount (i.e. the first value) of the acceleration data collected by the acceleration sensor each time, namely the acceleration sensor caches the acceleration data with the collected data amount smaller than the second value, until the data amount of the acceleration data cached by the acceleration sensor is the second value, the acceleration sensor can report the acceleration data with the data amount of the second value to the acceleration sensor drive, so that the energy consumption of data transmission can be reduced. In summary, the data processing method provided by the application can improve the data processing performance (timeliness of data transmission or reduce the energy consumption of data transmission) so as to improve the user experience.
An embodiment of the device of the present application will be described in detail below with reference to fig. 7. It should be understood that the data processing apparatus in the embodiments of the present application may perform the various data processing methods in the foregoing embodiments of the present application, that is, specific working procedures of the following various products may refer to corresponding procedures in the foregoing method embodiments.
Fig. 8 is a schematic diagram of a data processing apparatus according to an embodiment of the present application. Illustratively, the data processing apparatus 800 shown in fig. 8 is applied to an electronic device including an acceleration sensor for reporting acceleration data reported by the acceleration sensor to a virtual gyroscope driver for generating angular velocity data based on the acceleration data reported by the acceleration sensor driver, and the acceleration sensor driver. As shown in fig. 8, the data processing apparatus 800 includes a processing unit 810.
The processing unit 810 is configured to: setting a parameter value of a first parameter of the acceleration sensor as a first numerical value under the condition that a first application in the electronic equipment drives the subscription angular velocity data to the virtual gyroscope, wherein the parameter value of the first parameter represents the data quantity of acceleration data which is sent to the acceleration sensor every time by the acceleration sensor, and the first numerical value is the data quantity of acceleration data which is acquired every time by the acceleration sensor; or setting the parameter value of the first parameter to a second value under the condition that the first application drives the virtual gyroscope to unsubscribe from the angular velocity data, wherein the second value is larger than the first value.
In one possible implementation, the processing unit 810 is further configured to, in a case where the first application drives the subscription angular velocity data to the virtual gyroscope and it is determined that the parameter value of the first parameter is not the first numerical value, perform the following operations: the parameter value of the first parameter is set to a first value.
In another possible implementation, the processing unit 810 is further configured to, after setting the parameter value of the first parameter of the acceleration sensor to the first value, perform the following operations: and controlling the acceleration sensor to report the acceleration data with the acquired data quantity of the first value to the acceleration sensor for driving.
In another possible implementation, the processing unit 810 is further configured to: acquiring a first registration subscription message, wherein the first registration subscription message is used for representing that a first application subscribes angular velocity data to a virtual gyroscope driver; the parameter value of the first parameter is set to a first value based on the first registration subscription message.
In another possible implementation, the processing unit 810 is further configured to: acquiring a first de-registration subscription message, wherein the first de-registration subscription message is used for indicating that the first application drives the virtual gyroscope to cancel subscription angular velocity data; and setting the parameter value of the first parameter to the second value based on the first de-registration subscription message.
In another possible implementation, the electronic device includes a first processor for running the first application, the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive; or the electronic device comprises a first processor for running the first application and a second processor for running an acceleration sensor drive, the magnetic sensor drive and the virtual gyroscope drive; or the electronic device includes a first processor for running the first application and the first processor is further for running at least one of the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive, and a second processor for running a drive other than the at least one of the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive.
In another possible implementation, the first processor is an application processor and the second processor is a system control processor, a sensor hub, an audio digital signal processor, or an enhancement digital signal processor.
In another possible implementation, the processing unit 810 is further configured to, after the setting the parameter value of the first parameter to the second value, perform the following operations: and controlling the acceleration sensor to store the acquired acceleration data into a buffer of the acceleration sensor, wherein the buffer capacity threshold of the buffer is the second value.
In another possible implementation, the first value is 1 and the second value is an integer of [2,10 ].
Alternatively, the data processing apparatus shown in fig. 8 described above is applied to an electronic device including an acceleration sensor and an acceleration sensor drive, and the processing unit 810 is configured to: applied to an electronic device comprising an acceleration sensor and an acceleration sensor drive, the method comprises: under the condition that a first application in the electronic equipment subscribes acceleration data to the acceleration sensor, setting a parameter value of a first parameter of the acceleration sensor as a first numerical value, wherein the parameter value of the first parameter represents the data amount of the acceleration data which is sent to the acceleration sensor by the acceleration sensor every time, and the first numerical value is the data amount of the acceleration data which is acquired by the acceleration sensor every time; or setting the parameter value of the first parameter to a second value under the condition that the first application unsubscribes the acceleration sensor from the acceleration data, wherein the second value is larger than the first value.
In one possible implementation, the processing unit 810 is further configured to, in a case where the first application subscribes to the acceleration data with the acceleration sensor and determines that the parameter value of the first parameter is not the first numerical value, perform the following operations: the parameter value of the first parameter is set to a first value.
In another possible implementation, the processing unit 810 is further configured to, after setting the parameter value of the first parameter of the acceleration sensor to the first value, perform the following operations: and controlling the acceleration sensor to report the acceleration data with the acquired data quantity of the first value to the acceleration sensor for driving.
In another possible implementation, the processing unit 810 is further configured to: acquiring a second registration subscription message, wherein the second registration subscription message is used for indicating that the first application subscribes acceleration data to the acceleration sensor; the parameter value of the first parameter is set to a first value based on the second registration subscription message.
In another possible implementation, the processing unit 810 is further configured to: acquiring a second de-registration subscription message, wherein the second de-registration subscription message is used for indicating that the first application unsubscribes from acceleration data to the acceleration sensor; and setting the parameter value of the first parameter to the second numerical value based on the second deregistration subscription message.
In another possible implementation, the first value is 1 and the second value is an integer of [2,10 ].
The data processing apparatus 800 is embodied as a functional unit. The term "unit" herein may be implemented in software and/or hardware, without specific limitation.
For example, a "unit" may be a software program, a hardware circuit or a combination of both that implements the functions described above. The hardware circuitry may include Application Specific Integrated Circuits (ASICs), electronic circuits, processors (e.g., shared, proprietary, or group processors, etc.) and memory for executing one or more software or firmware programs, merged logic circuits, and/or other suitable components that support the described functions.
Thus, the elements of the examples described in the embodiments of the present application can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The application also provides a computer program product which, when executed by an electronic device, implements the data processing method according to any of the method embodiments of the application.
The computer program product may be stored in a memory, for example, as a program that is ultimately converted into an executable object file that can be executed by an electronic device via preprocessing, compiling, assembling, and linking processes.
The application also provides a chip applied to the electronic equipment, and the chip comprises one or more processors, wherein the processors are used for calling computer instructions so as to enable the electronic equipment to realize the data processing method according to any one of the method embodiments.
The application also provides a computer readable storage medium having stored thereon a computer program which when executed by a computer implements the data processing method of any of the method embodiments of the application. The computer program may be a high-level language program or an executable object program.
In the present application, "at least one" means one or more, and "a plurality" means two or more. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, or c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
It should be understood that, in various embodiments of the present application, the sequence numbers of the foregoing processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic thereof, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative; for example, the division of the units is only one logic function division, and other division modes can be adopted in actual implementation; for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of 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.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (15)

1. A data processing method, applied to an electronic device including an acceleration sensor, an acceleration sensor driver, and a virtual gyroscope driver, the acceleration sensor driver configured to report acceleration data reported by the acceleration sensor to the virtual gyroscope driver, the virtual gyroscope driver configured to generate angular velocity data based on the acceleration data reported by the acceleration sensor driver, the method comprising:
Setting a parameter value of a first parameter of the acceleration sensor to be a first numerical value under the condition that a first application in the electronic equipment drives the subscription angular velocity data to the virtual gyroscope, wherein the parameter value of the first parameter represents the data amount of acceleration data which is sent to the acceleration sensor each time by the acceleration sensor, and the first numerical value is the data amount of acceleration data which is acquired by the acceleration sensor each time; or alternatively
And setting a parameter value of the first parameter to a second value under the condition that the first application drives the virtual gyroscope to unsubscribe angular velocity data, wherein the second value is larger than the first value.
2. The method of claim 1, wherein setting a parameter value of the first parameter of the acceleration sensor to a first value if a first application in the electronic device drives subscribed angular velocity data to the virtual gyroscope comprises:
Setting a parameter value of the first parameter to the first value if the first application drives subscribed angular velocity data to the virtual gyroscope and determines that the parameter value of the first parameter is not the first value.
3. The method according to claim 1 or 2, characterized in that after the setting of the parameter value of the first parameter of the acceleration sensor to the first value, the method further comprises:
And controlling the acceleration sensor to report the acquired acceleration data with the data quantity of the first value to the acceleration sensor drive.
4. The method according to claim 1 or 2, wherein setting a parameter value of the first parameter of the acceleration sensor to a first value in case a first application in the electronic device drives subscription angular velocity data to the virtual gyroscope, comprises:
Acquiring a first registration subscription message, wherein the first registration subscription message is used for representing that the first application subscribes angular velocity data to the virtual gyroscope driver;
and setting the parameter value of the first parameter to the first numerical value based on the first registration subscription message.
5. The method of claim 4, wherein the electronic device further comprises a sensor manager at an application framework layer; and
The acquiring the first registration subscription message includes:
the sensor manager receives the first registration subscription message sent by the first application;
the setting, based on the first registration subscription message, a parameter value of the first parameter to the first value includes:
The sensor manager sends a first enabling message to the virtual gyroscope driver based on the first registration subscription message;
In response to receiving the first enable message, the virtual gyroscope driver sends a second enable message to the acceleration sensor driver;
the acceleration sensor driver sets a parameter value of the first parameter to the first value according to the second enabling message.
6. The method of claim 5, wherein the electronic device further comprises a magnetic sensor and a magnetic sensor drive; and, the method further comprises:
In response to receiving the first enable message, the virtual gyroscope drive registers acceleration data with the acceleration sensor drive, and registers magnetic data with the magnetic sensor drive;
After registering acceleration data with the acceleration sensor drive, the virtual gyroscope drive receives first acceleration data, the data amount of which is acquired from the acceleration sensor by the acceleration sensor drive, and the first acceleration data is the first value;
after registering magnetic data with the magnetic sensor drive, the virtual gyroscope drive receives first magnetic data, the data amount of which is acquired by the magnetic sensor drive from the magnetic sensor, and the first magnetic data is the first numerical value;
The virtual gyroscope driver generates first angular velocity data according to the first acceleration data and the first magnetic data;
The virtual gyroscope driver sends the first angular velocity data to the first application through the sensor manager.
7. The method according to claim 1 or 2, wherein setting the parameter value of the first parameter to a second value in case the first application drives an unsubscribe angular velocity data towards the virtual gyroscope, comprises:
acquiring a first de-registration subscription message, wherein the first de-registration subscription message is used for indicating that the first application drives the virtual gyroscope to cancel subscription angular velocity data;
And setting the parameter value of the first parameter to the second value based on the first de-registration subscription message.
8. The method of claim 7, wherein the electronic device further comprises a sensor manager at an application framework layer; and
The obtaining the first deregistration subscription message includes:
The sensor manager receives the first de-registration subscription message sent by the first application;
The setting, based on the first de-registration subscription message, a parameter value of the first parameter to the second value includes:
The sensor manager sends a first disabling message to the virtual gyroscope driver based on the first de-registration subscription message;
In response to receiving the first disable message, the virtual gyroscope driver sends a second disable message to the acceleration sensor driver;
the acceleration sensor driver sets a parameter value of the first parameter to the second value according to the second disable message.
9. The method of claim 6, wherein the step of providing the first layer comprises,
The electronic device includes a first processor for running the first application, the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive; or alternatively
The electronic device includes a first processor for running the first application and a second processor for running an acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive; or alternatively
The electronic device includes a first processor for running the first application, and the first processor is further for running at least one of the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive, and a second processor for running a drive other than the at least one of the acceleration sensor drive, the magnetic sensor drive, and the virtual gyroscope drive.
10. The method of claim 9, wherein the step of determining the position of the substrate comprises,
The first processor is an application processor and the second processor is a system control processor, a sensor hub, an audio digital signal processor, or an enhancement digital signal processor.
11. The method according to claim 1 or 2, characterized in that after said setting the parameter value of the first parameter to a second value, the method further comprises:
And controlling the acceleration sensor to store the acquired acceleration data into a buffer of the acceleration sensor, wherein the buffer capacity threshold of the buffer is the second value.
12. A method according to claim 1 or 2, characterized in that,
The first value is 1 and the second value is an integer of [2,10 ].
13. An electronic device comprising one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories being for storing a computer program which, when executed by the one or more processors, causes the electronic device to perform the data processing method of any of claims 1 to 12.
14. A chip for application to an electronic device, the chip comprising one or more processors, wherein the processors are configured to invoke computer instructions to cause the electronic device to perform the data processing method of any of claims 1 to 12.
15. A computer readable storage medium comprising a computer program, characterized in that the computer program, when run on an electronic device, causes the electronic device to perform the data processing method of any of claims 1 to 12.
CN202410845764.4A 2024-06-27 2024-06-27 Data processing method, electronic device, storage medium and chip Pending CN118426873A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410845764.4A CN118426873A (en) 2024-06-27 2024-06-27 Data processing method, electronic device, storage medium and chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410845764.4A CN118426873A (en) 2024-06-27 2024-06-27 Data processing method, electronic device, storage medium and chip

Publications (1)

Publication Number Publication Date
CN118426873A true CN118426873A (en) 2024-08-02

Family

ID=92321495

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410845764.4A Pending CN118426873A (en) 2024-06-27 2024-06-27 Data processing method, electronic device, storage medium and chip

Country Status (1)

Country Link
CN (1) CN118426873A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004212162A (en) * 2002-12-27 2004-07-29 Tokimec Inc Gyroscope device
CN106017453A (en) * 2016-05-18 2016-10-12 上海理工大学 Android phone based remote acquisition method for position and motion parameters of moving objects
CN114741256A (en) * 2020-09-09 2022-07-12 华为终端有限公司 Sensor monitoring method and device and terminal equipment
CN117707470A (en) * 2023-06-01 2024-03-15 荣耀终端有限公司 Data processing method, readable storage medium, and electronic device
CN117714568A (en) * 2023-06-21 2024-03-15 荣耀终端有限公司 Screen display method, device and storage medium
CN117707322A (en) * 2023-07-04 2024-03-15 荣耀终端有限公司 Data processing method, electronic device and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004212162A (en) * 2002-12-27 2004-07-29 Tokimec Inc Gyroscope device
CN106017453A (en) * 2016-05-18 2016-10-12 上海理工大学 Android phone based remote acquisition method for position and motion parameters of moving objects
CN114741256A (en) * 2020-09-09 2022-07-12 华为终端有限公司 Sensor monitoring method and device and terminal equipment
CN117707470A (en) * 2023-06-01 2024-03-15 荣耀终端有限公司 Data processing method, readable storage medium, and electronic device
CN117714568A (en) * 2023-06-21 2024-03-15 荣耀终端有限公司 Screen display method, device and storage medium
CN117707322A (en) * 2023-07-04 2024-03-15 荣耀终端有限公司 Data processing method, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US11276183B2 (en) Relocalization method and apparatus in camera pose tracking process, device, and storage medium
EP4224831A1 (en) Image processing method and electronic device
CN114217699B (en) Method for detecting pen point direction of handwriting pen, electronic equipment and handwriting pen
CN110557626B (en) Image display method and electronic equipment
CN108694073B (en) Control method, device and equipment of virtual scene and storage medium
WO2022052620A1 (en) Image generation method and electronic device
EP4020996A1 (en) Interactive data playing method and electronic device
CN110288689B (en) Method and device for rendering electronic map
KR20180096170A (en) Electronic device and method for displaying 360 degree image
CN111897429A (en) Image display method, image display device, computer equipment and storage medium
CN112272311A (en) Method, device, terminal, server and medium for repairing splash screen
CN110920631A (en) Method and device for controlling vehicle, electronic equipment and readable storage medium
CN110673944B (en) Method and device for executing task
WO2023216957A1 (en) Target positioning method and system, and electronic device
CN113032590B (en) Special effect display method, device, computer equipment and computer readable storage medium
CN110971840B (en) Video mapping method and device, computer equipment and storage medium
CN118426873A (en) Data processing method, electronic device, storage medium and chip
CN112181915A (en) Method, device, terminal and storage medium for executing service
CN112597417B (en) Page updating method and device, electronic equipment and storage medium
CN118056353A (en) Motion blur compensation by eye tracking
CN114598992A (en) Information interaction method, device, equipment and computer readable storage medium
WO2021089006A1 (en) Digital space management method, apparatus, and device
CN110519319B (en) Method and device for splitting partitions
CN110851435B (en) Data storage method and device
CN112711636A (en) Data synchronization method, device, equipment and medium

Legal Events

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