CN116033342B - Geofence processing method, equipment and storage medium - Google Patents

Geofence processing method, equipment and storage medium Download PDF

Info

Publication number
CN116033342B
CN116033342B CN202210599675.7A CN202210599675A CN116033342B CN 116033342 B CN116033342 B CN 116033342B CN 202210599675 A CN202210599675 A CN 202210599675A CN 116033342 B CN116033342 B CN 116033342B
Authority
CN
China
Prior art keywords
geofence
configuration information
information
shared memory
application
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
CN202210599675.7A
Other languages
Chinese (zh)
Other versions
CN116033342A (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.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210599675.7A priority Critical patent/CN116033342B/en
Publication of CN116033342A publication Critical patent/CN116033342A/en
Application granted granted Critical
Publication of CN116033342B publication Critical patent/CN116033342B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The application provides a geofence processing method, equipment and a storage medium. The method is suitable for a chip platform which needs to communicate with a low-power-consumption microprocessor of a hardware layer through a kernel, the low-power-consumption microprocessor determines whether the acquired position information is positioned in a geofence corresponding to the geofence configuration information according to the geofence configuration information recorded in a shared memory, so that even if an application processor is in a dormant mode, the application processor can timely sense the geofence event, the continuity of the geofence capability is improved, and the power consumption required by the processing service of the geofence is greatly reduced due to the fact that the low-power-consumption microprocessor is used. When the position information is located in the geofence corresponding to the geofence configuration information, an application processor determines an application scene corresponding to the geofence and activates business operation corresponding to the application scene, so that the business operation can be completed without user intervention, and user experience is greatly improved.

Description

Geofence processing method, equipment and storage medium
Technical Field
The present application relates to the field of electronic information technologies, and in particular, to a method and apparatus for processing a geofence, and a storage medium.
Background
Geofencing (Geo-fencing) is an application of location based services (Location Based Services, LBS) that enclose a virtual geographic boundary with a virtual fence. The electronic device may receive automatic notifications and alerts when the electronic device enters, leaves, or is active within a particular geographic area. Based on this feature of the geofence, each large application manufacturer sequentially pushes out location-based applications, such as car code applications, near field communication (Near Field Communication, NFC) applications, and the like, and simultaneously pushes out intelligent services, such as implementing intelligent switching of various access control, keys, traffic cards added in the NFC applications based on the geofence.
However, the geofence function supported by the current part of chip platforms only supports global positioning system (Global Positioning System, GPS) geofences, which results in that in places where satellite signals are weak, such as indoor, underground garages, etc., geofences cannot be accurately identified, even geofence services cannot be used at all.
Additionally, current geofencing is typically performed by an application processor (Application Processor, AP) within the electronic device, so that the electronic device does not have geofence awareness when the AP is in a dormant scenario, which results in the electronic device not receiving notification regarding geofence traffic when it enters, leaves, or is active within a particular geographic area.
Disclosure of Invention
In order to solve the technical problems, the application provides a method, equipment and a storage medium for processing a geofence, which aim to provide a continuous high-low-power-consumption geofence capability for a chip platform needing to communicate with a low-power-consumption microprocessor of a hardware layer through a kernel.
In a first aspect, the present application provides a method for processing a geofence, where the method is applied to an electronic device, and the electronic device includes a low-power microprocessor, an application processor, and a location information acquisition module. The method comprises the following steps: when the position information acquisition module acquires first position information of the electronic equipment, the low-power consumption microprocessor determines whether the first position information is positioned in a geofence corresponding to the geofence configuration information according to the geofence configuration information recorded in the shared memory; when the first position information is located in the geofence corresponding to the geofence configuration information, the application processor determines an application scene corresponding to the geofence, and activates business operation corresponding to the application scene.
Therefore, the application processor can timely sense the geofence event even if the application processor is in the sleep mode by adopting the low-power-consumption microprocessor which runs on line all the time to sense the geofence event, so that the continuity of the geofence capability is improved, and the power consumption required by the processing service of the geofence is greatly reduced due to the low-power-consumption microprocessor.
In addition, on the basis of the high-continuity and low-power consumption geofence capability, the application processor automatically activates the service operation of the application scene according to the application scene corresponding to the geofence, the user is not required to intervene, the service operation can be completed under the condition that the user does not feel, and the user experience is greatly improved.
According to a first aspect, when the first location information is located in a geofence corresponding to the geofence configuration information, the method further comprises: the low-power-consumption microprocessor generates geofence state change information indicating that the electronic device enters a geofence; the low power microprocessor writes geofence state change information into the shared memory that indicates the electronic device entered the geofence. In this way, the application processor can conveniently learn about the geofence event by writing geofence state change information indicating that the electronic device enters the geofence into the shared memory.
According to the first aspect, or any implementation manner of the first aspect, when the first location information is located in a geofence corresponding to the geofence configuration information, the application processor determines an application scenario corresponding to the geofence, and activates a business operation corresponding to the application scenario, including: when the first position information is located in the geofence corresponding to the geofence configuration information, the application processor acquires geofence state change information from the shared memory, and the geofence state change information indicates that the electronic equipment enters the geofence; an application processor determines an application scene corresponding to the geofence; and the application processor activates the business operation corresponding to the application scene according to the geofence state change information. Thus, according to the geofence state change information, the business operation corresponding to the application scene can be automatically controlled, for example, according to the geofence state change information indicating the electronic equipment to enter the geofence, the business operation corresponding to the application scene is activated.
According to the first aspect, or any implementation manner of the first aspect, after the application processor activates a service operation corresponding to the application scenario according to the geofence state change information, the method further includes: when the position information acquisition module acquires second position information of the electronic equipment, the low-power consumption microprocessor determines whether the second position information is positioned in a geofence corresponding to the geofence configuration information according to the geofence configuration information recorded in the shared memory; and when the second position information leaves the geofence corresponding to the geofence configuration information, the application processor exits the business operation corresponding to the application scene. Thus, after the electronic equipment leaves the matched geofence, the activated business operation can be automatically exited, and long-term occupation of resources is avoided.
According to the first aspect, or any implementation manner of the first aspect, when the second location information leaves the geofence corresponding to the geofence configuration information, the method further includes: the low power microprocessor generating geofence state change information indicating that the electronic device is away from the geofence; the low power microprocessor writes geofence state change information into the shared memory that indicates the electronic device entered the geofence. In this way, by writing geofence state change information indicating that the electronic device is away from the geofence into the shared memory, the application processor can be facilitated to learn about the geofence event.
According to the first aspect, or any implementation manner of the first aspect, when the second location information leaves the geofence corresponding to the geofence configuration information, the application processor exits the business operation corresponding to the application scenario, including: when the second position information leaves the geofence corresponding to the geofence configuration information, the application processor acquires geofence state change information from the shared memory, wherein the geofence state change information indicates that the electronic equipment leaves the geofence; and the application processor exits the business operation corresponding to the application scene according to the geofence state change information. Thus, according to the geofence state change information, the business operation corresponding to the application scene can be automatically controlled, for example, according to the geofence state change information indicating that the electronic equipment leaves the geofence, the business operation corresponding to the application scene is realized.
According to the first aspect, or any implementation manner of the first aspect, when the location information obtaining module obtains the first location information of the electronic device, the low-power microprocessor determines, according to the geofence configuration information recorded in the shared memory, whether the first location information is located before a geofence corresponding to the geofence configuration information, and the method further includes: generating geofence configuration information according to the position information acquired by the position information acquisition module in response to the received geofence adding instruction; the application processor adds the geofence configuration information to the shared memory. Thus, the shared memory is arranged, so that the cooperative operation of the application processor and the low-power-consumption microprocessor in the processing business of the geofence is realized.
According to a first aspect, or any implementation manner of the first aspect, after the application processor adds the geofence configuration information to the shared memory, the method further includes: the application processor sends first notification information to the low-power-consumption microprocessor to inform the low-power-consumption microprocessor that the geofence configuration information is added to the shared memory, wherein the first notification information comprises an identification number of a geofence type corresponding to the geofence configuration information and address information of the geofence configuration information in the shared memory. In this way, the first notification information including the identification number of the geofence type corresponding to the geofence configuration information and the address information of the geofence configuration information in the shared memory is sent to the low-power-consumption microprocessor, so that the low-power-consumption microprocessor can accurately find the corresponding geofence configuration information from the shared memory according to the parameters carried by the first notification information.
According to the first aspect, or any implementation manner of the first aspect, after the application processor sends the notification information to the low power consumption microprocessor, the method further includes: after receiving the first notification information, the low-power-consumption microprocessor acquires corresponding geofence configuration information from the shared memory according to the identification number and the address information; the low-power consumption microprocessor distributes a geofence identification number to the geofence configuration information; the low-power consumption microprocessor sends the geofence identification number to the application processor; and the low-power consumption microprocessor circularly calls the geofence matching function according to the set period, and executes the step of acquiring the position information of the electronic equipment. By assigning each geofence configuration information a geofence identification that can identify its uniqueness, it is facilitated that subsequently generated geofence state change information can explicitly indicate for which geofence configuration information. In addition, the low-power-consumption microprocessor circularly calls the geofence matching function according to a set period to execute the step of acquiring the position information of the electronic equipment, so that the power consumption of the geofence service is reduced, and the low-power-consumption microprocessor which always runs on line can acquire the position information of the electronic equipment in time even if the application processor is in a dormant state by adopting the mode, so that whether the geofence event changes or not is perceived.
According to a first aspect, or any implementation manner of the first aspect, after the low power microprocessor sends the geofence identification number to the application processor, the method further includes: and after receiving the geofence identification number through the polling thread, the low-power microprocessor reports the geofence identification number to an application generating a geofence adding instruction based on a netlink mechanism.
According to a first aspect, or any implementation manner of the first aspect, the location information obtaining module includes any one or more of the following: the system comprises a GPS module for acquiring coordinate information of a current position of the electronic equipment, a WIFI module for acquiring a MAC address and signal strength of a WIFI currently scanned by the electronic equipment, and a Modem module for acquiring a cell base station identification number of a cell scanned by the electronic equipment. Therefore, different position information can be acquired by adopting different position information acquisition modules according to the requirements of users, so that the requirements of the users on accuracy can be met, and the continuity and the power consumption of the geofence business can be considered.
According to a first aspect, or any implementation of the first aspect above, the geofence configuration information includes any one or more of: GPS geofence configuration information, WIFI geofence configuration information, cell geofence configuration information. Therefore, the current position of the electronic equipment can be determined by selecting the geofence configuration information with different geofence dimensions according to the requirements of the user, so that the geofence of the current position of the user can be positioned more accurately, and the accuracy of subsequent activation or exit business is ensured.
In a second aspect, the present application provides an electronic device. The electronic device includes: a memory and a processor, the memory and the processor coupled; the memory stores program instructions that, when executed by the processor, cause the electronic device to perform the instructions of the first aspect or of the method in any possible implementation of the first aspect.
In a third aspect, the application provides a computer readable medium storing a computer program comprising instructions for performing the method of the first aspect or any possible implementation of the first aspect.
In a fourth aspect, the present application provides a computer program comprising instructions for performing the method of the first aspect or any possible implementation of the first aspect.
In a fifth aspect, the present application provides a chip comprising processing circuitry, transceiver pins. Wherein the transceiver pin and the processing circuit communicate with each other via an internal connection path, the processing circuit performing the method of the first aspect or any one of the possible implementation manners of the first aspect to control the receiving pin to receive signals and to control the transmitting pin to transmit signals.
Drawings
FIG. 1 is one of the page views illustratively shown for turning on location services;
FIG. 2 is a second exemplary illustration of a page diagram for turning on a location service;
FIG. 3 is a third exemplary illustration of a page diagram for turning on a location service;
FIG. 4 is a schematic diagram illustrating an exemplary geofence-based intelligent recommendation;
fig. 5 is a schematic diagram illustrating a hardware structure of an electronic device;
FIG. 6 is a schematic diagram of a software architecture of an electronic device shown by way of example;
FIG. 7 is one of exemplary illustrations of interactions based on the software and hardware layers shown in FIG. 6;
FIG. 8 is a second exemplary illustration of an interaction between the software and hardware layers of FIG. 6;
FIG. 9 is a schematic diagram illustrating one geofence processing method applicable to different platforms;
FIG. 10 is a schematic diagram illustrating one method of geofencing processing;
FIG. 11 is one of the schematic views of a scenario illustrating one method of geofence processing;
FIG. 12 is a second schematic view of a scenario illustrating one method of geofence processing;
FIG. 13 is a schematic diagram of an exemplary geofence that determines where a user is based on three geofences.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone.
The terms first and second and the like in the description and in the claims of embodiments of the application, are used for distinguishing between different objects and not necessarily for describing a particular sequential order of objects. For example, the first target object and the second target object, etc., are used to distinguish between different target objects, and are not used to describe a particular order of target objects.
In embodiments of the application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g." in an embodiment should not be taken as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
In the description of the embodiments of the present application, unless otherwise indicated, the meaning of "a plurality" means two or more. For example, the plurality of processing units refers to two or more processing units; the plurality of systems means two or more systems.
In order to better understand the technical scheme provided by the embodiment of the present application, before the technical scheme of the embodiment of the present application is described, an application scenario of the embodiment of the present application is described with reference to the accompanying drawings.
It should be noted that, to implement related services based on the geofence, for example, intelligent switching of the entrance guard and the bus card added in the NFC smart card, the positioning service needs to be started first. Regarding the opening of the location services, in some implementations the opening of the portal to the open location services provided in the settings page may be enabled, in other implementations the opening of the portal to the open location services provided in the notification bar may be enabled. For convenience of description, the procedure of opening a location service provided in a notification bar is taken as an example, and the procedure is described with reference to fig. 1 to 3.
Referring to fig. 1, illustratively, when the user slides down in the arrow direction from the upper edge of the mobile phone while the page 10a (in practice, any page) is currently displayed by the mobile phone, the page 10a is switched to the face 10b in response to the user's operation behavior.
With continued reference to FIG. 1, one or more controls are illustratively included in page 10b, such as a notification option for switching to a notification message page, a switch option for switching to a page of various function switches.
With continued reference to fig. 1, by way of example, when the user slides down in the direction of the arrow from the top edge of the handset, in response to the user's operation, after the page 10a switches to page 10b, defaults to select the notification option, in which the page of the default selected notification option, time, currently unread messages, etc. will be displayed.
With continued reference to FIG. 1, the handset, illustratively, switches from page 10b to page 10c shown in FIG. 2 in response to the user's operational behavior after the user clicks on the switch option in page 10 a.
Referring to fig. 2, exemplary, page 10c includes one or more controls therein, such as a brightness setting option, a Wi-Fi setting option, a bluetooth setting option, a mobile data setting option, a system setting option, a GPS setting option, an auto-rotate setting option, and the like.
With continued reference to fig. 2, by way of example, when the user presses the GPS setting option for a certain period of time, for example, 5s, the handset switches from page 10c to page 10d for turning on the location service in response to the user's operational behavior.
With continued reference to FIG. 2, exemplary page 10d may include one or more controls, such as control 10d-1 for exiting page 10d, control 10d-2 for opening a location service, and control 10d-3 for selecting a location information mode.
For example, in some implementations, the location service may be in a closed state by default, i.e., the control 10d-2 is in the state shown in FIG. 2.
With continued reference to FIG. 2, by way of example, when the user clicks on control 10d-2, the handset turns on the location service in response to the user's operational actions, at which time control 10d-2 changes from the state shown in FIG. 2 to the state shown in FIG. 3.
Therefore, the mobile phone starts the positioning service, the follow-up application and service based on the geofence can realize intelligent service recommendation according to the notification received when the mobile phone enters and leaves the geofence, for example, the corresponding NFC intelligent flash card application can automatically adjust the sequence of the added access control card and riding card according to the event of the geofence under the condition that the user does not feel.
Further, in order to enable the geofence capability to bring more humanized experience to the user, the user needs of the unnecessary user are met, and in the geofence processing method provided by the embodiment, an entry for setting a position information mode is provided for the user.
Referring to fig. 3, illustratively, after the user clicks the control 10d-3, the handset switches from the page 10d to the page 10e for setting the location information mode in response to the user's operational behavior.
With continued reference to FIG. 3, exemplary page 10e may include one or more controls, such as control 10e-1 for pushing out page 10e, control 10e-2 for setting the information location mode to "high accuracy," control 10e-3 for setting the information location mode to "low power consumption," and control 10e-4 for setting the information location mode to "device only.
The "high-accuracy" position information mode refers to determining a position by using three modes of GPS (longitude and latitude coordinates based on a mobile phone), WIFI (WIFI signal (WLAN) scanned by the mobile phone) and Cell (Cell base station (using a mobile network) scanned by the mobile phone) simultaneously; the "low power consumption" location information mode refers to determining location via three ways, WIFI geofencing and Cell geofencing; the location information mode of "device only" refers to determining location using only GPS geofences, i.e., the handset's own latitude and longitude coordinates.
In other implementations, an automatic switching function of the location information mode may be further set, that is, the mobile phone dynamically switches among the three location information modes according to the current electric quantity, the GPS, the WLAN and the usage situation of the mobile network, so that user experience is better improved.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
For example, after the positioning service is started in the manner shown in fig. 1 to 3, if a part of access control and bus taking cards are already added to the NFC smart card application installed in the mobile phone, for example, electronic cards such as a bus card, a cell a access control card, and a cell building access control card shown in fig. 4 and displayed in a certain page 10f of the NFC smart card application.
Referring to FIG. 4, exemplary, a control 10f-1 for exiting the page 10f may also be included in the page 10 f.
In some implementations, for example, when a user starts a smart card function through an NFC smart card application, that is, automatically switches an added electronic card to activate, based on the processing method of a geofence provided by the embodiment of the present application, if the user walks to the gate of cell a, the user does not need to start the NFC smart card application to manually select the access card of cell a, and directly drops a card swiping area where the mobile phone approaches to a device such as an access control, a gate, a card reader, etc., the mobile phone can quickly and accurately determine that the user enters the geofence of cell a, and further notify the NFC smart card application to automatically switch the electronic card to the access card of cell a, thereby completing card swiping.
Accordingly, according to the processing method of the geofence provided by the embodiment of the application, if a user walks to the entrance of the unit building where the user is located, the NFC intelligent flashing card application does not need to be started to manually select the entrance guard card of the unit building, the mobile phone is directly lowered to approach the mobile phone to the card swiping area of equipment such as an entrance guard, a gate, a card reader and the like, the mobile phone can quickly and accurately determine that the user enters the geofence of the unit building, and further the NFC intelligent flashing card application is informed to automatically switch the electronic card to the entrance guard card of the unit building, so that the card swiping is completed.
Accordingly, according to the processing method of the geofence provided by the embodiment of the application, if a user walks to a bus station, the user can quickly and accurately determine that the user enters the geofence of the bus station by directly lowering a mobile phone to a card swiping area of equipment such as an entrance guard, a gate, a card reader and the like without starting an NFC intelligent flashing card application to manually select a bus card, and further the NFC intelligent flashing card application is informed to automatically switch an electronic card to the bus card, so that the card swiping is completed.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
In addition, it should be noted that, the names and numbers of the controls displayed on the display interface of the electronic device and the names and numbers of the controls in the drop-down notification bar in the drawings related to fig. 1 to 4 and the description of the following embodiments are merely illustrative examples, and the present application is not limited thereto.
In addition, it can be understood that in the description of the embodiments of the present application, a mobile phone is taken as an example for illustration, and in other embodiments, the present application is also applicable to electronic devices that provide positioning services, such as tablet computers, wearable devices, and the like.
In order to better describe the processing of the geofence provided by the embodiment of the present application, the following describes a hardware structure and a software structure of an electronic device to which the embodiment of the present application is applicable with reference to the accompanying drawings.
Fig. 5 is a schematic diagram illustrating a hardware structure of an electronic device. Referring to fig. 5, the electronic device 100 may include: processor 110, external memory interface 120, internal memory 121, universal serial bus (universal serial bus, USB) interface 130, charge management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headset interface 170D, sensor module 180, keys 190, motor 191, indicator 192, camera 193, display 194, and subscriber identity module (subscriber identification module, SIM) card interface 195, etc.
By way of example, in some implementations, the sensor module 180 may include a pressure sensor, a gyroscope sensor, a barometric sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc., which are not to be limiting in any way.
Furthermore, it should be noted that the processor 110 may include one or more processing units, for example: 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 memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
It is understood that the controller may be a neural hub and command center of the electronic device 100. In practical application, the controller can generate operation control signals according to the instruction operation codes and the time sequence signals to complete instruction fetching and instruction execution control.
In addition, it should be noted that, in particular, in the technical solution provided in the embodiment of the present application, in order to reduce power consumption of the geofence service, and solve the problem that when the AP is in the sleep mode, the geofence service cannot be processed, and thus the continuity of the geofence capability is poor, the processing 110 of the electronic device 100 suitable for the embodiment of the present application needs to further include a microprocessor with low power consumption, such as an intelligent sensor hub (sensor hub).
As can be appreciated, sensor hub is a solution based on a combination of software and hardware on a low power micro control unit (Microcontroller Unit, MCU) and a lightweight Real-time operating system (Real-time operating system, RTOS), the main function of which is to connect and process data from various sensor devices, signal acquisition devices (e.g. WIFI module/chip, GPS module/chip, modem processor (modem), etc.). Therefore, the embodiment of the application processes the geofence information by introducing the sensor hub, so that the power consumption of the geofence service can be greatly reduced, and meanwhile, the geofence information can be processed uninterruptedly when the AP is in the sleep mode, so that the continuity of the geofence capability is ensured.
It should be noted that, a memory may be further provided in the processor 110 for storing instructions and data. In some implementations, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
For example, in some implementations, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
With continued reference to fig. 5, the exemplary charge management module 140 is operable to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging implementations, the charge management module 140 may receive a charging input of the wired charger through the USB interface 130. In some wireless charging implementations, 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.
With continued reference to fig. 5, an exemplary power management module 141 is used to connect the battery 142, 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 implementations, the power management module 141 may also be provided in the processor 110. In other implementations, the power management module 141 and the charge management module 140 may also be disposed in the same device.
With continued reference to fig. 5, exemplary wireless communication functions 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 to transmit and receive 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 implementations, the antenna may be used in conjunction with a tuning switch.
With continued reference to fig. 5, the exemplary mobile communication module 150 may provide a solution for wireless communications, including 2G/3G/4G/5G, as 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 implementations, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some implementations, at least some of the functional modules of the mobile communication module 150 may be disposed in the same device as at least some of the modules of the processor 110.
In addition, the modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or video through the display screen 194. In some implementations, the modem processor may be a stand-alone device. In other implementations, the modem processor may be provided in the same device as the mobile communication module 150 or other functional module, independent of the processor 110.
For example, in particular to the technical solution provided in the embodiments of the present application, when the selected location information mode needs to rely on the dimension of the Cell geofence to determine the location, the sensor hub may determine the Cell geofence event by processing the Cell base station signal received by the modem processor, such as entering a certain Cell geofence, or leaving a certain Cell geofence.
With continued reference to fig. 5, exemplary 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, WIFI) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc., as applied to 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.
In an exemplary embodiment, when the selected location information mode needs to rely on the dimension of the WIFI geofence to determine the location, the sensor hub may determine a WIFI geofence event by processing the WIFI signal scanned by the WIFI module, for example, entering a certain WIFI geofence, or leaving a certain WIFI geofence.
In an exemplary embodiment, when the selected location information mode needs to rely on the dimension of the GPS geofence to determine the location, the sensor hub may determine the GPS geofence event, such as entering a GPS geofence or leaving a GPS geofence, by processing the longitude and latitude coordinates determined by the GPS module via the GNSS.
In addition, it should be noted that the electronic device 100 implements the display function through the GPU, the display screen 194, the 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.
With continued reference to fig. 5, exemplary display 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 (liquid crystal display, LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED) or an active-matrix organic light-emitting diode (matrix organic light emitting diode), a flexible light-emitting diode (flex), a mini, a Micro led, a Micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some implementations, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
In addition, it should be noted that the electronic device 100 may implement a photographing function through an ISP, a camera 193, a video codec, a GPU, a display 194, an application processor, and the like.
In addition, the ISP is used to process data fed back from 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 implementations, the ISP may be provided in the camera 193.
In addition, it is also noted that the camera 193 is used for capturing still images or videos. 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 implementations, the electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
In addition, the digital signal processor is used to process digital signals, and may process other digital signals in addition to 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.
Furthermore, it should be noted that video codecs are used for compressing or decompressing 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.
With continued reference to fig. 5, an exemplary external memory interface 120 may be used to interface with 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.
With continued reference to fig. 5, by way of example, the internal memory 121 may be used to store computer executable program code that includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like.
In addition, it should be further noted that the electronic device 100 may implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playing, recording, etc.
In addition, it should be noted that the audio module 170 is configured to convert digital audio information into an analog audio signal output, and also configured to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some implementations, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
With continued reference to fig. 5, exemplary 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.
With continued reference to fig. 5, exemplary, motor 191 may generate a vibration alert. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects by touching different areas of the display screen 194. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
With continued reference to fig. 5, the indicator 192 may be, for example, an indicator light, may be used to indicate a state of charge, a change in charge, may be used to indicate a message, missed call, notification, or the like.
As to the hardware architecture of the electronic device 100, it should be understood that the electronic device 100 shown in fig. 5 is merely an example, and in particular implementations, the electronic device 100 may have more or fewer components than shown, may combine two or more components, or may have different component configurations. The various components shown in fig. 5 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
To better understand the software structure of the electronic device 100 shown in fig. 5, and to implement the process of implementing the geofence by the sensor hub, the software structure of the electronic device is improved, and the software structure of the electronic device 100 is described below. Before explaining the software structure of the electronic device 100, an architecture that can be adopted by a software system of the electronic device 100 will be first described.
Specifically, in practical applications, the software system of the electronic device 100 may employ a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
Furthermore, it is understood that software systems currently used by mainstream terminal devices include, but are not limited to, windows systems, android systems, and iOS systems. For convenience of explanation, the embodiment of the present application takes an Android system with a layered architecture as an example, and illustrates a software structure of the electronic device 100.
In addition, the processing scheme of the geofence provided in the following embodiments of the present application is applicable to other systems in specific implementations.
Referring to fig. 6, fig. 6 is a block diagram of a software structure and hardware layers of the electronic device 100 according to an embodiment of the present application.
As shown in fig. 6, the layered architecture of the electronic device 100 divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through a software interface. In some implementations, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun row (Android run) and system libraries, a hardware abstraction layer, and a kernel layer, respectively.
The application layer may include a series of application packages, among other things. As shown in fig. 6, the application package may include, for example, NFC smart cards, settings, WLAN (WIFI), cameras, maps, music, etc. applications, which are not listed here, but are not limiting.
It should be noted that, in the embodiment of the present application, only the NFC smart card application capable of adding various electronic cards is shown in the application layer, and if different electronic cards have special applications in practical applications, the application layer may also include other applications based on the geofence characteristic, such as a health code application, a subway code application, etc., which are not listed here, and the present application is not limited thereto.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for application programs of the application layer.
Wherein the application framework layer comprises a number of predefined functions. As shown in FIG. 6, the application framework layer may include a resource manager, notification manager, view system, phone manager, location services required by the present embodiment to implement the geofence service, etc., which are not explicitly recited herein, and the present application is not limited in this regard.
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like, which are not listed here, but are not limiting.
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 a notification manager, is used to inform that a certain geofence is currently entered, 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. In particular, in the technical scheme provided by the embodiment of the application, various user interfaces are realized by a display system.
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 location service, also called location service, is a value-added service provided by combining a mobile communication network and a satellite positioning system, obtains location information (such as longitude and latitude coordinate data) of electronic equipment through a group of positioning technologies, and provides the location information to a mobile user or other people and the communication system to realize various services related to the location.
Android run time includes a core library and virtual machines. Android run is responsible for scheduling and management of the Android system.
The core library consists of two parts: 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 a virtual machine. The virtual machine executes java files of the application program layer and the application program 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 Libraries), three-dimensional graphics processing library (e.g., openGL ES), 2D graphics engine (e.g., SGL), etc., which are not explicitly recited herein, the application is not limited in this regard.
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.
It will be appreciated that the 2D graphics engine described above is a drawing engine for 2D drawing.
The hardware abstraction layer (HAL layer) is an interface layer located between the operating system kernel and the hardware circuitry, which aims at abstracting the hardware. The hardware interface details of a specific platform are hidden, and a virtual hardware platform is provided for an operating system, so that the operating system has hardware independence, and can be transplanted on various platforms. From the perspective of software and hardware testing, the software and hardware testing work can be completed based on the hardware abstraction layer, thereby enabling the parallel execution of the software and hardware testing work.
Referring to fig. 6, the hardware abstraction layer may include, for example, an NFC abstraction layer, a location abstraction layer, and the like.
The NFC abstract layer is a hardware abstract layer corresponding to an NFC chip/module which is depended on when the NFC intelligent flash card application is used, and the positioning abstract layer is a hardware abstract layer required when the geofence service is realized.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment. In practical application, the hardware abstraction layer also comprises abstraction layers corresponding to other hardware.
Furthermore, it can be appreciated that the kernel layer in the Android system is a layer between hardware and software. The kernel layer at least comprises a display driver, a camera driver, an audio driver, a sensor driver, and an NFC driver, a WIFI driver, a GPS driver and the like which can be used by the embodiment of the application.
In addition, it should be noted that, in order to implement the technical solution provided by the embodiment of the present application, that is, the processing process of the AP to the signals scanned by Modem, WIFI, GPS in the hardware layer (the process of determining the corresponding geofence) is completed by the sensor hub that is low in power consumption and is always online after the electronic device is started, the kernel layer also needs to include an ioctl processing framework, a message notification framework and a shared memory read-write framework.
The ioctl processing framework is used for providing a geofence configuration information adding interface which can be called by the positioning abstract layer; the shared memory read-write frame is used for providing an interface for accessing the shared memory; the message notification framework is used to provide an interface to send messages to the Sensorhub.
For example, after the interface for adding the geo-location configuration information provided by the ioctl processing framework is invoked by the positioning abstraction layer, the kernel for processing the geo-fence service writes the geo-fence configuration information to be added into the shared memory through a write interface provided by the shared memory read-write framework, and notifies the sensor hub of writing the geo-fence configuration information into the shared memory through an interface provided by the message notification framework for sending a message to the sensor hub.
In order to better understand the technical solution provided by the embodiments of the present application, the following describes specific improvements made by the kernel layer in conjunction with fig. 7 and fig. 8, and interactions made by the hardware abstraction layer, the kernel layer and the hardware layer when implementing the geofence service.
It should be noted that, in practical applications, the kernel layer of the electronic device generally processes not only one service of the geofence, but also other services, such as an augmented reality (Augmented Reality, AR) service, an audio/video service, etc., so in order to ensure the normal operation of each service, each service generally corresponds to a kernel device node, which is used to indicate which address in the kernel is used to process the corresponding service.
It can be understood that the kernel device node corresponding to each service indicates different starting addresses of the kernel, so that the hardware abstraction layer corresponding to different services establishes connection with the kernel device node corresponding to the service, and when the subsequent needs of the kernel to process the service, the kernel for processing the service can be quickly and accurately found according to the kernel device node.
Based on this, in order to implement the technical solution provided by the embodiments of the present application, the kernel layer needs to create a kernel device node for processing the processing service of the geofence provided by the embodiments of the present application. In addition, to decouple from other traffic, the kernel layer needs to create a kernel thread (referred to herein as a poll thread) that is dedicated to the kernel device node that receives the processing traffic sent by Sensorhub to the geofence in the hardware layer.
Referring to fig. 7, in an exemplary embodiment, in the technical solution provided in the embodiment of the present application, during an initialization stage of a kernel layer, a polling thread may be created first (performing step 1 in fig. 7), and then a kernel device node may be created (performing step 2 in fig. 7).
Illustratively, in some implementations, the creation of the polling thread may be accomplished through a kthread_run () function.
It will be appreciated that the kernel thread is working in kernel space, does not belong to any process, and may sleep, but will be reactivated once a message is received, so even if the AP enters into sleep mode, the polling thread created in step 1 will activate the reception and wake up the AP as long as the sensor hub sends a message. In this way, even if the AP is in the sleep mode, the processing of the geofence service can be realized through the sensor hub, and the AP is awakened when the AP is needed to be intervened, so that the continuity of the geofence capability is ensured.
In addition, it should be noted that, the kthread_run () function used for creating the polling thread is specifically a function for creating and starting the polling thread, that is, the polling thread is directly started after being created, and other functions are wirelessly invoked to implement a starting operation.
Furthermore, in other implementations, the polling thread may be created by a kthread_create () function. With respect to the kthread_create () function, specifically, only one polling thread is created, but not started. If the polling thread is started, a wake_up_process () function also needs to be called to start the polling thread.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
Furthermore, it should be noted that with respect to the creation of the kernel device node, in some implementations this may be accomplished, for example, by calling a risc register () function.
For example, to distinguish the processing traffic of a geofence from other traffic, the path of the core device node corresponding to the processing traffic of the geofence may be designated "/dev/AAA".
With continued reference to fig. 7, after steps 1 and 2 are completed, an exemplary connection between the location abstraction layer (the hardware abstraction layer corresponding to the location service in the application framework layer, and a process corresponding to the location service in the hardware abstraction layer) and the kernel device node created through step 2 may be established.
Illustratively, regarding locating the connection of the abstraction layer with the kernel device node, in some implementations, an open () function may be passed, for example.
Specifically, when the open () function is used to establish a connection between the localization abstraction layer and the kernel device node, it is necessary to use the path "/dev/AAA" pointed by the kernel device node as a parameter and set the authority. For example, open (/ dev/AAA, O_RDWR) represents that the localization abstraction layer is connected to the kernel device node whose path is "/dev/AAA" and opens the right to read and write the kernel device node.
Further, after the connection between the positioning abstract layer and the kernel device node is established by using the open () function, the file handle of the kernel device node is returned to the positioning abstract layer (the file handle of the kernel device node corresponding to the processing service of the geofence is represented as AAAFd in the following).
It should be noted that, in the above-mentioned AAAFd, a correlation function of the access kernel device node is recorded, for example, a correlation function provided by the ioctl processing framework in fig. 7 (such as a function/interface for adding geofence configuration information), a correlation function provided by the shared memory read-write framework (such as a function/interface for writing data into the shared memory, a function/interface for reading data from the shared memory), and a correlation function provided by the message notification framework (such as a function/interface for sending a message to the sensor hub).
With continued reference to fig. 7, since the AAAFd records the related function (callable frame) of the access kernel device node, after the positioning abstraction layer receives the geofence configuration information to be added (step 4 in fig. 7) transmitted by the application framework layer, the interface for adding the geofence configuration information provided by the ioctl processing frame is called according to the related function of the access kernel device node recorded by the AAAFd of the kernel device node, and the geofence configuration information to be added is transmitted to the kernel pointed by the kernel device node (step 5 in fig. 7).
With continued reference to fig. 7, the exemplary kernel pointed to by the kernel device node, upon receiving the geofence configuration information transmitted from the location abstraction layer, invokes the write interface provided by the shared memory read-write framework to write the geofence configuration information into the shared memory (step 6 in fig. 7), and after writing the geofence configuration information into the shared memory, invokes the interface provided by the message notification framework to send a message to the sensor hub to write the geofence configuration information (step 7 in fig. 7), i.e., notifies the sensor hub that the geofence configuration information has been written into the shared memory.
In addition, the related function (callable framework) of the access kernel device node of the AAAFd record of the kernel device node corresponding to the processing service of the geofence in the kernel layer needs to be created in advance. The specific creation process is as follows:
Illustratively, with respect to the ioctl processing framework, it may be implemented, for example, by an aaa_ioctl (struct file, unsigned int cmd, unsigned long arg) function. Wherein "struct file" indicates that the file structure is file, representing an open file, and each open file in the system has an associated "struct file" in kernel space; "cmd" indicates a number corresponding to a certain service, and "arg" indicates a start address of a configuration parameter corresponding to a certain service, etc.
It should be noted that, in a computer, an input/output control framework (ioctl) is a system call dedicated to input/output operations of a device, and the call is sent into a request code related to the device, and the function of the system call depends entirely on the request code.
Furthermore, since geofences can be divided into three dimensions, GPS geofences, WIFI geofences, and Cell geofences, geofences of different dimensions (types) can correspond to different cmd, as well as the starting address of different configuration parameters. Taking the example of adding a WIFI geofence, cmd can be 1, and arg is the MAC address of the WIFI of a certain WIFI and the starting address of configuration parameters such as the received signal (RSSI) strength.
In addition, it should be further noted that, in order to implement flexible configuration of a specific product, quick service shielding and expansion can be implemented, and use of different service functions can be determined in the aaa_ioctl () function body through macro switches, for example, an interface for adding WIFI geofence configuration information, an interface for adding GPS geofence configuration information, and an interface for adding Cell geofence configuration information are respectively set in different macro switches, so that an adding service of corresponding geofence configuration information can be implemented by defining the macro switches including the interfaces for adding different geofence configuration information.
For example, "# ifdef AAA WIFIFENCE" is defined in the AAA ioctl () function volume, indicating that the ioctl processing framework provides an interface to add WIFI geofence configuration information.
Also for example, "# ifdef aaa_gpsfence" is defined in the aaa_ioctl () function body, it is indicated that the ioctl processing framework provides an interface to add GPS geofence configuration information.
Also for example, "# ifdef AAA CELLFENCE" is defined in the AAA ioctl () function volume, it is indicated that the ioctl processing framework provides an interface to add Cell geofence configuration information.
Also for example, "# ifdef AAA CELLFENCE" is defined in the AAA ioctl () function body, it is indicated that the ioctl processing framework provides an interface to add Cell geofence configuration information, and further that different geofence configuration information interfaces can also be defined in the macro switch.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
The shared memory read-write framework is configured based on the shared memory channels of the kernel and the sensor hub. Specifically, first, the starting address and the memory block size of the shared memory are set for the processing service of the geofence, and then the read shared memory function and the write shared memory function are newly developed.
It will be appreciated that the read shared memory function, in particular the geofence state change data provided to the kernel to read the sensorub from the shared memory and write it to the shared memory. So-called geofence state change data indicates which geofence configuration information added to the shared memory the electronic device entered or exited.
The write shared memory function is specifically an interface for providing the kernel to write the geofence configuration information transmitted by the positioning abstraction layer into the shared memory.
The message notification framework is configured based on the bi-directional communication channels of the kernel and the sensor hub. Specifically, cmd information for identifying different types of geofences (GPS geofences, WIFI geofences and Cell geofences) is firstly set in the two-way communication channel, and then the data length of configuration information for identifying the different types of geofences is set in the two-way communication channel, so that the kernel can send a message to inform which type of geofence, and the length of the geofence configuration information is added into shared content. Accordingly, upon receiving the message, the Sensorhub can read the correct geofence configuration information from the shared memory based on the cmd and the data length of the configuration parameters.
In addition, it should be further noted that, in order to implement the technical solution provided by the embodiment of the present application, a reliability mechanism (hereinafter referred to as DFR mechanism) between the kernel and the sensor hub needs to be created. Regarding the implementation of the DFR mechanism, it is possible to listen for a restart event of the sensor hub by registering an aaa_notify_chain_register () function at the kernel, for example. Thus, by this mechanism, the kernel can be quickly perceived when a restart occurs in the sensorub.
In addition, it should be noted that, in the technical solution provided in the embodiment of the present application, the kernel cannot use the interface function provided by the ioctl processing framework in the application framework layer to feed back the message of writing the sensorub into the shared memory and the message of restarting the monitored sensorub to the positioning abstraction layer, so in order to implement the technical solution provided in the embodiment of the present application, the kernel adopts the Netlink mechanism to notify the positioning abstraction layer. For example, the setting kernel may report geofence state change data reported by SensorHub (steps 8 to 10 in fig. 9) and a restart event of SensorHub to the location abstraction layer through a genlmsg_unique () function, so that the location abstraction layer can notify the NFC smart card application in the application layer through the location service of the application framework layer, for the NFC smart card application to perceive and re-add the geofence configuration information.
Regarding the software structure of the electronic device 100, and the improvement of the kernel layer for implementing the technical solution provided in the embodiment of the present application, it will be understood that the layers and the components included in the layers in the software structure shown in fig. 6 do not constitute a specific limitation of the electronic device 100. In other embodiments of the application, electronic device 100 may include more or fewer layers than shown and may include more or fewer components per layer, as the application is not limited.
As can be seen from the description of the scenario, the hardware structure and the software structure to which the technical solution provided by the embodiment of the present application is applied, the technical solution provided by the embodiment of the present application does not need the processing capability of the geofence of the AP of the chip platform, and by introducing a low-power and lightweight sensor hub and adding an ioctl processing frame, a message notification frame and a shared memory read-write frame in the kernel layer, the sensor hub communicates with the kernel layer to which the ioctl processing frame, the message notification frame and the shared memory read-write frame are added, thereby realizing the cross-platform geofence processing capability.
In addition, it should be noted that, the technical solution provided in this embodiment is mainly aimed at a chip platform that needs to communicate with a sensor hub of a hardware layer through a kernel.
In addition, it should be noted that, in this embodiment, the WIFI geofence matching function, the Cell geofence matching function, and the GPS geofence matching function implemented by sensorub are independent of each other, i.e. do not affect each other. Therefore, by providing a communication mechanism for sharing memory read-write data, information notification, abnormal monitoring and the like between the kernel layer and the sensorub, products of different platforms can be quickly accessed into the sensorub with low power consumption, and a WIFI geofence matching function, a Cell geofence matching function and a GPS geofence matching function are selectively used through a macro switch. That is, the present embodiment avoids the work of implementing mechanisms such as kernel and sensor hub communication by encapsulating a common framework that can be reused, such as an ioctl processing framework, a shared memory read-write framework, and a message notification framework, so that the kernel layer feature development work can be greatly reduced.
In addition, through the reusable kernel layer public framework, products which support Sensorhub and realize WIFI geofence capability, GPS geofence capability and Cell geofence capability are enabled to be transplanted directly on the kernel layer, and the reusable kernel layer public framework packaged in the embodiment is enabled to be integrated with the processing capability of the geofence provided by the embodiment rapidly and conveniently, so that the coverage of the technical scheme provided by the embodiment is greatly improved.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
In combination with the above-mentioned scenario, and the hardware structure and the software structure of the electronic device, the implementation details of the technical solution provided by the present application will be described below by taking the geofence, which is a WIFI geofence, as an example, and the following details are provided only for understanding, but are not necessary to implement the present embodiment.
It should be noted that the processing scheme of the geofence provided in this embodiment is roughly divided into three stages. The first phase is an initialization phase; the second phase is a phase of adding geofence configuration information; the third phase is the matching phase of the geofence. The initialization stage is that an electronic device which is provided with an application which needs to realize corresponding service based on the geofence, for example, when a mobile phone is started, functional modules/functions/applications in each software layer and hardware of the mobile phone need to be initialized, so that the functional modules/functions/applications can be normally accessed and used; the so-called geofence configuration information adding stage is to add the geofence configuration information corresponding to each electronic card through an application which needs to realize corresponding services based on the geofence, such as an NFC intelligent flash card application, so that the NFC intelligent flash card application can realize automatic switching of different electronic card sequences and activated services based on the geofence; and the matching stage of the geofence is to determine whether the current position of the mobile phone is in the geofence corresponding to the added geofence configuration information, so as to trigger a geofence event and realize the activation of the corresponding service.
For convenience of explanation, the embodiment takes the application that needs to implement the corresponding service based on the geofence as the NFC smart card application as an example, and the three stages from the initialization stage to adding WIFI geofence configuration information and performing WIFI geofence matching are specifically explained.
An initialization stage:
referring to fig. 10, for example, after the mobile phone is started, the NFC smart card application located in the application layer, the location service (lbs device) located in the application framework layer, the location abstraction layer corresponding to the location service (or a process corresponding to the location service) located in the hardware abstraction layer, the kernel located in the kernel layer for processing the geographic location service, and the sensor hub located in the hardware layer with low power consumption and always on line, the WIFI module for scanning the MAC address and the signal strength of WIFI, and the Modem (hotspot WIFI) may sequentially complete the initialization operation, and for the initialization manner of these functions/services/modules, reference may be made to the existing standard, which will not be repeated herein.
With continued reference to fig. 10, exemplary, after the initialization of the NFC smart card application and the location service is completed, in order to ensure that the NFC smart card application can implement a corresponding service based on the geofence, the NFC smart card application needs to be connected with the location service to ensure that the NFC smart card application can invoke the location service, thereby having the capability of adding the geofence configuration information and obtaining the geofence matching result.
For example, in some implementations, the association operation between the NFC smart card application and the location service may be that after both the NFC smart card application and the location service are initialized, the NFC smart card application invokes an association function to initiate an association request to the location service. Accordingly, after receiving a connection establishment request initiated by the NFC intelligent flash card application, the location service calls a corresponding response interface to respond, so that connection establishment between the NFC intelligent flash card application and the location service is completed.
For example, in other implementations, the association operation between the NFC smart card application and the location service may be completed during the initialization process of the NFC smart card application and the location service. For example, by integrating the build-up function in the initialization function/code of the NFC smart card application, in the process of running the initialization function, when the initialization function is run to the location of the build-up function, the NFC smart card application will call the build-up function to initiate a build-up request to the location service. Accordingly, a function responding to the connection establishment request can be integrated in the initialization function/code of the location service, so that when the connection establishment request initiated by the NFC intelligent flash card application through the establishment function is received in the operation process of the initialization function, the connection establishment between the NFC intelligent flash card application and the initialization function can be completed through responding to the corresponding response function.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
The step of adding geofence configuration information:
it should be noted that, at this stage, the user is required to provide an address identification number (MAC address of WIFI) of the WIFI geofence configuration information to be added and signal strength information of WIFI corresponding to the MAC address of WIFI through an entry of adding the WIFI geofence configuration information provided by the NFC smart card application, so that after the user clicks a determination button of the user interface, the mobile phone receives a geofence adding instruction, and further, in response to an operation behavior of the user, obtains the MAC address of WIFI provided by the user and the signal strength information of the corresponding WIFI signal, and further generates the WIFI geofence configuration information.
In addition, it should be further noted that, in this embodiment, the kernel that processes the geofence service is still an application processor because the kernel in the kernel layer is not adjusted, so the generated WIFI geofence configuration information is added to the shared memory by the application processor according to the MAC address of the WIFI provided by the user and the signal strength information of the corresponding WIFI signal.
With continued reference to fig. 10, the process of adding WIFI geofence configuration information to shared memory by an application processor requires a location service through an application framework layer, a location abstraction layer of a hardware abstraction layer, to reach the kernel that handles the geofence traffic.
With continued reference to fig. 10, by way of example, when the mobile phone responds to the operation behavior of the user, and obtains the MAC address of the WIFI and the signal intensity information of the corresponding WIFI signal provided by the user, and further generates the WIFI geofence configuration information, an add function for adding the WIFI geofence configuration information supported by the location service, for example addWifiFence () may be invoked, and the WIFI geofence configuration information, that is, the MAC address of the WIFI and the signal intensity information of the corresponding WIFI signal, may be transmitted to the location service as parameters.
Accordingly, after obtaining the WIFI geofence configuration information provided by the NFC smart card application, the location service invokes an add function of the WIFI geofence configuration information supported by the positioning abstraction layer, for example addWifiFence (), and transmits the WIFI geofence configuration information, that is, the MAC address of the WIFI and the signal strength information of the corresponding WIFI signal, as parameters to the positioning abstraction layer.
Accordingly, after obtaining the configuration information of the WIFI geofence, the positioning abstraction layer determines ioctl (addWifiFence) functions provided by the ioctl processing framework as functions for adding the configuration information of the geofence according to file handles AAAFd provided by kernel equipment nodes (corresponding kernels are used for processing the geofence service) connected with the positioning abstraction layer in the kernel layer, and then transmits the configuration information of the WIFI geofence, namely the MAC address of the WIFI and signal intensity information of corresponding WIFI signals, as parameters to the kernels for processing the geofence service.
Accordingly, after receiving the WIFI geofence configuration information required to be added to the shared memory, the kernel for processing the geofence service writes the WIFI geofence configuration information into the shared content through a write interface provided by a newly added shared memory read-write frame in the kernel layer, and then sends notification information to the low-power microprocessor sensor hub through a notification interface provided by a newly added message notification frame in the kernel layer, so as to inform the sensor hub that the WIFI geofence configuration information is added to the shared memory.
Illustratively, in some implementations, the notification information sent by the kernel to the sensor hub carries a number (identification information cmd) that indicates that a service corresponds to, and the length of the configuration information data for that service.
Accordingly, after receiving the notification message sent by the kernel, the sensor hub finds out the matched geofence configuration information from the shared memory according to the cmd and the length of the configuration information data of the service, such as the WIFI geofence configuration information added to the shared memory, and starts the geofence matching function.
It can be understood that the geofence matching function specifically refers to a geofence matching function capable of circularly acquiring information such as a MAC address and signal strength of WIFI currently scanned by the electronic device according to a set period.
For example, in this embodiment, the geofence matching function initiated by the sensor hub may be a function implementing a WIFI matching algorithm when the sensor hub determines that the geofence configuration information is WIFI geofence configuration information by parsing the geofence configuration information found in the shared memory.
With continued reference to fig. 10, for example, in order to obtain, according to a set period, information such as a MAC address and a signal strength of a WIFI currently scanned by an electronic device, a sensor hub may send a request for scanning information such as a MAC address and a signal strength of the WIFI to a WIFI module and/or a Modem module, so that the WIFI module and/or the Modem module may scan information such as a MAC address and a signal strength of the WIFI according to the set period, or scan information such as a MAC address and a signal strength of the WIFI when the information such as the MAC address and the signal strength of the WIFI changes.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
In addition, it should be noted that, in order to distinguish different geofence configuration information, the sensor hub analyzes the geofence configuration information searched from the shared memory, determines the type corresponding to the geofence configuration information, allocates a unique geofence identification number for the current geofence configuration information, and feeds back the allocated geofence identification number to the NFC smart card application, so as to inform that the geofence configuration information is successfully added.
For example, when the determined geofence configuration information is WIFI geofence configuration information, the assigned geofence identification number may be, for example, a WIFI fence id. For example, for WIFI geofence configuration information with MAC address "XXX1" and signal strength "XXX2", the geofence identification number assigned thereto may be "WIFI fenid 1", for example.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
With continued reference to fig. 10, exemplary, after the sensor hub assigns a corresponding wifitenclid to the determined WIFI geofence configuration information, the wifitenclid is sent to the kernel. From the above description, a polling thread (as shown in fig. 7) for receiving the sensor hub and sending the same to the kernel is created in the kernel, so that the polling thread may find the wififunclid sent by the sensor hub, and then transmit the wififunclid to the location abstraction layer based on the netlink mechanism.
Accordingly, after the positioning abstraction layer receives the WifiFencId reported by the kernel, a function with successful addition of the geofence configuration information supported by the location service is called, such as a function WifiFeencAddCb () with successful addition of the WIFI geofence configuration information in FIG. 10, and the WifiFencId is used as a parameter to be transmitted to the NFC intelligent flash card application. Therefore, the NFC intelligent flash card application can acquire that the WIFI geofence configuration information generated according to the MAC address of the WIFI provided by the user and the signal intensity information of the corresponding WIFI signal is successfully added.
For example, in some implementations, to facilitate the user to know whether the addition of the geofence configuration information is successful, the NFC smart card application may be configured to display a prompt for the successful addition of the geofence configuration information on the display interface after receiving the wifitencid.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
Matching stage of geofence:
specifically, in the geofence configuration information adding stage, the sensor hub new process requests the Modem module and/or the WIFI module to scan the MAC address and the signal strength of WIFI, so when the user walks to a certain location, for example, a location attachment of the cell a access control in fig. 10, the Modem module and/or the WIFI module may be connected to the MAC address and the signal strength of WIFI provided by the cell a access control.
With continued reference to fig. 10, for example, after the Modem module and/or the WIFI module scans the MAC address and the signal strength of WIFI, the scanned MAC address and signal strength of WIFI is sent to the sensor hub.
It can be appreciated that, as the sensor hub initiates the geofence matching function in the stage of adding the geofence configuration information, the function for implementing the WIFI matching algorithm is invoked, for example, initially. Therefore, after receiving the current position information of the MAC address and signal strength of the WIFI scanned by the Modem module and/or the WIFI module, the mobile phone determines whether the current position information of the mobile phone is located in a geofence (WIFI geofence) corresponding to any one of the WIFI geofence configuration information in the shared memory according to the geofence configuration information recorded in the shared memory, specifically, the WIFI geofence configuration information recorded in the shared memory in this embodiment.
For example, regarding the manner of determining whether the acquired location information is located in the WIFI geofence corresponding to the WIFI geofence configuration information according to the WIFI geofence configuration information recorded in the shared memory, in some implementations, for example, the manner may be: firstly, determining whether the geofence corresponding to the acquired position information is matched with the WIFI geofence corresponding to any WIFI geofence configuration information recorded in the shared memory by the Sensorhub.
Accordingly, when the geofence corresponding to the location information matches the geofence corresponding to the geofence configuration information recorded in the shared memory, the sensor hub may determine that the location information is located in the geofence corresponding to the geofence configuration information; otherwise, it is determined that the location information is not located in the geofence corresponding to the geofence configuration information.
It should be noted that, regarding whether the geofence corresponding to the location information matches the WIFI geofence corresponding to any WIFI geofence configuration information recorded in the shared memory, a certain matching threshold may be set in some implementations. For example, when the degree of matching between the two is 80%, the matching is determined.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
In addition, in order to enable the application program layer to implement the application of the corresponding service based on the geofence, different operations can be implemented based on different geofence events, such as entering the geofence or leaving the geofence, after the sensor hub determines that the geofence corresponding to the location information matches the geofence corresponding to the geofence configuration information recorded in the shared memory, the geofence state change information corresponding to the geofence needs to be written into the shared memory, specifically, in this embodiment, the WIFI geofence state change information corresponding to the WIFI geofence is written.
It should be noted that, in this embodiment, the WIFI geofence status change information written into the shared memory is specifically used to instruct the mobile phone to enter the WIFI geofence or leave the WIFI geofence.
Illustratively, if the geofence status information written is for a GPS geofence, it is used to instruct the handset to enter the GPS geofence, or to leave the GPS geofence.
Illustratively, if the geofence status information written is for a Cell geofence, it is used to instruct the handset to enter the Cell geofence, or to leave the Cell geofence.
Furthermore, it should be noted that in some implementations, entry into a corresponding geofence may be indicated by "Y" or "1" and exit from a corresponding geofence may be indicated by "N" or "0", for example.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
Accordingly, when the position information is determined to be located in the geofence corresponding to any geofence configuration information in the shared memory, an application processor determines an application scene corresponding to the geofence, and activates business operation corresponding to the application scene.
For example, regarding determining, by the application processor, an application scenario corresponding to the geofence and activating a business operation corresponding to the application scenario, in some implementations, for example, when the location information is located in the geofence corresponding to the geofence configuration information, the application processor determines, first, the application scenario corresponding to the geofence and obtains the geofence state change information from the shared memory; and then activating the business operation corresponding to the application scene by the application processor according to the geofence state change information, namely determining whether the electronic equipment enters the geofence or not by the application processor according to the geofence state change information, and activating the business operation corresponding to the application scene by the application processor when the electronic equipment enters the geofence.
In addition, it should be further noted that, after the service operation corresponding to the application scenario is activated, if the geofence state change information is received again, and the received geofence state change information indicates that the mobile phone leaves the geofence, the application processor performs the service operation corresponding to the exit from the application scenario.
Regarding the implementation flow, in this embodiment, the implementation flow is specifically: when the position information is determined to be located in the WIFI geofence corresponding to any WIFI geofence configuration information in the shared memory, an application processor determines an application scene corresponding to the WIFI geofence, and when the WIFI geofence state change information corresponding to the WIFI geofence read from the shared memory indicates to enter the WIFI geofence, service operation corresponding to the application scene is activated.
Accordingly, after the business operation corresponding to the application scene is activated, when the WIFI geofence state change information corresponding to the WIFI geofence read from the shared memory indicates that the WIFI geofence is separated from the WIFI geofence, the business operation corresponding to the application scene is separated.
In order to better understand the matching stage of the geofence, taking the service operation corresponding to the application scenario to be activated as an example of activating the access card of the cell a, referring to fig. 10, for example, after the WIFI geofence is successfully added, if the user walks to (near) the access card of the cell a, the WIFI module scans the WIFI geofence information such as the MAC address, the signal strength and the like of the WIFI, and because the WIFI matching algorithm (WIFI geofence matching function) on the sensor hub side is always running after being started, whether the currently scanned WIFI geofence information is matched with the WIFI geofence configuration information stored in the shared memory or not is determined, if so, the mobile phone enters the WIFI range at the moment, namely, enters the WIFI geofence corresponding to the matched WIFI geofence configuration information, at the moment, WIFI geofence state change information entering the WIFI geofence is generated, and the WIFI geofence state change information is written into the shared memory.
For example, after determining that a geofence event (entering or leaving a geofence) occurs, the sensor hub needs to notify the application processor, so that the application processor feeds back WIFI geofence state change information to the NFC smart card of the application program layer, and further enables the NFC smart card to activate the access card of the cell a or exit the access card of the cell a according to the application scenario corresponding to the matched WIFI geofence and the geofence event indicated by the WIFI geofence state change information.
With continued reference to fig. 10, an exemplary process of the sensor hub notifying the application processor, specifically, sending a notification message with WIFI geofence state change information written into the shared memory to the kernel corresponding to the application processor for processing the geofence service.
It can be understood that, as can be seen from the description of the kernel layer in conjunction with fig. 7 and fig. 8, the polling thread created in the kernel layer for receiving the notification message sent by the sensor hub polls and receives the notification message sent by the sensor hub according to the set period, so that when the sensor hub sends the notification message with the WIFI geofence state change information written into the shared memory, the polling thread receives the notification message in a polling period, and further notifies the kernel for processing the geofence service to read the WIFI geofence state change information corresponding to the notification information from the shared memory.
With continued reference to fig. 10, the exemplary kernel, after reading the WIFI geofence state change information corresponding to the notification information from the shared memory through the read interface/function provided by the shared memory read-write framework, transmits the read WIFI geofence state change information to the positioning abstraction layer based on the netlink mechanism.
Correspondingly, after receiving the WIFI geofence state change information reported by the kernel based on the netlink mechanism, the positioning abstraction layer invokes the geofence state change interface, specifically in this embodiment, invokes the WIFI geofence state change interface, namely WifiFenceChangeCb (), and takes the received WIFI geofence state change information as a parameter, thereby reporting the WIFI geofence state change information to the location service.
For example, in some implementations, the WIFI geofence state change information specifically includes a WIFI fifenamid, and parameter information such as a WIFI geofence corresponding to the WIFI fifenamid or a WIFI geofence corresponding to the WIFI fenamid. For example, entry into a corresponding WIFI geofence may be indicated by "Y" or "1" and exit from a corresponding WIFI geofence may be indicated by "N" or "0".
Accordingly, after the location service receives the WIFI geofence state change information reported by the positioning abstraction layer, the location service notifies the NFC smart card application of the application program layer of the WIFI geofence state change information.
For example, taking the indication of the change of the WIFI geofence state to enter the WIFI geofence as an example, the NFC smart card activates the cell a access card after receiving the change of the WIFI geofence state.
That is, when the user carries the WIFI geofence configuration information corresponding to the access card of the cell a, and walks to the accessory of the access card reader of the cell a in fig. 11 with the mobile phone under the condition of starting the positioning service function and the NFC function, each functional module shown in fig. 10 in the mobile phone performs geofence matching according to the procedure of the geofence matching stage, determines that the mobile phone enters the WIFI geofence corresponding to the WIFI geofence configuration information corresponding to the access card of the cell a, and determines that the application scenario corresponding to the WIFI geofence is that the railing of the access card reader is lifted, if the user attaches the mobile phone to the access card reader of the cell a, the access card of the cell a is automatically activated, the swiping of the card is successful, and the railing of the access card is automatically lifted, as shown in fig. 12.
In addition, it should be noted that, based on the technical scheme provided by the embodiment, even if the NFC smart card application is not in the foreground operation, the background automatic switching of the electronic card and the corresponding electronic card can be realized under the condition that the user does not feel, so that the user experience is greatly improved.
In addition, it should be noted that, in practical application, when the mobile phone is close to the access control device of the cell a, the display interface of the mobile phone may automatically display the page of the activated access control card of the cell a, or may not display the page, which is not limited in this embodiment.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
Therefore, the application processor can timely sense the geofence event even if the application processor is in the sleep mode by adopting the low-power-consumption microprocessor which runs on line all the time to sense the geofence event, so that the continuity of the geofence capability is improved, and the power consumption required by the processing service of the geofence is greatly reduced due to the low-power-consumption microprocessor.
In addition, on the basis of the high-continuity and low-power consumption geofence capability, the application processor automatically activates the service operation of the application scene according to the application scene corresponding to the geofence, the user is not required to intervene, the service operation can be completed under the condition that the user does not feel, and the user experience is greatly improved.
In addition, in practical application, the geofence configuration information pre-added to the shared memory may be, in addition to WIFI geofence configuration information, GPS geofence configuration information, or Cell geofence configuration information.
That is, the geofence configuration information added to the shared memory may be any one or more of GPS geofence configuration information, WIFI geofence configuration information, and Cell geofence configuration information, depending on the traffic demand. The adding modes of GPS geofence configuration information and Cell geofence configuration information are similar to those of WIFI geofence configuration information, namely, an application needing to add the geofence configuration information in an application program layer calls an interface/function for adding geofence configuration information supported by LBSService in an application program framework layer, and then the GPS geofence configuration information and the Cell geofence configuration information needing to be added are transmitted to the LBSService; then, the LBSService calls the geofence configuration information adding interface/function supported by the corresponding positioning abstract layer (or the corresponding process in the hardware abstract layer), and then the GPS geofence configuration information and the Cell geofence configuration information which need to be added are transmitted to the positioning abstract layer; then, the positioning abstract layer calls an interface/function for adding geofence configuration information provided by the ioctl processing framework according to a file handle AAAFd provided by a kernel device node for processing geofence service in the kernel layer, and transmits GPS geofence configuration information and Cell geofence configuration information to be added to kernel processing corresponding to the kernel device node; then, the kernel writes GPS geofence configuration information and Cell geofence configuration information which need to be added into a specified shared memory through a writing interface provided by a shared memory reading and writing framework, and informs Sensorhub through an interface provided by a message notification framework, which GPS geofence configuration information and Cell geofence configuration information are already written into the shared memory; finally, the sensor hub reads the GPS geofence configuration information and the Cell geofence configuration information written by the kernel from the shared memory according to the received notification information, requests the corresponding module to start, scans/acquires the position information of the electronic equipment, such as the coordinate information of the current position of the electronic equipment through the GPS chip/module, acquires the Cell base station identification number of the Cell scanned by the electronic equipment through the Modem, starts the geofence matching function, distributes the corresponding geofence identification number for each piece of GPS geofence configuration information and Cell geofence configuration information added to the shared memory, and feeds the distributed geofence identification number back to the application program layer to trigger the application of adding the geofence configuration information.
For example, regarding the process of feeding back the assigned geofence identification number to the application layer to trigger the application adding the geofence configuration information, the geofence identification number is still transmitted to the positioning abstraction layer based on the netlink mechanism after the kernel receives the geofence identification number fed back by the sensor hub through the polling process; then, the positioning abstract layer adds a feedback interface to report the geofence identification number to the LBSService through the corresponding geofence configuration information; and finally, feeding back the geofence identification number to the application successfully established by the LBSService. Thus, the addition of GPS geofence configuration information, cell geofence configuration information is completed.
For example, in some implementations, to distinguish whether the added geofence configuration information is specifically GPS geofence configuration information, cell geofence configuration information, or WIFI geofence configuration information, functions/interfaces corresponding to the three geofence configuration information may be provided, respectively. For example, in the foregoing embodiment, the function addWifiFence, ioctl (addwififenac) of adding a WIFI geofence corresponding to the WIFI geofence configuration information is used, the WIFI geofence identifier wififenad corresponding to the WIFI geofence configuration information is returned, and the function wififenaddcb of the WIFI geofence configuration identifier is returned. Based on this, a function of adding a GPS geofence corresponding to the GPS geofence configuration information may be expressed as addGpsFence, ioctl (addgpsfenc), a GPS geofence identification number gpsfencid corresponding to the GPS geofence configuration information, a function of returning a GPS geofence configuration identification number gpsfencaddcb (), and the like; the function of adding a Cell geofence corresponding to the Cell geofence configuration information may be expressed as addCellFence, ioctl (addCellFence), a Cell geofence identification number cellfengid corresponding to the Cell geofence configuration information, a function of returning a Cell geofence assignment identification number CellFenceAddCb (), and so on.
Based on the above, when the geofence configuration information may be any one or more of GPS geofence configuration information, WIFI geofence configuration information, and Cell geofence configuration information, according to a location information mode selected when the user starts the positioning service function, the obtained location information of the electronic device may also be any one or more of coordinate information of a location where the electronic device is currently located, a MAC address and signal strength of WIFI currently scanned by the electronic device, and a Cell base station identification number of a Cell scanned by the electronic device. For example, when the location information mode selected by the user is a mode with high accuracy, the acquired location information includes the three types of location information described above, and in this case, the matching geofence configuration information is geofence configuration information corresponding to each of the three types of location information, that is, the finally determined geofence is determined based on the GPS geofence, the WIFI geofence, and the Cell geofence, and thus the accuracy is high.
For example, referring to fig. 13, 20A is a GPS geofence corresponding to GPS geofence configuration information, 20B is a WIFI geofence corresponding to WIFI geofence configuration information, and 20C is a Cell geofence corresponding to Cell geofence configuration information.
With continued reference to fig. 13, when the positioning service function is turned on and the location information mode is selected to be the high accuracy mode, if at a certain moment the location information acquired by the mobile phone includes the coordinate information of the current location, the MAC address and signal strength of the currently scanned WIFI, the Cell base station identification number of the scanned Cell, the GPS geofence configuration information corresponding to 20A is determined to match based on the coordinate information of the current location, the WIFI geofence configuration information corresponding to 20B is determined based on the MAC address and signal strength of the currently scanned WIFI, and the Cell geofence configuration information corresponding to 20C is determined to match based on the Cell base station identification number of the scanned Cell, so that the geofence where the mobile phone is currently located is determined to be 20D in fig. 13 according to the GPS geofence corresponding to 20A, the WIFI geofence corresponding to 20B, and the Cell geofence corresponding to 20C.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
In other implementations, when the user-selected location information mode is a low power consumption mode, the acquired location information includes two types of MAC address and signal strength of WIFI currently scanned by the electronic device and Cell base station identification number of a Cell scanned by the electronic device, and corresponding to this case, the matched geofence configuration information is geofence configuration information corresponding to each of the two types of location information, that is, the finally determined geofence is determined based on the WIFI geofence and the Cell geofence, and positioning is achieved without using GPS with high power consumption, so that the power consumption is relatively low.
For example, in other implementations, when the user-selected location information pattern is a device-only (location is determined using GPS) pattern, the acquired location information includes only coordinate information of the current location of the electronic device, and corresponding to this case, the matching geofence configuration information is geofence configuration information corresponding to each such location information, i.e., the finally determined geofence is determined based on the GPS geofence.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
Therefore, the current position information of the electronic equipment can be acquired by adopting different position information acquisition modes according to the requirements of the user, so that the requirement of the user on accuracy can be met, and the continuity and the power consumption of the geofence service can be considered.
Note that, the various function names in the above embodiments are examples only for better understanding the technical solution of the present embodiment, and are not the only limitation of the present embodiment.
Furthermore, it will be appreciated that the electronic device, in order to achieve the above-described functionality, comprises corresponding hardware and/or software modules that perform the respective functions. The present application can be implemented in hardware or a combination of hardware and computer software, in conjunction with the example algorithm steps described in connection with the embodiments disclosed herein. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Those skilled in the art may implement the described functionality using different approaches for each particular application in conjunction with the embodiments, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In addition, it should be noted that, in an actual application scenario, the method for processing the geofence provided in the foregoing embodiments implemented by the electronic device may also be performed by a chip system included in the electronic device, where the chip system may include a processor. The chip system may be coupled to a memory such that the chip system, when running, invokes a computer program stored in the memory, implementing the steps performed by the electronic device described above. The processor in the chip system can be an application processor or a non-application processor.
In addition, the embodiment of the application further provides a computer readable storage medium, and computer instructions are stored in the computer readable storage medium, and when the computer instructions are executed on the electronic device, the electronic device is caused to execute the related method steps to implement the method for processing the geofence in the embodiment.
In addition, the embodiment of the application further provides a computer program product, when the computer program product runs on the electronic device, the electronic device is caused to execute the related steps, so as to realize the method for processing the geofence in the embodiment.
In addition, embodiments of the present application also provide a chip (which may also be a component or module) that may include one or more processing circuits and one or more transceiver pins; wherein the transceiver pin and the processing circuit communicate with each other through an internal connection path, and the processing circuit executes the related method steps to implement the processing method of the geofence in the above embodiment, so as to control the receiving pin to receive signals, and control the sending pin to send signals.
In addition, as can be seen from the above description, the electronic device, the computer-readable storage medium, the computer program product, or the chip provided by the embodiments of the present application are used to perform the corresponding methods provided above, and therefore, the advantages achieved by the embodiments of the present application can refer to the advantages in the corresponding methods provided above, and are not repeated herein.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.

Claims (14)

1. The method is characterized by being applied to electronic equipment, wherein the electronic equipment comprises a low-power microprocessor, an application processor and a position information acquisition module, an ioctl processing frame, a message notification frame and a shared memory read-write frame are added in a kernel layer of an operating system of the electronic equipment, and the method comprises the following steps:
when the application processor is in a sleep mode and the position information acquisition module acquires first position information of the electronic equipment, the low-power-consumption microprocessor determines whether the first position information is positioned in a geofence corresponding to geofence configuration information according to the geofence configuration information recorded in a shared memory, wherein the shared memory is a memory space commonly accessed by the application processor and the low-power-consumption microprocessor, and the geofence configuration information recorded in the shared memory is generated by the application processor and is added into the shared memory;
when the first position information is located in the geofence corresponding to the geofence configuration information, the low-power-consumption microprocessor sends a business message for processing the geofence to the kernel;
After the low power microprocessor sends the business message for processing the geofence to the kernel, a polling thread special for receiving the business message in the kernel is activated;
the activated polling thread wakes up the application processor in sleep mode;
the application processor determines an application scene corresponding to the geofence and activates business operation corresponding to the application scene; after the application processor is in the sleep mode, the application processor is only required to be awakened once by the polling thread before the business operation corresponding to the application scene is activated;
wherein the geofence configuration information recorded in the shared memory is generated by the application processor and added to the shared memory, comprising:
when the kernel layer is initialized, kernel equipment nodes corresponding to the polling threads and the processing services of the geofence are created in the kernel layer;
establishing connection between a positioning abstract layer of a hardware abstract layer in an operating system of the electronic equipment and the kernel equipment node, and returning a file handle of the kernel equipment node to the positioning abstract layer after establishing connection, wherein a geofence configuration information adding interface provided by accessing the ioctl processing framework and used for being called by the positioning abstract layer, an interface provided by the shared memory read-write framework and used for accessing the shared memory, and an interface provided by the message notification framework and used for sending a message to the low-power microprocessor are recorded in the file handle;
After the positioning abstract layer receives the geofence configuration information which is transmitted by the application program framework layer and needs to be added, calling a geofence configuration information adding interface provided by the ioctl processing framework and used for being called by the positioning abstract layer according to the file handle, and transmitting the geofence configuration information to a kernel pointed by the kernel equipment node;
after the kernel pointed by the kernel equipment node receives the configuration information of the geofence, calling a writing interface provided by the shared memory read-write frame, writing the configuration information of the geofence into the shared memory, and after the configuration information of the geofence is written into the shared memory, calling an interface provided by the message notification frame and used for sending a message to the low-power-consumption microprocessor, and sending the message for writing the configuration information of the geofence to the low-power-consumption microprocessor;
wherein the activated polling thread wakes up the application processor in sleep mode, comprising:
the polling thread informs the kernel indicated by the kernel equipment node, and the low-power consumption microprocessor writes a geofence matching result into the shared memory, wherein the geofence matching result is a matching result that the first position information is positioned corresponding to the geofence configuration information;
And the kernel indicated by the kernel equipment node invokes a read interface provided by the shared memory read-write framework, reads the geofence matching result from the shared memory, and sends the geofence matching result to the positioning abstraction layer.
2. The method of claim 1, wherein when the first location information is located in a geofence corresponding to the geofence configuration information, the method further comprises:
the low power microprocessor generating geofence state change information indicating that the electronic device entered the geofence;
the low power microprocessor writes geofence state change information into the shared memory, wherein the geofence state change information indicates the electronic equipment to enter the geofence.
3. The method of claim 1, wherein when the first location information is located in a geofence corresponding to the geofence configuration information, the application processor determining an application scenario corresponding to the geofence and activating a business operation corresponding to the application scenario comprises:
when the first position information is located in a geofence corresponding to the geofence configuration information, the application processor obtains geofence state change information from the shared memory, wherein the geofence state change information indicates that the electronic equipment enters the geofence;
The application processor determines an application scene corresponding to the geofence;
and the application processor activates the business operation corresponding to the application scene according to the geofence state change information.
4. The method of claim 3, wherein after the application processor activates the business operation corresponding to the application scenario according to the geofence state change information, the method further comprises:
when the position information acquisition module acquires second position information of the electronic equipment, the low-power-consumption microprocessor determines whether the second position information is positioned in a geofence corresponding to the geofence configuration information according to the geofence configuration information recorded in the shared memory;
and when the second position information leaves the geofence corresponding to the geofence configuration information, the application processor exits the business operation corresponding to the application scene.
5. The method of claim 4, wherein when the second location information leaves the geofence corresponding to the geofence configuration information, the method further comprises:
the low power microprocessor generating geofence state change information indicating that the electronic device left the geofence;
The low power microprocessor writes geofence state change information into the shared memory, wherein the geofence state change information indicates the electronic equipment to enter the geofence.
6. The method of claim 5, wherein the application processor exiting the business operation corresponding to the application scenario when the second location information leaves the geofence corresponding to the geofence configuration information comprises:
when the second location information leaves the geofence corresponding to the geofence configuration information, the application processor obtains the geofence state change information from the shared memory, the geofence state change information indicating that the electronic device leaves the geofence;
and the application processor exits the business operation corresponding to the application scene according to the geofence state change information.
7. The method of any of claims 1 to 6, wherein when the location information obtaining module obtains the first location information of the electronic device, the low power microprocessor determines, according to geofence configuration information recorded in a shared memory, whether the first location information is located before a geofence corresponding to the geofence configuration information, the method further comprising:
Responding to the received geofence adding instruction, and generating the geofence configuration information according to the position information acquired by the position information acquisition module;
the application processor adds the geofence configuration information to the shared memory.
8. The method of claim 7, wherein after the application processor adds the geofence configuration information to the shared memory, the method further comprises:
the application processor sends first notification information to the low-power-consumption microprocessor to inform the low-power-consumption microprocessor that the geofence configuration information is added to the shared memory, wherein the first notification information comprises an identification number of a geofence type corresponding to the geofence configuration information and address information of the geofence configuration information in the shared memory.
9. The method of claim 8, wherein after the application processor sends notification information to the low power microprocessor, the method further comprises:
after the low-power consumption microprocessor receives the first notification information, corresponding geofence configuration information is obtained from the shared memory according to the identification number and the address information;
The low-power consumption microprocessor allocates a geofence identification number for the geofence configuration information;
the low power microprocessor sending the geofence identification number to the application processor;
and the low-power consumption microprocessor circularly calls a geofence matching function according to a set period, and executes the step of acquiring the position information of the electronic equipment.
10. The method of claim 9, wherein after the low power microprocessor sends the geofence identification number to the application processor, the method further comprises:
and after the low-power consumption microprocessor receives the geofence identification number through a polling thread, reporting the geofence identification number to an application generating the geofence adding instruction based on a netlink mechanism.
11. The method of any one of claims 1 to 6, wherein the location information acquisition module comprises any one or more of:
the wireless communication system comprises a GPS module for acquiring coordinate information of a current position of the electronic equipment, a WIFI module for acquiring a MAC address and signal strength of WIFI currently scanned by the electronic equipment, and a Modem module for acquiring a cell base station identification number of a cell scanned by the electronic equipment.
12. The method of any one of claims 1 to 6, wherein the geofence configuration information comprises any one or more of:
GPS geofence configuration information, WIFI geofence configuration information, cell geofence configuration information.
13. An electronic device, the electronic device comprising: a memory and a processor, the memory and the processor coupled; the memory stores program instructions that, when executed by the processor, cause the electronic device to perform the method of geofencing according to any one of claims 1 to 12.
14. A computer readable storage medium comprising a computer program which, when run on an electronic device, causes the electronic device to perform the method of processing a geofence as claimed in any one of claims 1 to 12.
CN202210599675.7A 2022-05-30 2022-05-30 Geofence processing method, equipment and storage medium Active CN116033342B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210599675.7A CN116033342B (en) 2022-05-30 2022-05-30 Geofence processing method, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210599675.7A CN116033342B (en) 2022-05-30 2022-05-30 Geofence processing method, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116033342A CN116033342A (en) 2023-04-28
CN116033342B true CN116033342B (en) 2023-11-24

Family

ID=86073526

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210599675.7A Active CN116033342B (en) 2022-05-30 2022-05-30 Geofence processing method, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116033342B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117273830A (en) * 2023-11-23 2023-12-22 荣耀终端有限公司 Method for displaying card, electronic device and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111328020A (en) * 2018-12-17 2020-06-23 华为技术有限公司 Service processing method and device based on indoor positioning system
WO2020191598A1 (en) * 2019-03-25 2020-10-01 华为技术有限公司 Method for determining that terminal device is located inside geofence, and terminal device
CN112311824A (en) * 2019-07-29 2021-02-02 腾讯科技(深圳)有限公司 Attendance information processing method and related device
CN112398895A (en) * 2019-08-19 2021-02-23 阿里巴巴集团控股有限公司 Method and device for providing service information
CN113779166A (en) * 2021-08-20 2021-12-10 上海瑾盛通信科技有限公司 Geo-fence control method and device, storage medium and electronic equipment
CN113794801A (en) * 2021-08-09 2021-12-14 荣耀终端有限公司 Method and device for processing geo-fence
WO2022037384A1 (en) * 2020-08-17 2022-02-24 华为技术有限公司 C-v2x low-power consumption method, electronic device, and chip system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9311011B2 (en) * 2013-08-07 2016-04-12 Qualcomm Incorporated Dynamic address negotiation for shared memory regions in heterogenous multiprocessor systems

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111328020A (en) * 2018-12-17 2020-06-23 华为技术有限公司 Service processing method and device based on indoor positioning system
WO2020191598A1 (en) * 2019-03-25 2020-10-01 华为技术有限公司 Method for determining that terminal device is located inside geofence, and terminal device
CN112311824A (en) * 2019-07-29 2021-02-02 腾讯科技(深圳)有限公司 Attendance information processing method and related device
CN112398895A (en) * 2019-08-19 2021-02-23 阿里巴巴集团控股有限公司 Method and device for providing service information
WO2022037384A1 (en) * 2020-08-17 2022-02-24 华为技术有限公司 C-v2x low-power consumption method, electronic device, and chip system
CN113794801A (en) * 2021-08-09 2021-12-14 荣耀终端有限公司 Method and device for processing geo-fence
CN113779166A (en) * 2021-08-20 2021-12-10 上海瑾盛通信科技有限公司 Geo-fence control method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN116033342A (en) 2023-04-28

Similar Documents

Publication Publication Date Title
CN114040242B (en) Screen projection method, electronic equipment and storage medium
CN110602686B (en) Method for using remote SIM module and electronic equipment
CN116055773A (en) Multi-screen collaboration method, system and electronic equipment
CN114513847B (en) Positioning method, device, system, electronic equipment and storage medium
CN116233300A (en) Method for controlling communication service state, terminal device and readable storage medium
CN113472477B (en) Wireless communication system and method
CN115543159B (en) Wallpaper display method, device, equipment and storage medium
CN116315667B (en) Data transmission method, device, equipment and storage medium
CN116033342B (en) Geofence processing method, equipment and storage medium
WO2022048453A1 (en) Unlocking method and electronic device
CN116055613B (en) Screen projection method and device
CN116033341B (en) Method and device for triggering fence event
CN116684521B (en) Audio processing method, device and storage medium
CN116709273B (en) Wireless communication system, method and equipment
CN116662024B (en) Inter-process communication monitoring method and device, electronic equipment and storage medium
CN116708647B (en) Notification message reply method and electronic equipment
CN115460445B (en) Screen projection method of electronic equipment and electronic equipment
CN116991302B (en) Application and gesture navigation bar compatible operation method, graphical interface and related device
CN116077943B (en) Method for scheduling system resources and related device
WO2023160217A1 (en) Method for detecting embedded subscriber identity module (esim) card, and terminal device
CN117666819A (en) Mouse operation method, electronic device, mouse and computer-readable storage medium
CN117998514A (en) Multi-network cooperative switching method, equipment and storage medium
CN117289807A (en) Communication method, communication system and mouse
CN117631935A (en) Parameter synchronization method and electronic equipment
CN117501233A (en) Screen projection image processing 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