CN110780929B - Method for calling hardware interface and electronic equipment - Google Patents

Method for calling hardware interface and electronic equipment Download PDF

Info

Publication number
CN110780929B
CN110780929B CN201910883684.7A CN201910883684A CN110780929B CN 110780929 B CN110780929 B CN 110780929B CN 201910883684 A CN201910883684 A CN 201910883684A CN 110780929 B CN110780929 B CN 110780929B
Authority
CN
China
Prior art keywords
hardware
interface
hardware interface
electronic device
indication information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910883684.7A
Other languages
Chinese (zh)
Other versions
CN110780929A (en
Inventor
丁超
蔺振超
陈晓轩
涂林林
王劲飞
宁维赛
陈中领
刘磊
姜钦华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010963635.7A priority Critical patent/CN112214294B/en
Priority to CN201910883684.7A priority patent/CN110780929B/en
Publication of CN110780929A publication Critical patent/CN110780929A/en
Priority to PCT/CN2020/102280 priority patent/WO2021051982A1/en
Application granted granted Critical
Publication of CN110780929B publication Critical patent/CN110780929B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Telephone Function (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application provides a method for calling a hardware interface and electronic equipment in the field of electronic equipment. The method for calling the hardware interface comprises the following steps: reading first indication information in a code of a first application, wherein the first indication information is used for indicating related information of a first hardware interface set, the first hardware interface set comprises hardware interfaces of a plurality of electronic devices, the types of any two hardware interfaces in the first hardware interface set are the same, or part or all of functions of any two hardware interfaces in the first hardware interface set are the same; determining at least one first hardware interface of the electronic device from the first hardware interface set according to the first indication information; at least one first hardware interface is invoked. The application provides a method for calling a hardware interface and electronic equipment, and aims to facilitate application developers to develop application programs.

Description

Method for calling hardware interface and electronic equipment
Technical Field
The present application relates to the field of electronic devices, and more particularly, to a method for calling a hardware interface and an electronic device.
Background
Common electronic devices in the market include mobile phones, tablet computers, watches, televisions, man-machine interaction devices on automobiles and the like, and manufacturers of different electronic devices can be different, so that hardware interfaces of different electronic devices can be different. The running of an application requires the invocation of a hardware interface on the electronic device. For example, running a video playback program requires invoking an interface of a display screen and an interface of a microphone on the electronic device. Because the hardware interfaces of different devices can be different, in order to run applications on multiple electronic devices and successfully call related hardware interfaces, an application development company needs to design at least two types of applications to realize that the applications are successfully run on two devices with different hardware interfaces. For example, an application development company needs to design two kinds of applications for a mobile phone and a wristwatch, respectively. The number of mainstream hardware interfaces in the market is large, and an application company needs to design a plurality of different applications for a plurality of hardware interfaces respectively, which can certainly increase the burden of application developers.
Disclosure of Invention
The application provides a method for calling a hardware interface and electronic equipment, and aims to facilitate application developers to develop application programs.
In a first aspect, a method for invoking a hardware interface is provided, comprising: reading first indication information in a code of a first application, wherein the first indication information is used for indicating related information of a first hardware interface set, the first hardware interface set comprises hardware interfaces of a plurality of electronic devices, the types of any two hardware interfaces in the first hardware interface set are the same, or part or all of functions of any two hardware interfaces in the first hardware interface set are the same; determining at least one first hardware interface of the electronic device from the first hardware interface set according to the first indication information; the at least one first hardware interface is invoked.
In the present application, the first application may be, for example, a call application, a video playback application, an audio playback application, a security application, a map navigation application, a file transfer application, a photographing application, or the like. The first application may also include music playing, video playing, reading applications, application markets, gallery, calendar, conversation, map, navigation, and the like. The application is not limited to the specific type of first application.
The first set of hardware interfaces includes hardware interfaces of a plurality of electronic devices, which may include, for example, at least two of a cell phone, a tablet, a smart watch, a video player, a Laptop (Laptop), a desktop computer, a television, a notebook computer.
The types of hardware interfaces may include: one or more of a mobile communication interface, a screen display interface, a speaker interface, a headset interface, a fingerprint identification interface, a positioning interface, a wireless communication interface, a camera interface, and the like.
The functions of the hardware interface may include: one or more of a voice call function, a function of displaying an image on a screen, a sound playing function, a fingerprint recognition function, a positioning function, a data transmission function, a function of capturing a scene around an electronic device, and the like.
In the embodiment of the application, the first application indicates the first hardware interface set through the first indication information, and the electronic device can confirm the real hardware interface parameters which the first application actually should call according to the parameters (such as version number, electronic device type and the like). Thus, the first application does not need to know in advance the real hardware interface that the electronic device executing the first application has. And, the first application may be executed on a plurality of electronic devices with the first set of hardware interfaces indicated. Therefore, the method provided by the embodiment of the application can reduce the burden of application developers.
With reference to the first aspect, in certain implementation manners of the first aspect, the first indication information includes information indicating a second hardware interface, and the electronic device does not have the second hardware interface, before the determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first set of hardware interfaces, the method further includes: and determining a hardware interface set to which the second hardware interface belongs as the first hardware interface set according to the first indication information.
In the embodiment of the present application, the first indication information may indicate the hardware interfaces of other electronic devices, so, according to the functions or types of the hardware interfaces of the other electronic devices, the electronic device executing the first application may determine the hardware interfaces with the same or similar functions or types, so that the first application that is originally specifically applied to a specific electronic device may be applied across devices to multiple electronic devices.
With reference to the first aspect, in certain implementation manners of the first aspect, the first indication information includes information indicating a first function of a hardware interface that the first application needs to call, and before determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first set of hardware interfaces, the method further includes: and determining a hardware interface set matched with the first function as the first hardware interface set according to the first indication information.
In the embodiment of the application, the first indication information can indicate the function of the hardware interface to be called; based on the functionality, the electronic device can determine a first set of hardware interfaces that match the functionality. The application developer who develops the first application also only needs to know the function of the hardware interface code, and does not need to develop an application program aiming at specific electronic equipment, so that the burden of the application developer can be reduced.
With reference to the first aspect, in certain implementation manners of the first aspect, the first indication information includes information indicating a first type of hardware interface that the first application needs to call, and before the determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first set of hardware interfaces, the method further includes: and determining the hardware interface set matched with the first type as the first hardware interface set according to the first indication information.
In the embodiment of the application, the first indication information can indicate the type of the hardware interface to be called; from this type, the electronic device can determine a first set of hardware interfaces that match the type. The application developer who develops the first application also only needs to know the type of the hardware interface code, and does not need to develop an application program aiming at specific electronic equipment, so that the burden of the application developer can be reduced.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes: reading second indication information in codes of a second application, wherein the second indication information is used for indicating related information of a second hardware interface set; and calling a preset target interface under the condition that the electronic equipment does not have any hardware interface in the second hardware interface set.
The preset target interface can be a virtual interface or a physical interface.
In the embodiment of the application, the electronic equipment can call the target interface, so that a call feedback result that the electronic equipment cannot call the hardware interface is not obtained, and the second application operation failure (such as second application operation breakdown or infinite cycle error) is not caused.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes: reading second indication information in codes of a second application, wherein the second indication information is used for indicating related information of a second hardware interface set; and presenting alarm information under the condition that the electronic equipment does not have any hardware interface in the second hardware interface set.
Optionally, presenting the alert information includes presenting alert information matching a type or function of the second set of hardware interfaces.
In the embodiment of the application, since the second indication information indicates the second hardware interface set, the electronic device can know the type or function of the hardware interface to be called by the first application, and the alarm information corresponds to the type or function of the hardware interface, so that more accurate hardware interface error reporting information can be provided for a user using the second application.
With reference to the first aspect, in certain implementation manners of the first aspect, the determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first hardware interface set includes: and determining the at least one first hardware interface from the first hardware interface set according to the type of the electronic equipment and the first indication information.
In the embodiment of the application, because the hardware interfaces of different electronic devices are different, when the types of the electronic devices are more, the efficiency of calling the hardware interfaces can be improved by determining the hardware interfaces according to the types of the electronic devices.
With reference to the first aspect, in certain implementation manners of the first aspect, the first indication information further includes information indicating a version number of an interface that the first application needs to call.
In the embodiment of the application, as the version numbers of different hardware interfaces may be different, when the version numbers of the hardware interfaces are more, the hardware interfaces are determined according to the version numbers of the hardware interfaces, so that the efficiency of calling the hardware interfaces can be improved.
In a second aspect, a method for invoking a hardware interface is provided, comprising: reading third indication information in a code of a third application, wherein the third indication information is used for indicating the function or type of a hardware interface which needs to be called by the third application; determining at least one third hardware interface of the electronic equipment from a plurality of hardware interfaces according to the type of the electronic equipment and the third indication information, wherein the plurality of hardware interfaces comprise the hardware interfaces of the electronic equipment; invoking the at least one third hardware interface.
In the present application, the third application may be, for example, a call application, a video playback application, an audio playback application, a security application, a map navigation application, a file transfer application, a photographing application, or the like. The third application may also include music playing, video playing, reading applications, application markets, gallery, calendar, conversation, map, navigation, and the like. The application is not limited to the specific type of third application.
The third set of hardware interfaces includes hardware interfaces of a plurality of electronic devices, which may include, for example, at least two of a cell phone, a tablet, a smart watch, a video player, a Laptop (Laptop), a desktop computer, a television, a notebook computer.
The types of hardware interfaces may include: one or more of a mobile communication interface, a screen display interface, a speaker interface, a headset interface, a fingerprint identification interface, a positioning interface, a wireless communication interface, a camera interface, and the like.
The functions of the hardware interface may include: one or more of a voice call function, a function of displaying an image on a screen, a sound playing function, a fingerprint recognition function, a positioning function, a data transmission function, a function of capturing a scene around an electronic device, and the like.
In the embodiment of the application, the third application indicates the type or the function of the hardware interface to be called through the third indication information, and the electronic equipment can confirm the real hardware interface parameters which the third application actually should call according to the parameters (such as version number, electronic equipment type and the like). Thus, the third application does not need to know in advance the real hardware interface that the electronic device executing the third application has. And, the third application may be executed on a plurality of electronic devices in case the third application indicates a type or function of a hardware interface that needs to be invoked. Therefore, the method provided by the embodiment of the application can reduce the burden of application developers.
With reference to the second aspect, in certain implementations of the second aspect, the method further includes: reading fourth indication information in a code of a fourth application, wherein the fourth indication information is used for indicating related information of a fourth hardware interface set; and calling a preset target interface under the condition that the electronic equipment does not have any hardware interface in the fourth hardware interface set.
The preset target interface can be a virtual interface or a physical interface.
In the embodiment of the application, the electronic equipment can call the target interface, so that a call feedback result that the electronic equipment cannot call the hardware interface is not obtained, and the fourth application operation failure (such as fourth application operation breakdown or infinite cycle error) is not caused.
With reference to the second aspect, in certain implementations of the second aspect, the method further includes: reading fourth indication information in a code of a fourth application, wherein the fourth indication information is used for indicating related information of a fourth hardware interface set; in the event that the electronic device does not have any of the fourth set of hardware interfaces, alert information is presented.
Optionally, presenting the alert information includes presenting alert information matching a type or function of the second set of hardware interfaces.
In the embodiment of the application, because the fourth indication information indicates the fourth hardware interface set, the electronic device can know the type or function of the hardware interface to be called by the fourth application, and the alarm information corresponds to the type or function of the hardware interface, so that more accurate hardware interface error reporting information can be provided for a user using the fourth application.
With reference to the second aspect, in certain implementations of the second aspect, the method further includes: the third indication information further includes information indicating a version number of an interface that the third application needs to call.
In the embodiment of the application, as the version numbers of different hardware interfaces may be different, when the version numbers of the hardware interfaces are more, the hardware interfaces are determined according to the version numbers of the hardware interfaces, so that the efficiency of calling the hardware interfaces can be improved.
In a third aspect, there is provided an electronic device comprising: a memory for storing a program; a processor for executing the program stored in the memory, the processor for performing the following processes when the program stored in the memory is executed: reading first indication information in a code of a first application, wherein the first indication information is used for indicating related information of a first hardware interface set, the first hardware interface set comprises hardware interfaces of a plurality of electronic devices, the types of any two hardware interfaces in the first hardware interface set are the same, or part or all of functions of any two hardware interfaces in the first hardware interface set are the same; determining at least one first hardware interface of the electronic device from the first hardware interface set according to the first indication information; the at least one first hardware interface is invoked.
With reference to the third aspect, in some implementations of the third aspect, the first indication information includes information indicating a second hardware interface, and the electronic device does not have the second hardware interface, and before determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first set of hardware interfaces, the processor is further configured to determine, according to the first indication information, a set of hardware interfaces to which the second hardware interface belongs as the first set of hardware interfaces.
With reference to the third aspect, in some implementations of the third aspect, the first indication information includes information indicating a first function of a hardware interface that the first application needs to call, and the processor is further configured, before determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first set of hardware interfaces, to apply, according to the first indication information, to determine, as the first set of hardware interfaces, a set of hardware interfaces that matches the first function.
With reference to the third aspect, in some implementations of the third aspect, the first indication information includes information indicating a first type of hardware interface that the first application needs to call, and the processor is further configured, before determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first set of hardware interfaces, to apply to determining, according to the first indication information, a set of hardware interfaces that matches the first type as the first set of hardware interfaces.
With reference to the third aspect, in some implementations of the third aspect, the processor is further configured to read second indication information in code of a second application, where the second indication information is used to indicate related information of a second set of hardware interfaces; the processor is further configured to apply to invoking a preset target interface if the electronic device does not have any hardware interface in the second set of hardware interfaces.
With reference to the third aspect, in some implementations of the third aspect, the processor is further configured to read second indication information in code of a second application, where the second indication information is used to indicate related information of a second set of hardware interfaces; the processor is further configured to apply to presenting alert information if the electronic device does not have any of the second set of hardware interfaces.
With reference to the third aspect, in some implementations of the third aspect, the processor is specifically configured to determine the at least one first hardware interface from the first set of hardware interfaces according to a type of the electronic device and the first indication information.
With reference to the third aspect, in some implementations of the third aspect, the first indication information further includes information indicating a version number of an interface that the first application needs to call.
In a fourth aspect, there is provided an electronic device comprising: a memory for storing a program; a processor for executing the program stored in the memory, the processor for performing the following processes when the program stored in the memory is executed: reading third indication information in a code of a third application, wherein the third indication information is used for indicating the function or type of a hardware interface which needs to be called by the third application; determining at least one third hardware interface of the electronic equipment from a plurality of hardware interfaces according to the type of the electronic equipment and the third indication information, wherein the plurality of hardware interfaces comprise the hardware interfaces of the electronic equipment; invoking the at least one third hardware interface.
With reference to the fourth aspect, in some implementations of the fourth aspect, the processor is further configured to read fourth indication information in code of a fourth application, where the fourth indication information is used to indicate related information of a fourth set of hardware interfaces; the processor is further configured to apply to invoking a preset target interface if the electronic device does not have any hardware interface in the fourth set of hardware interfaces.
With reference to the fourth aspect, in some implementations of the fourth aspect, the third indication information further includes information indicating a version number of an interface that the third application needs to call.
In a fifth aspect, a computer readable medium is provided, the computer readable medium storing program code for execution by a device, the program code comprising instructions for performing the method in any one of the implementations of the first to second aspects.
In a sixth aspect, there is provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method of any one of the implementations of the first to second aspects described above.
In a seventh aspect, a chip is provided, the chip including a processor and a data interface, the processor reading instructions stored on a memory through the data interface, and performing the method in any implementation manner of the first aspect to the second aspect.
Optionally, as an implementation manner, the chip may further include a memory, where the memory stores instructions, and the processor is configured to execute the instructions stored on the memory, where the instructions, when executed, are configured to perform the method in any implementation manner of the first aspect to the second aspect.
Drawings
Fig. 1 is a schematic hardware structure of an electronic device according to an embodiment of the present application.
Fig. 2 is a schematic software structure of an electronic device according to an embodiment of the present application.
Fig. 3 is a schematic flow chart of a method for calling a hardware interface according to an embodiment of the present application.
Fig. 4 is a schematic flow chart of a method for calling a hardware interface according to an embodiment of the present application.
Fig. 5 is a schematic block diagram of a hardware interface set provided by an embodiment of the present application.
FIG. 6 is a schematic block diagram of a hardware interface set provided by an embodiment of the present application.
Fig. 7 is a schematic flow chart of a method for calling a hardware interface according to an embodiment of the present application.
Fig. 8 is a schematic flow chart of a method for calling a hardware interface according to an embodiment of the present application.
Fig. 9 is a schematic block diagram of a hardware interface set provided by an embodiment of the present application.
Fig. 10 is a schematic software structure of an electronic device according to an embodiment of the present application.
Fig. 11 is a schematic software structure diagram of a hardware interface layer according to an embodiment of the present application.
Fig. 12 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
Detailed Description
The technical scheme of the application will be described below with reference to the accompanying drawings.
The terminology used in the following examples is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include, for example, "one or more" such forms of expression, unless the context clearly indicates to the contrary. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" means one, two or more than two. The term "and/or" is used to describe an association relationship of associated objects, meaning that there may be three relationships; for example, a and/or B may represent: a alone, a and B together, and B alone, wherein A, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
Embodiments of the electronic device, user interfaces for such electronic devices, and methods for using such electronic devices provided by embodiments of the present application are described below. In some embodiments, the electronic device may be a portable electronic device that also includes other functionality such as personal digital assistant and/or music player functionality, such as a cell phone, tablet computer, wearable electronic device with wireless communication functionality (e.g., a smart watch), video player, and the like. Exemplary embodiments of portable electronic devices include, but are not limited to, piggy-backOr other operating system. The portable electronic device may also be other portable electronic devices such as a Laptop computer (Laptop) or the like. It should also be appreciated that in other embodiments, the electronic device described above may be a desktop computer, a television, a notebook computer, rather than a portable electronic device.
By way of example, fig. 1 shows a schematic diagram of an electronic device 100. 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 charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, etc.
It should be understood that the illustrated structure of the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), 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, and/or a neural-Network Processor (NPU), etc. Wherein the different processing units may be separate components or may be integrated in one or more processors. In some embodiments, the electronic device 100 may also include one or more processors 110. 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. In other embodiments, memory may also be provided in the processor 110 for storing instructions and data. Illustratively, the memory in the processor 110 may be 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. This avoids repeated accesses and reduces the latency of the processor 110, thereby improving the efficiency of the electronic device 100 in processing data or executing instructions.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include inter-integrated circuit (inter-INTEGRATED CIRCUIT, I2C) interfaces, inter-integrated circuit audio (inter-INTEGRATED CIRCUIT SOUND, I2S) interfaces, pulse code modulation (pulse code modulation, PCM) interfaces, universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interfaces, mobile industry processor interfaces (mobile industry processor interface, MIPI), general-purpose input/output (GPIO) interfaces, SIM card interfaces, and/or USB interfaces, among others. The USB interface 130 is an interface conforming to the USB standard, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transfer data between the electronic device 100 and a peripheral device. The USB interface 130 may also be used to connect headphones through which audio is played.
It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present application is only illustrative, and is not meant to limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also employ different interfacing manners in the above embodiments, or a combination of multiple interfacing manners.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used for connecting the battery 142, and the charge management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charge management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution for wireless communication including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, perform processes such as filtering, amplifying, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna 1 to radiate. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be provided in the same device as at least some of the modules of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (WIRELESS FIDELITY, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation SATELLITE SYSTEM, GNSS), frequency modulation (frequency modulation, FM), near field communication (NEAR FIELD communication, NFC), infrared (IR), etc., applied to the electronic device 100. The wireless communication module 160 may be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2.
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 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 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a Liquid Crystal Display (LCD) CRYSTAL DISPLAY, an organic light-emitting diode (OLED), an active-matrix organic LIGHT EMITTING diode (AMOLED), a flexible light-emitting diode (FLED), miniled, microLed, micro-oLed, a quantum dot LIGHT EMITTING diode (QLED), or the like. In some embodiments, the electronic device 100 may include 1 or more display screens 194.
The display 194 of the electronic device 100 may be a flexible screen that is currently of great interest due to its unique characteristics and great potential. Compared with the traditional screen, the flexible screen has the characteristics of strong flexibility and bending property, can provide a new interaction mode based on the bending property for a user, and can meet more requirements of the user on electronic equipment. For electronic devices equipped with foldable display screens, the foldable display screen on the electronic device can be switched between a small screen in a folded configuration and a large screen in an unfolded configuration at any time. Accordingly, users use split screen functions on electronic devices configured with foldable display screens, as well as more and more frequently.
The electronic device 100 may implement photographing functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. ISP can also optimize the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in the camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, electronic device 100 may include 1 or more cameras 193.
The digital signal processor is used for processing digital signals, and can process other digital signals besides digital image signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the electronic device 100 may be implemented through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
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 one or more computer programs, including instructions. The processor 110 may cause the electronic device 100 to perform the method of off-screen display provided in some embodiments of the present application, as well as various applications, data processing, and the like, by executing the above-described instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. The storage program area can store an operating system; the storage program area may also store one or more applications (such as gallery, contacts, etc.), etc. The storage data area may store data created during use of the electronic device 100 (e.g., photos, contacts, etc.), and so on. In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage units, flash memory units, universal flash memory (universal flash storage, UFS), and the like. In some embodiments, processor 110 may cause electronic device 100 to perform the off-screen display methods provided in embodiments of the present application, as well as other applications and data processing, by executing instructions stored in internal memory 121, and/or instructions stored in a memory provided in processor 110. The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playing, recording, etc.
The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
The pressure sensor 180A is used for sensing a pressure signal, and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A is of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a capacitive pressure sensor comprising at least two parallel plates with conductive material. The capacitance between the electrodes changes when a force is applied to the pressure sensor 180A. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 may also calculate the location of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example: and executing an instruction for checking the short message when the touch operation with the touch operation intensity smaller than the first pressure threshold acts on the short message application icon. And executing an instruction for newly creating the short message when the touch operation with the touch operation intensity being greater than or equal to the first pressure threshold acts on the short message application icon.
The gyro sensor 180B may be used to determine a motion gesture of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., the X, Y, and Z axes) may be determined by gyro sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. For example, when the shutter is pressed, the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance to be compensated by the lens module according to the angle, and makes the lens counteract the shake of the electronic device 100 through the reverse motion, so as to realize anti-shake. The gyro sensor 180B may also be used for navigating, somatosensory game scenes.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
The ambient light sensor 180L is used to sense ambient light level. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. Ambient light sensor 180L may also cooperate with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent false touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 may utilize the collected fingerprint feature to unlock the fingerprint, access the application lock, photograph the fingerprint, answer the incoming call, etc.
The temperature sensor 180J is for detecting temperature. In some embodiments, the electronic device 100 performs a temperature processing strategy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs a reduction in the performance of a processor located in the vicinity of temperature sensor 180J in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery 142 to avoid the low temperature causing the electronic device 100 to be abnormally shut down. In other embodiments, when the temperature is below a further threshold, the electronic device 100 performs boosting of the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperatures.
The touch sensor 180K, also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display 194.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
Fig. 2 is a software configuration block diagram of the electronic device 100 according to the embodiment of the present application. 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 system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun rows (Android runtime), and a system library. As shown in fig. 2, each layer in the software architecture may call a hardware layer, which may include a plurality of hardware in fig. 1.
The application layer may include a series of application packages. As shown in fig. 2, the application package may include applications for music playing, video playing, reading applications, application markets, gallery, calendar, conversation, map, navigation, etc.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for applications of the application layer. The application framework layer includes some predefined functions. As shown in fig. 2, the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like. The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like. The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc. The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture. The telephony manager is used to provide the communication functions of the electronic device 100. Such as the management of call status (including on, hung-up, etc.). The resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files, and so forth. The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc.
Android run time includes a core library and virtual machines. Android runtime is responsible for scheduling and management of the android system. The core library consists of two parts: one part is a function which needs to be called by java language, and the other part is a core library of android. The application layer and the application framework layer run in virtual machines. The virtual machine executes java files of the application layer and the application framework layer 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 system library may include a plurality of functional modules. For example: surface manager (surface manager), media library (media library), three-dimensional graphics processing library (e.g., openGL ES), 2D graphics engine (e.g., SGL), etc. The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications. Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio video encoding formats, such as: MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc. The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like. The 2D graphics engine is a drawing engine for 2D drawing.
The hardware layer may include a plurality of hardware, such as the display screen 194, the camera 193, the audio module 170, the sensor module in fig. 1, wherein the sensor module may include, for example, the gyro sensor 180B, the fingerprint sensor 180H, etc. in fig. 1. The application layer, application framework layer, an Zhuoyun rows (Android runtime), and system libraries may each call hardware in the hardware layer by calling a hardware interface. For example, the application layer invokes the display 194 by invoking the display interface.
A hardware interface layer may also be included between the system layer and the hardware layer, the hardware interface layer including a plurality of interfaces for driving the hardware. Such as an interface to drive a display screen, an interface to drive a camera, an interface to drive an audio module, an interface to drive a gyroscopic sensor, an interface to drive a fingerprint sensor, etc.
When a processor or chip inside the electronic device reads the code of an application in the application layer, the hardware in the hardware layer can be driven by calling the hardware interface, and corresponding operations are performed.
In one example, an antenna for mobile communication may be driven by invoking a mobile communication interface, and uplink and downlink communication data may be transmitted through the antenna for mobile communication. For example, when the processor or the chip runs the call application, the code in the call application can be read, so that the mobile communication interface can be called, and the voice call function is realized by driving the antenna for mobile communication.
In one example, the display screen may be driven by invoking a screen display interface and an image may be displayed on the display screen. For example, when the processor or chip runs the video playing application, the code in the video playing application may be read, so that the screen display interface may be invoked and the video played on the display screen.
In one example, a speaker may be driven by invoking a speaker interface and sound may be played through the speaker; or may drive a (externally connected) headset by invoking a headset interface and may play sound through the headset. For example, when running an audio playback application, the processor or chip may read the code in the audio playback application, so that the speaker interface may be invoked and the audio file played through the speaker, or the headphone interface may be invoked and the audio file played through the (externally connected) headphones.
In one example, the fingerprint recognition module may be driven by invoking the fingerprint recognition interface and the fingerprint may be recognized by the fingerprint recognition module. For example, when the processor or the chip runs the security application, the code in the security application can be read, so that the fingerprint identification interface can be called, and when the fingerprint fed back by the fingerprint identification module is matched with the preset fingerprint information, the operation of the current electronic device is considered to be safe.
In one example, a global positioning system (global positioning system, GPS) antenna may be driven by invoking a position location interface and the current location of the electronic device may be determined by the GPS antenna. For example, when the processor or the chip runs the map navigation application, the code in the map navigation application can be read, so that the positioning interface can be called, and the driving path is planned through the positioning information fed back by the GPS antenna.
In one example, a bluetooth antenna may be driven by invoking a wireless communication interface and may receive data from or transmit data to other electronic devices via the bluetooth antenna. For example, when running a file transfer application, the processor or chip may read the code in the file transfer application, so that the wireless communication interface may be invoked and send files to or receive files sent by a nearby electronic device via the bluetooth antenna.
In one example, the camera may be driven by invoking a capture interface and an image or video may be captured by the camera. For example, when the processor or chip runs the photographing application, the code in the photographing application may be read, so that the front-end photographing interface may be called, and the image may be photographed by the front-end camera.
Fig. 3 is a schematic diagram of the architecture of development software for two different types of devices. The types of devices in fig. 3 may include, for example, cell phones, tablet computers, wearable electronic devices with wireless communication capabilities (e.g., smart watches), video player desktop computers, televisions, notebook computers, and the like. For example, the first device in fig. 3 may be a mobile phone, and the second device may be a television.
The hardware interface one of the device one may call the hardware one. The second hardware interface of the second device may call the second hardware. However, for various reasons (for example, the hardware of different devices is usually from different hardware manufacturers, or the design schemes of different electronic devices for the hardware interfaces are different), the hardware interface one is different from the hardware interface two, so that the same program cannot be used to implement the call of the hardware interface one and the call of the hardware interface two. For example, both the display screen of the mobile phone and the screen of the television can be used for playing videos and displaying pictures, however, the display screen of the mobile phone and the screen of the television can be produced by different screen manufacturers, so that the interface of the display screen of the mobile phone is different from the interface of the screen of the television, that is, the same program cannot be used for realizing the calling of the interface of the display screen of the mobile phone and the calling of the interface of the screen of the television.
The system software is typically a program that is installed and loaded on the electronic device by the device manufacturer before the electronic device leaves the factory. Since the hardware interface one of the device one is different from the hardware interface two of the device two, the system software of the device one is different from the system software of the device two.
To facilitate the application developer, device manufacturers typically open a software development kit (software development kit, SDK) to the application developer to facilitate the application developer to develop application software for the device type. The SDK contains code to quickly invoke the hardware interface. Since the hardware interface one of the device one is different from the hardware interface two of the device two, the SDK of the device one is different from the SDK of the device two.
Suppose an application developer wishes to develop a suite of applications, such as video playback software, map navigation software, telephony software, system applications, etc. In order to be able to implement the functionality of the set of applications on both device one and device two (as in fig. 3), two different applications of the same type need to be developed for device one and device two, respectively. For example, video playback software 1 for a mobile phone, and video playback software 2 for a television. Wherein, the two different applications of the same type may refer to the two applications may include an application one for a device one and an application two for a device two, the application one being the same as the application two or having the same main function; however, when the same function or the same main function is implemented, the application one is different from the code, the called interface and/or the function used by the application two, so that the application one cannot be applied to the device two generally, and the application two cannot be applied to the device one generally, and the application one and the application two are two different applications.
Application developers often want applications that most users can use the applications that they develop, so they must compromise the mainstream devices on the market to design application packages for multiple types of devices separately. The application provides a method and aims to improve the convenience of application development.
Fig. 4 is a schematic flowchart of a method for calling a hardware interface according to an embodiment of the present application.
And 401, reading first indication information in a code of a first application, wherein the first indication information is used for indicating related information of a first hardware interface set, the first hardware interface set comprises hardware interfaces of a plurality of electronic devices, and any two hardware interfaces in the first hardware interface set are identical in type or part or all of the functions of any two hardware interfaces in the first hardware interface set are identical.
In the present application, the first application may be, for example, a call application, a video playback application, an audio playback application, a security application, a map navigation application, a file transfer application, a photographing application, or the like. The first application may also include music playing, video playing, reading applications, application markets, gallery, calendar, conversation, map, navigation, and the like. The application is not limited to the specific type of first application.
The first set of hardware interfaces includes hardware interfaces of a plurality of electronic devices, which may include, for example, at least two of a cell phone, a tablet, a smart watch, a video player, a Laptop (Laptop), a desktop computer, a television, a notebook computer.
It will be appreciated that the first application may drive the hardware by code when it invokes the hardware interface, and thus the first set of hardware interfaces may be stored in the processor or memory in the form of code. The hardware interface may implement the hardware call through code, and thus, the hardware interface may be defined using the code. For example, in an android system, a hardware interface may be defined using a hardware interface definition language (HARDWARE INTERFACE definition language, HIDL). For another example, code in java format may be called using the HIDL language to implement the call of the hardware interface.
The electronic device may include a software module or an induration module for identifying the type of device. For example, the electronic device may call the hardware of the electronic device with a version number, model number, etc. of the electronic device.
In general, the hardware interfaces of different types of electronic devices are usually different, for example, the hardware interfaces of a mobile phone are different from the hardware interfaces of a watch, the hardware interfaces of a watch are different from the hardware interfaces of a television, and the hardware interfaces of the mobile phone are different from the hardware interfaces of the television.
The hardware interfaces that different electronic devices of the same type have may be the same or different. For example, the hardware interfaces of two handsets with the same version number may be the same, and the hardware interfaces of two handsets with the same version number may be different.
The electronic device may identify the type of chip, thereby invoking hardware comprising the chip, or determining a hardware interface of hardware comprising the chip. As another example, the electronic device may identify a version number or model of the hardware to determine whether to call the hardware or determine a hardware interface of the hardware.
In one example, any two hardware interfaces in the first set of hardware interfaces are the same type. For example, all hardware interfaces in the first set of hardware interfaces are mobile communication interfaces. For another example, all hardware interfaces in the first set of hardware interfaces are screen display interfaces. As another example, all hardware interfaces in the first set of hardware interfaces are speaker interfaces. As another example, all hardware interfaces in the first set of hardware interfaces are earphone interfaces. As another example, all hardware interfaces in the first set of hardware interfaces are fingerprint identification interfaces. As another example, all hardware interfaces in the first set of hardware interfaces are positioning interfaces. As another example, all hardware interfaces in the first set of hardware interfaces are wireless communication interfaces. As another example, all hardware interfaces in the first set of hardware interfaces are capture interfaces.
In the case that the types of any two hardware interfaces in the first hardware interface set are the same, the type of the first hardware interface set is the same as the type of any one hardware interface in the first hardware interface set. For example, all hardware interfaces in the first set of hardware interfaces are mobile communication interfaces, and the type of the first set of hardware interfaces may be mobile communication interfaces.
Portions of any two hardware interfaces in the first set of hardware interfaces are functionally identical. For example, all hardware interfaces in the first set of hardware interfaces may be used for voice calls, while a first portion of the hardware interfaces in the first set of hardware interfaces may operate in a global system for mobile communications (global system for mobile communications, GSM) system, and a second portion of the hardware interfaces in the first set of hardware interfaces may operate in either a global system for mobile communications (global system for mobile communications, GSM) system or a code division multiple access (code division multiple access, CDMA) system, due to the different mobile communications standards. As another example, all of the first set of hardware interfaces may be used for bluetooth file transfer, while a first portion of the first set of hardware interfaces may be used to drive bluetooth 2.0 and a second portion of the first set of hardware interfaces may be used to drive bluetooth 4.0 due to different wireless communication standards. As another example, all of the hardware interfaces in the first set of hardware interfaces may be used to play audio, while the interface used to play audio includes a speaker interface for driving a speaker and a headphone interface for driving headphones, so that a first portion of the hardware interfaces in the first set of hardware interfaces may be used to drive speakers and a second portion of the hardware interfaces may be used to drive headphones. As another example, all of the hardware interfaces in the first set of hardware interfaces may be used for video input, while the high-definition multimedia interface (high definition multimedia interface, HDMI) may be used for audio input and video input, while the video graphics array (video GRAPHICS ARRAY, VGA) interface is used for video input only, so the first portion of the hardware interfaces in the first set of hardware interfaces may be interfaces used for video input only, and the second portion of the hardware interfaces may be interfaces used for both audio and video input. For another example, all hardware interfaces in the first set of hardware interfaces may be used to capture images or video, while the cameras are further divided into front cameras and rear cameras, so that a first portion of the hardware interfaces in the first set of hardware interfaces may be used to drive the front cameras and a second portion of the hardware interfaces may be used to drive the rear cameras.
In the case that the partial functions of any two hardware interfaces in the first hardware interface set are the same, the functions of the first hardware interface set include the functions of any one hardware interface in the first hardware interface set. For example, all hardware interfaces in the first set of hardware interfaces may be used for voice calls, and the functionality of the first set of hardware interfaces includes voice calls.
All the functions of any two hardware interfaces in the first set of hardware interfaces are identical. For example, all of the first set of hardware interfaces may be used for voice calls and may operate in either a Global System for Mobile communications (global system for mobile communications, GSM) or code division multiple Access (code division multiple access, CDMA) system, and all of the functions performed by any of the first set of hardware interfaces may be performed by other ones of the first set of hardware interfaces. As another example, all hardware interfaces in the first set of hardware interfaces may be used to drive bluetooth 4.0. As another example, all hardware interfaces in the first set of hardware interfaces may be used to play audio and all used to drive headphones. As another example, all hardware interfaces in the first set of hardware interfaces may be used for video input and all may be used for audio input. As another example, all hardware interfaces in the first set of hardware interfaces may be used to capture images or video and all used to drive the front-facing camera.
In the case where all functions of any two hardware interfaces in the first hardware interface set are the same, the functions of the first hardware interface set are the same as those of any one hardware interface in the first hardware interface set. For example, all hardware interfaces in the first set of hardware interfaces may be used for voice calls, the first set of hardware interfaces functioning as voice calls.
Generally, the types of any two hardware interfaces are the same, and the functions that any two hardware interfaces can perform are generally the same or similar.
The first set of hardware interfaces may include a plurality of hardware interfaces of a class of electronic devices. For example, the electronic device comprises a front camera and a rear camera, and the first set of hardware interfaces may comprise a hardware interface 1 for driving the front camera and a hardware interface 2 for driving the rear camera. As another example, the electronic device includes a plurality of multimedia transmission interfaces for supporting different multimedia transmission standards (e.g., HDMI, VGA), respectively.
FIG. 5 is a schematic diagram of hardware interfaces in the first set of hardware interfaces. The first set of hardware interfaces comprises hardware interface 1, hardware interface 2, hardware interface 3, hardware interface 4. The hardware interfaces 1 and 2 are hardware interfaces of the electronic device 501. The hardware interface 3 is a hardware interface provided in the electronic device 502. The hardware interfaces 3 and 4 are hardware interfaces of the electronic device 503.
It can be seen that the hardware interfaces of different electronic devices may be identical. For example, the mobile phone 1 with version number 1 uses the hardware 1, the mobile phone 2 with version number 2 uses the hardware 2, the hardware 1 and the hardware 2 are from the same hardware manufacturer, and the hardware 1 and the hardware 2 are the same model of hardware, so the mobile phone 1 and the mobile phone 2 can have the same hardware interface.
According to the above description, the first set of hardware interfaces may include a plurality of hardware interfaces of the same type, and include hardware interfaces of a plurality of electronic devices. Taking fig. 5as an example, the hardware interface 1, the hardware interface 2, the hardware interface 3, and the hardware interface 4 may be shooting interfaces, the electronic device 501 may be a mobile phone, the electronic device 502 may be a watch, and the electronic device 503 may be a tablet computer. The hardware interface 1 of the electronic device 501 may be a photographing interface for calling a front camera, and the hardware interface 2 of the electronic device 501 may be a photographing interface for calling a rear camera. The hardware interface 3 of the electronic device 503 may be a photographing interface for calling a front camera, and the hardware interface 4 of the electronic device 503 may be a photographing interface for calling a rear camera. The hardware interface 3 of the electronic device 502 is the same as the hardware interface 3 of the electronic device 503. Similarly, according to the description above, the first set of hardware interfaces may include a plurality of hardware interfaces that are partially or fully functionally identical, and include hardware interfaces of a plurality of electronic devices.
Optionally, the first indication information includes information indicating a second hardware interface, and the electronic device does not have the second hardware interface, and before determining at least one first hardware interface of the electronic device from the first hardware interface set according to the first indication information, the method further includes: and determining a hardware interface set to which the second hardware interface belongs as the first hardware interface set according to the first indication information.
The electronic device may store information related to the first set of hardware interfaces including an identification of the first set of hardware interfaces and information (e.g., an identification of each hardware interface, a call parameter, etc.) of a plurality of hardware interfaces in the first set of hardware interfaces including the second hardware interface. For example, the identifier of the first hardware interface set shown in fig. 5, the identifier of the hardware interface 1, the identifier of the hardware interface 2, the identifier of the hardware interface 3, the identifier of the hardware interface 4, and the correspondence relationship between the first hardware interface set and the hardware interface 1, the hardware interface 2, the hardware interface 3, and the hardware interface 4, respectively, may be saved. When the electronic device 501 reads the first indication information in the code of the first application and the first indication information indicates the hardware interface 3 in fig. 5, since the electronic device 501 does not have the hardware interface 3, the electronic device 501 cannot call the hardware interface 3, and the electronic device 501 may determine that a correspondence exists between the hardware interface 3 and the first hardware interface set according to the first indication information and the related information of the first hardware interface set, so as to determine the first hardware interface set.
FIG. 6 is a schematic diagram of a plurality of hardware interface sets. The electronic device may store information about a plurality of hardware interface sets including the hardware interface set 601 and the hardware interface set 602 shown in fig. 6.
In one example, the type of the set of hardware interfaces 601 is type 1 and the type of the set of hardware interfaces 602 is type 2.
The first indication information includes information indicating a first type of hardware interface that the first application needs to call, and before determining at least one first hardware interface of the electronic device from the first hardware interface set according to the first indication information, the method further includes: and determining the hardware interface set matched with the first type as the first hardware interface set according to the first indication information.
The first set of hardware interfaces matches a first type, which is a possible case. The types of hardware interface sets have been described in detail above and will not be described in detail here.
Another possibility is that the functionality of the first set of hardware interfaces is the same or similar to the functionality implemented by the first type.
For example, the type indicated by the first indication information is a mobile communication interface, and the functions of the first set of hardware interfaces include a voice call function, which can also be implemented by the mobile communication interface, so that the first set of hardware interfaces matches the first type.
As another example, the type indicated by the first indication information is a screen display interface, the function of the first set of hardware interfaces includes a function of displaying an image on a screen, and the screen display interface is also capable of implementing the function of displaying an image on a screen, so that the first set of hardware interfaces matches the first type.
As another example, the type indicated by the first indication information is a speaker interface, and the function of the first set of hardware interfaces includes a sound playing function, and the speaker interface is also capable of implementing the sound playing function, so that the first set of hardware interfaces matches the first type.
As another example, the type indicated by the first indication information is an earphone interface, and the function of the first hardware interface set includes a sound playing function, and the earphone interface can also implement the sound playing function, so that the first hardware interface set is matched with the first type.
For another example, the type indicated by the first indication information is a fingerprint identification interface, and the functions of the first hardware interface set include fingerprint identification functions, and the fingerprint identification interface can also implement the fingerprint identification functions, so that the first hardware interface set is matched with the first type.
As another example, the type indicated by the first indication information is a positioning interface, and the functions of the first set of hardware interfaces include a positioning function, and the positioning interface is also capable of implementing the positioning function, so that the first set of hardware interfaces matches the first type.
As another example, the type indicated by the first indication information is a wireless communication interface, and the function of the first set of hardware interfaces includes a data transmission function, and the wireless communication interface is also capable of implementing the data transmission function, so that the first set of hardware interfaces matches the first type.
For another example, the type indicated by the first indication information is a shooting interface, and the functions of the first hardware interface set include capturing a scene around the electronic device, and the shooting interface can also implement the function of capturing the scene around the electronic device, so that the first hardware interface set is matched with the first type.
Thus, in the event that the first application indicates to invoke a first type of hardware interface via the first indication information, the electronic device may determine the first set of hardware interfaces matching the first type based on the first type.
In one example, the functions of the set of hardware interfaces 601 include function 1 and the functions of the set of hardware interfaces 602 include function 2.
Optionally, the first indication information includes information indicating a first function of a hardware interface that the first application needs to call, and before determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first hardware interface set, the method further includes: and determining a hardware interface set matched with the first function as the first hardware interface set according to the first indication information.
The first set of hardware interfaces matches a first function, and it is possible that the functions of the first set of hardware interfaces include the first type. The functions of the various hardware interface sets have been described in detail above and will not be described in detail here.
Another possibility is that the functionality of the first set of hardware interfaces is the same or similar to the functionality implemented by the first type.
For example, the function indicated by the first indication information is a voice call function, the type of the first set of hardware interfaces is a mobile communication interface, and the mobile communication interface is capable of implementing the voice call function, so that the first set of hardware interfaces is matched with the first type.
For another example, the function indicated by the first indication information is a function of displaying an image on a screen, the type of the first hardware interface set is a screen display interface, and the screen display interface can realize the function of displaying the image on the screen, so that the first hardware interface set is matched with the first type.
As another example, the function indicated by the first indication information is a sound playing function, the type of the first hardware interface set is a speaker interface or a headphone interface, and the speaker interface or the headphone interface can implement the sound playing function, so that the first hardware interface set is matched with the first type.
In another example, the function indicated by the first indication information is a fingerprint identification function, the type of the first hardware interface set is a fingerprint identification interface, and the fingerprint identification interface can realize the fingerprint identification function, so that the first hardware interface set is matched with the first type.
For another example, the function indicated by the first indication information is a positioning function, the type of the first hardware interface set is a positioning interface, and the positioning interface can implement the positioning function, so that the first hardware interface set is matched with the first type.
As another example, the function indicated by the first indication information is a data transmission function, the type of the first set of hardware interfaces is a wireless communication interface, and the wireless communication interface is capable of implementing the data transmission function, so that the first set of hardware interfaces is matched with the first type.
For another example, the function indicated by the first indication information is a function of capturing a scene around the electronic device, the type of the first hardware interface set is a shooting interface, and the shooting interface can realize the function of capturing the scene around the electronic device, so that the first hardware interface set is matched with the first type.
Thus, in the case where the first application indicates, via the first indication information, a hardware interface that invokes a first function, the electronic device may determine, from the first function, the first set of hardware interfaces that match the first function.
And 402, determining at least one first hardware interface of the electronic device from the first hardware interface set according to the first indication information.
After determining the first set of hardware interfaces, the electronic device may select one or more hardware interfaces in the first set of hardware interfaces that the electronic device has, i.e., the electronic device may select one or more hardware interfaces that the electronic device is able to correctly invoke.
Taking the first set of hardware interfaces shown in fig. 5 as an example, since neither the hardware interface 3 nor the hardware interface 4 is a hardware interface of the electronic device 501, but the hardware interface 1 and the hardware interface 2 are hardware interfaces of the electronic device 501, the electronic device 501 can determine the hardware interface 1 and the hardware interface 2 from the first set of hardware interfaces, and use both the hardware interface 1 and the hardware interface 2 as the first hardware interface.
In one example, the electronic device may attempt the hardware interfaces in the first set of hardware interfaces one by one according to the information of the hardware interfaces in the first set of hardware interfaces, and may determine the at least one first hardware interface when the call result is successful.
Taking the first hardware interface set shown in fig. 5 as an example, the electronic device 501 may sequentially attempt whether the hardware interface 1, the hardware interface 2, the hardware interface 3, and the hardware interface 4 can be successfully invoked from the first hardware interface set, and since neither the hardware interface 3 nor the hardware interface 4 is a hardware interface of the electronic device 501, the electronic device 501 cannot correctly invoke, and the hardware interface 1 and the hardware interface 2 are hardware interfaces of the electronic device 501, the electronic device 501 can correctly invoke the hardware interface 1 and the hardware interface 2, and thus both the hardware interface 1 and the hardware interface 2 can be determined as the first hardware interface.
In one example, the electronic device may determine at least one first hardware interface that the electronic device has from a first set of hardware interfaces according to a type of the electronic device.
Optionally, the determining, according to the first indication information, at least one first hardware interface of the electronic device from the first hardware interface set includes: and determining the at least one first hardware interface from the first hardware interface set according to the type of the electronic equipment and the first indication information.
Taking the first set of hardware interfaces shown in fig. 5 as an example, the first set of hardware interfaces includes hardware interface 1, hardware interface 2, hardware interface 3, and hardware interface 4. The hardware interfaces 1 and 2 are hardware interfaces of the electronic device 501. The hardware interface 3 is a hardware interface provided in the electronic device 502. The hardware interfaces 3 and 4 are hardware interfaces of the electronic device 503. The electronic device 501 may determine both the hardware interface 1 and the hardware interface 2 as the first hardware interface according to its own device type.
Optionally, the first indication information further includes information indicating a version number of an interface that the first application needs to call.
Taking a wireless communication interface as an example, an interface corresponding to a bluetooth antenna of a bluetooth 2.0 version is different from an interface corresponding to a bluetooth antenna of a bluetooth 4.0 version, and the electronic device may ignore the interface corresponding to bluetooth 2.0 when the first indication information indicates the bluetooth 4.0 version. For example, the hardware interface 1 in fig. 5 is a bluetooth interface of a bluetooth version 2.0, the hardware interface 2 in fig. 5 is a bluetooth interface of a bluetooth version 4.0, the first indication information indicates the bluetooth version 4.0, and the electronic device may determine the hardware interface 2 as the first hardware interface according to the version number in the first indication information. In addition to the wireless communication interface having a version number, a multimedia transmission interface (version number may be HDMI, VGA, etc.), a headset interface (version number may be 2.5mm, 3.5mm, USB-C, etc.), a mobile communication interface (version number may be GSM, CDMA, etc.), etc. may also have a version number.
403, Invoking the at least one first hardware interface.
Invoking the first hardware interface may refer to driving hardware corresponding to the first hardware interface through the first hardware interface.
In one example, an electronic device reads first indication information in a code of a call application, the first indication information being used to indicate a first set of hardware interfaces of a type that are mobile communication interfaces or function that are language calls. The electronic device may determine at least one first hardware interface of the electronic device from the first set of hardware interfaces, where the at least one first according interface is a mobile communication interface, or where functions of the at least one first hardware interface include voice calls. Thus, the electronic device invokes the at least one first hardware interface to implement a voice call function by driving an antenna for mobile communication.
In one example, an electronic device reads first indication information in code of a video playback application, the first indication information being used to indicate a first set of hardware interfaces of a type that are screen display interfaces, or a first set of hardware interfaces that function to display images on a screen. The electronic device may determine at least one first hardware interface of the electronic device from the first set of hardware interfaces, where the at least one first according interface is a screen display interface, or functions of the at least one first hardware interface include displaying an image on a screen, so that the electronic device invokes the at least one first hardware interface and plays a video on the display screen.
In one example, the electronic device reads first indication information in a code of the audio playing application, the first indication information being used to indicate a first set of hardware interfaces of a type being speaker interfaces, or a first set of hardware interfaces of a function being playing sound. The electronic device may determine at least one first hardware interface of the electronic device from the first set of hardware interfaces, where the at least one first according interface is a speaker interface, or functions of the at least one first hardware interface include playing sound, so that the electronic device invokes the at least one first hardware interface and plays an audio file through a speaker.
In one example, the electronic device reads first indication information in a code of the audio playing application, where the first indication information is used to indicate a first set of hardware interfaces that are of a headset interface type, or a first set of hardware interfaces that are functional to play sound. The electronic device may determine at least one first hardware interface of the electronic device from the first hardware interface set, where the at least one first according interface is an earphone interface, or functions of the at least one first hardware interface include playing sound, so that the electronic device invokes the at least one first hardware interface and plays an audio file through the earphone.
In one example, the electronic device reads first indication information in a code of the security application, the first indication information being used to indicate a first set of hardware interfaces of a type that is a fingerprint identification interface, or a first set of hardware interfaces of a function that is fingerprint identification. The electronic device may determine at least one first hardware interface of the electronic device from the first hardware interface set, where the at least one first interface is a fingerprint identification interface according to a type of the interface, or functions of the at least one first hardware interface include fingerprint identification, so that the electronic device invokes the at least one first hardware interface, and considers that an operation of the current electronic device is safe when a fingerprint fed back by the fingerprint identification module matches with preset fingerprint information.
In one example, the electronic device reads first indication information in a code of the map navigation application, the first indication information being used to indicate a first set of hardware interfaces of a type of positioning interface, or a first set of hardware interfaces of a function of positioning. The electronic device may determine at least one first hardware interface of the electronic device from the first hardware interface set, where the at least one first interface is a positioning interface according to a type of the interface, or functions of the at least one first hardware interface include positioning, so that the electronic device invokes the at least one first hardware interface and plans a driving path through positioning information fed back by the GPS antenna.
In one example, the electronic device reads first indication information in a code of the file transfer application, the first indication information being used to indicate a first set of hardware interfaces of a type that is a wireless communication interface, or a first set of hardware interfaces that is functional for data transfer. The electronic device may determine at least one first hardware interface of the electronic device from the first hardware interface set, where the at least one first interface is a wireless communication interface according to a type of the interface, or functions of the at least one first hardware interface include data transmission, so that the electronic device invokes the at least one first hardware interface, and sends a file to an adjacent electronic device through a bluetooth antenna, or receives a file sent by the adjacent electronic device.
In one example, the electronic device reads first indication information in code of a photographing application, the first indication information being used to indicate a first set of hardware interfaces of a type of photographing interface, or a first set of hardware interfaces that function to capture a scene surrounding the electronic device. The electronic device may determine at least one first hardware interface of the electronic device from the first hardware interface set, where the at least one first according interface is a shooting interface, or functions of the at least one first hardware interface include capturing a scene around the electronic device, so that the electronic device invokes the at least one first hardware interface, invokes a front-end shooting interface, and shoots a portrait through a front-end camera.
Optionally, the hardware call mode may also be determined according to the hardware type of the electronic device.
For example, the size of the mobile phone display screen is 5 inches, and the hardware calling mode 1 can be selected according to the hardware type; the watch screen size is 40mm, and different from the mobile phone display screen size, the hardware calling mode 2 for the small screen can be selected; the television screen size is 50 inches, different from the size of the mobile phone display screen and also different from the size of the watch screen, and the hardware call mode 3 for the oversized screen can be selected.
As another example, the dimensions of the display of the mobile phone include 4.8 inches, 5 inches, and 5.1 inches, so that different mobile phones can select different hardware call modes that fit different sized screens.
In the embodiment of the application, the first application indicates the first hardware interface set through the first indication information, and the electronic device can confirm the real hardware interface parameters which the first application actually should call according to the parameters (such as version number, electronic device type and the like). Thus, the first application does not need to know in advance the real hardware interface that the electronic device executing the first application has. And, the first application may be executed on a plurality of electronic devices with the first set of hardware interfaces indicated. Therefore, the method provided by the embodiment of the application can reduce the burden of application developers.
Fig. 7 is a schematic flowchart of a method for calling a hardware interface according to an embodiment of the present application.
701, Second indication information in a code of a second application is read, where the second indication information is used to indicate related information of a second hardware interface set, where the second hardware interface set includes hardware interfaces of a plurality of electronic devices, and any two hardware interfaces in the second hardware interface set are the same in type, or some or all of functions of any two hardware interfaces in the second hardware interface set are the same.
In the present application, the second application may be, for example, a call application, a video playback application, an audio playback application, a security application, a map navigation application, a file transfer application, a photographing application, or the like. The second application may also include music playing, video playing, reading applications, application markets, gallery, calendar, conversation, map, navigation, and the like. The application is not limited to the specific type of second application.
The second set of hardware interfaces includes hardware interfaces of a plurality of electronic devices, which may include, for example, at least two of a cell phone, a tablet, a smart watch, a video player, a Laptop (Laptop), a desktop computer, a television, a notebook computer.
In general, the hardware interfaces of different types of electronic devices are usually different, for example, the hardware interfaces of a mobile phone are different from the hardware interfaces of a watch, the hardware interfaces of a watch are different from the hardware interfaces of a television, and the hardware interfaces of the mobile phone are different from the hardware interfaces of the television.
The hardware interfaces that different electronic devices of the same type have may be the same or different. For example, the hardware interfaces of two handsets with the same version number may be the same, and the hardware interfaces of two handsets with the same version number may be different.
The specific implementation of step 701 may refer to step 401 in the embodiment shown in fig. 4, which is not described herein.
And 702, calling a preset target interface or presenting alarm information under the condition that the electronic equipment does not have any hardware interface in the second hardware interface set.
As shown in fig. 6, the second set of hardware interfaces includes a hardware interface 5, a hardware interface 6, and a hardware interface 7, where none of the hardware interfaces 5, 6, and 7 is a hardware interface of the electronic device.
The type of the second set of hardware interfaces is a second type, and in case the second application indicates to call an interface belonging to the second type, the electronic device does not have any hardware interface of the second set of hardware interfaces, and therefore the electronic device does not have an interface belonging to the second type, or does not have an interface matching the second type.
Or the function of the second hardware interface set is the second function, and the electronic device does not have any hardware interface in the second hardware interface set when the second application indicates to call the interface with the second function, so the electronic device does not have an interface capable of realizing the second function or an interface matched with the second function.
The preset target interface can be a virtual interface or a physical interface.
For example, the electronic device is a wristwatch, and the second indication information indicates that the USB interface is invoked, whereas the wristwatch does not have a USB interface. In this case, the electronic device may call a headphone interface for charging, which is a target interface. Because the electronic device can call the target interface, a call feedback result that the electronic device cannot call the USB interface is not obtained, and the second application operation failure (such as second application operation crash or unlimited times of circulation errors) caused by the fact that the electronic device does not have the USB interface is avoided.
As another example, the electronic device is a television, and the second indication information indicates that the mobile communication interface is invoked, and the television does not have a mobile communication interface. In this case, the electronic device may invoke a preset virtual interface. Because the electronic equipment can call the target interface, the call feedback result that the electronic equipment cannot call the mobile communication interface is not obtained, and the second application operation failure (such as second application operation breakdown or infinite cycle error) caused by the fact that the electronic equipment does not have the mobile communication interface is avoided.
The warning information may be, for example, a symbol such as "x" displayed on the screen.
Alternatively, the alert information may be presented, and alert information may be presented that matches the type or function of the second set of hardware interfaces.
For example, the second hardware interface set is a mobile communication interface, and the presented alarm information may be "no voice call function in the local".
As another example, the second hardware interface set is of a fingerprint identification interface type, and the presented alarm information may be "unable to acquire fingerprint information".
For another example, the second hardware interface set is a positioning interface, and the presented alarm information may be "unable to acquire the current location information, and whether the current location information is manually input.
As another example, the second set of hardware interfaces may be bluetooth interfaces, and the alert information presented may be "connectionless bluetooth devices".
For another example, the second hardware interface set is a front camera interface, and the presented alarm information may be "call front camera error, call rear camera.
Fig. 8 is a schematic flow chart of a method for calling a hardware interface according to an embodiment of the present application.
And 801, reading third indication information in the code of a third application, wherein the third indication information is used for indicating the function or type of a hardware interface which needs to be called by the third application.
In the present application, the third application may be, for example, a call application, a video playback application, an audio playback application, a security application, a map navigation application, a file transfer application, a photographing application, or the like. The third application may also include music playing, video playing, reading applications, application markets, gallery, calendar, conversation, map, navigation, and the like. The application is not limited to the specific type of third application.
The third set of hardware interfaces includes hardware interfaces of a plurality of electronic devices, which may include, for example, at least two of a cell phone, a tablet, a smart watch, a video player, a Laptop (Laptop), a desktop computer, a television, a notebook computer.
The hardware interface may implement the hardware call through code, and thus, the hardware interface may be defined using the code. For example, in an android system, a hardware interface may be defined using a hardware interface definition language (HARDWARE INTERFACE definition language, HIDL). For another example, code in java format may be called using the HIDL language to implement the call of the hardware interface. In general, the hardware interfaces of different types of electronic devices are usually different, for example, the hardware interfaces of a mobile phone are different from the hardware interfaces of a watch, the hardware interfaces of a watch are different from the hardware interfaces of a television, and the hardware interfaces of the mobile phone are different from the hardware interfaces of the television.
The hardware interfaces that different electronic devices of the same type have may be the same or different. For example, the hardware interfaces of two handsets with the same version number may be the same, and the hardware interfaces of two handsets with the same version number may be different.
The functions of the hardware interface may be, for example, a voice call function, a function of displaying an image on a screen, a sound playing function, a fingerprint recognition function, a positioning function, a file transfer function, a function of capturing a scene around the electronic device, and the like.
The type of hardware interface may be, for example, a mobile communication interface, a screen display interface, a speaker interface, a headset interface, a fingerprint identification interface, a positioning interface, a wireless communication interface, a camera interface.
And 802, determining at least one third hardware interface of the electronic device from a plurality of hardware interfaces according to the type of the electronic device and the third indication information, wherein the plurality of hardware interfaces comprise the hardware interfaces of the electronic device.
For clarity of description, the function of the hardware interface that needs to be called by the third application indicated by the third indication information is a third function, and the type of the hardware interface that needs to be called by the third application indicated by the third indication information is a third type. That is, according to the third type indicated by the third indication information, at least one third hardware interface that the electronic device can successfully call is determined, and the type or function of the third hardware interface matches the third type indicated by the third indication information. Or determining at least one third hardware interface which can be successfully invoked by the electronic device according to the third function indicated by the third indication information, wherein the type or function of the third hardware interface is matched with the third function indicated by the third indication information.
The electronic device may store information related to the plurality of hardware interfaces, the information including a function or type of each of the plurality of hardware interfaces. The related information also includes various parameters required to invoke the each hardware interface. The related information also includes information of the electronic device to which each hardware interface belongs. Optionally, the related information may further include an identification of each hardware interface. Therefore, after the electronic device reads the third indication information, at least one third hardware interface meeting the requirements can be selected from the plurality of hardware interfaces according to the type, the parameter, the model and the like of the electronic device.
When the third indication information indicates the function of the hardware interface, the electronic device may find at least one third hardware interface from the plurality of hardware interfaces according to the related information of the plurality of hardware interfaces, where the at least one third hardware interface matches the third function indicated by the third indication information. The at least one third hardware interface is matched with the third function indicated by the third indication information, which may mean that the functions of the at least one third hardware interface are the same as the third function, and may also mean that the type of the at least one third hardware interface is matched with the third function.
In one example, the function of the hardware interface indicated by the third indication information is a voice call function, and the electronic device may find, from among the plurality of hardware interfaces, a hardware interface that is capable of implementing a language call function and is provided by the electronic device, for example, may find, from among the plurality of hardware interfaces, a mobile communication interface that is provided by the electronic device, according to information related to the plurality of hardware interfaces.
In one example, the function of the hardware interface indicated by the third indication information is a function of displaying an image on a screen, and the electronic device may find, from among the plurality of hardware interfaces, a hardware interface that is possessed by the electronic device and that is capable of implementing the function of displaying an image on a screen, for example, may find, from among the plurality of hardware interfaces, a screen display interface that is possessed by the electronic device, according to information related to the plurality of hardware interfaces.
In one example, the function of the hardware interface indicated by the third indication information is a sound playing function, and the electronic device may find, from among the plurality of hardware interfaces, a hardware interface that is capable of implementing the sound playing function and is provided by the electronic device, for example, may find, from among the plurality of hardware interfaces, a speaker interface and a headphone interface that are provided by the electronic device, according to information related to the plurality of hardware interfaces.
In one example, the function of the hardware interface indicated by the third indication information is a positioning function, and the electronic device may find, from among the plurality of hardware interfaces, a hardware interface that is capable of implementing the positioning function and is provided by the electronic device, according to information related to the plurality of hardware interfaces, for example, may find, from among the plurality of hardware interfaces, a positioning interface that is provided by the electronic device.
In one example, the function of the hardware interface indicated by the third indication information is a wireless communication function, and the electronic device may find, from among the plurality of hardware interfaces, a hardware interface that is capable of implementing the wireless communication function and is provided by the electronic device, for example, may find, from among the plurality of hardware interfaces, a bluetooth interface that is provided by the electronic device, according to information related to the plurality of hardware interfaces.
In an example, the function of the hardware interface indicated by the third indication information is a shooting function, and the electronic device may find, from among the plurality of hardware interfaces, a hardware interface that is capable of implementing the shooting function and is provided by the electronic device, for example, a front camera interface and a rear camera interface that are provided by the electronic device may be found from among the plurality of hardware interfaces according to information related to the plurality of hardware interfaces.
When the third indication information indicates the type of the hardware interface, the electronic device may find at least one third hardware interface from the plurality of hardware interfaces according to the related information of the plurality of hardware interfaces, where the at least one third hardware interface matches with the third type indicated by the third indication information. The at least one third hardware interface is matched with the third type indicated by the third indication information, which may mean that the type of the at least one third hardware interface is the same as the third type, and may mean that the function that the at least one third hardware interface can implement is matched with the third type.
In one example, the third indication information indicates a mobile communication interface, and the electronic device may find a mobile communication interface of the electronic device from a plurality of hardware interfaces or find a hardware interface of the electronic device capable of implementing a language call function from a plurality of hardware interfaces according to information about the plurality of hardware interfaces.
In one example, the third indication information indicates a screen display interface, and the electronic device may find a screen display interface that the electronic device has from among the plurality of hardware interfaces or find a hardware interface that the electronic device has and that can implement a function of displaying an image on a screen from among the plurality of hardware interfaces according to information about the plurality of hardware interfaces.
In one example, the third indication information indicates a speaker interface, and the electronic device may find a speaker interface of the electronic device from a plurality of hardware interfaces or find a hardware interface of the electronic device capable of implementing a sound playing function from a plurality of hardware interfaces according to information about the plurality of hardware interfaces.
In one example, the third indication information indicates a headphone interface, and the electronic device may find a headphone interface that the electronic device has from among a plurality of hardware interfaces or find a hardware interface that the electronic device has and that can implement a sound playing function from among a plurality of hardware interfaces according to information about the plurality of hardware interfaces.
In one example, the third indication information indicates a positioning interface, and the electronic device may find a positioning interface of the electronic device from a plurality of hardware interfaces or find a hardware interface of the electronic device capable of implementing a positioning function from a plurality of hardware interfaces according to information related to the plurality of hardware interfaces.
In one example, the third indication information indicates a bluetooth interface, and the electronic device may find a bluetooth interface of the electronic device from a plurality of hardware interfaces or find a hardware interface of the electronic device capable of implementing a wireless communication function from a plurality of hardware interfaces according to information related to the plurality of hardware interfaces.
In one example, the third indication information indicates a front-end camera interface, and the electronic device may find the front-end camera interface of the electronic device from the plurality of hardware interfaces or find the hardware interface of the electronic device capable of implementing the shooting function from the plurality of hardware interfaces according to the related information of the plurality of hardware interfaces.
Optionally, determining at least one third hardware interface of the electronic device from a plurality of hardware interfaces according to the type of the electronic device and the third indication information, including: determining a third hardware interface set matched with the type of the electronic equipment according to the type of the electronic equipment, wherein the plurality of hardware interfaces comprise hardware interfaces in the third hardware interface set; and determining at least one third hardware interface from the third hardware interface set according to the third indication information.
The third set of hardware interfaces matches the type of the electronic device, which may mean that the third set of hardware interfaces includes some or all of the hardware interfaces that the electronic device has, and does not include hardware interfaces that the electronic device does not have. The third set of hardware interfaces does not include hardware interfaces that the electronic device does not have, for example, the third set of hardware interfaces may include hardware interfaces that other types of electronic devices have. For example, the third hardware interface is matched with the mobile phone, and the hardware interfaces in the third hardware interface set are all hardware interfaces of the mobile phone, and the third hardware interface set does not include hardware interfaces not being the mobile phone, for example, does not include a hardware interface of a watch, and does not include a hardware interface of a television.
As shown in fig. 9, the hardware interfaces 1,2,3, and 4 in the hardware interface set 901 are all hardware interfaces of the electronic device 1, and the hardware interfaces 5, 6, and 7 in the hardware interface set 902 are all hardware interfaces of the electronic device 2.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the function of the hardware interface indicated by the third indication information is a voice call function, and the electronic device may determine, according to the third indication information, a hardware interface capable of implementing a language call function from the third hardware interface set, or determine a mobile communication interface from the third hardware interface set.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the function of the hardware interface indicated by the third indication information is a function of displaying an image on a screen; the electronic device may determine, according to the third instruction information, a hardware interface capable of realizing a function of displaying an image on a screen from the third set of hardware interfaces, or determine a screen display interface from the third set of hardware interfaces.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the function of the hardware interface indicated by the third indication information is a sound playing function; the electronic device may determine, according to the third indication information, a hardware interface capable of implementing a sound playing function from the third set of hardware interfaces, or determine a speaker interface and a headphone interface from the third set of hardware interfaces.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the function of the hardware interface indicated by the third indication information is a positioning function; the electronic device may determine, according to the third indication information, a hardware interface capable of implementing the positioning function from the third set of hardware interfaces, or determine a positioning interface from the third set of hardware interfaces.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the function of the hardware interface indicated by the third indication information is a wireless communication function; the electronic device may determine, according to the third indication information, a hardware interface capable of implementing the wireless communication function from the third set of hardware interfaces, or determine a bluetooth interface from the third set of hardware interfaces.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the function of the hardware interface indicated by the third indication information is a shooting function; the electronic device may determine, according to the third indication information, a hardware interface capable of implementing a shooting function from the third hardware interface set, or determine a front camera interface and a rear camera interface from the third hardware interface set.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the third indication information indicates the mobile communication interface, and the electronic device may determine the mobile communication interface from the third hardware interface set or determine a hardware interface capable of implementing a language call function from the third hardware interface set according to the third indication information.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the third indication information indicates a screen display interface; the electronic device may determine, according to the third instruction information, a screen display interface from the third set of hardware interfaces, or determine, from the third set of hardware interfaces, a hardware interface capable of implementing a function of displaying an image on a screen.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the third indication information indicates a speaker interface; the electronic device may determine, according to the third indication information, a speaker interface from the third set of hardware interfaces, or determine, from the third set of hardware interfaces, a hardware interface capable of implementing a sound playing function.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the third indication information indicates the earphone interface; the electronic device may determine, according to the third indication information, an earphone interface from the third set of hardware interfaces, or determine, from the third set of hardware interfaces, a hardware interface capable of implementing a sound playing function.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the third indication information indicates a positioning interface; the electronic device may determine, according to the third indication information, a positioning interface from the third set of hardware interfaces, or determine, from the third set of hardware interfaces, a hardware interface capable of implementing a positioning function.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the third indication information indicates Bluetooth; the electronic device may determine, according to the third indication information, a bluetooth interface from the third set of hardware interfaces, or determine, from the third set of hardware interfaces, a hardware interface capable of implementing a wireless communication function.
In one example, the electronic device is a watch, and the electronic device may determine, according to a type of the electronic device, a third set of hardware interfaces from a plurality of sets of hardware interfaces, where the hardware interfaces in the third set of hardware interfaces are all hardware interfaces that the electronic device has; the third indication information indicates a front camera interface; the electronic device may determine, according to the third indication information, a front camera interface from the third set of hardware interfaces, or determine, from the third set of hardware interfaces, a hardware interface capable of implementing a photographing function.
803, Invoking the at least one third hardware interface.
The specific implementation of step 803 may refer to step 403 in the embodiment shown in fig. 4, and need not be described herein.
Optionally, the method further comprises: reading fourth indication information in a code of a fourth application, wherein the fourth application needs a fourth function of a called hardware interface; and calling a preset target interface or presenting alarm information under the condition that the electronic equipment does not have a hardware interface matched with the fourth function.
Optionally, the method further comprises: reading fourth indication information in a code of a fourth application, wherein the fourth application needs a fourth type of a called hardware interface; and calling a preset target interface or presenting alarm information under the condition that the electronic equipment does not have the hardware interface matched with the fourth type.
Examples of matching the type of the hardware interface with the type or function of the hardware interface and examples of matching the function of the hardware interface with the type or function of the hardware interface have been described above in detail, and will not be described herein.
The preset target interface can be a virtual interface or a physical interface.
For example, the electronic device is a wristwatch, and the second indication information indicates that the USB interface is invoked, whereas the wristwatch does not have a USB interface. In this case, the electronic device may call a headphone interface for charging, which is a target interface. Because the electronic device can call the target interface, a call feedback result that the electronic device cannot call the USB interface is not obtained, and the second application operation failure (such as second application operation crash or unlimited times of circulation errors) caused by the fact that the electronic device does not have the USB interface is avoided.
As another example, the electronic device is a television, and the second indication information indicates that the mobile communication interface is invoked, and the television does not have a mobile communication interface. In this case, the electronic device may invoke a preset virtual interface. Because the electronic equipment can call the target interface, the call feedback result that the electronic equipment cannot call the mobile communication interface is not obtained, and the second application operation failure (such as second application operation breakdown or infinite cycle error) caused by the fact that the electronic equipment does not have the mobile communication interface is avoided.
The warning information may be, for example, a symbol such as "x" displayed on the screen.
The alarm information is presented, and the presented alarm information can be determined according to the type or the function of the second hardware interface set indicated by the second indication information.
For example, the second hardware interface set is a mobile communication interface, and the presented alarm information may be "no voice call function in the local".
As another example, the second hardware interface set is of a fingerprint identification interface type, and the presented alarm information may be "unable to acquire fingerprint information".
For another example, the second hardware interface set is a positioning interface, and the presented alarm information may be "unable to acquire the current location information, and whether the current location information is manually input.
As another example, the second set of hardware interfaces may be bluetooth interfaces, and the alert information presented may be "connectionless bluetooth devices".
For another example, the second hardware interface set is a front camera interface, and the presented alarm information may be "call front camera error, call rear camera.
Optionally, the third indication information further includes information indicating a version number of an interface that the third application needs to call.
Fig. 10 is a software configuration block diagram of the electronic device 100 according to the embodiment of the present application. 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 system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun rows (Android runtime), and a system library. As shown in fig. 9, each layer in the software architecture may call a hardware layer through a hardware interface layer, which may include a plurality of hardware in fig. 1. The application layer, the application framework layer, an Zhuoyun rows (Android runtime), the system library and the hardware layer may refer to the example shown in fig. 2, and are not described herein.
A hardware interface layer may also be included between the system layer and the hardware layer, the hardware interface layer including hardware interfaces of a plurality of electronic devices, each hardware interface capable of driving hardware of one electronic device. Including for example a cell phone interface for driving a display, a watch interface for driving a display, a television interface for driving a display, a cell phone interface for driving a camera, etc.
When a processor or a chip in the electronic equipment reads codes of an application program layer, an application framework layer, an Zhuoyun rows and a system library, a hardware interface which can be called by the electronic equipment can be found through a hardware interface layer, so that hardware in the hardware layer is driven, and corresponding operations are executed. For example, the hardware interface layer includes hardware that can be called by the mobile phone, hardware that can be called by the watch, and hardware that can be called by the television, and the mobile phone can find a hardware interface that can be called by the mobile phone in the hardware interface layer, so as to drive the hardware in the hardware layer and execute corresponding operations.
Fig. 11 is a block diagram showing an internal structure of a hardware interface layer. The hardware interface layer may include a hardware interface agent layer, a hardware interface adaptation layer, and a hardware interface access control layer.
The hardware interface agent layer may include a rights control for confirming whether the hardware interface access request is secure or not, and may also be used for confirming whether the access object has rights to access the hardware interface or not. The hardware interface agent layer can realize safe and reasonable access to the hardware interface layer.
The hardware interface adaptation layer includes a plurality of hardware interfaces. The hardware interface may implement the hardware call through code, and thus, the hardware interface may be defined using the code. For example, in an android system, a hardware interface may be defined using a hardware interface definition language (HARDWARE INTERFACE definition language, HIDL). For another example, code in java format may be called using the HIDL language to implement the call of the hardware interface.
The plurality of hardware interfaces are of different types from each other. Or the hardware interface adaptation layer comprises the plurality of hardware interfaces, and functions which can be realized by the plurality of hardware interfaces are different from each other. Fig. 11 shows an example in which the hardware interface adaptation layer includes a plurality of different types of hardware interfaces. As shown in fig. 11, the hardware interface adaptation layer includes a type 1 hardware interface and a type 2 hardware interface. The plurality of hardware interfaces in the hardware interface adaptation layer are virtual interfaces. The plurality of hardware interfaces in the hardware interface adaptation layer may be used to represent at least one of the first set of hardware interfaces, the second set of hardware interfaces, the third set of hardware interfaces, the fourth set of hardware interfaces above. The specific method for calling the hardware interface adaptation layer can refer to the embodiments shown in fig. 4, 7 and 8. Specifically, the method for specifically invoking the hardware interface adaptation layer may refer to step 401 of the embodiment shown in fig. 4, step 701 of the embodiment shown in fig. 7, and step 801 of the embodiment shown in fig. 8.
The hardware interface access control layer is used for determining a hardware interface which can be called by the electronic equipment or executing preset operation according to the calling condition of the hardware interface in the hardware interface adaptation layer. The electronic device may include a software module or an induration module for identifying the type of device. For example, the electronic device may call the hardware of the electronic device or determine the hardware interface of the electronic device by the version number, model number, etc. of the electronic device. The electronic device may include a software module or an induration module for identifying the type of hardware. For example, the electronic device may identify the type of chip, thereby invoking hardware comprising the chip, or determining a hardware interface of hardware comprising the chip. As another example, the electronic device may identify a version number or model of the hardware to determine whether to call the hardware or determine a hardware interface of the hardware.
Each hardware interface in the hardware interface adaptation layer has a corresponding relation with the hardware interfaces of at least two electronic devices. As shown in fig. 11, the hardware interface of type 1 corresponds to the hardware interface 1 of the device 1, the hardware interface 2 of the device 2, and the hardware interface 3 of the device 3. The hardware interface of the type 2 has a corresponding relation with the hardware interface 4 of the device 1 and the hardware interface 5 of the device 2. When there is an instruction by the application program to call the hardware interface of the type 1 through the instruction information, the device 1 may call the hardware interface 1 according to the instruction information. And when the application program indicates to call the hardware interface of the type 2 through the indication information, the device 3 can call a preset target interface or present alarm information. The plurality of hardware interfaces in the hardware interface access control layer may be used to represent the plurality of hardware interfaces in the set of hardware interfaces above. The specific method for calling the hardware interface adaptation layer can refer to the embodiments shown in fig. 4, 7 and 8. Specifically, the method for specifically invoking the hardware interface adaptation layer may refer to steps 402-403 of the embodiment shown in fig. 4, step 702 of the embodiment shown in fig. 7, and steps 802-803 of the embodiment shown in fig. 8.
The hardware interface access control layer may drive hardware in the hardware layer to perform corresponding operations according to code in the application.
Fig. 12 is a schematic hardware structure of an electronic device according to an embodiment of the present application. The electronic device 1200 shown in fig. 12, which electronic device 1200 may in particular be a computer device, comprises a memory 1201, a processor 1202, a communication interface 1203 and a bus 1204. Wherein the memory 1201, the processor 1202 and the communication interface 1203 are communicatively coupled to each other via a bus 1204.
The memory 1201 may be a Read Only Memory (ROM), a static storage device, a dynamic storage device, or a random access memory (random access memory, RAM). The memory 1201 may store a program, and the processor 1202 is configured to perform the steps of the method of processing an image shown in fig. 4, 7, or 8 in the embodiment of the present application when the program stored in the memory 1201 is executed by the processor 1202.
The processor 1202 may employ a general-purpose central processing unit (central processing unit, CPU), microprocessor, application SPECIFIC INTEGRATED Circuit (ASIC), graphics processor (graphics processing unit, GPU) or one or more integrated circuits for executing associated programs to implement the methods of processing images illustrated in fig. 4, 7 or 8 in embodiments of the present application.
The processor 1202 may also be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the method for processing an image shown in fig. 4, 7 or 8 in the embodiment of the present application may be implemented by an integrated logic circuit of hardware in the processor 1202 or an instruction in the form of software.
The processor 1202 may also be a general purpose processor, a digital signal processor (DIGITAL SIGNAL processing unit, DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (field programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in the memory 1201, and the processor 1202 reads information in the memory 1201, and in combination with its hardware, performs functions necessary for the units included in the electronic device according to the embodiment of the present application, or performs the method for processing an image shown in fig. 4, 7 or 8 in the embodiment of the present application.
The communication interface 1203 uses a transceiver means, such as, but not limited to, a transceiver, to enable communication between the electronic device 1200 and other devices or communication networks. For example, the information of the neural network to be constructed and training data (such as the image to be processed in the embodiment shown in fig. 4, 7 or 8) required in constructing the neural network may be acquired through the communication interface 1203.
The bus 1204 may include a path for transferring information between various components of the electronic device 1200 (e.g., the memory 1201, the processor 1202, the communication interface 1203).
It should be appreciated that the acquisition module in the electronic device may correspond to the communication interface 1203 in the electronic device 1200; the processing module in the electronic device may correspond to the processor 1202.
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 systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or 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 functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
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 (18)

1. A method of invoking a hardware interface, comprising:
reading first indication information in a code of a first application, wherein the first indication information is used for indicating related information of a first hardware interface set, the first hardware interface set comprises hardware interfaces of a plurality of electronic devices, the types of any two hardware interfaces in the first hardware interface set are the same, or part or all of functions of any two hardware interfaces in the first hardware interface set are the same;
Determining at least one first hardware interface of the electronic device from the first hardware interface set according to the first indication information;
Invoking the at least one first hardware interface;
The method further comprises the steps of:
reading second indication information in a code of a second application, wherein the second indication information is used for indicating related information of a second hardware interface set, the second hardware interface set comprises hardware interfaces of a plurality of electronic devices, the types of any two hardware interfaces in the second hardware interface set are the same, or part or all of the functions of any two hardware interfaces in the second hardware interface set are the same;
And calling a preset target interface under the condition that the electronic equipment does not have any hardware interface in the second hardware interface set.
2. The method of claim 1, wherein the first indication information includes information indicating a second hardware interface, and the electronic device does not have the second hardware interface, and wherein prior to said determining, from the first set of hardware interfaces, at least one first hardware interface that the electronic device has based on the first indication information, the method further comprises:
and determining a hardware interface set to which the second hardware interface belongs as the first hardware interface set according to the first indication information.
3. The method of claim 1, wherein the first indication information includes information indicating a first function of a hardware interface that the first application needs to call, and wherein before determining at least one first hardware interface that the electronic device has from the first set of hardware interfaces according to the first indication information, the method further comprises:
and determining a hardware interface set matched with the first function as the first hardware interface set according to the first indication information.
4. The method of claim 1, wherein the first indication information includes information indicating a first type of hardware interface that the first application needs to invoke, the method further comprising, prior to said determining at least one first hardware interface that the electronic device has from the first set of hardware interfaces based on the first indication information:
And determining the hardware interface set matched with the first type as the first hardware interface set according to the first indication information.
5. The method according to any one of claims 1 to 4, wherein said determining at least one first hardware interface of the electronic device from the first set of hardware interfaces according to the first indication information comprises:
And determining the at least one first hardware interface from the first hardware interface set according to the type of the electronic equipment and the first indication information.
6. The method of any of claims 1-4, wherein the first indication information further comprises information indicating a version number of an interface that the first application needs to call.
7. A method of invoking a hardware interface, comprising:
Reading third indication information in a code of a third application, wherein the third indication information is used for indicating the function or type of a hardware interface which needs to be called by the third application;
determining at least one third hardware interface of the electronic equipment from a plurality of hardware interfaces according to the type of the electronic equipment and the third indication information, wherein the plurality of hardware interfaces comprise the hardware interfaces of the electronic equipment;
Invoking the at least one third hardware interface;
The method further comprises the steps of:
Reading fourth indication information in a code of a fourth application, wherein the fourth indication information is used for indicating related information of a fourth hardware interface set, the fourth hardware interface set comprises hardware interfaces of a plurality of electronic devices, the types of any two hardware interfaces in the fourth hardware interface set are the same, or part or all of the functions of any two hardware interfaces in the fourth hardware interface set are the same;
and calling a preset target interface under the condition that the electronic equipment does not have any hardware interface in the fourth hardware interface set.
8. The method of claim 7, wherein the third indication information further comprises information indicating a version number of an interface that the third application needs to call.
9. An electronic device, comprising:
A memory for storing a program;
A processor for executing the program stored in the memory, the processor for performing the following processes when the program stored in the memory is executed:
reading first indication information in a code of a first application, wherein the first indication information is used for indicating related information of a first hardware interface set, the first hardware interface set comprises hardware interfaces of a plurality of electronic devices, the types of any two hardware interfaces in the first hardware interface set are the same, or part or all of functions of any two hardware interfaces in the first hardware interface set are the same;
Determining at least one first hardware interface of the electronic device from the first hardware interface set according to the first indication information;
Invoking the at least one first hardware interface;
The processor is further configured to read second indication information in a code of a second application, where the second indication information is used to indicate related information of a second hardware interface set, where the second hardware interface set includes hardware interfaces of a plurality of electronic devices, and any two hardware interfaces in the second hardware interface set are the same type, or some or all of the functions of any two hardware interfaces in the second hardware interface set are the same;
the processor is further configured to apply to invoking a preset target interface if the electronic device does not have any hardware interface in the second set of hardware interfaces.
10. The electronic device of claim 9, wherein the first indication information includes information indicating a second hardware interface, and wherein the electronic device does not have the second hardware interface,
The processor is further configured to determine, according to the first indication information, a hardware interface set to which the second hardware interface belongs as the first hardware interface set, before determining, according to the first indication information, at least one first hardware interface of the electronic device from the first hardware interface set.
11. The electronic device of claim 9, wherein the first indication information includes information indicating a first function of a hardware interface that the first application needs to invoke,
The processor is further configured to determine, according to the first indication information, a set of hardware interfaces that matches the first function as the first set of hardware interfaces before determining, according to the first indication information, at least one first hardware interface that the electronic device has from the first set of hardware interfaces.
12. The electronic device of claim 9, wherein the first indication information includes a first type of information indicating that the first application needs to invoke a hardware interface,
The processor is further configured to determine, according to the first indication information, a set of hardware interfaces matching the first type as the first set of hardware interfaces before determining, according to the first indication information, at least one first hardware interface of the electronic device from the first set of hardware interfaces.
13. The electronic device according to any one of the claims 9 to 12, characterized in that,
The processor is specifically configured to determine the at least one first hardware interface from the first set of hardware interfaces according to the type of the electronic device and the first indication information.
14. The electronic device of any of claims 9-12, wherein the first indication information further includes information indicating a version number of an interface that the first application needs to call.
15. An electronic device, comprising:
A memory for storing a program;
A processor for executing the program stored in the memory, the processor for performing the following processes when the program stored in the memory is executed:
Reading third indication information in a code of a third application, wherein the third indication information is used for indicating the function or type of a hardware interface which needs to be called by the third application;
Determining at least one third hardware interface of the electronic equipment from a plurality of hardware interfaces according to the type of the electronic equipment and the third indication information, wherein the plurality of hardware interfaces comprise the hardware interfaces of the electronic equipment;
Invoking the at least one third hardware interface;
The processor is further configured to read fourth indication information in a code of a fourth application, where the fourth indication information is used to indicate related information of a fourth hardware interface set, the fourth hardware interface set includes hardware interfaces of a plurality of electronic devices, and types of any two hardware interfaces in the fourth hardware interface set are the same, or some or all functions of any two hardware interfaces in the fourth hardware interface set are the same;
The processor is further configured to apply to invoking a preset target interface if the electronic device does not have any hardware interface in the fourth set of hardware interfaces.
16. The electronic device of claim 15, wherein the third indication information further comprises information indicating a version number of an interface that the third application needs to call.
17. A computer readable storage medium storing program code for execution by a device, the program code comprising instructions for performing the method of any one of claims 1-8.
18. A chip comprising a processor and a data interface, the processor reading instructions stored on a memory via the data interface to perform the method of any of claims 1-8.
CN201910883684.7A 2019-09-18 2019-09-18 Method for calling hardware interface and electronic equipment Active CN110780929B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN202010963635.7A CN112214294B (en) 2019-09-18 2019-09-18 Method for calling hardware interface and electronic equipment
CN201910883684.7A CN110780929B (en) 2019-09-18 2019-09-18 Method for calling hardware interface and electronic equipment
PCT/CN2020/102280 WO2021051982A1 (en) 2019-09-18 2020-07-16 Method for calling hardware interface and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910883684.7A CN110780929B (en) 2019-09-18 2019-09-18 Method for calling hardware interface and electronic equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202010963635.7A Division CN112214294B (en) 2019-09-18 2019-09-18 Method for calling hardware interface and electronic equipment

Publications (2)

Publication Number Publication Date
CN110780929A CN110780929A (en) 2020-02-11
CN110780929B true CN110780929B (en) 2024-05-03

Family

ID=69383794

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201910883684.7A Active CN110780929B (en) 2019-09-18 2019-09-18 Method for calling hardware interface and electronic equipment
CN202010963635.7A Active CN112214294B (en) 2019-09-18 2019-09-18 Method for calling hardware interface and electronic equipment

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202010963635.7A Active CN112214294B (en) 2019-09-18 2019-09-18 Method for calling hardware interface and electronic equipment

Country Status (2)

Country Link
CN (2) CN110780929B (en)
WO (1) WO2021051982A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110780929B (en) * 2019-09-18 2024-05-03 华为技术有限公司 Method for calling hardware interface and electronic equipment
CN111813724B (en) * 2020-05-20 2023-06-30 北京元心科技有限公司 HIDL interface adapting system, method, corresponding equipment and storage medium
CN111918135A (en) * 2020-06-23 2020-11-10 青岛海尔多媒体有限公司 Method and device for checking configuration parameters and television
CN113312103A (en) * 2021-05-31 2021-08-27 浙江商汤科技开发有限公司 Software definition method and device for intelligent camera, electronic equipment and storage medium
CN114817115A (en) * 2022-05-20 2022-07-29 深圳市广和通无线通信软件有限公司 Serial port communication method and related device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164207A (en) * 2011-12-16 2013-06-19 深圳市快播科技有限公司 Application program development method and system for spanning hardware platforms based on Android system
CN104281455A (en) * 2014-10-11 2015-01-14 北京金山安全软件有限公司 Interface calling method and device and terminal
WO2016192556A1 (en) * 2015-05-29 2016-12-08 北京金山安全软件有限公司 Interface invoking method, device and terminal
CN106649164A (en) * 2016-12-29 2017-05-10 南威软件股份有限公司 Hardware interface management method
CN109684103A (en) * 2018-12-17 2019-04-26 上海曼恒数字技术股份有限公司 A kind of interface call method, device, server and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8918841B2 (en) * 2011-08-31 2014-12-23 At&T Intellectual Property I, L.P. Hardware interface access control for mobile applications
CN103984540A (en) * 2014-04-14 2014-08-13 美的集团股份有限公司 Method and device for generating hardware interface running program
CN104615410A (en) * 2015-01-22 2015-05-13 北京彩云动力教育科技有限公司 Multi-type hardware interface instruction processing method and system
CN105224489A (en) * 2015-11-12 2016-01-06 南威软件股份有限公司 A kind of integrated management system of hardware device
US20180095605A1 (en) * 2016-09-30 2018-04-05 International Business Machines Corporation Generating a Mixed reality Interface to Expose Object Functionality
CN108415863A (en) * 2018-02-01 2018-08-17 广东欧珀移动通信有限公司 The hardware compatibility implementation method and Related product of electronic device
CN108415856A (en) * 2018-02-08 2018-08-17 广东欧珀移动通信有限公司 Hardware compatibility method and relevant apparatus
CN108829379B (en) * 2018-05-31 2021-09-10 天津大学 Multi-hardware interface communication protocol software on-demand automatic generation method
CN110780929B (en) * 2019-09-18 2024-05-03 华为技术有限公司 Method for calling hardware interface and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164207A (en) * 2011-12-16 2013-06-19 深圳市快播科技有限公司 Application program development method and system for spanning hardware platforms based on Android system
CN104281455A (en) * 2014-10-11 2015-01-14 北京金山安全软件有限公司 Interface calling method and device and terminal
WO2016192556A1 (en) * 2015-05-29 2016-12-08 北京金山安全软件有限公司 Interface invoking method, device and terminal
CN106649164A (en) * 2016-12-29 2017-05-10 南威软件股份有限公司 Hardware interface management method
CN109684103A (en) * 2018-12-17 2019-04-26 上海曼恒数字技术股份有限公司 A kind of interface call method, device, server and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邹建宇 ; 郑思娴 ; .同密条件接收系统软件适配层的设计与实现.电视技术.2007,(第06期),全文. *

Also Published As

Publication number Publication date
WO2021051982A1 (en) 2021-03-25
CN112214294A (en) 2021-01-12
CN112214294B (en) 2022-01-14
CN110780929A (en) 2020-02-11

Similar Documents

Publication Publication Date Title
CN110780929B (en) Method for calling hardware interface and electronic equipment
CN115473957B (en) Image processing method and electronic equipment
WO2020000448A1 (en) Flexible screen display method and terminal
CN109559270B (en) Image processing method and electronic equipment
CN112506386B (en) Folding screen display method and electronic equipment
CN111182614B (en) Method and device for establishing network connection and electronic equipment
US20240031450A1 (en) Method and apparatus for processing push message
US20210397752A1 (en) Electronic Device Control Method and Electronic Device
CN116048358B (en) Method and related device for controlling suspension ball
CN115914461B (en) Position relation identification method and electronic equipment
CN111381996B (en) Memory exception handling method and device
CN114004732A (en) Image editing prompting method and device, electronic equipment and readable storage medium
CN115119048B (en) Video stream processing method and electronic equipment
CN112817610A (en) Cota package installation method and related device
CN113467821A (en) Application program repairing method, device, equipment and readable storage medium
CN116795476B (en) Wallpaper deleting method and electronic equipment
CN115175164B (en) Communication control method and related device
CN116048681B (en) Icon display method, electronic device, and computer-readable storage medium
CN111459271B (en) Gaze offset error determination method and device
CN115482143B (en) Image data calling method and system for application, electronic equipment and storage medium
EP4180949A1 (en) Method and apparatus for generating graffiti patterns, electronic device, and storage medium
WO2024017332A1 (en) Method for controlling component, and related apparatus
CN116931802A (en) Control method and central control equipment
CN116149501A (en) Display method and electronic equipment
CN118043836A (en) Advertisement attribution system, method and device

Legal Events

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