[go: up one dir, main page]

CN115914350A - Service discovery method and device, electronic device, storage medium - Google Patents

Service discovery method and device, electronic device, storage medium Download PDF

Info

Publication number
CN115914350A
CN115914350A CN202211437785.XA CN202211437785A CN115914350A CN 115914350 A CN115914350 A CN 115914350A CN 202211437785 A CN202211437785 A CN 202211437785A CN 115914350 A CN115914350 A CN 115914350A
Authority
CN
China
Prior art keywords
target
request
target application
service
client
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.)
Granted
Application number
CN202211437785.XA
Other languages
Chinese (zh)
Other versions
CN115914350B (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.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software 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 Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN202211437785.XA priority Critical patent/CN115914350B/en
Priority claimed from CN202211437785.XA external-priority patent/CN115914350B/en
Publication of CN115914350A publication Critical patent/CN115914350A/en
Application granted granted Critical
Publication of CN115914350B publication Critical patent/CN115914350B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The disclosure relates to a service discovery method and device, an electronic device and a storage medium. The method comprises the following steps: acquiring a target request, wherein the target request contains a target application parameter preset in a client; searching the target application parameter in an application parameter registration list to obtain a search result indicating whether the target application parameter is found; generating target response data which contains the search result and is matched with the target request; and feeding back the target response data to the client so that the client interacts data with the server after the target response data represents and discovers the target application parameters. In the embodiment, the target application parameters can be searched in the application parameter registration list without traversing all the application parameters in the application parameter registration list, so that the searching time is reduced, the data interaction time of two electronic devices through a Bluetooth link is shortened, and the improvement of the data interaction efficiency is facilitated.

Description

服务发现方法和装置、电子设备、存储介质Service discovery method and device, electronic device, storage medium

技术领域technical field

本公开涉及通信技术领域,尤其涉及一种服务发现方法和装置、电子设备、存储介质。The present disclosure relates to the technical field of communication, and in particular, to a service discovery method and device, electronic equipment, and a storage medium.

背景技术Background technique

现有大部分电子设备设置有蓝牙功能,以低功耗蓝牙(BLE)为例,电子设备与其他设备建立BLE链接。其中两台电子设备建立蓝牙链接后,主动发起请求的应用称之客户端(Client),被动接收请求的应用称之为服务端(Server)。Most of the existing electronic devices are equipped with a Bluetooth function. Taking Bluetooth Low Energy (BLE) as an example, the electronic device establishes a BLE link with other devices. After the two electronic devices establish a Bluetooth connection, the application that actively initiates the request is called the client (Client), and the application that passively receives the request is called the server (Server).

上述BLE链接可以基于通用属性协议(Generic Attribute Profile,GATT)建立。在BLE链接建立之后,Client端开始发现GATT服务,发现对端的服务后,可以通过对应服务的特征来交互数据。The above BLE link can be established based on the Generic Attribute Profile (GATT). After the BLE connection is established, the client starts to discover the GATT service. After discovering the peer service, it can exchange data through the characteristics of the corresponding service.

在发现服务过程中,Client端必须遍历Service端所有的Service(包括Include和Characteristic)后,双方才能进行数据传输。然而,当Server端注册的服务数量较多时,尤其是很多服务并非对应的应用注册的,造成上述发现过程浪费较多时间,导致应用从建立连接到传输数据的时间较长。In the process of discovering services, the client must traverse all services (including Include and Characteristic) on the server before the two parties can perform data transmission. However, when the number of services registered on the server side is large, especially many services are not registered by the corresponding application, the above discovery process wastes a lot of time, resulting in a long time from the establishment of the connection to the transmission of data by the application.

发明内容Contents of the invention

本公开提供一种服务发现方法和装置、电子设备、存储介质,以解决相关技术的不足。The disclosure provides a service discovery method and device, electronic equipment, and a storage medium to solve the deficiencies of related technologies.

根据本公开实施例的第一方面,提供一种服务发现方法,适用于服务端,所述方法包括:According to the first aspect of the embodiments of the present disclosure, a service discovery method is provided, which is applicable to a server, and the method includes:

获取目标请求,所述目标请求含有客户端中预设的目标应用参数;Obtaining a target request, the target request containing preset target application parameters in the client;

在应用参数注册列表中查找所述目标应用参数,得到表示是否发现所述目标应用参数的查找结果;Searching for the target application parameter in the application parameter registration list, and obtaining a search result indicating whether the target application parameter is found;

生成包含所述查找结果且与所述目标请求相匹配的目标响应数据;generating target response data that includes the search result and matches the target request;

将所述目标响应数据反馈给所述客户端,以使所述客户端在所述目标响应数据表征发现目标应用参数后与所述服务端交互数据。The target response data is fed back to the client, so that the client exchanges data with the server after the target response data represents the discovery of target application parameters.

可选地,所述目标应用参数包括服务、包含和特征。Optionally, the target application parameters include service, inclusion and feature.

可选地,当所述目标应用参数包括服务时,所述目标响应数据包括服务响应;所述服务响应包括操作码、属性类型、结果数据和属性权限;Optionally, when the target application parameter includes a service, the target response data includes a service response; the service response includes an operation code, attribute type, result data, and attribute permission;

所述操作码为第二操作码,所述属性类型为第一属性类型,所述结果数据表示此服务是否位于注册列表之内。The operation code is the second operation code, the attribute type is the first attribute type, and the result data indicates whether the service is in the registration list.

可选地,当所述目标应用参数包括包含时,所述目标响应数据包括包含响应;所述包含响应包括操作码、属性类型和结果数据;Optionally, when the target application parameter includes include, the target response data includes include response; the include response includes opcode, attribute type and result data;

所述操作码为第二操作码,所述属性类型为第二属性类型,所述结果数据表示此包含是否位于注册列表之内。The opcode is a second opcode, the attribute type is a second attribute type, and the result data indicates whether the inclusion is in the registration list.

可选地,当所述目标应用参数包括特征时,所述目标响应数据包括特征响应;所述特征响应包括操作码、属性类型、属性权限、特征UUID和特征句柄;所述操作码为第二操作码,所述属性类型为第三属性类型,所述属性权限表示数据操作类型,特征句柄是指待传输消息的对象,特征UUID表示特征的识别码。Optionally, when the target application parameters include features, the target response data includes feature responses; the feature responses include opcodes, attribute types, attribute permissions, feature UUIDs, and feature handles; the opcodes are the second Operation code, the attribute type is the third attribute type, the attribute permission indicates the type of data operation, the feature handle refers to the object to transmit the message, and the feature UUID indicates the identification code of the feature.

可选地,所述方法还包括:Optionally, the method also includes:

在接收到客户端发送的链接建立请求时,与所述客户端建立蓝牙链接。When receiving the link establishment request sent by the client, establish a bluetooth link with the client.

可选地,所述方法还包括:Optionally, the method also includes:

在查找完所述目标应用参数后停止查找过程。The search process is stopped after the target application parameters are searched.

根据本公开实施例的第二方面,提供一种服务发现方法,适用于客户端,所述方法包括:According to a second aspect of an embodiment of the present disclosure, a service discovery method is provided, which is suitable for a client, and the method includes:

获取客户端中预设的目标应用参数;Obtain the preset target application parameters in the client;

生成含有所述目标应用参数的目标请求并发送给服务端,以使所述服务端响应于所述目标请求查找应用参数注册列表并返回表示是否发现所述目标应用参数的查找结果的目标响应数据;Generate a target request containing the target application parameter and send it to the server, so that the server searches the application parameter registration list in response to the target request and returns target response data indicating whether the search result of the target application parameter is found ;

当所述目标响应数据表示发现目标应用参数后,根据所述目标应用参数与所述服务端交互数据。When the target response data indicates that target application parameters are found, data is exchanged with the server according to the target application parameters.

可选地,所述目标应用参数包括服务、包含和特征。Optionally, the target application parameters include service, inclusion and feature.

可选地,当所述目标应用参数包括服务时,所述目标请求包括服务请求;所述服务请求包括操作码、属性类型和服务参数UUID;所述操作码为第一操作码,所述属性类型为第一属性类型。Optionally, when the target application parameter includes a service, the target request includes a service request; the service request includes an operation code, an attribute type, and a service parameter UUID; the operation code is a first operation code, and the attribute Type is the first attribute type.

可选地,当所述目标应用参数包括包含时,所述目标请求包括包含请求;所述包含请求包括操作码、属性类型和属性权限;所述操作码为第一操作码,所述属性类型为第二属性类型。Optionally, when the target application parameter includes inclusion, the target request includes an inclusion request; the inclusion request includes an operation code, an attribute type, and an attribute permission; the operation code is a first operation code, and the attribute type is the second attribute type.

可选地,当所述目标应用参数包括特征时,所述目标请求包括特征请求;所述特征请求包括操作码、属性类型和特征UUID;所述操作码为第一操作码,所述属性类型为第三属性类型。Optionally, when the target application parameter includes a feature, the target request includes a feature request; the feature request includes an opcode, an attribute type, and a feature UUID; the opcode is a first opcode, and the attribute type is the third attribute type.

可选地,所述方法还包括:Optionally, the method also includes:

发送链接建立请求,以使服务端响应于所述链接建立请求与客户端建立蓝牙链接。Sending a link establishment request, so that the server establishes a bluetooth link with the client in response to the link establishment request.

根据本公开实施例的第三方面,提供一种服务发现装置,适用于服务端,所述装置包括:According to a third aspect of the embodiments of the present disclosure, there is provided a service discovery device, which is suitable for a server, and the device includes:

目标请求获取模块,用于获取目标请求,所述目标请求含有客户端中预设的目标应用参数;A target request obtaining module, configured to obtain a target request, the target request containing preset target application parameters in the client;

查找结果获取模块,用于在应用参数注册列表中查找所述目标应用参数,得到表示是否发现所述目标应用参数的查找结果;A search result acquisition module, configured to search for the target application parameter in the application parameter registration list, and obtain a search result indicating whether the target application parameter is found;

目标响应获取模块,用于生成包含所述查找结果且与所述目标请求相匹配的目标响应数据;A target response acquisition module, configured to generate target response data that includes the search result and matches the target request;

目标响应反馈模块,用于将所述目标响应数据反馈给所述客户端,以使所述客户端在所述目标响应数据表征发现目标应用参数后与所述服务端交互数据。A target response feedback module, configured to feed back the target response data to the client, so that the client can exchange data with the server after the target response data represents the discovery of target application parameters.

可选地,所述目标应用参数包括服务、包含和特征。Optionally, the target application parameters include service, inclusion and feature.

可选地,当所述目标应用参数包括服务时,所述目标响应数据包括服务响应;所述服务响应包括操作码、属性类型、结果数据和属性权限;Optionally, when the target application parameter includes a service, the target response data includes a service response; the service response includes an operation code, attribute type, result data, and attribute permission;

所述操作码为第二操作码,所述属性类型为第一属性类型,所述结果数据表示此服务是否位于注册列表之内。The operation code is the second operation code, the attribute type is the first attribute type, and the result data indicates whether the service is in the registration list.

可选地,当所述目标应用参数包括包含时,所述目标响应数据包括包含响应;所述包含响应包括操作码、属性类型和结果数据;Optionally, when the target application parameter includes include, the target response data includes include response; the include response includes opcode, attribute type and result data;

所述操作码为第二操作码,所述属性类型为第二属性类型,所述结果数据表示此包含是否位于注册列表之内。The opcode is a second opcode, the attribute type is a second attribute type, and the result data indicates whether the inclusion is in the registration list.

可选地,当所述目标应用参数包括特征时,所述目标响应数据包括特征响应;所述特征响应包括操作码、属性类型、属性权限、特征UUID和特征句柄;所述操作码为第二操作码,所述属性类型为第三属性类型,所述属性权限表示数据操作类型,特征句柄是指待传输消息的对象,特征UUID表示特征的识别码。Optionally, when the target application parameters include features, the target response data includes feature responses; the feature responses include opcodes, attribute types, attribute permissions, feature UUIDs, and feature handles; the opcodes are the second Operation code, the attribute type is the third attribute type, the attribute permission indicates the type of data operation, the feature handle refers to the object to transmit the message, and the feature UUID indicates the identification code of the feature.

可选地,所述装置还包括:Optionally, the device also includes:

蓝牙链接建立模块,用于在接收到客户端发送的链接建立请求时,与所述客户端建立蓝牙链接。The Bluetooth link establishment module is configured to establish a Bluetooth link with the client when receiving a link establishment request sent by the client.

可选地,所述装置还包括:Optionally, the device also includes:

查找停止模块,用于在查找完所述目标应用参数后停止查找过程。A search stop module, configured to stop the search process after the target application parameters are searched.

根据本公开实施例的第四方面,提供一种服务发现装置,适用于客户端,所述装置包括:According to a fourth aspect of an embodiment of the present disclosure, there is provided a service discovery apparatus, which is suitable for a client, and the apparatus includes:

目标参数获取模块,用于获取客户端中预设的目标应用参数;A target parameter acquisition module, configured to acquire target application parameters preset in the client;

目标请求生成模块,用于生成含有所述目标应用参数的目标请求并发送给服务端,以使所述服务端响应于所述目标请求查找应用参数注册列表并返回表示是否发现所述目标应用参数的查找结果的目标响应数据;A target request generating module, configured to generate a target request containing the target application parameters and send it to the server, so that the server can search the application parameter registration list in response to the target request and return whether the target application parameters are found The target response data of the search results;

数据交互模块,用于在所述目标响应数据表示发现目标应用参数后,根据所述目标应用参数与所述服务端交互数据。A data interaction module, configured to exchange data with the server according to the target application parameters after the target response data indicates that the target application parameters are found.

可选地,所述目标应用参数包括服务、包含和特征。Optionally, the target application parameters include service, inclusion and feature.

可选地,当所述目标应用参数包括服务时,所述目标请求包括服务请求;所述服务请求包括操作码、属性类型和服务参数UUID;所述操作码为第一操作码,所述属性类型为第一属性类型。Optionally, when the target application parameter includes a service, the target request includes a service request; the service request includes an operation code, an attribute type, and a service parameter UUID; the operation code is a first operation code, and the attribute Type is the first attribute type.

可选地,当所述目标应用参数包括包含时,所述目标请求包括包含请求;所述包含请求包括操作码、属性类型和属性权限;所述操作码为第一操作码,所述属性类型为第二属性类型。Optionally, when the target application parameter includes inclusion, the target request includes an inclusion request; the inclusion request includes an operation code, an attribute type, and an attribute permission; the operation code is a first operation code, and the attribute type is the second attribute type.

可选地,当所述目标应用参数包括特征时,所述目标请求包括特征请求;所述特征请求包括操作码、属性类型和特征UUID;所述操作码为第一操作码,所述属性类型为第三属性类型。Optionally, when the target application parameter includes a feature, the target request includes a feature request; the feature request includes an opcode, an attribute type, and a feature UUID; the opcode is a first opcode, and the attribute type is the third attribute type.

可选地,所述装置还包括:Optionally, the device also includes:

链接请求发送模块,用于发送链接建立请求,以使服务端响应于所述链接建立请求与客户端建立蓝牙链接。A link request sending module, configured to send a link establishment request, so that the server can establish a bluetooth link with the client in response to the link establishment request.

根据本公开实施例的第五方面,提供一种电子设备,包括:According to a fifth aspect of the embodiments of the present disclosure, there is provided an electronic device, including:

存储器与处理器;memory and processor;

所述存储器用于存储所述处理器可执行的计算机程序;The memory is used to store a computer program executable by the processor;

所述处理器用于执行所述存储器中的计算机程序,以实现如上述的方法。The processor is configured to execute the computer program in the memory, so as to realize the above-mentioned method.

根据本公开实施例的第六方面,提供一种非暂态计算机可读存储介质,当所述存储介质中的可执行的计算机程序由处理器执行时,能够实现如上述的方法。According to a sixth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, and when the executable computer program in the storage medium is executed by a processor, the above method can be realized.

本公开的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:

本公开实施例提供的方案中可以获取目标请求,所述目标请求含有客户端中预设的目标应用参数;然后,在应用参数注册列表中查找所述目标应用参数,得到表示是否发现所述目标应用参数的查找结果;之后,生成包含所述查找结果且与所述目标请求相匹配的目标响应数据;最后,将所述目标响应数据反馈给所述客户端,以使所述客户端在所述目标响应数据表征发现目标应用参数后与所述服务端交互数据。这样,本实施例中可以在应用参数注册列表中查找目标应用参数而无需遍历应用参数注册列表中全部应用参数,减少了查找时间,从而缩短两个电子设备通过蓝牙链接进行数据交互时间,有利于提高数据交互效率。In the solution provided by the embodiments of the present disclosure, the target request can be obtained, and the target request contains the preset target application parameters in the client; then, the target application parameters are searched in the application parameter registration list to obtain whether the target is found Applying the search results of the parameters; afterward, generating target response data containing the search results and matching the target request; finally, feeding back the target response data to the client, so that the client is in the The target response data represents data exchanged with the server after the target application parameters are discovered. In this way, in this embodiment, the target application parameter can be searched in the application parameter registration list without traversing all the application parameters in the application parameter registration list, which reduces the search time, thereby shortening the data interaction time between two electronic devices through the Bluetooth link, which is beneficial Improve data interaction efficiency.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.

图1是根据一示例性实施例示出的一种服务发现方法的流程图。Fig. 1 is a flowchart of a service discovery method according to an exemplary embodiment.

图2是根据一示例性实施例示出的一种目标应用参数的关系的示意图。Fig. 2 is a schematic diagram showing a relationship of target application parameters according to an exemplary embodiment.

图3是根据一示例性实施例示出的另一种服务发现方法的流程图。Fig. 3 is a flow chart showing another service discovery method according to an exemplary embodiment.

图4是根据一示例性实施例示出的一种客户端与服务端之间的交互图。Fig. 4 is an interaction diagram between a client and a server according to an exemplary embodiment.

图5是根据一示例性实施例示出的另一种客户端与服务端之间的交互图。Fig. 5 is another interaction diagram between a client and a server according to an exemplary embodiment.

图6是根据一示例性实施例示出的一种服务发现装置的框图。Fig. 6 is a block diagram showing an apparatus for service discovery according to an exemplary embodiment.

图7是根据一示例性实施例示出的一种服务发现装置的框图。Fig. 7 is a block diagram showing an apparatus for service discovery according to an exemplary embodiment.

图8是根据一示例性实施例示出的一种电子设备的框图。Fig. 8 is a block diagram of an electronic device according to an exemplary embodiment.

具体实施方式Detailed ways

这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性所描述的实施例并不代表与本公开相一致的所有实施例。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置例子。需要说明的是,在不冲突的情况下,下述的实施例及实施方式中的特征可以相互组合。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in 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 exemplary described embodiments below do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices consistent with aspects of the present disclosure as recited in the appended claims. It should be noted that, in the case of no conflict, the features in the following embodiments and implementation manners can be combined with each other.

为解决上述技术问题,本公开实施例提供了一种服务发现方法和装置、电子设备、存储介质。上述服务发现方法可以适用于具有蓝牙功能的电子设备,该电子设备可以包括但不限于智能手机、智能手表、智能眼镜、车用设备等等,可以根据具体场景进行选择,在此不作限定。考虑到数据交互涉及到两台电子设备,其中一方作为客户端(Client),另一方作为服务端(Server)。为方便理解本公开的方案,本公开分别以客户端和服务端为执行主体描述服务发现方法的方案。In order to solve the above technical problems, embodiments of the present disclosure provide a service discovery method and device, electronic equipment, and a storage medium. The above service discovery method can be applied to electronic devices with bluetooth function, such electronic devices may include but not limited to smart phones, smart watches, smart glasses, vehicle equipment, etc., which can be selected according to specific scenarios, and are not limited here. Considering that data exchange involves two electronic devices, one of them acts as a client (Client) and the other acts as a server (Server). To facilitate understanding of the solutions of the present disclosure, the present disclosure uses the client and the server as execution bodies to describe the solution of the service discovery method.

图1是根据一示例性实施例示出的一种服务发现方法的流程图,参见图1,一种服务发现方法,应用于服务端,包括步骤11~步骤14。FIG. 1 is a flow chart of a service discovery method according to an exemplary embodiment. Referring to FIG. 1 , a service discovery method is applied to a server and includes steps 11 to 14.

在步骤11中,获取目标请求,所述目标请求含有客户端中预设的目标应用参数。In step 11, a target request is obtained, and the target request contains target application parameters preset in the client.

本实施例中,服务端可以与客户端建立蓝牙链接(即BLE链接)。例如,客户端可以生成链接建立请求并进行广播。服务端可以监听周围空间的广播信号,当接收到上述链接建立请求后,可以检测当地的配对信息;当链接建立请求内的客户端的识别码位于服务端中已配对设备列表之内时,服务端可以与该客户端建立蓝牙链接,这样服务端与客户端完成配对与连接的工作。In this embodiment, the server can establish a Bluetooth link (that is, a BLE link) with the client. For example, a client can generate a link establishment request and broadcast it. The server can monitor the broadcast signal in the surrounding space, and can detect the local pairing information after receiving the above-mentioned link establishment request; when the identification code of the client in the link establishment request is in the list of paired devices in the server, the server A Bluetooth link can be established with the client, so that the server and the client complete the pairing and connection work.

本实施例中,服务端可以通过上述蓝牙链接与客户端进行通信,从而获取到目标请求。其中,该目标请求含有客户端中预设的目标应用参数。在一示例中,目标应用参数包括服务(Service)、包含(Include)和特征(Characteristic)。可理解的是,上述蓝牙链接基于GATT协议建立,GATT协议中配置的目标应用参数的关系如图2所示。服务端和客户端可以包括至少一个服务(Service)组成,每个(Service)包括多个包含(Include)和多个特征(Characteristic)组成。In this embodiment, the server can communicate with the client through the Bluetooth link, so as to obtain the target request. Wherein, the target request includes target application parameters preset in the client. In an example, the target application parameters include service (Service), inclusion (Include) and characteristic (Characteristic). It can be understood that the above Bluetooth link is established based on the GATT protocol, and the relationship of the target application parameters configured in the GATT protocol is shown in FIG. 2 . The server and the client may include at least one service (Service) component, and each (Service) includes multiple inclusion (Include) and multiple characteristic (Characteristic) components.

在一示例中,当目标应用参数包括服务(Service)时,该目标请求包括服务请求(Target Service Request)。该服务请求包括操作码(opcode,1byte)、属性类型(AttributeType,2bytes)和服务参数UUID(Service UUID,2bytes或者16bytes)。In an example, when the target application parameter includes a service (Service), the target request includes a service request (Target Service Request). The service request includes an operation code (opcode, 1byte), an attribute type (AttributeType, 2bytes) and a service parameter UUID (Service UUID, 2bytes or 16bytes).

本示例中,上述操作码为第一操作码,用来识别对端所发的命令类型。在GATT协议中,opcode为1个字节,并且0x01~0x23、0x51和0xD2已被占用,因此上述第一操作码采用opcode中的保留字节,例如第一操作码的取值为0x25、0x26或者0x27等,后续以第一操作码的取值为0x25为例描述各方案。In this example, the above operation code is the first operation code, which is used to identify the command type sent by the peer end. In the GATT protocol, the opcode is 1 byte, and 0x01~0x23, 0x51 and 0xD2 are already occupied, so the above-mentioned first operation code uses the reserved bytes in the opcode, for example, the value of the first operation code is 0x25, 0x26 Or 0x27, etc., and the following uses the value of the first operation code 0x25 as an example to describe various solutions.

本示例中,上述属性类型为第一属性类型(0x2801),用于识别对端所发的应用参数的类型,即服务类型。在GATT协议中,0x2801为服务Service,0x2802为包含Include,0x2803为特征Characteristic。本示例中,第一属性类型的取值为0x2801。本示例中,服务请求的帧格式如表1所示。In this example, the above attribute type is the first attribute type (0x2801), which is used to identify the type of the application parameter sent by the peer end, that is, the service type. In the GATT protocol, 0x2801 is Service, 0x2802 is Include, and 0x2803 is Characteristic. In this example, the value of the first attribute type is 0x2801. In this example, the frame format of the service request is shown in Table 1.

表1服务请求(Target Service Request)的帧格式Table 1 Frame format of Target Service Request

opcode(1byte)opcode(1byte) AttributeType(2bytes)AttributeType (2bytes) Service UUID(2bytes或16bytes)Service UUID (2bytes or 16bytes) 0x250x25 0x28010x2801  the

在一示例中,当目标应用参数包括包含(Include)时,该目标请求包括包含请求(Target Include Request)。该包含请求包括操作码(opcode,1byte)、属性类型(AttributeType,2bytes)和包含参数UUID(Include UUID,2bytes或者16bytes)。In an example, when the target application parameter includes (Include), the target request includes a target include request (Target Include Request). The include request includes an operation code (opcode, 1 byte), an attribute type (AttributeType, 2 bytes) and an include parameter UUID (Include UUID, 2 bytes or 16 bytes).

本示例中,包含请求中的操作码为第一操作码,具体内容可以参见服务请求的操作码的内容,在此不再赘述。In this example, the operation code included in the request is the first operation code. For specific content, please refer to the content of the operation code of the service request, which will not be repeated here.

本示例中,上述属性类型为第二属性类型,用于识别对端所发的应用参数的类型,即包含类型。本示例中,第二属性类型的取值为0x2802。In this example, the above attribute type is the second attribute type, which is used to identify the type of the application parameter sent by the peer end, that is, the containing type. In this example, the value of the second attribute type is 0x2802.

本示例中,包含请求(Target Include Request)的帧格式如表2所示。In this example, the frame format of the Target Include Request is shown in Table 2.

表2包含请求的帧格式Table 2 contains the frame format of the request

opcode(1byte)opcode(1byte) AttributeType(2bytes)AttributeType (2bytes) Include UUID(2bytes或16bytes)Include UUID (2bytes or 16bytes) 0x250x25 0x28020x2802  the

在一示例中,当目标应用参数包括特征(Characteristic)时,该目标请求包括特征请求(Target Characteristic Request)。该特征请求包括操作码(opcode,1byte)、属性类型(AttributeType,2bytes)和特征参数UUID(Characteristic UUID,2bytes或者16bytes)。In an example, when the target application parameter includes a characteristic (Characteristic), the target request includes a characteristic request (Target Characteristic Request). The feature request includes an operation code (opcode, 1 byte), an attribute type (AttributeType, 2 bytes) and a characteristic parameter UUID (Characteristic UUID, 2 bytes or 16 bytes).

本示例中,特征请求中的操作码为第一操作码,具体内容可以参见服务请求的操作码的内容,在此不再赘述。In this example, the operation code in the feature request is the first operation code. For specific content, please refer to the content of the operation code in the service request, which will not be repeated here.

本示例中,上述属性类型为第三属性类型,用于识别对端所发的应用参数的类型,即特征类型。本示例中,第三属性类型的取值为0x2803。In this example, the above attribute type is the third attribute type, which is used to identify the type of the application parameter sent by the peer end, that is, the feature type. In this example, the value of the third attribute type is 0x2803.

本示例中,特征请求(Target Characteristic Request)的帧格式如表3所示。In this example, the frame format of the Target Characteristic Request is shown in Table 3.

表3特征请求的帧格式Table 3 Frame format of feature request

opcode(1byte)opcode(1byte) AttributeType(2bytes)AttributeType (2bytes) Characteristic UUID(2bytes或16bytes)Characteristic UUID (2bytes or 16bytes) 0x250x25 0x28030x2803  the

本实施例中,在获得目标请求后,服务端可以获取目标请求内的目标应用参数,即获得目标应用参数对应的操作码。In this embodiment, after obtaining the target request, the server may obtain the target application parameters in the target request, that is, obtain the operation code corresponding to the target application parameters.

在步骤12中,在应用参数注册列表中查找所述目标应用参数,得到表示是否发现所述目标应用参数的查找结果。In step 12, the target application parameter is searched in the application parameter registration list, and a search result indicating whether the target application parameter is found is obtained.

本实施例中,服务端会向系统注册服务、包含和特征三个应用参数,从而存储到对应的应用参数注册列表之内。或者说,服务端内设置有应用参数注册列表,例如服务注册列表、包含注册列表和特征注册列表。In this embodiment, the server will register the three application parameters of service, inclusion and feature with the system, and store them in the corresponding application parameter registration list. In other words, an application parameter registration list is set in the server, such as a service registration list, an inclusion registration list, and a feature registration list.

本实施例中,服务端可以在应用参数注册列表内查找目标应用参数,从而得到表示是否发现目标应用参数的查找结果。In this embodiment, the server may search for the target application parameter in the application parameter registration list, so as to obtain a search result indicating whether the target application parameter is found.

例如,服务端可以根据服务请求中的操作码确定命令类型,即第一操作码0x25时表示发现命令或者查找命令。然后,服务端可以根据服务请求中的属性类型确定查找哪个对象(服务、包含或特征),即第一属性类型为0x2801时表示查找服务(Service);服务器可以确定服务请求中的服务UUID是否位于服务注册列表之内。当服务UUID位于服务注册列表之内时,服务端可以获得发现服务的查找结果;当服务UUID未位于服务注册列表之内时,服务端可以获得未发现服务的查找结果。For example, the server can determine the command type according to the operation code in the service request, that is, the first operation code 0x25 indicates a discovery command or a search command. Then, the server can determine which object (service, inclusion or feature) to look for according to the attribute type in the service request, that is, when the first attribute type is 0x2801, it means to find the service (Service); the server can determine whether the service UUID in the service request is located in within the service registration list. When the service UUID is in the service registration list, the server can obtain the search result of the discovered service; when the service UUID is not in the service registration list, the server can obtain the search result of the undiscovered service.

又如,服务器可以根据包含请求中的操作码确定命令类型,即第一操作码为0x25时表示发现命令或者查找命令。服务端可以根据包含请求中的属性类型确定查找哪个对象(服务、包含或特征),即第二属性类型为0x2802表示查找包含(Include)。服务器可以确定包含请求中的包含UUID是否位于包含注册列表之内。当包含UUID位于包含注册列表之内时,服务端可以获得发现包含的查找结果;当包含UUID未位于包含注册列表之内时,服务端可以获得未发现包含的查找结果。For another example, the server may determine the command type according to the operation code included in the request, that is, when the first operation code is 0x25, it means a discovery command or a search command. The server can determine which object (service, inclusion or feature) to search for according to the attribute type in the include request, that is, the second attribute type is 0x2802, which means to search for include (Include). The server can determine whether the containment UUID in the containment request is within the containment registration list. When the included UUID is included in the included registration list, the server can obtain the search result of found inclusion; when the included UUID is not located in the included registration list, the server can obtain the search result of not found included.

再如,服务器可以根据特征请求中的操作码确定命令类型,即第一操作码为0x25时表示发现命令或者查找命令。服务端可以根据特征请求中的属性类型确定查找哪个对象(服务、包含或特征),即第三属性类型为0x2803表示查找包含(Include)。服务器可以确定特征请求中的包含UUID是否位于特征注册列表之内。当特征UUID位于特征注册列表之内时,服务端可以获得发现特征的查找结果;当特征UUID未位于特征注册列表之内时,服务端可以获得未发现特征的查找结果。For another example, the server may determine the command type according to the operation code in the feature request, that is, when the first operation code is 0x25, it means a discovery command or a search command. The server can determine which object (service, inclusion or feature) to search for according to the attribute type in the feature request, that is, the third attribute type is 0x2803, which means to search for include (Include). The server can determine whether the UUID included in the feature request is in the feature registration list. When the feature UUID is in the feature registration list, the server can obtain the search result of the discovered feature; when the feature UUID is not in the feature registration list, the server can obtain the search result of the undiscovered feature.

在步骤13中,生成包含所述查找结果且与所述目标请求相匹配的目标响应数据。In step 13, target response data containing the search result and matching the target request is generated.

本实施例中,服务端可以生成包含查找结果且与目标请求相匹配的目标响应数据。In this embodiment, the server can generate target response data that includes the search result and matches the target request.

例如,当所述目标应用参数包括服务时,上述目标响应数据包括服务响应;该服务响应包括操作码(opcode,1byte)、属性类型(AttributeType,2bytes)、结果数据(result,1byte)和属性权限(Attribute Permission,1byte)。其中,服务响应的操作码为第二操作码(0x26),用于表示命令类型为响应类型。服务响应的属性类型为第一属性类型(0x2801),用于表示服务类型;服务响应的结果数据表示此服务是否位于注册列表之内(例如0x00表示存在,0x01表示不存在);服务响应的属性权限表示数据交互类型(例如0x00表示可读,0x01表示可写,0x02表示可读和可写等)For example, when the target application parameter includes a service, the target response data includes a service response; the service response includes an operation code (opcode, 1 byte), an attribute type (AttributeType, 2 bytes), a result data (result, 1 byte) and an attribute permission (Attribute Permission, 1byte). Wherein, the operation code of the service response is the second operation code (0x26), which is used to indicate that the command type is the response type. The attribute type of the service response is the first attribute type (0x2801), which is used to indicate the service type; the result data of the service response indicates whether the service is in the registration list (for example, 0x00 means it exists, 0x01 means it does not exist); the attribute of the service response The permission indicates the type of data interaction (for example, 0x00 means readable, 0x01 means writable, 0x02 means readable and writable, etc.)

本示例中,服务响应(Target Service Response)的帧格式如表4所示。In this example, the frame format of the service response (Target Service Response) is shown in Table 4.

表4服务响应的帧格式Table 4 The frame format of the service response

opcode(1byte)opcode(1byte) AttributeType(2bytes)AttributeType (2bytes) result(1byte)result(1byte) 0x260x26 0x28010x2801 0x00/0x010x00/0x01

又如,当所述目标应用参数包括包含时,上述目标响应数据包括包含响应;该包含响应包括操作码(opcode,1byte)、属性类型(AttributeType,2bytes)、结果数据(result,1byte)和属性权限(Attribute Permission,1byte)。其中,包含响应的操作码为第二操作码(0x26),用于表示命令类型为响应类型。包含响应的属性类型为第二属性类型(0x2802),用于表示包含类型。包含响应的结果数据表示此包含是否位于注册列表之内(例如0x00表示存在,0x01表示不存在)。As another example, when the target application parameter includes inclusion, the above-mentioned target response data includes inclusion response; the inclusion response includes operation code (opcode, 1 byte), attribute type (AttributeType, 2 bytes), result data (result, 1 byte) and attribute Permission (Attribute Permission, 1byte). Wherein, the operation code containing the response is the second operation code (0x26), which is used to indicate that the command type is the response type. The attribute type of the containment response is the second attribute type (0x2802), which is used to indicate the containment type. The result data of the inclusion response indicates whether the inclusion is in the registration list (for example, 0x00 means it exists, and 0x01 means it does not exist).

本示例中,包含响应(Target Include Response)的帧格式如表5所示。In this example, the frame format of Target Include Response is shown in Table 5.

表5包含响应的帧格式Table 5 contains the frame format of the response

opcode(1byte)opcode(1byte) AttributeType(2bytes)AttributeType (2bytes) result(1byte)result(1byte) 0x260x26 0x28020x2802 0x00/0x010x00/0x01

再如,当所述目标应用参数包括特征时,上述目标响应数据包括特征响应;该特征响应包括操作码(opcode,1byte)、属性类型(AttributeType,2bytes)、属性权限(Attribute Permission,1byte)、特征特点(Charcteristic Perperties,1byte或2byte)、特性UUID(Charcteristic UUID,1byte)和特征句柄(Characteristic handle,2bytes)。其中,特征响应的操作码为第二操作码(0x26),用于表示命令类型为响应类型。包含响应的属性类型为第三属性类型(0x2803),用于表示特征类型。属性权限表示数据操作类型(例如0x00表示可读,0x01表示可写,0x02表示可读和可写等),特征句柄是指待传输消息的对象,特征UUID表示特征的识别码For another example, when the target application parameter includes a feature, the above-mentioned target response data includes a feature response; the feature response includes an operation code (opcode, 1 byte), an attribute type (AttributeType, 2 bytes), an attribute permission (Attribute Permission, 1 byte), Characteristic properties (Characteristic Perperties, 1byte or 2byte), characteristic UUID (Characteristic UUID, 1byte) and characteristic handle (Characteristic handle, 2bytes). Wherein, the operation code of the characteristic response is the second operation code (0x26), which is used to indicate that the command type is a response type. The attribute type containing the response is the third attribute type (0x2803), which is used to represent the feature type. The attribute permission indicates the type of data operation (for example, 0x00 indicates readable, 0x01 indicates writable, 0x02 indicates readable and writable, etc.), the feature handle refers to the object to transmit the message, and the feature UUID indicates the identification code of the feature

本示例中,特征响应(Target Characteristic Response)的帧格式如表6所示。In this example, the frame format of the Target Characteristic Response is shown in Table 6.

表6特征响应的帧格式Table 6 Frame format of feature response

Figure BDA0003944815400000121
Figure BDA0003944815400000121

在步骤14中,将所述目标响应数据反馈给所述客户端,以使所述客户端在所述目标响应数据表征发现目标应用参数后与所述服务端交互数据。In step 14, the target response data is fed back to the client, so that the client interacts with the server after the target response data represents the discovery of target application parameters.

本实施例中,服务端可以将目标响应数据反馈给客户端。客户端在接收到上述目标响应数据后,可以获取到服务、包含和特征;然后根据上述服务、包含和特征建立数据传输通道,并根据上述数据传输通道。这样,服务端与客户端可以通过上述数据传输通道交互数据。In this embodiment, the server may feed back target response data to the client. After receiving the above-mentioned target response data, the client can obtain the service, inclusion and characteristics; then establish a data transmission channel according to the above-mentioned service, inclusion and characteristics, and transmit the data according to the above-mentioned data transmission channel. In this way, the server and the client can exchange data through the above data transmission channel.

本实施例中,服务端在查找完目标应用参数后即可停止查找过程,而无需遍历所有已注册的应用参数。In this embodiment, the server can stop the search process after searching the target application parameters without traversing all registered application parameters.

至此,本公开实施例提供的方案中可以获取目标请求,所述目标请求含有客户端中预设的目标应用参数;然后,在应用参数注册列表中查找所述目标应用参数,得到表示是否发现所述目标应用参数的查找结果;之后,生成包含所述查找结果且与所述目标请求相匹配的目标响应数据;最后,将所述目标响应数据反馈给所述客户端,以使所述客户端在所述目标响应数据表征发现目标应用参数后与所述服务端交互数据。这样,本实施例中可以在应用参数注册列表中查找目标应用参数而无需遍历应用参数注册列表中全部应用参数,减少了查找时间,从而缩短两个电子设备通过蓝牙链接进行数据交互时间,有利于提高数据交互效率。So far, in the solution provided by the embodiments of the present disclosure, the target request can be obtained, and the target request contains the preset target application parameters in the client; then, the target application parameters are searched in the application parameter registration list to obtain the information indicating whether the target application parameters are found. the search result of the target application parameters; then, generate target response data containing the search result and matching with the target request; finally, feed back the target response data to the client, so that the client After the target response data represents the discovery of target application parameters, data is exchanged with the server. In this way, in this embodiment, the target application parameter can be searched in the application parameter registration list without traversing all the application parameters in the application parameter registration list, which reduces the search time, thereby shortening the data interaction time between two electronic devices through the Bluetooth link, which is beneficial Improve data interaction efficiency.

图3是根据一示例性实施例示出的一种服务发现方法的流程图,参见图3,一种服务发现方法,应用于客户端,包括步骤31~步骤33。Fig. 3 is a flow chart of a service discovery method according to an exemplary embodiment. Referring to Fig. 3 , a service discovery method is applied to a client, including steps 31 to 33.

在步骤31中,获取客户端中预设的目标应用参数。In step 31, the preset target application parameters in the client are acquired.

本实施例中,参见图4,客户端可以与服务端建立蓝牙链接(即BLE链接)。例如,客户端可以生成链接建立请求并进行广播。服务端可以监听周围空间的广播信号,当接收到上述链接建立请求后,可以检测当地的配对信息;当链接建立请求内的客户端的识别码位于服务端中已配对设备列表之内时,服务端可以与该客户端建立蓝牙链接,这样服务端与客户端完成配对与连接的工作。In this embodiment, referring to FIG. 4 , the client can establish a Bluetooth link (that is, a BLE link) with the server. For example, a client can generate a link establishment request and broadcast it. The server can monitor the broadcast signal in the surrounding space, and can detect the local pairing information after receiving the above-mentioned link establishment request; when the identification code of the client in the link establishment request is in the list of paired devices in the server, the server A Bluetooth link can be established with the client, so that the server and the client complete the pairing and connection work.

本实施例中,客户端可以获取客户端中预设的目标应用参数。在一示例中,目标应用参数包括服务(Service)、包含(Include)和特征(Characteristic)。客户端可以依次获取服务(Service)、包含(Include)和特征(Characteristic),具体来说,客户端可以先获取服务,在确定该服务已经在服务端注册时再获取包含;在确定该包含已经在服务端注册时再获取特征。In this embodiment, the client may acquire target application parameters preset in the client. In an example, the target application parameters include service (Service), inclusion (Include) and characteristic (Characteristic). The client can obtain the service (Service), include (Include) and characteristic (Characteristic) in turn. Specifically, the client can obtain the service first, and then obtain the inclusion when it is determined that the service has been registered on the server; Get the characteristics when registering on the server.

在步骤32中,生成含有所述目标应用参数的目标请求并发送给服务端,以使所述服务端响应于所述目标请求查找应用参数注册列表并返回表示是否发现所述目标应用参数的查找结果的目标响应数据。In step 32, a target request containing the target application parameters is generated and sent to the server, so that the server searches the application parameter registration list in response to the target request and returns a query indicating whether the target application parameters are found The target response data for the result.

本实施例中,继续参见图4,客户端可以生成含有目标应用参数的目标请求并发送给服务端。其中,目标请求可以参见步骤11的相关内容,在此不再赘述。In this embodiment, continue referring to FIG. 4 , the client may generate a target request containing target application parameters and send it to the server. Wherein, for the target request, reference may be made to the relevant content in step 11, which will not be repeated here.

本实施例中,服务端在接收到目标请求后可以在应用参数注册列表内查找相应的应用参数,例如服务、包含或者特征,并生成目标响应数据。其中,查找应用参数和生成目标响应数据的方案可以参见步骤12和步骤13的相关内容,在此不再赘述。In this embodiment, after receiving the target request, the server can search for corresponding application parameters in the application parameter registration list, such as service, inclusion or feature, and generate target response data. Wherein, for the solutions of searching for application parameters and generating target response data, refer to the relevant contents of step 12 and step 13, and details are not repeated here.

在步骤33中,当所述目标响应数据表示发现目标应用参数后,根据所述目标应用参数与所述服务端交互数据。In step 33, when the target response data indicates that target application parameters are found, data is exchanged with the server according to the target application parameters.

本实施例中,客户端在接收到目标响应数据后,在依次确定出目标应用参数中的服务、包含和特征之后,可以确定发现服务。此时客户端与服务端可以根据服务的特征进行交互数据。In this embodiment, after receiving the target response data, the client may determine the discovery service after sequentially determining the service, content and features in the target application parameters. At this time, the client and the server can exchange data according to the characteristics of the service.

需要说明的是,相关技术中客户端与服务端数据交互之前需要完成以下过程,参见图5,包括:It should be noted that, in related technologies, the following processes need to be completed before data interaction between the client and the server, as shown in Figure 5, including:

客户端向服务端发送集合类型请求(ATT_READ_BY_GROUP_TYPE_REQ),该集合类型请求用于请求服务端返回当前已经注册的主要服务(Primary Service)。在接收到此集合类型请求后,服务端按照预设大小搜索服务注册列表中的服务,从而返回搜索结果即返回一帧数据。依次类推,服务器在搜索完所有已经注册的服务后,最多搜索65535个注册服务而通常会远少于65535个,并返回搜索结果。相应地,客户端会接收到若干帧服务响应,例如4~10帧。在接收到服务响应中,客户端可以确定服务UUID是否是服务端内注册的服务。在服务UUID是已经注册的服务时,客户端再发现服务内的包含(Include),即发送读包含指令(ATT_READ_BY_TYPE_REQ),与查询服务的过程类型,服务端会查找服务中已注册的包含,并按照预设大小返回包含响应,直至搜索完所有的包含注册列表,因此客户端又会接收到若干帧包含响应数据。在确定相应的包含之后,客户端会发送读特征指令(ATT_READ_BY_TYPE_REQ),以使服务端返回已注册的特征。在确定出服务的特征之后,客户端与服务端可以根据服务的特征进行数据交互。基于上述过程分析,客户端与服务端进行数据交互之前,客户端在三个阶段需要接收多帧响应数据(服务响应、包含响应以及特征响应),从而消耗较多的时间。本实施例中客户端与服务端通过4次请求过程以及接收4帧响应数据即可实现数据交互,服务搜索时间减少至原来的四分之一。The client sends an aggregate type request (ATT_READ_BY_GROUP_TYPE_REQ) to the server, which is used to request the server to return the currently registered primary service (Primary Service). After receiving this collection type request, the server searches for services in the service registration list according to the preset size, and returns a frame of data as the search result. By analogy, after searching all the registered services, the server will search up to 65535 registered services but usually far less than 65535, and return the search results. Correspondingly, the client will receive several frames of service responses, for example, 4-10 frames. Upon receiving the service response, the client can determine whether the service UUID is a service registered in the server. When the service UUID is a registered service, the client will find the inclusion (Include) in the service, that is, send the read include command (ATT_READ_BY_TYPE_REQ), and query the process type of the service, the server will search for the registered inclusion in the service, and Return the included response according to the preset size until all the included registration lists are searched, so the client will receive several frames containing the response data. After determining the corresponding inclusion, the client will send a read characteristic command (ATT_READ_BY_TYPE_REQ), so that the server returns the registered characteristic. After determining the characteristics of the service, the client and the server can exchange data according to the characteristics of the service. Based on the above process analysis, before the data interaction between the client and the server, the client needs to receive multi-frame response data (service response, inclusion response, and feature response) in three stages, thus consuming more time. In this embodiment, the client and the server can realize data interaction through 4 request processes and receiving 4 frames of response data, and the service search time is reduced to a quarter of the original one.

至此,本公开实施例提供的方案中可以获取客户端中预设的目标应用参数;生成含有所述目标应用参数的目标请求并发送给服务端,以使所述服务端响应于所述目标请求查找应用参数注册列表并返回表示是否发现所述目标应用参数的查找结果的目标响应数据;当所述目标响应数据表示发现目标应用参数后,根据所述目标应用参数与所述服务端交互数据。这样,本实施例中客户端可以仅发送4次请求以及接收4次响应数据即可与服务端交互数据,缩短数据交互时长,提升数据交互效率。So far, in the solutions provided by the embodiments of the present disclosure, the preset target application parameters in the client can be obtained; a target request containing the target application parameters can be generated and sent to the server, so that the server can respond to the target request Search the application parameter registration list and return target response data indicating whether the target application parameter is found; when the target response data indicates that the target application parameter is found, interact data with the server according to the target application parameter. In this way, in this embodiment, the client can exchange data with the server by only sending 4 requests and receiving 4 responses, shortening the data interaction time and improving data interaction efficiency.

在本公开实施例提供的一种服务发现方法的基础上,本公开还提供了一种服务发现装置,适用于服务端,参见图6,所述装置包括:On the basis of a service discovery method provided by an embodiment of the present disclosure, the present disclosure also provides a service discovery device, which is suitable for a server, see FIG. 6 , the device includes:

目标请求获取模块61,用于获取目标请求,所述目标请求含有客户端中预设的目标应用参数;A target request acquiring module 61, configured to acquire a target request, the target request containing preset target application parameters in the client;

查找结果获取模块62,用于在应用参数注册列表中查找所述目标应用参数,得到表示是否发现所述目标应用参数的查找结果;A search result acquisition module 62, configured to search for the target application parameter in the application parameter registration list, and obtain a search result indicating whether the target application parameter is found;

目标响应获取模块63,用于生成包含所述查找结果且与所述目标请求相匹配的目标响应数据;A target response acquisition module 63, configured to generate target response data that includes the search result and matches the target request;

目标响应反馈模块64,用于将所述目标响应数据反馈给所述客户端,以使所述客户端在所述目标响应数据表征发现目标应用参数后与所述服务端交互数据。The target response feedback module 64 is configured to feed back the target response data to the client, so that the client can exchange data with the server after the target response data represents the discovery of target application parameters.

可选地,所述目标应用参数包括服务、包含和特征。Optionally, the target application parameters include service, inclusion and feature.

可选地,当所述目标应用参数包括服务时,所述目标响应数据包括服务响应;所述服务响应包括操作码、属性类型、结果数据和属性权限;Optionally, when the target application parameter includes a service, the target response data includes a service response; the service response includes an operation code, attribute type, result data, and attribute permission;

所述操作码为第二操作码,所述属性类型为第一属性类型,所述结果数据表示此服务是否位于注册列表之内。The operation code is the second operation code, the attribute type is the first attribute type, and the result data indicates whether the service is in the registration list.

可选地,当所述目标应用参数包括包含时,所述目标响应数据包括包含响应;所述包含响应包括操作码、属性类型和结果数据;Optionally, when the target application parameter includes include, the target response data includes include response; the include response includes opcode, attribute type and result data;

所述操作码为第二操作码,所述属性类型为第二属性类型,所述结果数据表示此包含是否位于注册列表之内。The opcode is a second opcode, the attribute type is a second attribute type, and the result data indicates whether the inclusion is in the registration list.

可选地,当所述目标应用参数包括特征时,所述目标响应数据包括特征响应;所述特征响应包括操作码、属性类型、属性权限、特征UUID和特征句柄;所述操作码为第二操作码,所述属性类型为第三属性类型,所述属性权限表示数据操作类型,特征句柄是指待传输消息的对象,特征UUID表示特征的识别码。Optionally, when the target application parameters include features, the target response data includes feature responses; the feature responses include opcodes, attribute types, attribute permissions, feature UUIDs, and feature handles; the opcodes are the second Operation code, the attribute type is the third attribute type, the attribute permission indicates the type of data operation, the feature handle refers to the object to transmit the message, and the feature UUID indicates the identification code of the feature.

可选地,所述装置还包括:Optionally, the device also includes:

蓝牙链接建立模块,用于在接收到客户端发送的链接建立请求时,与所述客户端建立蓝牙链接。The Bluetooth link establishment module is configured to establish a Bluetooth link with the client when receiving a link establishment request sent by the client.

可选地,所述装置还包括:Optionally, the device also includes:

查找停止模块,用于在查找完所述目标应用参数后停止查找过程。A search stop module, configured to stop the search process after the target application parameters are searched.

在本公开实施例提供的一种服务发现方法的基础上,本公开还提供了一种服务发现装置,适用于客户端,参见图7,所述装置包括:On the basis of a service discovery method provided by an embodiment of the present disclosure, the present disclosure also provides a service discovery device suitable for a client, see FIG. 7 , the device includes:

目标参数获取模块71,用于获取客户端中预设的目标应用参数;A target parameter acquisition module 71, configured to acquire target application parameters preset in the client;

目标请求生成模块72,用于生成含有所述目标应用参数的目标请求并发送给服务端,以使所述服务端响应于所述目标请求查找应用参数注册列表并返回表示是否发现所述目标应用参数的查找结果的目标响应数据;A target request generation module 72, configured to generate a target request containing the target application parameters and send it to the server, so that the server responds to the target request to search for an application parameter registration list and returns whether the target application is found The target response data for the lookup result of the parameter;

数据交互模块73,用于在所述目标响应数据表示发现目标应用参数后,根据所述目标应用参数与所述服务端交互数据。The data interaction module 73 is configured to exchange data with the server according to the target application parameters after the target response data indicates that the target application parameters are found.

可选地,所述目标应用参数包括服务、包含和特征。Optionally, the target application parameters include service, inclusion and feature.

可选地,当所述目标应用参数包括服务时,所述目标请求包括服务请求;所述服务请求包括操作码、属性类型和服务参数UUID;所述操作码为第一操作码,所述属性类型为第一属性类型。Optionally, when the target application parameter includes a service, the target request includes a service request; the service request includes an operation code, an attribute type, and a service parameter UUID; the operation code is a first operation code, and the attribute Type is the first attribute type.

可选地,当所述目标应用参数包括包含时,所述目标请求包括包含请求;所述包含请求包括操作码、属性类型和属性权限;所述操作码为第一操作码,所述属性类型为第二属性类型。Optionally, when the target application parameter includes inclusion, the target request includes an inclusion request; the inclusion request includes an operation code, an attribute type, and an attribute permission; the operation code is a first operation code, and the attribute type is the second attribute type.

可选地,当所述目标应用参数包括特征时,所述目标请求包括特征请求;所述特征请求包括操作码、属性类型和特征UUID;所述操作码为第一操作码,所述属性类型为第三属性类型。Optionally, when the target application parameter includes a feature, the target request includes a feature request; the feature request includes an opcode, an attribute type, and a feature UUID; the opcode is a first opcode, and the attribute type is the third attribute type.

可选地,所述装置还包括:Optionally, the device also includes:

链接请求发送模块,用于发送链接建立请求,以使服务端响应于所述链接建立请求与客户端建立蓝牙链接。A link request sending module, configured to send a link establishment request, so that the server can establish a bluetooth link with the client in response to the link establishment request.

需要说明的是,本实施例中示出的装置实施例与上述方法实施例的内容相匹配,可以参考上述方法实施例的内容,在此不再赘述。It should be noted that the device embodiment shown in this embodiment matches the content of the above-mentioned method embodiment, and reference may be made to the content of the above-mentioned method embodiment, which will not be repeated here.

在本公开实施例提供的一种服务发现方法的基础上,本公开实施例还提供了一种服务发现系统,所述系统包括车用设备和电子设备;车用设备响应于检测到车用设备的触发操作显示本次投屏所使用的投屏识别码;所述车用设备播放携带所述投屏识别码的音频文件至少一次;电子设备启动投屏应用程序和开启电子设备的音频采集功能,并基于所述音频采集功能获取携带投屏识别码的声波信号,得到声波文件,以及根据所述声波信号内的投屏识别码与所述车用设备建立投屏链接;所述车用设备根据所述投屏链接共享所述电子设备的当前显示内容。On the basis of the service discovery method provided by the embodiment of the present disclosure, the embodiment of the present disclosure also provides a service discovery system, the system includes a vehicle device and an electronic device; the vehicle device responds to detecting the vehicle device The trigger operation displays the screen projection identification code used for this screen projection; the vehicle device plays the audio file carrying the screen projection identification code at least once; the electronic device starts the screen projection application and starts the audio collection function of the electronic device , and based on the audio collection function, acquire a sound wave signal carrying a screen projection identification code, obtain a sound wave file, and establish a screen projection link with the vehicle device according to the screen projection identification code in the sound wave signal; the vehicle device Sharing the currently displayed content of the electronic device according to the screen-casting link.

需要说明的是,本实施例中示出的系统实施例与上述方法实施例的内容相匹配,可以参考上述所示方法实施例的内容,在此不再赘述。It should be noted that the system embodiment shown in this embodiment matches the content of the above method embodiment, and reference may be made to the content of the above method embodiment, which will not be repeated here.

图8是根据一示例性实施例示出的一种电子设备的框图。例如,电子设备800可以是智能手机,计算机,数字广播终端,平板设备,医疗设备,健身设备,个人数字助理等,以及上述的车用设备等。Fig. 8 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 800 may be a smart phone, a computer, a digital broadcast terminal, a tablet device, a medical device, a fitness device, a personal digital assistant, etc., as well as the above-mentioned vehicle devices.

参照图8,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,通信组件816,图像采集组件818。8, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814 , a communication component 816, and an image acquisition component 818.

处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行计算机程序。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operations of the electronic device 800, such as those associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 for executing computer programs. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802 .

存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的计算机程序,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 804 is configured to store various types of data to support operations at the electronic device 800 . Examples of such data include computer programs for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.

电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。电源组件806可以包括电源芯片,控制器可以电源芯片通信,从而控制电源芯片导通或者断开开关器件,使电池向主板电路供电或者不供电。The power supply component 806 provides power to various components of the electronic device 800 . Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 800 . The power supply component 806 may include a power chip, and the controller may communicate with the power chip, so as to control the power chip to turn on or turn off the switching device, so that the battery supplies power to the motherboard circuit or not.

多媒体组件808包括在电子设备800和目标对象之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示屏(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自目标对象的输入信息。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与触摸或滑动操作相关的持续时间和压力。The multimedia component 808 includes a screen providing an output interface between the electronic device 800 and the target object. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input information from a target object. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or a swipe action, but also detect duration and pressure associated with the touch or swipe operation.

音频组件810被配置为输出和/或输入音频文件信息。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频文件信息。所接收的音频文件信息可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频文件信息。Audio component 810 is configured to output and/or input audio file information. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio file information when the electronic device 800 is in an operation mode, such as a calling mode, a recording mode and a voice recognition mode. The received audio file information may be further stored in memory 804 or sent via communication component 816 . In some embodiments, the audio component 810 also includes a speaker for outputting audio file information.

I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按键等。The I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module. The peripheral interface module may be a keyboard, a click wheel, or a button.

传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如组件为电子设备800的显示屏和小键盘,传感器组件814还可以检测电子设备800或一个组件的位置改变,目标对象与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。本示例中,传感器组件814可以包括磁力传感器、陀螺仪和磁场传感器,其中磁场传感器包括以下至少一种:霍尔传感器、薄膜磁致电阻传感器、磁性液体加速度传感器。Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of electronic device 800 . For example, the sensor component 814 can detect the open/closed state of the electronic device 800, the relative positioning of components, such as the display screen and the keypad of the electronic device 800, and the sensor component 814 can also detect the position change of the electronic device 800 or a component , the presence or absence of the target object in contact with the electronic device 800 , the orientation or acceleration/deceleration of the electronic device 800 and the temperature change of the electronic device 800 . In this example, the sensor component 814 may include a magnetic sensor, a gyroscope, and a magnetic field sensor, wherein the magnetic field sensor includes at least one of the following: a Hall sensor, a thin film magnetoresistive sensor, and a magnetic liquid acceleration sensor.

通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如WiFi,2G、3G、4G、5G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信息或广播相关信息。在一个示例性实施例中,通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on communication standards, such as WiFi, 2G, 3G, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast information or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.

在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信息处理器(DSP)、数字信息处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现。In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Data Processors (DSPs), Digital Data Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic implementation.

在示例性实施例中,还提供了一种电子设备,包括:In an exemplary embodiment, there is also provided an electronic device, comprising:

存储器与处理器;memory and processor;

所述存储器用于存储所述处理器可执行的计算机程序;The memory is used to store a computer program executable by the processor;

所述处理器用于执行所述存储器中的计算机程序,以实现如上述的方法。The processor is configured to execute the computer program in the memory, so as to realize the above-mentioned method.

在示例性实施例中,还提供了一种非暂态计算机可读存储介质,例如包括指令的存储器804,上述可执行的计算机程序可由处理器执行。其中,可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium, such as the memory 804 including instructions, and the above-mentioned executable computer program can be executed by a processor. Wherein, the readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device and the like.

本领域技术人员在考虑说明书及实践这里公开的公开后,将容易想到本公开的其它实施方案。本公开旨在涵盖任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. The present disclosure is intended to cover any modification, use or adaptation that follows the general principles of the present disclosure and includes common knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It should be understood that the present disclosure is not limited to the precise constructions which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (17)

1.一种服务发现方法,其特征在于,适用于服务端,所述方法包括:1. A method for service discovery, characterized in that it is suitable for a server, the method comprising: 获取目标请求,所述目标请求含有客户端中预设的目标应用参数;Obtaining a target request, the target request containing preset target application parameters in the client; 在应用参数注册列表中查找所述目标应用参数,得到表示是否发现所述目标应用参数的查找结果;Searching for the target application parameter in the application parameter registration list, and obtaining a search result indicating whether the target application parameter is found; 生成包含所述查找结果且与所述目标请求相匹配的目标响应数据;generating target response data that includes the search result and matches the target request; 将所述目标响应数据反馈给所述客户端,以使所述客户端在所述目标响应数据表征发现目标应用参数后与所述服务端交互数据。The target response data is fed back to the client, so that the client exchanges data with the server after the target response data represents the discovery of target application parameters. 2.根据权利要求1所述的方法,其特征在于,所述目标应用参数包括服务、包含和特征。2. The method according to claim 1, wherein the target application parameters include services, inclusions and features. 3.根据权利要求2所述的方法,其特征在于,当所述目标应用参数包括服务时,所述目标响应数据包括服务响应;所述服务响应包括操作码、属性类型、结果数据和属性权限;3. The method according to claim 2, wherein when the target application parameter includes a service, the target response data includes a service response; the service response includes an operation code, attribute type, result data, and attribute authority ; 所述操作码为第二操作码,所述属性类型为第一属性类型,所述结果数据表示此服务是否位于注册列表之内。The operation code is the second operation code, the attribute type is the first attribute type, and the result data indicates whether the service is in the registration list. 4.根据权利要求2所述的方法,其特征在于,当所述目标应用参数包括包含时,所述目标响应数据包括包含响应;所述包含响应包括操作码、属性类型和结果数据;4. The method according to claim 2, wherein when the target application parameter includes inclusion, the target response data includes an inclusion response; the inclusion response includes an operation code, an attribute type, and result data; 所述操作码为第二操作码,所述属性类型为第二属性类型,所述结果数据表示此包含是否位于注册列表之内。The opcode is a second opcode, the attribute type is a second attribute type, and the result data indicates whether the inclusion is in the registration list. 5.根据权利要求2所述的方法,其特征在于,当所述目标应用参数包括特征时,所述目标响应数据包括特征响应;所述特征响应包括操作码、属性类型、属性权限、特征UUID和特征句柄;所述操作码为第二操作码,所述属性类型为第三属性类型,所述属性权限表示数据操作类型,特征句柄是指待传输消息的对象,特征UUID表示特征的识别码。5. The method according to claim 2, wherein when the target application parameters include features, the target response data includes feature responses; the feature responses include opcodes, attribute types, attribute permissions, feature UUIDs and a feature handle; the opcode is the second opcode, the attribute type is the third attribute type, the attribute permission indicates the type of data operation, the feature handle refers to the object to transmit the message, and the feature UUID indicates the identification code of the feature . 6.根据权利要求1所述的方法,其特征在于,所述方法还包括:6. The method according to claim 1, further comprising: 在接收到客户端发送的链接建立请求时,与所述客户端建立蓝牙链接。When receiving the link establishment request sent by the client, establish a bluetooth link with the client. 7.根据权利要求1~6任一项所述的方法,其特征在于,所述方法还包括:7. The method according to any one of claims 1 to 6, characterized in that the method further comprises: 在查找完所述目标应用参数后停止查找过程。The search process is stopped after the target application parameters are searched. 8.一种服务发现方法,其特征在于,适用于客户端,所述方法包括:8. A service discovery method, characterized in that, being applicable to a client, the method comprises: 获取客户端中预设的目标应用参数;Obtain the preset target application parameters in the client; 生成含有所述目标应用参数的目标请求并发送给服务端,以使所述服务端响应于所述目标请求查找应用参数注册列表并返回表示是否发现所述目标应用参数的查找结果的目标响应数据;Generate a target request containing the target application parameter and send it to the server, so that the server searches the application parameter registration list in response to the target request and returns target response data indicating whether the target application parameter is found ; 当所述目标响应数据表示发现目标应用参数后,根据所述目标应用参数与所述服务端交互数据。When the target response data indicates that target application parameters are found, data is exchanged with the server according to the target application parameters. 9.根据权利要求8所述的方法,其特征在于,所述目标应用参数包括服务、包含和特征。9. The method according to claim 8, wherein the target application parameters include service, containment and feature. 10.根据权利要求9所述的方法,其特征在于,当所述目标应用参数包括服务时,所述目标请求包括服务请求;所述服务请求包括操作码、属性类型和服务参数UUID;所述操作码为第一操作码,所述属性类型为第一属性类型。10. The method according to claim 9, wherein when the target application parameter includes a service, the target request includes a service request; the service request includes an operation code, an attribute type, and a service parameter UUID; the The operation code is the first operation code, and the attribute type is the first attribute type. 11.根据权利要求9所述的方法,其特征在于,当所述目标应用参数包括包含时,所述目标请求包括包含请求;所述包含请求包括操作码、属性类型和属性权限;所述操作码为第一操作码,所述属性类型为第二属性类型。11. The method according to claim 9, wherein when the target application parameter includes include, the target request includes include request; the include request includes opcode, attribute type and attribute permission; the operation The code is a first opcode, and the attribute type is a second attribute type. 12.根据权利要求9所述的方法,其特征在于,当所述目标应用参数包括特征时,所述目标请求包括特征请求;所述特征请求包括操作码、属性类型和特征UUID;所述操作码为第一操作码,所述属性类型为第三属性类型。12. The method according to claim 9, wherein when the target application parameter includes a feature, the target request includes a feature request; the feature request includes an operation code, an attribute type, and a feature UUID; the operation The code is a first operation code, and the attribute type is a third attribute type. 13.根据权利要求8所述的方法,其特征在于,所述方法还包括:13. The method of claim 8, further comprising: 发送链接建立请求,以使服务端响应于所述链接建立请求与客户端建立蓝牙链接。Sending a link establishment request, so that the server establishes a bluetooth link with the client in response to the link establishment request. 14.一种服务发现装置,其特征在于,适用于服务端,所述装置包括:14. A service discovery device, characterized in that it is suitable for a server, and the device comprises: 目标请求获取模块,用于获取目标请求,所述目标请求含有客户端中预设的目标应用参数;A target request obtaining module, configured to obtain a target request, the target request containing preset target application parameters in the client; 查找结果获取模块,用于在应用参数注册列表中查找所述目标应用参数,得到表示是否发现所述目标应用参数的查找结果;A search result acquisition module, configured to search for the target application parameter in the application parameter registration list, and obtain a search result indicating whether the target application parameter is found; 目标响应获取模块,用于生成包含所述查找结果且与所述目标请求相匹配的目标响应数据;A target response acquisition module, configured to generate target response data that includes the search result and matches the target request; 目标响应反馈模块,用于将所述目标响应数据反馈给所述客户端,以使所述客户端在所述目标响应数据表征发现目标应用参数后与所述服务端交互数据。A target response feedback module, configured to feed back the target response data to the client, so that the client can exchange data with the server after the target response data represents the discovery of target application parameters. 15.一种服务发现装置,其特征在于,适用于客户端,所述装置包括:15. A service discovery device, characterized in that it is suitable for a client, and the device comprises: 目标参数获取模块,用于获取客户端中预设的目标应用参数;A target parameter acquisition module, configured to acquire target application parameters preset in the client; 目标请求生成模块,用于生成含有所述目标应用参数的目标请求并发送给服务端,以使所述服务端响应于所述目标请求查找应用参数注册列表并返回表示是否发现所述目标应用参数的查找结果的目标响应数据;A target request generating module, configured to generate a target request containing the target application parameters and send it to the server, so that the server can search the application parameter registration list in response to the target request and return whether the target application parameters are found The target response data of the search results; 数据交互模块,用于在所述目标响应数据表示发现目标应用参数后,根据所述目标应用参数与所述服务端交互数据。A data interaction module, configured to exchange data with the server according to the target application parameters after the target response data indicates that the target application parameters are found. 16.一种电子设备,其特征在于,包括:16. An electronic device, characterized in that it comprises: 存储器与处理器;memory and processor; 所述存储器用于存储所述处理器可执行的计算机程序;The memory is used to store a computer program executable by the processor; 所述处理器用于执行所述存储器中的计算机程序,以实现如权利要求1~13任一项所述的方法。The processor is configured to execute the computer program in the memory, so as to realize the method according to any one of claims 1-13. 17.一种非暂态计算机可读存储介质,其特征在于,当所述存储介质中的可执行的计算机程序由处理器执行时,能够实现如权利要求1~13任一项所述的方法。17. A non-transitory computer-readable storage medium, characterized in that, when the executable computer program in the storage medium is executed by a processor, the method according to any one of claims 1 to 13 can be implemented .
CN202211437785.XA 2022-11-15 Service discovery method and device, electronic device, and storage medium Active CN115914350B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211437785.XA CN115914350B (en) 2022-11-15 Service discovery method and device, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211437785.XA CN115914350B (en) 2022-11-15 Service discovery method and device, electronic device, and storage medium

Publications (2)

Publication Number Publication Date
CN115914350A true CN115914350A (en) 2023-04-04
CN115914350B CN115914350B (en) 2025-10-03

Family

ID=

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6845393B1 (en) * 1999-06-14 2005-01-18 Sun Microsystems, Inc. Lookup discovery service in a distributed system having a plurality of lookup services each with associated characteristics and services
CN1859516A (en) * 2005-04-30 2006-11-08 艾威梯软件技术(北京)有限公司 Method for one blue tooth terminal and multiple blue tooth gateway connecting to call and receive telephone
US20060259578A1 (en) * 2005-04-18 2006-11-16 Brindusa Fritsch System and method for discovering wireless mobile applications
CN101902458A (en) * 2010-02-21 2010-12-01 中国联合网络通信集团有限公司 Method, device and system for cross-host interprocess communication
CN105245595A (en) * 2015-09-30 2016-01-13 小米科技有限责任公司 Service response method and service response device
US20170054787A1 (en) * 2014-02-12 2017-02-23 Lg Electronics Inc. Method and apparatus for performing object transfer service using bluetooth low energy in wireless communication system
CN107948215A (en) * 2018-01-17 2018-04-20 广州汇智通信技术有限公司 A kind of remote invocation method and device based on UDP communications
CN111756795A (en) * 2020-05-06 2020-10-09 浙江吉利汽车研究院有限公司 A service information management method, device, electronic device and storage medium
CN111886900A (en) * 2018-02-06 2020-11-03 瑞典爱立信有限公司 Unique service identifier for message brokers in a service-based architecture
CN111918262A (en) * 2020-08-15 2020-11-10 北京百瑞互联技术有限公司 Low-power-consumption Bluetooth communication method and system for rapidly discovering GATT service
CN114501449A (en) * 2022-01-28 2022-05-13 Oppo广东移动通信有限公司 Information query method, device, electronic device and storage medium
CN115065691A (en) * 2022-08-18 2022-09-16 飞天诚信科技股份有限公司 Communication implementation method and device based on android platform
CN115244957A (en) * 2020-03-11 2022-10-25 微软技术许可有限责任公司 System and method for establishing highly secure and resilient persistent communication connections

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6845393B1 (en) * 1999-06-14 2005-01-18 Sun Microsystems, Inc. Lookup discovery service in a distributed system having a plurality of lookup services each with associated characteristics and services
US20060259578A1 (en) * 2005-04-18 2006-11-16 Brindusa Fritsch System and method for discovering wireless mobile applications
CN1859516A (en) * 2005-04-30 2006-11-08 艾威梯软件技术(北京)有限公司 Method for one blue tooth terminal and multiple blue tooth gateway connecting to call and receive telephone
CN101902458A (en) * 2010-02-21 2010-12-01 中国联合网络通信集团有限公司 Method, device and system for cross-host interprocess communication
US20170054787A1 (en) * 2014-02-12 2017-02-23 Lg Electronics Inc. Method and apparatus for performing object transfer service using bluetooth low energy in wireless communication system
CN105245595A (en) * 2015-09-30 2016-01-13 小米科技有限责任公司 Service response method and service response device
CN107948215A (en) * 2018-01-17 2018-04-20 广州汇智通信技术有限公司 A kind of remote invocation method and device based on UDP communications
CN111886900A (en) * 2018-02-06 2020-11-03 瑞典爱立信有限公司 Unique service identifier for message brokers in a service-based architecture
CN115244957A (en) * 2020-03-11 2022-10-25 微软技术许可有限责任公司 System and method for establishing highly secure and resilient persistent communication connections
CN111756795A (en) * 2020-05-06 2020-10-09 浙江吉利汽车研究院有限公司 A service information management method, device, electronic device and storage medium
CN111918262A (en) * 2020-08-15 2020-11-10 北京百瑞互联技术有限公司 Low-power-consumption Bluetooth communication method and system for rapidly discovering GATT service
CN114501449A (en) * 2022-01-28 2022-05-13 Oppo广东移动通信有限公司 Information query method, device, electronic device and storage medium
CN115065691A (en) * 2022-08-18 2022-09-16 飞天诚信科技股份有限公司 Communication implementation method and device based on android platform

Similar Documents

Publication Publication Date Title
CN105915627A (en) Service request processing method and service request processing device
CN106713418B (en) Reset result confirmation method, device, server and mobile terminal
CN108320745A (en) Control the method and device of display
CN108496341A (en) Method, apparatus, equipment and the base station of edge calculations are realized in cellular network
CN107094094B (en) Application networking method and device and terminal
WO2016127795A1 (en) Service processing method, server, and terminal
CN114430920B (en) Capability reporting method and device, and capability determining method and device
US11172428B2 (en) Broadcasting and discovering methods, broadcasting and discovering devices and storage medium
CN107371052A (en) Equipment control method and device
CN108848497A (en) Acquisition methods, device, terminal and the computer readable storage medium of list of application
CN106790743A (en) Information transferring method, device and mobile terminal
CN115914350A (en) Service discovery method and device, electronic device, storage medium
CN115914350B (en) Service discovery method and device, electronic device, and storage medium
CN107070816A (en) Recognition methods, device and the mobile terminal of application
WO2023130436A1 (en) Session release method and apparatus, and storage medium
WO2022032458A1 (en) Multi-modal data transmission method and apparatus, and multi-modal data processing method and apparatus
US11252640B2 (en) Method, apparatus, device and base station for implementing internet of things device bootstrapping
CN105722078A (en) Wifi access method and device
CN113179529B (en) Information processing method and device, network equipment, storage medium
CN109194639A (en) Message sink processing method, device, terminal and readable storage medium storing program for executing
US20230327908A1 (en) Operation method, invoking service method, device, and medium
CN108476392A (en) The method, apparatus and equipment quickly connected is established between internet of things equipment
US20230300220A1 (en) Method for sending multimodal data
CN116261015A (en) Subtitle processing method and device based on WebSocket and HTML technology and electronic equipment
CN116246370A (en) Method, device, and storage medium for sharing digital car keys

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