CN115309253A - Method, device, terminal and storage medium for acquiring positioning data - Google Patents
Method, device, terminal and storage medium for acquiring positioning data Download PDFInfo
- Publication number
- CN115309253A CN115309253A CN202110501640.0A CN202110501640A CN115309253A CN 115309253 A CN115309253 A CN 115309253A CN 202110501640 A CN202110501640 A CN 202110501640A CN 115309253 A CN115309253 A CN 115309253A
- Authority
- CN
- China
- Prior art keywords
- operating system
- positioning
- data
- processor
- positioning data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/16—Constructional details or arrangements
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/16—Constructional details or arrangements
- G06F1/1613—Constructional details or arrangements for portable computers
- G06F1/163—Wearable computers, e.g. on a belt
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/26—Power supply means, e.g. regulation thereof
- G06F1/32—Means for saving power
- G06F1/3203—Power management, i.e. event-based initiation of a power-saving mode
- G06F1/3206—Monitoring of events, devices or parameters that trigger a change in power modality
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/26—Power supply means, e.g. regulation thereof
- G06F1/32—Means for saving power
- G06F1/3203—Power management, i.e. event-based initiation of a power-saving mode
- G06F1/3234—Power saving characterised by the action undertaken
- G06F1/3293—Power saving characterised by the action undertaken by switching to a less power-consuming processor, e.g. sub-CPU
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Computer Hardware Design (AREA)
- Position Fixing By Use Of Radio Waves (AREA)
Abstract
Description
技术领域technical field
本申请实施例涉及计算机技术领域,特别涉及一种获取定位数据的方法、装置、终端及存储介质。The embodiments of the present application relate to the field of computer technologies, and in particular to a method, device, terminal and storage medium for acquiring positioning data.
背景技术Background technique
随着可穿戴设备功能的日益丰富,定位功能逐渐成为可穿戴设备的标配。可穿戴通过处理器从定位芯片中获取定位数据。With the increasingly rich functions of wearable devices, the positioning function has gradually become the standard configuration of wearable devices. The wearable obtains positioning data from the positioning chip through the processor.
相关技术中,可穿戴设备在实时获取定位数据时,操作系统需要持续运行。也即运行该操作系统的处理器需要持续保持唤醒状态,以实时获取到定位数据,导致可穿戴设备在获取定位数据时功耗较大。In related technologies, when the wearable device acquires positioning data in real time, the operating system needs to run continuously. That is to say, the processor running the operating system needs to be continuously awake to obtain positioning data in real time, resulting in a large power consumption of the wearable device when obtaining positioning data.
发明内容Contents of the invention
本申请实施例提供了一种获取定位数据的方法、装置、终端及存储介质。所述技术方案如下:Embodiments of the present application provide a method, device, terminal, and storage medium for acquiring positioning data. Described technical scheme is as follows:
根据本申请的一方面内容,提供了一种所述方法应用在终端中,所述终端包括第一处理器和第二处理器,所述第一处理器中运行有第一操作系统,所述第二处理器中运行有第二操作系统且所述第二处理器中挂载有定位芯片,所述第二处理器的功耗低于所述第一处理器的功耗,所述方法包括:According to one aspect of the present application, it is provided that the method is applied in a terminal, the terminal includes a first processor and a second processor, the first processor runs a first operating system, the A second operating system runs in the second processor and a positioning chip is mounted in the second processor, the power consumption of the second processor is lower than that of the first processor, and the method includes :
响应于所述第一操作系统中生成的第一获取请求,通过所述第一操作系统向所述第二操作系统发送所述第一获取请求,所述第一获取请求用于请求获取定位数据;In response to the first acquisition request generated in the first operating system, sending the first acquisition request to the second operating system through the first operating system, where the first acquisition request is used to request acquisition of positioning data ;
在所述第二操作系统中,根据所述第一获取请求从所述定位芯片中获取所述定位数据;In the second operating system, acquire the positioning data from the positioning chip according to the first acquisition request;
将所述定位数据从所述第二操作系统反馈至所述第一操作系统。The positioning data is fed back from the second operating system to the first operating system.
根据本申请的另一方面内容,提供了一种获取定位数据的装置,所述装置应用在终端中,所述终端包括第一处理器和第二处理器,所述第一处理器中运行有第一操作系统,所述第二处理器中运行有第二操作系统且所述第二处理器中挂载有定位芯片,所述第二处理器的功耗低于所述第一处理器的功耗,所述装置包括:According to another aspect of the present application, a device for acquiring positioning data is provided, the device is applied in a terminal, the terminal includes a first processor and a second processor, and the first processor runs a The first operating system, the second operating system runs in the second processor and the positioning chip is mounted in the second processor, and the power consumption of the second processor is lower than that of the first processor power consumption, the device consists of:
第一生成模块,用于响应于所述第一操作系统中生成的第一获取请求,通过所述第一操作系统向所述第二操作系统发送所述第一获取请求,所述第一获取请求用于请求获取定位数据;A first generating module, configured to send the first obtaining request to the second operating system through the first operating system in response to the first obtaining request generated in the first operating system, the first obtaining Request is used to request to obtain positioning data;
获取模块,用于在所述第二操作系统中,根据所述第一获取请求从所述定位芯片中获取所述定位数据;An obtaining module, configured to obtain the positioning data from the positioning chip according to the first obtaining request in the second operating system;
反馈模块,用于将所述定位数据从所述第二操作系统反馈至所述第一操作系统。A feedback module, configured to feed back the positioning data from the second operating system to the first operating system.
根据本申请的另一方面内容,提供了一种终端,所述终端包括处理器和存储器,所述存储器中存储有至少一条指令,所述指令由所述处理器加载并执行以实现如本申请实施提供的获取定位数据的方法。According to another aspect of the present application, a terminal is provided, the terminal includes a processor and a memory, at least one instruction is stored in the memory, and the instruction is loaded and executed by the processor to implement the Implement the provided methods for obtaining location data.
根据本申请的另一方面内容,提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令,所述指令由处理器加载并执行以实现如本申请实施提供的获取定位数据的方法。According to another aspect of the present application, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to realize the acquisition of positioning data as provided by the implementation of the present application. Methods.
根据本申请的一个方面,提供了一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备的各种可选实现方式中提供的获取定位数据的方法。According to one aspect of the present application, there is provided a computer program product comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the method for acquiring positioning data provided in various optional implementation manners of the computer device.
本申请能够应用在包含两个处理器的终端中,第一处理器中运行有第一操作系统,第二处理器中运行有第二操作系统且第二处理器挂载有定位芯片,第二处理器的功耗低于第一处理器的功耗,响应于第一操作系统中的第一获取请求,通过第一操作系统向第二操作系统发送第一获取请求,第一获取请求用于获取定位数据,第二操作系统中根据第一获取请求从定位芯片中获取定位数据,并将定位数据从第二操作系统反馈至第一操作系统中,使得终端能够通过功耗较低的处理器获取到定位数据,降低了终端获取定位数据时的功耗。The present application can be applied to a terminal including two processors, the first operating system runs on the first processor, the second operating system runs on the second processor and the second processor is mounted with a positioning chip, and the second The power consumption of the processor is lower than the power consumption of the first processor, and in response to the first acquisition request in the first operating system, the first acquisition request is sent to the second operating system through the first operating system, and the first acquisition request is used for Obtain positioning data, the second operating system obtains positioning data from the positioning chip according to the first acquisition request, and feeds the positioning data from the second operating system to the first operating system, so that the terminal can use the processor with lower power consumption The positioning data is acquired, which reduces the power consumption of the terminal when acquiring the positioning data.
附图说明Description of drawings
为了更清楚地介绍本申请实施例中的技术方案,下面将对本申请实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly introduce the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments of the present application will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application , for those skilled in the art, other drawings can also be obtained based on these drawings without creative work.
图1是本申请一个示例性实施例提供的一种终端的结构框图;FIG. 1 is a structural block diagram of a terminal provided in an exemplary embodiment of the present application;
图2是本申请一个示例性实施例提供的一种获取定位数据的方法的流程图;Fig. 2 is a flow chart of a method for acquiring positioning data provided by an exemplary embodiment of the present application;
图3是本申请另一个示例性实施例提供的一种获取定位数据的方法流程图;Fig. 3 is a flow chart of a method for acquiring positioning data provided by another exemplary embodiment of the present application;
图4是本申请涉及的一种第一操作系统的结构示意图;FIG. 4 is a schematic structural diagram of a first operating system involved in the present application;
图5是本申请实施例提供的一种第二操作系统的结构示意图;FIG. 5 is a schematic structural diagram of a second operating system provided by an embodiment of the present application;
图6是本申请实施例提供的一种获取定位数据的系统框架示意图;FIG. 6 is a schematic diagram of a system framework for acquiring positioning data provided by an embodiment of the present application;
图7是本申请一个示例性实施例提供的一种获取定位数据的方法流程图;Fig. 7 is a flow chart of a method for acquiring positioning data provided by an exemplary embodiment of the present application;
图8是基于图7所示实施例提供的一种停止获取定位数据的流程图;Fig. 8 is a flow chart of stopping acquiring positioning data provided based on the embodiment shown in Fig. 7;
图9本申请一个示例性实施例提供的一种获取定位数据的装置的结构框图。FIG. 9 is a structural block diagram of an apparatus for acquiring positioning data provided by an exemplary embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the purpose, technical solution and advantages of the present application clearer, the implementation manners of the present application will be further described in detail below in conjunction with the accompanying drawings.
下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present application as recited in the appended claims.
在本申请的描述中,需要理解的是,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。在本申请的描述中,需要说明的是,除非另有明确的规定和限定,术语“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本申请中的具体含义。此外,在本申请的描述中,除非另有说明,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。In the description of the present application, it should be understood that the terms "first", "second" and so on are used for descriptive purposes only, and should not be understood as indicating or implying relative importance. In the description of this application, it should be noted that, unless otherwise clearly stipulated and limited, the terms "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integrated Ground connection; it can be mechanical connection or electrical connection; it can be direct connection or indirect connection through an intermediary. Those of ordinary skill in the art can understand the specific meanings of the above terms in this application in specific situations. In addition, in the description of the present application, unless otherwise specified, "plurality" means two or more. "And/or" describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B may indicate: A exists alone, A and B exist simultaneously, and B exists independently. The character "/" generally indicates that the contextual objects are an "or" relationship.
如本文中所使用,根据上下文,术语“如果”任选地被解释为“当......时”、“在……时”、“响应于确定”或“响应于检测”。类似地,根据上下文,短语“如果确定……”或“如果检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。As used herein, the term "if" is optionally interpreted as "when," "at," "in response to determining," or "in response to detecting," depending on the context. Similarly, the phrase "if determined..." or "if (the stated condition or event) is detected" or "in response to detecting (the stated condition or event)" depends on the context.
需要说明的是,使用个人可识别信息应遵循公认为满足或超过维护用户隐私的行业或政府要求的隐私政策和做法。具体地,个人可识别信息在管理和处理的过程中应当向用户明确说明授权使用的性质,以使无意或未经授权的访问或使用的风险最小化。For clarification, use of personally identifiable information is subject to privacy policies and practices that are recognized as meeting or exceeding industry or government requirements for maintaining user privacy. Specifically, personally identifiable information should be managed and processed to clearly explain the nature of authorized use to users, so as to minimize the risk of inadvertent or unauthorized access or use.
为了本申请实施例所示方案易于理解,下面对本申请实施例中出现的若干名词进行介绍。In order to make the solutions shown in the embodiments of the present application easy to understand, several terms appearing in the embodiments of the present application are introduced below.
休眠状态:用于指示操作系统处于低功耗在线的工作状态。在一种可能的方式中,操作系统的状态包括上电运行的运行状态和断电的离线状态。操作系统的运行状态包括唤醒状态和休眠状态。其中,当操作系统处于休眠状态时,运行操作系统的处理器也可处于休眠状态。Sleep state: It is used to indicate that the operating system is in a low-power online working state. In a possible manner, the state of the operating system includes a running state of power-on operation and an offline state of power-off. The running state of the operating system includes a wake-up state and a sleep state. Wherein, when the operating system is in the dormant state, the processor running the operating system may also be in the dormant state.
唤醒状态:用于指示操作系统处于较高功耗的正常工作状态。在唤醒状态时,操作系统能够响应各种应用请求,并根据应用请求来控制各式硬件,以实现响应的应用功能。在操作系统处于唤醒状态时,运行操作系统的处理也可处于唤醒状态。Wakeup state: It is used to indicate that the operating system is in a normal working state with high power consumption. In the wake-up state, the operating system can respond to various application requests, and control various hardware according to the application requests, so as to realize corresponding application functions. While the operating system is awake, processes running the operating system may also be awake.
其中,操作系统能够从休眠状态切换至唤醒状态。同样地,操作系统也能够从唤醒状态切换至休眠状态。Wherein, the operating system can switch from the sleep state to the wake-up state. Similarly, the operating system can also switch from the awake state to the hibernate state.
示意性的,由于本申请中第一处理器中运行有第一操作系统,且第二处理器中运行有第二操作系统。因此,对于第一操作系统而言。当第一操作系统从休眠状态切换至唤醒状态时,第一处理器也随着第一操作系统的状态切换,由休眠状态切换至唤醒状态。当第一操作系统从唤醒状态切换至休眠状态时,第一处理器也随着第一操作系统的状态切换,由从唤醒状态切换至休眠状态。Schematically, in this application, the first operating system runs on the first processor, and the second operating system runs on the second processor. Therefore, for the first operating system. When the first operating system switches from the sleep state to the wake-up state, the first processor also switches from the sleep state to the wake-up state along with the state switching of the first operating system. When the first operating system switches from the wake-up state to the sleep state, the first processor also switches from the wake-up state to the sleep state following the state switch of the first operating system.
需要说明的是,由于第二处理器在单位时间内的功耗小于第一处理器在单位时间内的功耗。因此,本申请将定位芯片挂载在第二处理器中,并令第二处理器来通过与定位芯片的交互,实现终端以较少的能量开销获取定位数据。It should be noted that, since the power consumption of the second processor per unit time is less than the power consumption of the first processor per unit time. Therefore, the present application mounts the positioning chip in the second processor, and enables the second processor to interact with the positioning chip, so that the terminal acquires positioning data with less energy consumption.
示例性地,本申请实施例所示的获取定位数据的方法,可以应用在终端中,该终端至少包括第一处理器和第二处理器两个处理器,并且第一处理器中运行有第一操作系统,第二处理器中运行有第二操作系统。终端可以包括手机、智能手环、智能眼镜、智能手表、数码相机、MP4播放终端、MP5播放终端、学习机、点读机、电纸书、电子词典或车载终端等设备。Exemplarily, the method for acquiring positioning data shown in the embodiment of the present application can be applied in a terminal, and the terminal includes at least two processors, a first processor and a second processor, and the first processor runs a second processor. An operating system, the second operating system runs in the second processor. Terminals can include mobile phones, smart bracelets, smart glasses, smart watches, digital cameras, MP4 playback terminals, MP5 playback terminals, learning machines, point readers, electronic paper books, electronic dictionaries, or vehicle-mounted terminals.
请参见图1,图1是本申请一个示例性实施例提供的一种终端的结构框图,如图1所示,该终端包括第一处理器121、第二处理器122、存储器140和定位芯片160,所述存储器140中存储有至少一条指令,所述指令由所述第一处理器121加载并执行,或者,由第二处理器122加载并执行以实现如本申请各个方法实施例所述的获取定位数据的方法。Please refer to FIG. 1. FIG. 1 is a structural block diagram of a terminal provided by an exemplary embodiment of the present application. As shown in FIG. 1, the terminal includes a
可选地,上述各个部件可以通过总线150连通,使得组件之间的信号能够互通。Optionally, the above-mentioned components may be connected through the
在本申请中,终端100是具备获取定位数据的功能的电子设备。当终端100中由第一处理器121运行的第一操作系统时,终端100能够通过第一操作系统生成第一获取请求,该第一获取请求用于请求获取定位数据。当该第一获取请求生成后,终端能够通过第一操作系统向第二操作系统发送该第一获取请求。在第二操作系统中,终端根据第一获取请求从定位芯片中获取定位数据。随后,终端将定位数据从第二操作系统反馈至第一操作系统。In this application, the terminal 100 is an electronic device capable of acquiring positioning data. When the first operating system is run by the
第一处理器121在单位时间内的功耗低于第二处理器122在单位时间内的功耗。The power consumption of the
在第一可能的实现方式中,第一处理器121能够搭载功能较为复杂的第一操作系统。例如,第一处理器121搭载的第一操作系统可以是具备丰富功能的安卓(英文:Android)操作系统、基于linux开发的移动操作系统或者基于安卓深度开发的操作系统。In a first possible implementation manner, the
在另一种可能的实现方式中,第二处理器122能够搭载功能较为简单的第二操作系统。例如,第二处理器122搭载的第二操作系统可以是MCU(Microcontroller Unit,微控制器)操作系统。或者,第二操作系统还可以其它嵌入式操作系统。In another possible implementation manner, the
需要说明的是,第一处理器121和第二处理器122在硬件结构以及运行逻辑有相似的部分。在下述介绍中,将第一处理器121和第二处理器122统一为处理器进行介绍。It should be noted that, the
处理器可以包括一个或者多个处理核心。当处理器包括多个处理器核心时,处理器核心的数量可以是2个、3个、4个、6个或8个等数量。处理器利用各种接口和线路连接整个终端100内的各个部分,通过运行或执行存储在存储器140内的指令、程序、代码集或指令集,以及调用存储在存储器140内的数据,执行终端100的各种功能和处理数据。可选的,处理器可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable LogicArray,PLA)中的至少一种硬件形式来实现。处理器可集成中央处理器(CentralProcessing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示屏所需要显示的内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器中,单独通过一块芯片进行实现。在调整解调器单独实现时,该调制解调器通过总线或者其它线缆与处理器相连。A processor may include one or more processing cores. When the processor includes multiple processor cores, the number of processor cores may be 2, 3, 4, 6 or 8, etc. The processor uses various interfaces and lines to connect various parts of the
存储器140可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。可选的,该存储器140包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器140可用于存储指令、程序、代码、代码集或指令集。存储器140可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能或图像播放功能等)、用于实现本申请所示的获取定位数据的各个方法实施例的指令等;存储数据区可存储下面各个获取定位数据的方法实施例中涉及到的数据等。The
定位芯片160可以用于从导航卫星中获取定位数据。The
请参考图2,图2是本申请一个示例性实施例提供的一种获取定位数据的方法的流程图。该获取定位数据的方法可以应用在上述图1所示的终端中,该终端包括第一处理器和第二处理器,第一处理器中运行有第一操作系统,第二处理器中运行有第二操作系统且第二处理器中挂载有定位芯片。在图2中,获取定位数据的方法包括:Please refer to FIG. 2 . FIG. 2 is a flow chart of a method for acquiring positioning data provided by an exemplary embodiment of the present application. The method for obtaining positioning data can be applied to the terminal shown in FIG. 1 above, the terminal includes a first processor and a second processor, the first processor runs a first operating system, and the second processor runs a The second operating system is loaded with a positioning chip in the second processor. In Figure 2, the methods for obtaining positioning data include:
步骤210,响应于第一操作系统中生成的第一获取请求,通过第一操作系统向第二操作系统发送第一获取请求,第一获取请求用于请求获取定位数据。
在本申请实施例中,终端中设置有至少两个处理器。需要说明的是,终端中的每个处理器都能够运行有一个操作系统。在本申请所示的终端至少包括第一处理器和第二处理器。其中,第一处理器运行有支持较为复杂功能的第一操作系统,第二处理器运行有支持较为简单功能的第二操作系统。In the embodiment of the present application, at least two processors are set in the terminal. It should be noted that each processor in the terminal can run an operating system. The terminal shown in this application includes at least a first processor and a second processor. Wherein, the first processor runs a first operating system supporting relatively complex functions, and the second processor runs a second operating system supporting relatively simple functions.
一种可能的实现方式中,第一操作系统可以是基于Linux内核的操作系统,例如安卓(Android)系统或基于安卓深度定制开发的操作系统。需要说明的是,第一操作系统可以随着终端的生产厂商的不同而随之改变。例如,当终端是A厂商生产的设备,则终端可以预先内置A厂商提供的基于安卓深度定制开发的A操作系统。当终端是H厂商生产的设备,则终端可以预先内置H厂商提供的基于安卓深度定制开发的H操作系统。当终端是M厂商生产的设备,则终端可以预先内容M厂商基于安卓深度定制开发的M操作系统。当终端是S厂商生产的设备,则终端可以预先内置S厂商基于安卓深度定制开发的S操作系统。当终端是V厂商生产的设备,则终端可以预先内容V厂商基于安卓深度定制开发的V操作系统。In a possible implementation manner, the first operating system may be an operating system based on the Linux kernel, such as an Android system or an operating system developed based on deep customization of Android. It should be noted that the first operating system may vary with different terminal manufacturers. For example, when the terminal is a device produced by manufacturer A, the terminal may pre-install an operating system A based on Android deep customization provided by manufacturer A. When the terminal is a device produced by H manufacturer, the terminal can pre-install the H operating system provided by H manufacturer based on Android deep customization development. When the terminal is a device produced by M manufacturer, the terminal can pre-content the M operating system developed by M manufacturer based on Android deep customization. When the terminal is a device produced by S manufacturer, the terminal can pre-install the S operating system developed by S manufacturer based on Android deep customization. When the terminal is a device produced by V manufacturer, the terminal can pre-content the V operating system developed by V manufacturer based on Android deep customization.
需要说明的是,上述第一操作系统的预设方式仅为本申请的一种可能的应用场景。在另一种可能的应用方式中,终端的第一操作系统是后期维护更新时安装到终端中的操作系统。例如,终端进行刷机或者ROM操作后,能够在终端中安装不同于出厂时安装的操作系统。It should be noted that the above-mentioned preset manner of the first operating system is only one possible application scenario of the present application. In another possible application manner, the first operating system of the terminal is an operating system installed in the terminal during subsequent maintenance and update. For example, after flashing or ROM operation is performed on the terminal, an operating system different from that installed at the factory can be installed in the terminal.
在本申请中,第一获取请求用于请求获取定位数据。该第一获取请求的生成者是第一操作系统中的应用程序。In this application, the first acquisition request is used to request acquisition of positioning data. The generator of the first acquisition request is an application program in the first operating system.
示意性的,该应用程序可以是地图应用、健康应用、运动应用、社交应用、团购应用、外卖应用、打车应用或视频应用中的任意一种应用。需要说明的是,上述应用仅为举例,任意一种能够获取定位数据的应用均可作为本申请中所示的应用。Schematically, the application program may be any one of a map application, a health application, a sports application, a social networking application, a group-buying application, a takeaway application, a taxi application or a video application. It should be noted that the above applications are only examples, and any application capable of obtaining positioning data may be used as the application shown in this application.
在本申请中,在应用程序中生成第一获取请求后,应用程序将调用第一操作系统提供的接口,以令第一操作系统获取该第一获取请求。第一操作系统在获取该第一获取请求后,将该第一获取请求从第一操作系统发送至第二操作系统。在本申请中,第一操作系统与第二操作系统之间具备预先设计的信息传递通道。相应的,在硬件底层,第一操作系统所基于的第一处理器与第二操作系统所基于的第二处理器之间同样具备信息传输通道。一种可能的方式中,第一处理器和第二处理器之间通过SPI(Serial Peripheral Interface,串行外设接口)进行通信。In the present application, after the first obtaining request is generated in the application program, the application program will call the interface provided by the first operating system, so that the first operating system obtains the first obtaining request. After obtaining the first obtaining request, the first operating system sends the first obtaining request from the first operating system to the second operating system. In this application, there is a pre-designed information transfer channel between the first operating system and the second operating system. Correspondingly, at the bottom layer of the hardware, there is also an information transmission channel between the first processor on which the first operating system is based and the second processor on which the second operating system is based. In a possible manner, communication is performed between the first processor and the second processor through an SPI (Serial Peripheral Interface, serial peripheral interface).
可选地,终端可以指示第一操作系统切换至休眠状态。Optionally, the terminal may instruct the first operating system to switch to the sleep state.
在本申请中,第一操作系统上电时的运行状态可以包括休眠状态和唤醒状态,当第一操作系统从应用程序中获取第一获取请求时,第一操作系统处于唤醒状态。在终端将第一获取请求从第一操作系统发送至第二操作系统后,终端将能够将第一操作系统从唤醒状态切换至休眠状态。In this application, the running state of the first operating system when it is powered on may include a sleep state and a wake-up state, and when the first operating system obtains a first acquisition request from an application program, the first operating system is in the wake-up state. After the terminal sends the first acquisition request from the first operating system to the second operating system, the terminal will be able to switch the first operating system from the wake-up state to the sleep state.
示意性的,当第一操作系统进入休眠状态时,支持该第一操作系统的第一处理器也将进入休眠状态。休眠状态下的第一处理器的能耗将小于唤醒状态下的第一处理器的能耗。Schematically, when the first operating system enters the sleep state, the first processor supporting the first operating system will also enter the sleep state. The energy consumption of the first processor in the sleep state will be less than the energy consumption of the first processor in the wake-up state.
可选的,第一处理器和第二处理器在不同状态下的功耗参数可参见表一所示的内容。Optionally, the power consumption parameters of the first processor and the second processor in different states may refer to the content shown in Table 1.
表一Table I
现对表一中的数据进行介绍。其中,第一处理器在休眠状态下的功耗是P11,第一处理器在唤醒状态下的功耗是P12,第二处理器在休眠状态下的功耗是P21,第二处理器在唤醒状态下的功耗是P22。Now introduce the data in Table 1. Among them, the power consumption of the first processor in the sleep state is P11, the power consumption of the first processor in the wake-up state is P12, the power consumption of the second processor in the sleep state is P21, and the power consumption of the second processor in the wake-up state is P12. The power consumption in the state is P22.
示意性的,在本申请提供的方案中,将满足如下不等式成立P11+P22≤P12+P21。Schematically, in the solution provided by the present application, the following inequalities will be satisfied and established P11+P22≤P12+P21.
在相关技术的方案中,若采用同一个终端中的第一处理器、第二处理器和定位芯片,同时定位芯片挂载在第一处理器上,则获取定位数据时的功耗是P12+P21。另一方面,本申请实施例在获取定位数据时的功耗是P11+P22。由于本申请提供的方案能够满足不等式P11+P22≤P12+P21。因此,终端采用如本申请提供的定位芯片挂载在第二处理器中的方案时,终端能够降低自身在获取定位数据时的功耗。In the solution of the related art, if the first processor, the second processor and the positioning chip in the same terminal are used, and the positioning chip is mounted on the first processor at the same time, the power consumption when obtaining the positioning data is P12+ P21. On the other hand, the power consumption in the embodiment of the present application when acquiring positioning data is P11+P22. Because the solution provided by the present application can satisfy the inequality P11+P22≦P12+P21. Therefore, when the terminal adopts the solution that the positioning chip is mounted in the second processor as provided in the present application, the terminal can reduce its own power consumption when acquiring positioning data.
步骤220,在第二操作系统中,根据第一获取请求从定位芯片中获取定位数据。
在本申请实施例中,终端能够在第二操作系统中,根据第一获取请求从定位芯片中获取到定位数据。需要说明的是,第二操作系统是运行在第二处理器上的系统。由于第二处理器与定位芯片之间通过引脚直接相连。因此,第一处理器与定位芯片之间具备交互信息的硬件基础。在此基础上,第二处理器能够通过与定位芯片之间的信号交互获得相应的定位数据。In the embodiment of the present application, the terminal can obtain the positioning data from the positioning chip according to the first obtaining request in the second operating system. It should be noted that the second operating system is a system running on the second processor. Because the second processor is directly connected to the positioning chip through pins. Therefore, there is a hardware basis for exchanging information between the first processor and the positioning chip. On this basis, the second processor can obtain corresponding positioning data through signal interaction with the positioning chip.
在一种可能的实现方式中,定位数据可以由导航卫星系统提供。其中,导航卫星系统包括BDS(BeiDou Navigation Satellite System,北斗系统)、GPS(Global PositioningSystem,全球定位系统)、GLONASS(GLOBAL NAVIGATION SATELLITE SYSTEM,全球卫星导航系统)以及伽利略卫星导航系统(Galileo satellite navigation system)等定位系统。In one possible implementation, the positioning data may be provided by a navigation satellite system. Among them, the navigation satellite system includes BDS (BeiDou Navigation Satellite System, Beidou System), GPS (Global Positioning System, Global Positioning System), GLONASS (GLOBAL NAVIGATION SATELLITE SYSTEM, Global Satellite Navigation System) and Galileo satellite navigation system (Galileo satellite navigation system) and other positioning systems.
在另一种可能的实现方式中,定位数据还可以由网络定位设备或wifi定位设备提供。In another possible implementation manner, the positioning data may also be provided by a network positioning device or a wifi positioning device.
步骤230,将定位数据从第二操作系统反馈至第一操作系统。
在本申请中,终端能够将定位数据从第二操作系统反馈至第一操作系统,从而使得第一操作系统在进入唤醒状态后获取相应的定位数据。In the present application, the terminal can feed back positioning data from the second operating system to the first operating system, so that the first operating system acquires corresponding positioning data after entering the wake-up state.
可选地,终端还能够先指示第一操作系统从休眠状态切换至唤醒状态,再将定位数据从第二操作系统反馈至第一操作系统。基于本申请提供的获取定位数据的方法,第一操作系统仅在将第一获取请求发送至第二操作系统后,便可进而进入休眠状态。进而,在第二操作系统成功获取到定位数据后,第一操作系统再唤醒,从而获取到该反馈的定位数据。Optionally, the terminal can also first instruct the first operating system to switch from the sleep state to the wake-up state, and then feed back the positioning data from the second operating system to the first operating system. Based on the method for obtaining positioning data provided in the present application, the first operating system can enter into a dormant state only after sending the first obtaining request to the second operating system. Furthermore, after the second operating system successfully obtains the positioning data, the first operating system wakes up again, so as to obtain the feedback positioning data.
综上所述,本实施例提供的获取定位数据的方法,能够应用在包含两个处理器的终端中,第一处理器中运行有第一操作系统,第二处理器中运行有第二操作系统且第二处理器挂载有定位芯片,第二处理器的功耗低于第一处理器的功耗,响应于第一操作系统中的第一获取请求,通过第一操作系统向第二操作系统发送第一获取请求,第一获取请求用于获取定位数据,在第二操作系统中,终端根据第一获取请求从定位芯片中获取定位数据,将定位数据从第二操作系统反馈至第一操作系统中,使得终端能够通过功耗较低的处理器获取到定位数据,降低了终端获取定位数据时的功耗。To sum up, the method for obtaining positioning data provided by this embodiment can be applied to a terminal including two processors, the first processor runs the first operating system, and the second processor runs the second operating system System and the second processor is mounted with a positioning chip, the power consumption of the second processor is lower than that of the first processor, and in response to the first acquisition request in the first operating system, the first operating system sends a request to the second The operating system sends a first acquisition request, and the first acquisition request is used to acquire positioning data. In the second operating system, the terminal acquires the positioning data from the positioning chip according to the first acquisition request, and feeds back the positioning data from the second operating system to the second operating system. In an operating system, the terminal can obtain positioning data through a processor with low power consumption, thereby reducing the power consumption of the terminal when obtaining positioning data.
基于上一个实施例所公开的方案,终端还能够从操作系统层面设计第一操作系统和第二操作系统之间的信息交互逻辑,从而降低终端获取定位数据时的功耗。请参考如下实施例。Based on the solution disclosed in the previous embodiment, the terminal can also design information interaction logic between the first operating system and the second operating system from the operating system level, thereby reducing the power consumption of the terminal when acquiring positioning data. Please refer to the following examples.
请参见图3,图3是本申请另一个示例性实施例提供的一种获取定位数据的方法流程图。该获取定位数据的方法可以应用在上述所示的终端中。在图3中,该获取定位数据的方法包括:Please refer to FIG. 3 . FIG. 3 is a flow chart of a method for acquiring positioning data provided by another exemplary embodiment of the present application. The method for acquiring positioning data can be applied to the terminals shown above. In Fig. 3, the method for obtaining positioning data includes:
步骤301,响应于第一操作系统中生成的第一获取请求,通过第一操作系统生成对应的第一中间指令,第一中间指令的数据格式能够在第二操作系统中解析。
在本申请中,请参见图4,图4是本申请涉及的一种第一操作系统的结构示意图。在图4中,第一操作系统400可以包括应用(Application,APP)层410、框架(Framework)层420、Java本地接口(Java Native Interface)层430、HAL(Hardware Abstraction Layer,硬件抽象层)440和内核层(Kernel)450。In this application, please refer to FIG. 4 , which is a schematic structural diagram of a first operating system involved in this application. In FIG. 4 , the first operating system 400 may include an application (Application, APP) layer 410, a framework (Framework) layer 420, a Java native interface (Java Native Interface) layer 430, and a HAL (Hardware Abstraction Layer, hardware abstraction layer) 440 and kernel layer (Kernel) 450 .
在应用层410中,包括位置管理器(location manager)。需要说明的是,位置管理器直接响应应用程序的请求获取定位数据的请求,并生成本申请实施例中所示的第一获取请求。示意性的,位置管理器是一个类,用于获取和调用定位服务。In the application layer 410, a location manager (location manager) is included. It should be noted that the location manager directly responds to the application program's request to acquire positioning data, and generates the first acquisition request shown in the embodiment of the present application. Schematically, the location manager is a class used to obtain and invoke location services.
在本例中,应用层410与框架层420之间可以通过binder数据通道进行通信。In this example, the application layer 410 and the framework layer 420 can communicate through a binder data channel.
在框架层420中,位置管理器服务(Location Manager Service)421通过三个分支分别获取相应的定位数据。位置管理器服务421通过位置提供器代理(Location ProviderProxy)422与第一个第三方定位(ThirdPart APK)模块423相连,具备从第三方定位模块中获取定位数据的能力。In the framework layer 420, a location manager service (Location Manager Service) 421 obtains corresponding positioning data through three branches respectively. The location manager service 421 is connected to the first third-party positioning (ThirdPart APK) module 423 through a location provider proxy (Location ProviderProxy) 422, and has the ability to obtain positioning data from the third-party positioning module.
另一方面,位置管理器服务421还能够通过全球导航卫星系统位置提供者424(GnssLocationProvider.java)来获取卫星导航数据,进而将卫星导航数据确定为定位数据。On the other hand, the location manager service 421 can also obtain satellite navigation data through the global navigation satellite system location provider 424 (GnssLocationProvider.java), and then determine the satellite navigation data as positioning data.
又一方面,位置管理器服务421还能够通过地理编码器代理(Geocoderproxy)425与第二个第三方定位(ThirdPart APK)模块426相连。位置管理器服务421具备从第三方定位模块中获取定位数据的能力。一种可能实现的应用场景中,地理编码器代理425用于实现电子围栏的功能。In yet another aspect, the location manager service 421 can also be connected to a second third-party positioning (ThirdPart APK) module 426 through a geocoder proxy (Geocoderproxy) 425 . The location manager service 421 is capable of obtaining location data from third-party location modules. In a possible application scenario, the geocoder agent 425 is used to realize the function of electronic fence.
在下面的实施例中,介绍一种通过导航卫星获得定位数据的流程。In the following embodiments, a process of obtaining positioning data through navigation satellites is introduced.
在本例中,框架层420中的全球导航卫星系统位置提供者424与Java本地接口层430相连。Java本地接口层430中提供有C++文件,该C++文件用于将Java类型的指令转换为C++类型的文件,以便后续的层级了解上层指令的含义。In this example, the GNSS location provider 424 in the framework layer 420 is connected to the Java native interface layer 430 . A C++ file is provided in the Java native interface layer 430, and the C++ file is used to convert Java-type instructions into C++-type files, so that subsequent layers can understand the meaning of upper-layer instructions.
示意性的,本申请中的C++文件可以根据需要进行自主命名或者选择。其中,该C++文件可以是com_android_server_location_GnssLocationProvider.cpp(JNI(lib))。在本申请中,Java本地接口层430和硬件抽象层440之间通过hwbinder连接通信。Schematically, the C++ files in this application can be named or selected independently as required. Wherein, the C++ file may be com_android_server_location_GnssLocationProvider.cpp (JNI (lib)). In this application, the Java native interface layer 430 and the hardware abstraction layer 440 communicate through a hwbinder connection.
在硬件抽象层440中,提供有针对定位芯片编写的文件,该文件处理后的信息能够被第二操作系统解析,同时能够被定位芯片识别。示意性的,第一中间指令可以在硬件抽象层440中生成。In the hardware abstraction layer 440, a file written for the positioning chip is provided, and the information processed by the file can be parsed by the second operating system and recognized by the positioning chip. Schematically, the first intermediate instruction may be generated in the hardware abstraction layer 440 .
在本例中,硬件抽象层440和内核层450之间通过IO接口互相传输数据。In this example, the hardware abstraction layer 440 and the kernel layer 450 transmit data to each other through the IO interface.
内核层450可以通过指定内核文件继续处理第一中间指令,并将处理后的第一中间指令发送至第二操作系统。The kernel layer 450 may continue to process the first intermediate instruction by specifying the kernel file, and send the processed first intermediate instruction to the second operating system.
步骤302,将第一中间指令通过第一操作系统发送至第二操作系统。
在一种可能的实现方式中,第一操作系统和第二操作系统之间通过SPI进行通信。In a possible implementation manner, the communication between the first operating system and the second operating system is performed through SPI.
请参见图5,图5是本申请实施例提供的一种第二操作系统的结构示意图。在图5中,第二操作系统500中包括路由任务510和定位主任务520。其中,路由任务510由于接收第一操作系统发送来的第一中间指令,并将第一中间指令转发至定位主任务520。定位主任务520用于从定位芯片中获取到定位数据。Please refer to FIG. 5 . FIG. 5 is a schematic structural diagram of a second operating system provided by an embodiment of the present application. In FIG. 5 , the second operating system 500 includes a routing task 510 and a positioning main task 520 . Wherein, the routing task 510 receives the first intermediate instruction sent by the first operating system, and forwards the first intermediate instruction to the positioning main task 520 . The positioning main task 520 is used to obtain positioning data from the positioning chip.
请参见图6,图6是本申请实施例提供的一种获取定位数据的系统框架示意图。在第一处理器610上运行有第一操作系统,在第二处理器620上运行有第二操作系统。在本例中,第一处理器610可以是应用处理器(Application Processor,AP),第二处理器620可以是MCU(Microcontroller Unit,微控制单元)。导航数据获取模块630挂载在第二处理器620上。Please refer to FIG. 6 . FIG. 6 is a schematic diagram of a system framework for acquiring positioning data provided by an embodiment of the present application. A first operating system runs on the first processor 610 , and a second operating system runs on the second processor 620 . In this example, the first processor 610 may be an application processor (Application Processor, AP), and the second processor 620 may be an MCU (Microcontroller Unit, micro control unit). The navigation data acquisition module 630 is mounted on the second processor 620 .
步骤303,指示第一操作系统切换至休眠状态。
在本例中,当第一中间指令从第一操作系统发送至第二操作系统之后,终端能够指示第一操作系统从唤醒状态切换至休眠状态。其中,该切换动作可以是第一操作系统在发送第一中间指令后自主执行的操作。或者,该切换动作也可以是第一操作系统在发送第一中间指令给第二操作系统,并接收到第二操作系统反馈的确认消息后执行的操作。In this example, after the first intermediate instruction is sent from the first operating system to the second operating system, the terminal can instruct the first operating system to switch from the wake-up state to the sleep state. Wherein, the switching action may be an operation performed autonomously by the first operating system after sending the first intermediate instruction. Alternatively, the switching action may also be an operation performed by the first operating system after sending the first intermediate command to the second operating system and receiving a confirmation message fed back by the second operating system.
步骤304,在第二操作系统中,确定与第一中间指令匹配的定位数据获取指令。
在本例中,当第一中间指令传输至第二操作系统时,终端能够确定与第一中间指令匹配的定位数据获取指令。需要说明的是,定位数据获取指令是能够被定位芯片识别并执行相应操作的指令。可选的,第二操作系统中可以维护第一中间指令和定位数据获取指令之间的对应关系。示意性的,表二所处了一种第一中间指令和定位数据获取指令之间的对应关系示意图。In this example, when the first intermediate instruction is transmitted to the second operating system, the terminal can determine the positioning data acquisition instruction matching the first intermediate instruction. It should be noted that the positioning data acquisition instruction is an instruction that can be recognized by the positioning chip and perform corresponding operations. Optionally, the second operating system may maintain a correspondence between the first intermediate instruction and the positioning data acquisition instruction. Schematically, Table 2 shows a schematic diagram of the corresponding relationship between the first intermediate instruction and the positioning data acquisition instruction.
表二Table II
在一种可能的方式中,第二操作系统中可以预先存储上述对应关系。例如,当第二操作系统接收到的第一中间指令是z3,则第二操作系统能够确定对应的定位数据获取指令是定位数据获取指令d3。In a possible manner, the above correspondence relationship may be pre-stored in the second operating system. For example, when the first intermediate instruction received by the second operating system is z3, the second operating system can determine that the corresponding positioning data acquisition instruction is the positioning data acquisition instruction d3.
步骤305,根据定位数据获取指令从定位芯片中获取定位数据。
在本申请实施例中,第二操作系统将能够将定位数据获取指令发送至定位芯片。相应的,定位芯片在定位数据获取指令的指示下,通过天线与导航卫星通信后,获得相应的定位数据。In the embodiment of the present application, the second operating system will be able to send the positioning data acquisition instruction to the positioning chip. Correspondingly, the positioning chip obtains the corresponding positioning data after communicating with the navigation satellite through the antenna under the instruction of obtaining the positioning data.
步骤306,指示第一操作系统切换至唤醒状态,并将定位数据从第二操作系统反馈至第一操作系统。
在本申请中,在第二操作系统获取到定位数据后,终端能够指示第一操作系统从休眠状态切换至唤醒状态。由于第一操作系统在唤醒状态中能够正常地与外接进行信息交互。因此,第一操作系统唤醒后具备从第二操作系统中获取定位数据的能力。在第二操作系统向第一操作系统传输定位数据时,第一操作系统能够正常获取到该定位数据。In the present application, after the second operating system acquires the positioning data, the terminal can instruct the first operating system to switch from the sleep state to the wake-up state. Because the first operating system can normally perform information interaction with the add-in in the wake-up state. Therefore, the first operating system has the ability to obtain positioning data from the second operating system after waking up. When the second operating system transmits the positioning data to the first operating system, the first operating system can normally obtain the positioning data.
一种可能的实现方式中,用于指示第一操作系统从休眠状态切换至唤醒状态的指令,可以从第二操作系统发出。处于休眠状态的第一操作系统能够在接收到从休眠状态切换至唤醒状态的指令时,将从休眠状态切换至唤醒状态。In a possible implementation manner, the instruction for instructing the first operating system to switch from the sleep state to the wake-up state may be issued from the second operating system. The first operating system in the sleep state can switch from the sleep state to the wake-up state when receiving an instruction to switch from the sleep state to the wake-up state.
另一种可能的实现方式中,用于指示第一操作系统从休眠状态切换至唤醒状态的指令,可以是第一操作系统中预设的周期性指令。当第一操作系统完成一个休眠周期后,第一操作系统可以根据该周期性指令自动从休眠状态切换至唤醒状态。In another possible implementation manner, the command used to instruct the first operating system to switch from the sleep state to the wake-up state may be a preset periodic command in the first operating system. After the first operating system completes a sleep cycle, the first operating system can automatically switch from the sleep state to the wake-up state according to the periodic instruction.
当第一操作系统切换至唤醒状态后,能够从第二操作系统获取定位数据。随后,第一操作系统能够将定位数据反馈至请求定位数据的具体应用程序,以保证第一操作系统中的应用程序的正常运行。After the first operating system switches to the wake-up state, the location data can be obtained from the second operating system. Subsequently, the first operating system can feed back the positioning data to a specific application program requesting the positioning data, so as to ensure normal operation of the application program in the first operating system.
综上所述,本实施例提供的方法能够在具有多个系统层级的第一操作系统中逐层传递第一中间指令,使得第一操作系统需要获取定位数据的意图正确传递至第二操作系统,第二操作系统按照相应的指令从挂载在第二处理器上的定位芯片获取定位数据。由于第一操作系统仅需要发送获取定位数据的意图,并在第二操作系统程序获取到定位数据后唤醒以接收该定位数据,使得功耗较高的第一处理器在获取定位数据的期间处于休眠状态,而是由功耗较低的第二处理器来获取定位数据,实现了以较低功耗获取定位数据的效果。To sum up, the method provided by this embodiment can transfer the first intermediate instruction layer by layer in the first operating system with multiple system layers, so that the intention of the first operating system to obtain positioning data can be correctly transferred to the second operating system , the second operating system acquires positioning data from the positioning chip mounted on the second processor according to corresponding instructions. Since the first operating system only needs to send the intention to obtain the positioning data, and wake up to receive the positioning data after the second operating system program obtains the positioning data, the first processor with higher power consumption is in the process of obtaining the positioning data. In the dormant state, the positioning data is acquired by the second processor with lower power consumption, thereby achieving the effect of acquiring positioning data with lower power consumption.
基于上述实施例所示的方法,本申请实施例还提供一种获取定位数据的方法,能够提高第二操作系统中获取定位数据的效率,请参考如下实施例。Based on the methods shown in the foregoing embodiments, the embodiments of the present application further provide a method for obtaining positioning data, which can improve the efficiency of obtaining positioning data in the second operating system. Please refer to the following embodiments.
请参考图7,图7是本申请一个示例性实施例提供的一种获取定位数据的方法流程图。该获取定位数据的方法可以应用在上述所示的终端中。在图7中,该获取定位数据的方法包括:Please refer to FIG. 7 . FIG. 7 is a flowchart of a method for acquiring positioning data provided by an exemplary embodiment of the present application. The method for acquiring positioning data can be applied to the terminals shown above. In FIG. 7, the method for obtaining positioning data includes:
步骤701,响应于第一操作系统中的数据请求对象生成的获取请求,通过自定义的可执行文件生成获取请求对应的第一中间指令。Step 701, in response to the acquisition request generated by the data request object in the first operating system, generate a first intermediate instruction corresponding to the acquisition request through a custom executable file.
其中,可执行文件是基于定位芯片的硬件规范编写的文件。需要说明的是,数据请求对象可以是应用层的应用程序或者进程。获取请求在从应用层生成后,可以逐层通过框架层、Java本地接口层直至传递到硬件抽象层。为了侧重描述本方案在第二操作系统中的交互过程,图7中未示出获取请求在第一操作系统中的应用层、框架层和Java本地接口层中的信息传递过程。Wherein, the executable file is a file written based on the hardware specification of the positioning chip. It should be noted that the data request object may be an application program or a process at the application layer. After the acquisition request is generated from the application layer, it can pass through the framework layer, the Java native interface layer layer by layer, and then be passed to the hardware abstraction layer. In order to focus on describing the interaction process of this solution in the second operating system, FIG. 7 does not show the information transfer process of the acquisition request in the application layer, framework layer and Java native interface layer in the first operating system.
在一种可能的实现方式中,终端中的软件设计人员预先知晓终端中适配的定位芯片的型号,设计人员将根据所需要使用的定位芯片的型号来编写对应的可执行文件。示意性的,该可执行文件的一种可能的命名方式可以是android.hardware.gnss@1.0-service.cxd5603。In a possible implementation manner, the software designer in the terminal knows in advance the model of the positioning chip adapted in the terminal, and the designer will write the corresponding executable file according to the model of the positioning chip to be used. Schematically, a possible naming manner of the executable file may be android.hardware.gnss@1.0-service.cxd5603.
在另一种可能的实现方式中,终端中的软件设计人员将预先编写多个可执行文件,使得操作系统能够在初始化的时候具备适配多种定位芯片的能力。在该实现方式中,若第一操作系统中有多种预置的可执行文件,则在终端设备生产时,无需因使用的定位芯片不同而频繁更换所预先装载的第一操作系统。In another possible implementation, the software designer in the terminal will pre-write multiple executable files, so that the operating system can have the ability to adapt to multiple positioning chips when it is initialized. In this implementation manner, if there are multiple preset executable files in the first operating system, it is not necessary to frequently replace the preloaded first operating system due to different positioning chips used during the production of the terminal device.
例如,若终端中预先编写有可执行文件D1、可执行文件D2和可执行文件D3三个文件,则终端在生产线上首次开机时,终端会在显示屏中显示终端安装的芯片型号。当检测员选择相应的型号后,终端将重新启动并加载对应的可执行文件。可选地,为避免后续执行逻辑错误,终端可以删除未被选中的可执行文件。可选的,在一些可能的场景中,终端还能够在自动加载的过程中自动识别出所需要运行的可执行文件,并删除其余不需要的可执行文件。For example, if three executable files D1, D2 and D3 are pre-programmed in the terminal, when the terminal is turned on for the first time on the production line, the terminal will display the chip model installed in the terminal on the display. When the inspector selects the corresponding model, the terminal will restart and load the corresponding executable file. Optionally, to avoid subsequent execution logic errors, the terminal may delete unselected executable files. Optionally, in some possible scenarios, the terminal can also automatically identify executable files that need to be run during the automatic loading process, and delete other unnecessary executable files.
比如,可执行文件D1对应于定位芯片L1,可执行文件D2对应于定位芯片L2,可执行文件D3对应于定位芯片L3。当检测员确定终端中安装的是定位芯片L2,因此在终端屏幕中选择定位芯片L2。此时,终端进行了重启,将可执行文件D2确定为获取定位数据的组件,并相应地删除了可执行文件D1和可执行文件D3。For example, the executable file D1 corresponds to the positioning chip L1, the executable file D2 corresponds to the positioning chip L2, and the executable file D3 corresponds to the positioning chip L3. When the inspector determines that the positioning chip L2 is installed in the terminal, he selects the positioning chip L2 on the terminal screen. At this time, the terminal restarts, determines the executable file D2 as the component for obtaining the location data, and deletes the executable file D1 and the executable file D3 accordingly.
步骤702,将第一中间指令从可执行文件所在的硬件抽象层发送至内核层。Step 702, sending the first intermediate instruction from the hardware abstraction layer where the executable file is located to the kernel layer.
其中,硬件抽象层和内核层属于第一操作系统。Wherein, the hardware abstraction layer and the kernel layer belong to the first operating system.
在本申请中,第一中间指令在生成之后,终端能够将其传送至第一操作系统中的下个层级中。在本次传递过程中,终端能够将第一中间指令从硬件抽象层发送至内核层。In the present application, after the first intermediate instruction is generated, the terminal can transmit it to the next level in the first operating system. During this transfer process, the terminal can send the first intermediate instruction from the hardware abstraction layer to the kernel layer.
需要说明的是,硬件抽象层和内核层同属于一个操作系统。在本申请实施例中,硬件抽象层和内核层同属于第一操作系统。It should be noted that the hardware abstraction layer and the kernel layer belong to the same operating system. In the embodiment of the present application, the hardware abstraction layer and the kernel layer both belong to the first operating system.
步骤703,将第一中间指令从内核层通过第一数据通道传送至路由任务。Step 703, transmitting the first intermediate instruction from the kernel layer to the routing task through the first data channel.
其中,路由任务属于第二操作系统。Wherein, the routing task belongs to the second operating system.
在本申请中,第一中间指令的目的在于指示第二操作系统通过与定位芯片的交互,获取相应的定位数据。因此,目前位于内核层中的第一中间指令将进一步被内核层通过第一数据通道传送至路由任务。其中,该路由任务是属于第二操作系统的任务。In this application, the purpose of the first intermediate instruction is to instruct the second operating system to obtain corresponding positioning data through interaction with the positioning chip. Therefore, the first intermediate instruction currently located in the kernel layer will be further transmitted to the routing task by the kernel layer through the first data channel. Wherein, the routing task is a task belonging to the second operating system.
步骤704,获取第一中间指令中的数据请求对象的对象标识。Step 704, acquire the object identifier of the data request object in the first intermediate instruction.
需要说明的是,数据请求对象可以是第一操作系统中的应用程序、进程或服务中的任意一种。It should be noted that the data request object may be any one of the application program, process or service in the first operating system.
在本申请中,终端能够通过第二操作系统,获取第一中间指令中的数据请求对象的对象标识。需要说明的是,由于在当前步骤中第一中间指令留存在路由任务中。因此,终端可以指示路由任务从第一中间指令中获取数据请求对象的对象标识。In this application, the terminal can obtain the object identifier of the data request object in the first intermediate instruction through the second operating system. It should be noted that, in the current step, the first intermediate instruction remains in the routing task. Therefore, the terminal may instruct the routing task to obtain the object identifier of the data request object from the first intermediate instruction.
步骤705,根据对象标识,通过路由任务将第一中间指令转发至定位主任务。Step 705, forward the first intermediate instruction to the positioning main task through the routing task according to the object identifier.
其中,定位主任务属于第二操作系统。Wherein, the positioning main task belongs to the second operating system.
在本例中,终端能够根据对象标识确定其需要被转发的目的地。当终端确定第一中间指令需要被转发至定位主任务时,终端将能够通过路由任务将第一中间指令转发至定位主任务。In this example, the terminal can determine the destination to be forwarded according to the object identifier. When the terminal determines that the first intermediate instruction needs to be forwarded to the positioning main task, the terminal will be able to forward the first intermediate instruction to the positioning main task through the routing task.
步骤706,通过定位主任务在第二操作系统中注册第一回调函数。Step 706, register the first callback function in the second operating system by locating the main task.
其中,第一回调函数用于将定位数据反馈至数据请求对象。Wherein, the first callback function is used to feed back the positioning data to the data request object.
在本例中,终端能够通过定位主任务在第二操作系统中注册第一回调函数。其中,第一回调函数的主要作用是向请求定位数据的数据请求对象反馈数据。因此,终端将事先在定位主任务中注册该第一回调函数。In this example, the terminal can register the first callback function in the second operating system by locating the main task. Wherein, the main function of the first callback function is to feed back data to the data request object requesting the positioning data. Therefore, the terminal will register the first callback function in the positioning main task in advance.
步骤707,通过定位主任务,从定位指令库中确定与第一中间指令匹配的定位数据获取指令。Step 707: Determine the positioning data acquisition instruction that matches the first intermediate instruction from the positioning instruction library through the positioning main task.
在本例中,终端能够通过定位主任务,从定位指令库中确定与第一中间指令匹配的定位数据获取指令。其中,定位指令库可以是第二操作系统中维护的一个数据库。或者,定位指令库可以没有具体的文件或者数据集合包括相应的数据,可以仅有第二操作系统记录的若干个指令组成。In this example, the terminal can determine the positioning data acquisition instruction matching the first intermediate instruction from the positioning instruction library by positioning the main task. Wherein, the positioning instruction library may be a database maintained in the second operating system. Alternatively, the location instruction library may not include specific files or data sets including corresponding data, and may only consist of several instructions recorded by the second operating system.
步骤708,指示定位主任务调用串行通信接口,向定位芯片发送定位数据获取指令。Step 708, instruct the positioning main task to call the serial communication interface, and send a positioning data acquisition instruction to the positioning chip.
在本申请中,定位主任务具备与定位芯片进行通信的能力。定位主任务能够在终端的指示下,或者说,定位主任务能够在第二操作系统的控制下,调用串行通信接口,向定位芯片发送定位数据获取指令。在一种可能的方式中,由于串行通信接口是定位芯片与第二处理器连接的硬件接口。因此,串行通信接口中还包括从定位芯片向第二处理器发送数据的数据线。In this application, the positioning main task has the ability to communicate with the positioning chip. Under the instruction of the terminal, or in other words, under the control of the second operating system, the main positioning task can call the serial communication interface and send the positioning data acquisition instruction to the positioning chip. In a possible manner, since the serial communication interface is a hardware interface for connecting the positioning chip with the second processor. Therefore, the serial communication interface also includes a data line for sending data from the positioning chip to the second processor.
步骤709,响应于定位芯片向串行通信接口发送第一数据,通过目标中断任务提供的中断方式接收定位数据,并生成中断服务。Step 709, in response to the positioning chip sending the first data to the serial communication interface, receive the positioning data through the interrupt mode provided by the target interrupt task, and generate an interrupt service.
在本申请中,定位芯片向串行通信接口发送的第一数据包括多种数据类型。其中,数据类型包括反馈信号或定位数据。In the present application, the first data sent by the positioning chip to the serial communication interface includes multiple data types. Wherein, the data type includes feedback signal or positioning data.
其中,定位数据是定位芯片基于定位数据获取指令反馈的定位标准数据,目标中断任务用于为串行通信接收接口提供中断。Wherein, the positioning data is the positioning standard data obtained by the positioning chip based on the positioning data to obtain instruction feedback, and the target interrupt task is used to provide interrupts for the serial communication receiving interface.
在本例中,第二操作系统中的目标中断任务能够用来接收定位数据。当目标中断任务需要获取定位数据时,目标中断任务为串行通信接收接口提供中断,从而获取定位数据。In this example, a target interrupt task in the second operating system can be used to receive positioning data. When the target interrupt task needs to obtain positioning data, the target interrupt task provides an interrupt for the serial communication receiving interface to obtain positioning data.
在本例中,响应于接收到定位数据,终端能够通过目标中断任务生成中断服务程序。In this example, in response to receiving the positioning data, the terminal can generate an interrupt service routine through the target interrupt task.
其中,在第二操作系统获取到定位数据之后,第二操作系统能够通过指示目标中断任务生成中断服务程序,以便后续操作。Wherein, after the second operating system acquires the location data, the second operating system can generate an interrupt service routine by instructing the target interrupt task for subsequent operations.
步骤710,基于中断服务程序,向事件任务推送第二回调函数。Step 710, push the second callback function to the event task based on the interrupt service routine.
在前序步骤已经生成中断服务程序的前提下,终端能够在第二操作系统中基于中断服务向事件任务推送第二回调函数。需要说明的是,该第二回调函数具备检测定位数据的完整性的能力。On the premise that the interrupt service program has been generated in the preceding steps, the terminal can push the second callback function to the event task based on the interrupt service in the second operating system. It should be noted that the second callback function has the ability to detect the integrity of the positioning data.
步骤711,指示事件任务基于第二回调函数检测第一数据的完整性。Step 711, instruct the event task to detect the integrity of the first data based on the second callback function.
在本例中,第二操作系统能够指示事件任务基于第二回调函数检测第一数据的完整性。第一数据包括定位数据或反馈信号。需要说明的是,当第一数据是定位数据且定位数据不再完整,则终端较大可能无法从定位数据中获取反映真实世界位置的数据。当第一数据是反馈信号且反馈信号不完整,则终端较大可能无法从反馈信号中确定当前定位过程是否已经完成。In this example, the second operating system can instruct the event task to detect the integrity of the first data based on the second callback function. The first data includes positioning data or feedback signals. It should be noted that when the first data is positioning data and the positioning data is no longer complete, the terminal may not be able to acquire data reflecting real-world positions from the positioning data. When the first data is a feedback signal and the feedback signal is incomplete, the terminal may not be able to determine from the feedback signal whether the current positioning process has been completed.
在本申请中,若定位数据是完整的,则该定位数据能够反映真实世界中的位置。In this application, if the positioning data is complete, the positioning data can reflect the position in the real world.
步骤712,响应于第一数据是完整的数据,检测第一数据中包含的数据类型。Step 712, in response to the fact that the first data is complete data, detect the data type contained in the first data.
其中,终端能够根据数据类型执行相应的处理,以完成获取定位数据的流程。在一种可能的方式中,若数据类型是反馈信号,则第二处理器能够知晓当前获取定位数据的流程是否已经结束。在另一种可能的方式中,若数据类型是定位数据,则本次是指获取定位数据的流程已经完成。Wherein, the terminal can perform corresponding processing according to the data type, so as to complete the process of obtaining the positioning data. In a possible manner, if the data type is a feedback signal, the second processor can know whether the current process of acquiring positioning data has ended. In another possible manner, if the data type is positioning data, this means that the process of obtaining the positioning data has been completed.
步骤721,响应于数据类型是定位数据,指示事件任务通过第一回调函数将定位数据反馈至第一操作系统。Step 721, in response to the data type being location data, instruct the event task to feed back the location data to the first operating system through the first callback function.
在本申请所提供的另一个能够实现的方案中,第二操作系统能够通过传感器任务(sensor task)为本系统获取定位数据。在实际实现的过程中,传感器任务用于注册第三回调函数,第三回调函数用于在被调用时通过第二数据通道向指定对象发送定位数据。In another implementable solution provided by the present application, the second operating system can acquire positioning data for the system through a sensor task. In an actual implementation process, the sensor task is used to register a third callback function, and the third callback function is used to send positioning data to a specified object through the second data channel when called.
需要说明的是,指定对象属于第一操作系统。同时,传感器任务还用于注册第四回调函数,该第四回调函数用于在调用时向第二操作系统内的对象发送定位数据。It should be noted that the specified object belongs to the first operating system. At the same time, the sensor task is also used to register a fourth callback function, and the fourth callback function is used to send positioning data to the object in the second operating system when called.
在本申请的另一种可能的实现方式中,当第一操作系统获取定位数据之后,第一操作系统还能够向第二操作系统发出停止指令,以指示第二操作系统停止从定位芯片中获取定位数据。In another possible implementation of the present application, after the first operating system obtains the positioning data, the first operating system can also issue a stop command to the second operating system to instruct the second operating system to stop obtaining positioning data from the positioning chip. positioning data.
可选地,本申请还提供有反馈机制,以令第二操作系统能够知晓定位芯片是否成功接收到定位数据获取指令。作为步骤721的替代步骤,终端还可以执行步骤(a1)和步骤(a2)。Optionally, the present application further provides a feedback mechanism, so that the second operating system can know whether the positioning chip has successfully received the positioning data acquisition instruction. As an alternative to step 721, the terminal may also perform step (a1) and step (a2).
步骤(a1),响应于数据类型是反馈信号,指示事件任务通过第二回调函数,向定位主任务发送反馈信号。Step (a1), in response to the data type being a feedback signal, instruct the event task to send a feedback signal to the positioning main task through the second callback function.
在本例中,第二操作系统中包括的事件任务通过第二回调函数,向定位主任务发送反馈信息。In this example, the event task included in the second operating system sends feedback information to the positioning main task through the second callback function.
步骤(a2),响应于定位主任务接收到反馈信号,指示定位主任务停止向定位芯片重发定位数据获取指令。Step (a2), in response to the positioning master task receiving the feedback signal, instruct the positioning master task to stop resending the positioning data acquisition instruction to the positioning chip.
在本例中,响应于定位主任务接收到反馈信号,终端指示定位主任务停止向定位芯片重发定位数据获取指令。需要说明的是,反馈信号用于指示定位芯片已经成功接收到定位数据获取指令。In this example, in response to the positioning main task receiving the feedback signal, the terminal instructs the positioning main task to stop resending the positioning data acquisition instruction to the positioning chip. It should be noted that the feedback signal is used to indicate that the positioning chip has successfully received the positioning data acquisition instruction.
综上所述,本申请提供的获取定位数据的方法,能够在第二操作系统中通过定位主任务与定位芯片的交互,以从定位芯片中获取到定位数据。在相应的交互过程结束后,第二操作系统中的事件任务能够通过预先注册的回调函数向第一操作系统反馈定位数据。由于第二操作系统提供了完整的信息控制流程,因此,第二操作系统能够在顺利获取定位芯片中的定位数据并反馈到第一操作系统中,在降低终端获取定位数据时的功耗的前提下,提升了第二操作系统获取定位数据的稳定性。To sum up, the method for obtaining positioning data provided by the present application can acquire positioning data from the positioning chip through the interaction between the positioning main task and the positioning chip in the second operating system. After the corresponding interaction process ends, the event task in the second operating system can feed back positioning data to the first operating system through a pre-registered callback function. Since the second operating system provides a complete information control process, the second operating system can successfully obtain the positioning data in the positioning chip and feed it back to the first operating system, on the premise of reducing the power consumption of the terminal when acquiring positioning data In this case, the stability of obtaining positioning data by the second operating system is improved.
可选的,第二操作系统还能够通过目标中断任务从定位芯片中获取到定位数据,并且通过反馈机制了解定位芯片是否已经接收到第一获取请求。在定位芯片已经获取到第一获取请求后,第二操作系统中的定位主任务不再向定位芯片重发第一获取请求,节省了第二操作系统的功耗。Optionally, the second operating system can also obtain positioning data from the positioning chip through the target interrupt task, and know whether the positioning chip has received the first obtaining request through a feedback mechanism. After the positioning chip has obtained the first obtaining request, the positioning main task in the second operating system does not resend the first obtaining request to the positioning chip, which saves power consumption of the second operating system.
请参见图8,图8是基于图7所示实施例提供的一种停止获取定位数据的流程图。在图8中,停止获取定位数据的流程可以在第一操作系统成功获取到低位数据之后执行。在一种可能的执行方式中,终端能够在图7所示的步骤721后执行步骤801,在图8中,各个步骤的执行过程如下:Please refer to FIG. 8 . FIG. 8 is a flow chart of stopping obtaining positioning data based on the embodiment shown in FIG. 7 . In FIG. 8 , the process of stopping acquiring positioning data may be executed after the first operating system successfully acquires low-order data. In a possible execution manner, the terminal can execute step 801 after step 721 shown in FIG. 7. In FIG. 8, the execution process of each step is as follows:
步骤801,响应于第一操作系统中生成的停止请求,生成对应的第二中间指令。Step 801: Generate a corresponding second intermediate instruction in response to a stop request generated in the first operating system.
其中,停止请求用于请求停止获取定位数据,停止请求中可以携带有数据请求对象的标识。Wherein, the stop request is used to request to stop obtaining the positioning data, and the stop request may carry the identifier of the data request object.
在本申请中,停止请求是第一操作系统中的应用生成的请求。一种可能的方式中,当第一操作系统中的获取定位数据的应用程序关闭或退出之前,应用程序生成停止请求并告知到第一操作系统。第一操作系统在获取到该停止请求之后,能够根据停止请求生成对应的第二中间指令。In this application, the stop request is a request generated by an application in the first operating system. In a possible manner, when the application program that acquires the positioning data in the first operating system is closed or before exiting, the application program generates a stop request and informs the first operating system. After acquiring the stop request, the first operating system can generate a corresponding second intermediate instruction according to the stop request.
在一种可能的方式中,第一操作系统在硬件抽象层中生成第二中间指令。In a possible manner, the first operating system generates the second intermediate instruction in the hardware abstraction layer.
步骤802,将第二中间指令从第一操作系统发送至第二操作系统。
在一种可能的方式中,终端中的第一操作系统能够将第二中间指令通过跨核通信的方式,传送至第二操作系统。需要说明的是,第二中间指令的传输方式和第一中间指令的传输方式相同。In a possible manner, the first operating system in the terminal can transmit the second intermediate instruction to the second operating system through cross-core communication. It should be noted that the transmission mode of the second intermediate instruction is the same as that of the first intermediate instruction.
步骤803,在第二操作系统中,确定与第二中间指令匹配的停止指令。
在本申请中,第二操作系统能够确定出第二中间指令向匹配的停止指令。一种可能的方式中,第二中间指令和停止指令在第二操作系统中具有匹配关系。在该场景中,第二操作系统能够按照指定的匹配关系,确定出与第二中间指令匹配的停止指令。In the present application, the second operating system can determine that the second intermediate instruction corresponds to a matching stop instruction. In a possible manner, the second intermediate instruction and the stop instruction have a matching relationship in the second operating system. In this scenario, the second operating system can determine the stop instruction that matches the second intermediate instruction according to the specified matching relationship.
步骤804,基于停止指令,停止获取定位数据。
在本申请的一种可能的实现方式中,本申请能够通过执行步骤(c1)、步骤(c2)和步骤(c3)来实现停止获取定位数据的过程。或者,本申请能够通过执行步骤(c1)、步骤(c2)和步骤(c4)来实现停止获取定位数据的过程。In a possible implementation manner of the present application, the present application can implement step (c1), step (c2) and step (c3) to stop the process of obtaining positioning data. Alternatively, the present application can stop the process of obtaining positioning data by performing step (c1), step (c2) and step (c4).
步骤(c1),指示定位主任务接收停止指令。Step (c1), instructing the positioning main task to receive a stop instruction.
在本申请中,第二操作系统能够指示定位主任务接收停止指令。In this application, the second operating system can instruct the positioning main task to receive the stop instruction.
步骤(c2),指示定位主任务基于停止指令,注销数据请求对象对应的第一回调函数,第一回调函数用于将定位数据反馈至数据请求对象。Step (c2), instructing the positioning master task to log out of the first callback function corresponding to the data request object based on the stop instruction, and the first callback function is used to feed back the positioning data to the data request object.
可选地,定位主任务在接收到停止指令后,能够基于该停止指令注销数据请求对象对应的第一回调函数。其中,该第一回调函数用于将定位数据反馈至数据请求对象。Optionally, after receiving the stop instruction, the positioning main task can cancel the first callback function corresponding to the data request object based on the stop instruction. Wherein, the first callback function is used to feed back the positioning data to the data request object.
步骤(c3),响应于定位芯片处于使用状态,结束流程。Step (c3), in response to the fact that the positioning chip is in use, the process ends.
在本例中,若定位芯片处于使用状态,则说明终端有其它的对象在使用该定位芯片。在此情况下,第二操作系统将不再干涉定位芯片的状态,结束本次控制流程。In this example, if the positioning chip is in use, it means that the terminal has other objects using the positioning chip. In this case, the second operating system will no longer interfere with the state of the positioning chip, and end this control process.
步骤(c4),响应于定位芯片处于空闲状态,关闭定位芯片。Step (c4), in response to the fact that the positioning chip is in an idle state, turn off the positioning chip.
可选地,若定位芯片处于空闲状态,则终端能够在此场景下关闭定位芯片,使得定位芯片在无需继续获取定位数据的情况下关闭,从而节省终端的能源。Optionally, if the positioning chip is in an idle state, the terminal can turn off the positioning chip in this scenario, so that the positioning chip is turned off without continuing to acquire positioning data, thereby saving energy of the terminal.
在一种可能的关闭定位芯片的方式中,终端能够响应于定位芯片处于空闲状态,延时目标时长后关闭定位芯片。示意性的,目标时长可以是30秒、40秒、45秒或50秒等固定时长,本申请实施例对此不作限定。In a possible way of turning off the positioning chip, the terminal can respond to the fact that the positioning chip is in an idle state, and turn off the positioning chip after a target time delay. Exemplarily, the target duration may be a fixed duration such as 30 seconds, 40 seconds, 45 seconds, or 50 seconds, which is not limited in this embodiment of the present application.
本申请实施例可以根据定位芯片中的延时规范,选择适应于延时规范的目标时长。例如,终端中采用的定位芯片的延时规范是50秒,则本申请实施例中的目标时长将被设置为50秒。In this embodiment of the present application, according to the delay specification in the positioning chip, a target duration suitable for the delay specification can be selected. For example, if the delay specification of the positioning chip used in the terminal is 50 seconds, then the target duration in this embodiment of the application will be set to 50 seconds.
在一种可能的关闭定位芯片的方式中,响应于当前系统时刻处于目标时长内且接收到定位芯片启用指令,停止关闭定位芯片的流程。其中,定位芯片启用指令用于启用定位芯片。In a possible manner of disabling the positioning chip, in response to the current system moment being within the target duration and receiving a positioning chip enabling instruction, the process of disabling the positioning chip is stopped. Wherein, the positioning chip enabling instruction is used to enable the positioning chip.
例如,若目标时长是50秒,则在该50秒的倒计时中,若第二处理器再次接收到用于启动定位芯片的定位芯片启用指令时,则第二处理器将停止倒计时,取消关闭定位芯片的流程。For example, if the target duration is 50 seconds, then during the 50-second countdown, if the second processor receives the positioning chip enabling instruction for starting the positioning chip again, the second processor will stop counting down and cancel the positioning off. Chip flow.
综上所述,本实施例提供的获取定位数据的方法,能够令具备双操作系统的终端通过较节省能耗的操作系统获取定位数据,并在第一操作系统成功获取到定位数据之后,通过指令第二操作系统中的相关程序对象实现停止定位芯片工作的效果,以令定位芯片在无需工作的情况下及时关闭,从而进一步节省电能,提高终端的续航效果。To sum up, the method for obtaining positioning data provided by this embodiment can enable a terminal with dual operating systems to obtain positioning data through an operating system that saves energy consumption, and after the first operating system successfully obtains positioning data, the terminal can obtain positioning data through Instructing related program objects in the second operating system to realize the effect of stopping the work of the positioning chip, so that the positioning chip can be turned off in time when there is no need to work, thereby further saving power and improving the battery life of the terminal.
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
请参考图9,图9本申请一个示例性实施例提供的一种获取定位数据的装置的结构框图。该获取定位数据的装置可以通过软件、硬件或者两者的结合实现成为终端的全部或一部分。终端包括第一处理器和第二处理器,所述第一处理器中运行有第一操作系统,所述第二处理器中运行有第二操作系统且所述第二处理器中挂载有定位芯片,所述第二处理器的功耗低于所述第一处理器的功耗。该装置包括:Please refer to FIG. 9 , which is a structural block diagram of an apparatus for acquiring positioning data provided by an exemplary embodiment of the present application. The device for acquiring positioning data can be implemented as all or a part of the terminal through software, hardware or a combination of the two. The terminal includes a first processor and a second processor, the first processor runs a first operating system, the second processor runs a second operating system and the second processor mounts a Positioning the chip, the power consumption of the second processor is lower than the power consumption of the first processor. The unit includes:
第一生成模块910,用于响应于所述第一操作系统中生成的第一获取请求,通过所述第一操作系统向所述第二操作系统发送所述第一获取请求,所述第一获取请求用于请求获取定位数据;The
获取模块920,用于在所述第二操作系统中,根据所述第一获取请求从所述定位芯片中获取所述定位数据;An obtaining
反馈模块930,用于将所述定位数据从所述第二操作系统反馈至所述第一操作系统。The
在一个可选的实施例中,所述第一生成模块910,用于响应于所述第一操作系统中生成的所述第一获取请求,通过所述第一操作系统生成对应的第一中间指令,所述第一中间指令的数据格式能够在所述第二操作系统中解析;将所述第一中间指令通过所述第一操作系统发送至所述第二操作系统;所述获取模块920,用于在所述第二操作系统中,确定与所述第一中间指令匹配的定位数据获取指令;根据所述定位数据获取指令从定位芯片中获取所述定位数据。In an optional embodiment, the
在一个可选的实施例中,所述第一生成模块910,用于响应于所述第一操作系统中的数据请求对象生成的所述获取请求,通过自定义的可执行文件生成所述获取请求对应的所述第一中间指令,所述可执行文件是基于所述定位芯片的硬件规范编写的文件。In an optional embodiment, the
在一个可选的实施例中,所述第一生成模块910,用于将所述第一中间指令从所述可执行文件所在的硬件抽象层发送至内核层,所述硬件抽象层和所述内核层属于所述第一操作系统;将所述第一中间指令从所述内核层通过第一数据通道传送至路由任务,所述路由任务属于所述第二操作系统;所述获取模块920,用于获取所述第一中间指令中的所述数据请求对象的对象标识;根据所述对象标识,通过所述路由任务将所述第一中间指令转发至定位主任务,所述定位主任务属于所述第二操作系统;通过所述定位主任务,从定位指令库中确定与所述第一中间指令匹配的所述定位数据获取指令。In an optional embodiment, the
在一个可选的实施例中,所述装置还包括注册模块,用于通过所述定位主任务在所述第二操作系统中注册第一回调函数,所述第一回调函数用于将所述定位数据反馈至所述数据请求对象。In an optional embodiment, the device further includes a registration module, configured to register a first callback function in the second operating system through the positioning main task, and the first callback function is used to register the Positioning data is fed back to the data request object.
在一个可选的实施例中,所述获取模块920,用于指示所述定位主任务调用串行通信接口,向所述定位芯片发送所述定位数据获取指令;响应于所述定位芯片向所述串行通信接口发送第一数据,通过目标中断任务提供的中断方式接收所述第一数据,所述第一数据包括反馈信号或所述定位数据,所述定位数据是所述定位芯片基于所述定位数据获取指令反馈的定位标准数据,所述目标中断任务用于为串行通信接收接口提供中断。In an optional embodiment, the obtaining
在一个可选的实施例中,所述获取模块920,用于响应于所述定位芯片向所述串行通信接口发送所述第一数据,通过所述目标中断任务生成中断服务程序;基于所述中断服务程序,向事件任务推送第二回调函数;指示所述事件任务基于所述第二回调函数检测所述第一数据的完整性;响应于所述第一数据是完整的数据,检测所述第一数据中包含的数据类型;根据所述数据类型执行相应的处理,以完成获取所述定位数据的流程。In an optional embodiment, the obtaining
在一个可选的实施例中,所述获取模块920,用于指示所述事件任务通过所述第一回调函数将所述定位数据反馈至所述第一操作系统。或者,所述获取模块920,用于响应于所述数据类型是所述反馈信号,指示所述事件任务通过第二回调函数,向所述定位主任务发送所述反馈信号;响应于所述定位主任务接收到所述反馈信号,指示所述定位主任务停止向所述定位芯片重发所述定位数据获取指令。In an optional embodiment, the obtaining
在一个可选的实施例中,所述装置涉及的所述第二操作系统还包括传感器任务,所述传感器任务用于注册第三回调函数,所述第三回调函数用于在调用时通过第二数据通道向指定对象发送所述定位数据,所述指定对象属于所述第一操作系统;和/或,所述传感器任务用于注册第四回调函数,所述第四回调函数用于在调用时向所述第二操作系统内的对象发送所述定位数据。In an optional embodiment, the second operating system involved in the device further includes a sensor task, the sensor task is used to register a third callback function, and the third callback function is used to pass the first The second data channel sends the positioning data to a specified object, and the specified object belongs to the first operating system; and/or, the sensor task is used to register a fourth callback function, and the fourth callback function is used to call sending the positioning data to an object in the second operating system at a time.
在一个可选的实施例中,所述获取模块920,用于指示所述第一操作系统切换至休眠状态,并在所述第二操作系统中,根据所述第一获取请求从所述定位芯片中获取所述定位数据;反馈模块930,用于指示所述第一操作系统切换至唤醒状态,并将所述定位数据从所述第二操作系统反馈至所述第一操作系统。In an optional embodiment, the acquiring
在一个可选的实施例中,所述装置还包括:第二生成模块、指令发送模块、指令确定模块和第一停止模块,所述第二生成模块,用于响应于所述第一操作系统中生成的停止请求,生成对应的第二中间指令,所述停止请求用于请求停止获取所述定位数据;所述指令发送模块,用于将所述第二中间指令从所述第一操作系统发送至所述第二操作系统;所述指令确定模块,用于在所述第二操作系统中,确定与所述第二中间指令匹配的停止指令;所述第一停止模块,用于基于所述停止指令,停止获取所述定位数据。In an optional embodiment, the device further includes: a second generation module, an instruction sending module, an instruction determination module, and a first stop module, the second generation module is configured to respond to the first operating system Generate a stop request generated in the corresponding second intermediate instruction, the stop request is used to request to stop obtaining the positioning data; the instruction sending module is used to send the second intermediate instruction from the first operating system sent to the second operating system; the instruction determination module is configured to determine a stop instruction that matches the second intermediate instruction in the second operating system; the first stop module is configured to determine based on the The stop command is used to stop obtaining the positioning data.
在一个可选的实施例中,所述第一停止模块,用于指示定位主任务接收所述停止指令;指示所述定位主任务基于所述停止指令,注销所述数据请求对象对应的第一回调函数,所述第一回调函数用于将所述定位数据反馈至所述数据请求对象;响应于所述定位芯片处于使用状态,结束流程;响应于所述定位芯片处于空闲状态,关闭所述定位芯片。In an optional embodiment, the first stop module is configured to instruct the positioning main task to receive the stop instruction; instruct the positioning main task to log off the first stop corresponding to the data request object based on the stop instruction. A callback function, the first callback function is used to feed back the positioning data to the data request object; in response to the positioning chip being in use, end the process; in response to the positioning chip being in the idle state, shut down the Position the chip.
在一个可选的实施例中,所述第一停止模块,用于响应于所述定位芯片处于空闲状态,延时目标时长后关闭所述定位芯片。In an optional embodiment, the first stop module is configured to, in response to the positioning chip being in an idle state, shut down the positioning chip after a target duration.
在一个可选的实施例中,所述装置还包括第二停止模块,用于响应于当前系统时刻处于所述目标时长内且接收到定位芯片启用指令,停止关闭所述定位芯片的流程,所述定位芯片启用指令用于启用所述定位芯片。In an optional embodiment, the device further includes a second stop module, configured to stop the process of shutting down the positioning chip in response to the current system moment being within the target duration and receiving a positioning chip enabling instruction, The positioning chip activation instruction is used to enable the positioning chip.
综上所述,本申请提供的获取定位数据的装置,能够在第二操作系统中通过定位主任务与定位芯片的交互,以从定位芯片中获取到定位数据。在相应的交互过程结束后,第二操作系统中的事件任务能够通过预先注册的回调函数向第一操作系统反馈定位数据。由于第二操作系统提供了完整的信息控制流程,因此,第二操作系统能够在顺利获取定位芯片中的定位数据并反馈到第一操作系统中,在降低终端获取定位数据时的功耗的前提下,提升了第二操作系统获取定位数据的稳定性。To sum up, the device for obtaining positioning data provided by the present application can obtain positioning data from the positioning chip through the interaction between the positioning main task and the positioning chip in the second operating system. After the corresponding interaction process ends, the event task in the second operating system can feed back positioning data to the first operating system through a pre-registered callback function. Since the second operating system provides a complete information control process, the second operating system can successfully obtain the positioning data in the positioning chip and feed it back to the first operating system, on the premise of reducing the power consumption of the terminal when acquiring positioning data In this case, the stability of obtaining positioning data by the second operating system is improved.
可选的,第二操作系统还能够通过目标中断任务从定位芯片中获取到定位数据,并且通过反馈机制了解定位芯片是否已经接收到第一获取请求。在定位芯片已经获取到第一获取请求后,第二操作系统中的定位主任务不再向定位芯片重发第一获取请求,节省了第二操作系统的功耗。Optionally, the second operating system can also obtain positioning data from the positioning chip through the target interrupt task, and know whether the positioning chip has received the first obtaining request through a feedback mechanism. After the positioning chip has obtained the first obtaining request, the positioning main task in the second operating system does not resend the first obtaining request to the positioning chip, which saves power consumption of the second operating system.
本申请实施例还提供了一种计算机可读介质,该计算机可读介质存储有至少一条指令,所述至少一条指令由所述处理器加载并执行以实现如上各个实施例所述的获取定位数据的方法。The embodiment of the present application also provides a computer-readable medium, the computer-readable medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to achieve the acquisition of positioning data as described in the above embodiments Methods.
需要说明的是:上述实施例提供的获取定位数据的装置在执行获取定位数据的方法时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的获取定位数据的装置与获取定位数据的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that: when the device for obtaining positioning data provided by the above-mentioned embodiments executes the method for obtaining positioning data, the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned by different The functional modules are completed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for obtaining positioning data provided by the above embodiment and the method embodiment for obtaining positioning data belong to the same idea, and its specific implementation process is detailed in the method embodiment, and will not be repeated here.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the above embodiments of the present application are for description only, and do not represent the advantages and disadvantages of the embodiments.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, and can also be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium. The above-mentioned The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, and the like.
以上所述仅为本申请的能够实现的示例性的实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above descriptions are only exemplary embodiments of the present application that can be realized, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the Within the protection scope of this application.
Claims (17)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110501640.0A CN115309253A (en) | 2021-05-08 | 2021-05-08 | Method, device, terminal and storage medium for acquiring positioning data |
| PCT/CN2022/084295 WO2022237371A1 (en) | 2021-05-08 | 2022-03-31 | Method and apparatus for acquiring positioning data, and terminal and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110501640.0A CN115309253A (en) | 2021-05-08 | 2021-05-08 | Method, device, terminal and storage medium for acquiring positioning data |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115309253A true CN115309253A (en) | 2022-11-08 |
Family
ID=83854487
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110501640.0A Pending CN115309253A (en) | 2021-05-08 | 2021-05-08 | Method, device, terminal and storage medium for acquiring positioning data |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN115309253A (en) |
| WO (1) | WO2022237371A1 (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105487918A (en) * | 2014-10-08 | 2016-04-13 | 展讯通信(上海)有限公司 | Independent information processing system |
| WO2020199009A1 (en) * | 2019-03-29 | 2020-10-08 | 华为技术有限公司 | Processing method, apparatus and device for starting apparatus, and storage medium |
| CN111831098A (en) * | 2020-06-16 | 2020-10-27 | 出门问问信息科技有限公司 | Information synchronization method, device and system and computer readable storage medium |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9699594B2 (en) * | 2015-02-27 | 2017-07-04 | Plantronics, Inc. | Mobile user device and method of communication over a wireless medium |
| CN105674977A (en) * | 2016-01-06 | 2016-06-15 | 华为技术有限公司 | Navigation device and navigation method |
| CN109996185B (en) * | 2017-12-29 | 2022-02-15 | 腾讯科技(深圳)有限公司 | Terminal positioning method and device, storage medium and electronic device |
-
2021
- 2021-05-08 CN CN202110501640.0A patent/CN115309253A/en active Pending
-
2022
- 2022-03-31 WO PCT/CN2022/084295 patent/WO2022237371A1/en not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105487918A (en) * | 2014-10-08 | 2016-04-13 | 展讯通信(上海)有限公司 | Independent information processing system |
| WO2020199009A1 (en) * | 2019-03-29 | 2020-10-08 | 华为技术有限公司 | Processing method, apparatus and device for starting apparatus, and storage medium |
| CN111831098A (en) * | 2020-06-16 | 2020-10-27 | 出门问问信息科技有限公司 | Information synchronization method, device and system and computer readable storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2022237371A1 (en) | 2022-11-17 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR101832953B1 (en) | Remote wakeup of application processor of mobile device | |
| US10285000B2 (en) | Apparatus and method for determining a wireless device's location after shutdown | |
| US10075530B2 (en) | Method and electronic device for establishing connection with external electronic device | |
| US10044073B2 (en) | Method for preventing battery swelling and electronic device thereof | |
| JP2013225861A5 (en) | ||
| US20240356828A1 (en) | Method for maintaining communication connection, electronic device, and non-transitory computer-readable storage medium | |
| CN115167953A (en) | Application interface display method, device, device and storage medium | |
| TWI578120B (en) | Wearable apparatus, controlling method and non-transitory computer readable storage medium | |
| CN104020476A (en) | External device for Big Dipper locating and method thereof | |
| CN108156650B (en) | Control method and device of positioning module, storage medium and terminal | |
| CN111726848B (en) | Equipment binding method, target starting device, fixed terminal and storage medium | |
| CN107526512B (en) | Switching method and system for electronic equipment | |
| CN115309253A (en) | Method, device, terminal and storage medium for acquiring positioning data | |
| WO2018192207A1 (en) | Satellite signal search method, device, and mobile terminal | |
| CN121099289A (en) | Network data processing methods, devices, and electronic equipment | |
| WO2024109290A1 (en) | Application startup method and apparatus, device, and storage medium | |
| US20170244644A1 (en) | Electronic device and method for processing data in electronic device | |
| CN117729092A (en) | A method for determining the cause of restart and electronic device | |
| CN111355782B (en) | Equipment management method and device, storage medium and electronic equipment | |
| TWI791316B (en) | Method and system for implementing inter-process communications | |
| AU2015203796B2 (en) | Apparatus and method for determining a wireless device's location after shutdown | |
| WO2023236516A1 (en) | Speech recognition method and apparatus, device, and storage medium | |
| CN118519512A (en) | Exception handling method and related device | |
| CN120567590A (en) | Wake-up method and system | |
| CN116233185A (en) | Transmission link control method, device, equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |

