WO2023020253A1 - Data acquisition method and apparatus, electronic device, and storage medium - Google Patents

Data acquisition method and apparatus, electronic device, and storage medium Download PDF

Info

Publication number
WO2023020253A1
WO2023020253A1 PCT/CN2022/108839 CN2022108839W WO2023020253A1 WO 2023020253 A1 WO2023020253 A1 WO 2023020253A1 CN 2022108839 W CN2022108839 W CN 2022108839W WO 2023020253 A1 WO2023020253 A1 WO 2023020253A1
Authority
WO
WIPO (PCT)
Prior art keywords
service data
server
identifier
data
specified
Prior art date
Application number
PCT/CN2022/108839
Other languages
French (fr)
Chinese (zh)
Inventor
吕生义
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023020253A1 publication Critical patent/WO2023020253A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding

Definitions

  • the present application relates to the technical field of communications, and more specifically, to a data acquisition method, device, electronic device, and storage medium.
  • the client needs to obtain the services provided by the server before using the services provided by the server.
  • the GATT client needs to initiate a service discovery process to the GATT server to discover service data in the GATT server.
  • GATT Generic Attribute Profile
  • the present application proposes a data acquisition method, device, electronic device, and storage medium, so as to improve the above problems.
  • the present application provides a method for obtaining data, which is applied to a client, and the method includes: obtaining a specified identifier from the wireless data corresponding to the server, and the specified identifier is used to identify the first One service data, the first service data is fixed service data; if the first service data previously obtained from the server based on the designated identifier is stored locally, the first service data obtained from the server based on the designated identifier Obtain the second service data in the server, the second service data is the service data in the server other than the first service data; use the second service data and the local first service data as the acquired The service data of the server.
  • the present application provides a data acquisition method applied to a server, the method comprising: sending wireless data carrying a specified identifier, the specified identifier is used to identify the first service data in the server , the first service data is fixed service data; in response to the acquisition request sent by the client corresponding to the specified identifier, the second service data is acquired from the server, and the acquisition request is the After the client determines that the first service data previously obtained from the server based on the specified identifier is locally stored, the client sends the second service data to the client, so that the client will The second service data and the local first service data are used as the acquired service data of the server.
  • the present application provides a data acquisition device, which runs on a client, and the device includes: an identification acquisition unit, configured to acquire a designated identification from the wireless data corresponding to the server, and the designated identification is used to identify the The first service data in the server end, the first service data is fixed service data; the first data acquisition unit is configured to locally store the first service data acquired from the server based on the specified identifier in advance A service data, obtaining second service data from the server based on the specified identifier, the second service data being service data other than the first service data in the server; a second data acquisition unit , used to use the second service data and the local first service data as the acquired service data of the server.
  • the present application provides a data acquisition device that runs on a server, the device includes: an identification sending unit, configured to send wireless data carrying a specified identification, and the specified identification is used to identify the server
  • the first service data is fixed service data
  • the data search unit is configured to obtain from the server in response to the acquisition request sent by the client and corresponding to the specified identifier
  • the acquisition request is sent by the client after determining that the first service data previously obtained from the server based on the specified identifier is locally stored
  • the data sending unit is configured to send the second service data
  • the service data is sent to the client, so that the client uses the second service data and the local first service data as the acquired service data of the server.
  • the present application provides an electronic device, including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, The one or more programs are configured to perform the methods described above.
  • the present application provides a computer-readable storage medium, wherein program code is stored in the computer-readable storage medium, wherein the above method is executed when the program code is running.
  • FIG. 1 shows a schematic diagram of an application scenario of a data acquisition method proposed in an embodiment of the present application
  • FIG. 2 shows a schematic diagram of another application scenario of a data acquisition method proposed in the embodiment of the present application
  • FIG. 3 shows a flow chart of a data acquisition method proposed in an embodiment of the present application
  • FIG. 4 shows a schematic diagram of service data stored by the server in the embodiment of the present application
  • FIG. 5 shows a flow chart of a data acquisition method proposed by another embodiment of the present application.
  • FIG. 6 shows a flow chart of a data acquisition method proposed in yet another embodiment of the present application.
  • FIG. 7 shows a flow chart of a data acquisition method proposed in another embodiment of the present application.
  • FIG. 8 shows a flow chart of a data acquisition method proposed in another embodiment of the present application.
  • FIG. 9 shows a flow chart of a data acquisition method proposed in another embodiment of the present application.
  • FIG. 10 shows a structural block diagram of a data acquisition device proposed in an embodiment of the present application.
  • Fig. 11 shows a structural block diagram of a data acquisition device proposed in another embodiment of the present application.
  • Fig. 12 shows a structural block diagram of an electronic device proposed by the present application
  • Fig. 13 is a storage unit for storing or carrying program codes for realizing the data acquisition method according to the embodiment of the present application according to the embodiment of the present application.
  • some electronic devices may be configured with a server, and the other electronic device may have a client that can establish a connection with the server.
  • the client first needs to obtain the service provided by the server.
  • GATT Generic Attribute Profile
  • the GATT client needs to initiate a service discovery process to the GATT server to discover the service data in the GATT server, so as to obtain the services that the GATT server can provide.
  • the inventor proposes a data acquisition method, device, electronic device and storage medium provided in the present application, which identifies the first service data specified in the server by obtaining from the wireless data corresponding to the server. After the identification, it is further determined whether the first service data obtained from the server based on the specified identification has been pre-stored locally, and if so, directly obtained from the server based on the specified identification. service data (second service data) other than the first service data, so that the second service data and the local first service data are used as the acquired service data of the server.
  • the client when the server distinguishes the service data into the first service data and the second service data, the client can obtain the first service data from the server in advance to store locally, and then make subsequent In the process of obtaining the service data corresponding to the server each time, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the need to obtain the second service data from the server during each service data acquisition process.
  • the amount of data for data acquisition in the server improves the efficiency of obtaining service data from the server.
  • an application scenario involved in the embodiment of the present application includes an electronic device 100 and an electronic device 200 .
  • the electronic device 100 runs a server
  • the electronic device 200 runs a client.
  • the client in the electronic device 200 may be a GATT client
  • the server in the electronic device 100 may be a GATT server.
  • the types of the first electronic device and the second electronic device shown in FIG. 1 are only exemplary.
  • the second electronic device can also be a wireless earphone 210 in addition to the smart phone shown in FIG. 1 .
  • the first electronic device can also be a tablet computer or a computer.
  • the second electronic device can also be devices such as smart bracelets and smart watches.
  • a data acquisition method provided by the embodiment of the present application is applied to the client, and the method includes:
  • S110 Obtain a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
  • the server can send wireless data after running.
  • the wireless data sent by the server is different at different stages.
  • the wireless data sent by the server may be broadcast data after the server starts running but before establishing a connection with the client.
  • the server may add the specified identifier to the broadcast data for sending.
  • the server is a GATT server and the client is a GATT client.
  • the GATT server After the GATT server is running, it can trigger the electronic device to send BLE (Bluetooh Low Energy) broadcast data.
  • the BLE broadcast data may carry a specified identifier. Then, after the electronic device where the GATT client is located scans the BLE broadcast data, the GATT client can extract the specified identifier from the BLE broadcast data.
  • the server may send wireless data based on the connection established with the client, then the wireless data sent after the connection is established may be wireless data carrying service information.
  • the business data may be data transmitted during the mutual business interaction between the client and the server.
  • the service data in the server can be understood as data related to the service provided by the server, or can be understood as data used to describe the provided service.
  • the service data may include a service (service name), a feature corresponding to the service, and a feature descriptor corresponding to the feature.
  • the feature can be used to describe the function of the corresponding service
  • the feature descriptor can be used to describe how the corresponding function is used and whether it is scalable.
  • the services, features, and feature descriptors included in the service data in the server are respectively identified. For example, in the GATT server, the service, feature, and feature descriptor each correspond to a handle as their respective identifiers.
  • the identifiers corresponding to the services, features, and feature descriptors are arranged in a certain order.
  • the server includes service 1 , service 2 and service 3 .
  • Service 1 corresponds to Feature 1
  • Feature 1 corresponds to Feature Descriptor 1.
  • Service 2 corresponds to Feature 2
  • Feature 2 corresponds to Feature Descriptor 2.
  • Service 3 corresponds to feature 3
  • feature 3 corresponds to feature descriptor 3.
  • the ID corresponding to service 1 is 0x0001, the ID corresponding to feature 1 is 0x0002, and the ID corresponding to feature descriptor 1 is 0x0003.
  • the ID corresponding to service 2 is 0x0004, the ID corresponding to feature 2 is 0x0005, and the ID corresponding to feature descriptor 2 is 0x0006.
  • the identifier corresponding to service 3 is 0x0007, the identifier corresponding to feature 3 is 0x0008, and the identifier corresponding to feature descriptor 3 is 0x0009.
  • the number of services included in the server shown in FIG. 4 is only exemplary, and the server may include fewer or more services than those shown in FIG. 4 .
  • Service 1 and Service 2 may be included, or services other than Service 1, Service 2, and Service 3 may be included.
  • the number of features corresponding to each service may not be limited to one as shown in FIG. 4 , for example, there may be multiple features corresponding to a service.
  • the style of the logo shown in FIG. 4 is only exemplary, and the logo in this embodiment of the present application may also have other styles.
  • the storage location of the service data at the server end may be directly used as the corresponding identifier.
  • the storage addresses in the server are sequentially sorted adjacently, so the storage address of the service data is used as an identifier, and the service data can still be sorted based on the storage address.
  • part of the service data may be fixed, and the part of the service data that is fixed may be classified based on their corresponding identifiers.
  • the service data may be divided into first service data and second service data by corresponding identifiers of the service data.
  • the first service data represents fixed service data
  • the second service data represents service data that may change.
  • the specified identifier may include a start identifier and an end identifier, wherein the start identifier is used to identify the start position of the first service data, and the end identifier is used to represent the end position of the first service data.
  • the determined first service data includes service 2, feature 2, feature descriptor 2, service 3, feature 3, and feature descriptor 3, then the corresponding The specified identifiers include 0x0004 and 0x0009, where 0x0004 is the start identifier and 0x0009 is the end identifier.
  • the first service data can be determined starting from the service data with the highest corresponding identifier among the service data included in the server, and the first service data is determined sequentially along the order of identifiers from small to large until the first detection of The service data is not constant, and the identifier of the previous service data that is detected for the first time as the service data that is not constant is used as the designated identifier.
  • the identifier 0x0001 corresponding to service 1 is the highest-ranked identifier
  • the fixed service data will be determined sequentially starting from 0x0001.
  • the first detected non-fixed service data is service 3
  • 0x0006 will be used as the specified identifier.
  • the fixed service data shown in the embodiment of the present application can be understood as service data that does not change within a specified time period on the device where the server is located.
  • the specified time period may be a life cycle of the device where the server is located, or a certain operation period of the device where the server is located.
  • the life cycle can be understood as the time when the device can be used. For example, if a device is used for two years, then the life cycle of the device is two years.
  • the operation period may be a period set by the user, for example, the user may set one week as one operation period, or one month as one operation period.
  • the client after the client obtains the specified identifier from the wireless data for the first time, it can determine which specific service data in the server are the first service data according to the specified identifier. Furthermore, the first service data is stored locally on the client.
  • each time the client obtains the specified identifier from the wireless data sent by the server it can first determine whether the first service data identified by the acquired specified identifier has been stored this time, and if it has already been stored, then The second service data can be directly obtained from the server based on the specified identifier.
  • the wireless data corresponding to the server after obtaining the specified identifier from the wireless data corresponding to the server, it further includes: if the first service data obtained from the server based on the specified identifier is not locally stored, then from the server Acquire the service data corresponding to the server; store the first service data in the service data corresponding to the server locally.
  • S130 Use the second service data and the local first service data as the acquired service data of the server.
  • the wireless data received by the client as shown in the foregoing content may be broadcast data, or it may be wireless data sent by the server received after establishing a connection with the server .
  • the purpose of establishing a connection between the client and the server is to discover the service data corresponding to the server, and then perform subsequent operations based on the obtained service data corresponding to the server. operate.
  • the client can combine the second service data with the first service data, and then use the combined service data as the acquired service data corresponding to the server. .
  • combining the second service data and the first service data may be understood as sorting the second service data and the first service data in a predetermined order. It can be understood that all service data in the server are arranged in a certain order. However, in this embodiment of the application, the client will separately store the first service data in the service data corresponding to the server locally, so that the first service data and the second service data may be obtained separately, then it can By uniformly sorting the second service data and the first service data in a predetermined order, the order of the service data finally acquired by the client is consistent with the original order in the server.
  • the predetermined order is the arrangement order of the service data in the server.
  • the data acquisition method After obtaining the designated identifier of the first service data in the identified server from the wireless data corresponding to the server, it is further determined whether the specified identifier based on the designated identifier has been pre-stored locally.
  • the first service data obtained by the server if any, directly obtain the service data (second service data) in the server other than the first service data (second service data) from the server based on the specified identifier, so that all The second service data and the local first service data are used as the acquired service data of the server.
  • the client when the server distinguishes the service data into the first service data and the second service data, the client can obtain the first service data from the server in advance to store locally, and then make subsequent In the process of obtaining the service data corresponding to the server each time, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the need to obtain the second service data from the server during each service data acquisition process.
  • the amount of data for data acquisition in the server improves the efficiency of obtaining service data from the server.
  • a data acquisition method provided by the embodiment of the present application is applied to the client, and the method includes:
  • S210 Acquire a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
  • S220 If the first service data previously obtained from the server based on the specified identifier is locally stored, determine a service data query range based on the specified identifier, and the service data query range is a range corresponding to the second service data.
  • the designated identifier is the last identifier in the designated identifier interval
  • the start identifier of the designated identifier interval is the first identifier in the server end
  • the designated identifier interval is the The interval where the identifier corresponding to the first service data is located
  • the determining the service data query range based on the specified identifier includes: taking the range where the identifiers sorted after the specified identifier is located as the service data query range. That is to say, in the case that the first service data is counted from the first identifier, the designated identifier is the last identifier among the identifiers corresponding to the service data included in the first service data.
  • the designated identifier is the largest identifier among the identifiers corresponding to the service data included in the first service data. For example, please refer to FIG. 4 again. In this manner, if the designated identifier is 0x0006, then the determined service data query range is from 0x0007 to the last identifier.
  • the client will use the range from the first identifier on the server to the start identifier, and the range after the end identifier as the service data query scope.
  • the client will use the range from the first identifier on the server to the start identifier, and the range after the end identifier as the service data query scope.
  • the start identifier is 0x0004 and the end identifier is 0x0006
  • the determined service data query range will include 0x0001 (the first identifier) to 0x0003, and include 0x0007 after the range.
  • S230 Trigger the server to search for service data based on the service data query range, so as to obtain the found second service data.
  • S240 Use the second service data and the local first service data as the acquired service data of the server.
  • the data acquisition method provided by this embodiment enables the client to obtain the first service data from the server in advance when the server distinguishes the service data into the first service data and the second service
  • the data is stored locally, so that in the subsequent process of obtaining the service data corresponding to the server, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the number of times
  • the amount of data that needs to be obtained from the server in the process of obtaining service data improves the efficiency of obtaining service data from the server.
  • the client can further determine the service data query range according to the specified identifier, so that the server can directly obtain the service data based on the service data query range determined by the client, further improving the efficiency.
  • a data acquisition method provided by the embodiment of the present application is applied to the client, and the method includes:
  • S310 Acquire a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
  • S320 Obtain the device identifier of the device where the server is located from the wireless data.
  • the device identifier is information used to identify the uniqueness of the device.
  • the device identification there may be multiple implementation manners for the device identification.
  • the device identification can be implemented through the network address corresponding to the device.
  • the network address of the device can be used as the device identifier of the device.
  • the device where the server is located sends wireless data through Bluetooth communication.
  • the wireless data sent based on the Bluetooth communication will carry the Bluetooth address of the device, and then the client can use the Bluetooth address carried in the wireless data as the device identifier of the device.
  • the Bluetooth address is a public address, so that the Bluetooth address of the device is fixed.
  • the device identifier can be a random number generated based on a specified protocol, and the random number generated each time can be different, so that the device identifiers corresponding to different devices can be unique.
  • the server sends wireless data every time, it can add the random number as the device identification to the wireless data sent, so that the client receiving the wireless data can know which server the current wireless data is from sent by the end.
  • the client can obtain the device identifier in a predetermined way.
  • the predetermined method configured by the client is to obtain the network address carried in the wireless data as the device identifier, then after the client obtains the wireless data sent by the server, it can directly perform The extraction of the network address is used as the device identification of the device where the server is located.
  • the predetermined method configured by the client is to obtain the random number carried in the wireless data as the device identification, then after the client obtains the wireless data sent by the server, it can directly perform The extraction of the random number is used as the device identification of the device where the server is located.
  • the client may also acquire the device identifier in an adaptive manner.
  • the server may adopt different identification methods. For example, although the wireless data sent by the device may carry a network address, some devices use a random network address (random network address), which may make the network addresses of different devices the same. In this case, there is no way for the network address to uniquely identify the device.
  • random network address random network address
  • the client can first detect the type of network address used in the wireless data; if it detects that the network address is a fixed type of network address, it will directly use the obtained network address as the sending The device identification of the device for the wireless data; if it is detected that the network address is a random type of network address, then further detect whether the wireless data carries a random number generated based on a specified protocol; if a random number generated based on a specified protocol is detected , then use the random number generated based on the specified protocol as the device identifier of the device sending the wireless data. If no random number generated based on the specified protocol is detected, all service data is directly obtained from the server as service data corresponding to the server.
  • the client may store the device identifier and the first service data correspondingly.
  • the client when storing the first service data, may store the device identifier and the first service data correspondingly. Then, the client detects whether the service data corresponding to the device identifier is stored locally. It can actually be understood that the client determines whether there is the first service data obtained from the server locally. Moreover, the first service data is service data identified by a specified identifier in the wireless data where the device identifier is located.
  • S350 If the service data corresponding to the device identifier is stored locally, determine that the first service data previously obtained from the server based on the specified identifier is stored locally.
  • S370 Use the second service data and the local first service data as the acquired service data of the server.
  • the data acquisition method provided by this embodiment enables the client to obtain the first service data from the server in advance when the server distinguishes the service data into the first service data and the second service
  • the data is stored locally, so that in the subsequent process of obtaining the service data corresponding to the server, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the number of times
  • the amount of data that needs to be obtained from the server in the process of obtaining service data improves the efficiency of obtaining service data from the server.
  • the first service data and the device identifier of the device where the server is located will be stored correspondingly, so that when it is determined that the service data corresponding to the device identifier is stored , it can be directly determined that the first service data of the server is stored.
  • a data acquisition method provided by the embodiment of the present application is applied to the client, and the method includes:
  • S410 Obtain a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
  • S420 Check whether the designated identifier acquired from the wireless data is consistent with the designated identifier stored locally.
  • the first service data and the second service data are distinguished by a designated identifier in the server. Then, after the client acquires the first service data from the server based on the specified identifier in the wireless data for the first time, it can store the specified identifier based on which the first service data is obtained and the acquired first service data correspondingly locally. Then it means that the first service data stored locally corresponds to the designated identifier. Then the client can check whether the specified identifier currently obtained from the wireless data is consistent with the specified identifier stored locally after each time the specified identifier is obtained from the wireless data sent by the server. If they are consistent, it indicates that the server The first service data is still unchanged, and then the client can determine that the first service data obtained from the server based on the specified identifier currently obtained from the wireless data has actually been stored locally.
  • the client can determine the specified identifier obtained from wireless data and the locally stored The specified identifiers are consistent. If the designated identifier currently obtained from the wireless data is identifier 2, and the designated identifier obtained locally by the client is also identifier 2, then the client can determine that the designated identifier obtained from the wireless data and the designated identifier stored locally are inconsistent.
  • the client may have established connections with various servers, and the designated identifiers corresponding to different servers may be the same. Then in this way, the client can store the specified identifier and the device identifier (the device identifier of the device where the server is located) correspondingly, so as to distinguish the specified identifiers corresponding to different servers.
  • the specified identifier stored locally by the client may be as shown in the following table.
  • the client can query the data in which the specified identifier is identifier 2 and the device identifier is device 2 in the specified identifier stored locally (that is, the data corresponding to the ID being 2), the client determines that the specified identifier obtained from the wireless data is consistent with the specified identifier stored locally. If the specified identifier currently obtained from the wireless data is identifier 2 and the device identifier is device 1, it is determined that the specified identifier obtained from the wireless data is not consistent with the specified identifier stored locally.
  • the server in device 1 it can be further determined that the first service data corresponding to the server in device 1 has actually changed, so that the specified identifier used to identify the first service data has also changed, and, after determining that the server In the case that the corresponding first service data has actually changed, all the service data corresponding to the server needs to be reacquired from the server.
  • S460 If the first service data previously obtained from the server based on the specified identifier is locally stored, acquire second service data from the server based on the specified identifier, and the second service data is the Service data other than the first service data in the server.
  • S470 Use the second service data and the local first service data as the acquired service data of the server.
  • the data acquisition method provided by this embodiment enables the client to obtain the first service data from the server in advance when the server distinguishes the service data into the first service data and the second service
  • the data is stored locally, so that in the subsequent process of obtaining the service data corresponding to the server, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the number of times
  • the amount of data that needs to be obtained from the server in the process of obtaining service data improves the efficiency of obtaining service data from the server.
  • the specified identifier on which the first service data is obtained will also be stored locally, so that in the subsequent process of obtaining the service data corresponding to the server Among them, whether the first service data is pre-stored locally can be quickly determined by detecting whether the specified identifier obtained from the wireless data is stored locally, which is beneficial to improving the efficiency of obtaining service data.
  • a data acquisition method provided by the embodiment of the present application is applied to the server, and the method includes:
  • S510 Send wireless data carrying a specified identifier, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
  • the wireless data is broadcast data
  • the sending the wireless data carrying the specified identifier includes: sending the broadcast data carrying the specified identifier.
  • S520 Obtain second service data from the server in response to an acquisition request sent by the client and corresponding to the specified identifier, where the acquisition request is determined locally stored by the client in advance based on the specified identifier.
  • the first service data obtained from the server is sent later.
  • S530 Send the second service data to the client, so that the client uses the second service data and the local first service data as the acquired service data of the server.
  • the obtaining the second service data from the server in response to the obtaining request sent by the client corresponding to the specified identifier includes: responding to the obtaining request corresponding to the specified identifier sent by the client request, obtaining the service data query range from the acquisition request, and querying the service data corresponding to the service data query range as the second service data in the server.
  • the server adds the specified identifier used to identify the first service data in the server to the wireless data sent, so that the client can pass the data sent by the server.
  • the wireless data obtained by the designated identifier so that in the case that the client pre-stores the first service data obtained based on the designated identifier, it can only obtain the service data from the server in the process of obtaining the entire service data of the server.
  • the second service data is enough. This further reduces the amount of data that needs to be acquired from the server in each service data acquisition process, and improves the efficiency of acquiring service data from the server.
  • the client before the client obtains the specified identifier from the wireless data corresponding to the server, the client can first detect whether a credit relationship has been established with the server that transmits the wireless data. After establishing a credit relationship, you can directly acquire services in the server according to the service acquisition method corresponding to the established credit relationship. If the credit relationship is not established, the subsequent acquisition of the specified identifier from the corresponding wireless data of the server may be performed. Wherein, if a trust relationship has been established between the client and the server, it means that identity authentication has been performed between the client and the server.
  • the process shown in Figure 9 includes:
  • the GATT client obtains the broadcast data sent by the GATT server, and obtains a specified identifier from it.
  • S620 The GATT client establishes a connection with the GATT server.
  • S630 The GATT client detects whether it is the first time to establish a connection with the server.
  • the GATT client may have multiple ways to detect whether it is the first time to establish a connection with the server.
  • the method of detecting whether the service data corresponding to the device identifier of the device where the GATT server is located can be detected locally in the foregoing embodiments.
  • the service data corresponding to the device identifier is stored locally, it is determined that it is not the first A connection, otherwise, if the service data corresponding to the device identification is not stored locally, it is determined to be the first connection.
  • the specified identifier obtained from the broadcast data is consistent with the specified identifier stored locally, Then it is determined that it is not the first connection. On the contrary, if it is detected that the specified identifier obtained from the broadcast data is consistent with the specified identifier stored locally, or if the specified identifier has not been stored locally, it is determined that it is the first connection.
  • the service data in the server may be arranged in a certain order. For example, as shown in FIG. 4 , the service data whose corresponding identifier is 0x0001 is the first service data among all the service data of the server. Then, when the GATT client determines that it is the first time to establish a connection with the GATT server, it will trigger to start searching for services from the service data identified as 0x0001 in the GATT server.
  • S641 The GATT client locally stores the first service data among the searched service data.
  • the GATT client When the GATT client determines that it is the first time to establish a connection with the GATT server, the GATT client will actually search all the service data in the GATT server to find all the services in the GATT server data. then for convenience
  • the GATT client triggers a service search starting from the first service data after the specified identifier, so as to obtain the second service data.
  • the designated identifier represents the identifier corresponding to the last service data in the manner of performing fixed data detection starting from the first service data. It can also be understood that the specified identifier is an identifier with the largest corresponding identifier in the fixed service data.
  • the ordering of the service data is equivalent to the ordering of the identifiers corresponding to the service data. For example, please refer to Figure 4, if the fixed service data is determined starting from 0x0001, and the determined fixed service data includes service 1, feature 1, feature descriptor 1, service 2, feature 2, and feature description character 2.
  • the one with the largest corresponding identifier is 0x0006, and the determined specified identifier is 0x0006.
  • the first service data stored locally will include service 1, feature 1, feature descriptor 1, service 2, feature 2, and feature descriptor 2 .
  • the service data search will start from 0x0007.
  • processing manner after obtaining the first service data and the second service data can refer to the contents in the foregoing embodiments.
  • a data acquisition device 600 provided by the embodiment of the present application runs on a client, and the device 600 includes:
  • An identifier acquiring unit 610 configured to acquire a specified identifier from the wireless data corresponding to the server, the specified identifier is used to identify the first service data in the server, and the first service data is fixed service data .
  • the identifier acquiring unit 610 is specifically configured to acquire a specified identifier from broadcast data corresponding to the server.
  • the first data acquiring unit 620 is configured to acquire second service data from the server based on the specified identifier if the first service data previously acquired from the server based on the specified identifier is locally stored, the The second service data is service data in the server other than the first service data.
  • the second data acquiring unit 630 is configured to use the second service data and the local first service data as the acquired service data of the server.
  • the first data acquisition unit 620 is specifically configured to determine the service data query range based on the specified identifier if the first service data previously acquired from the server based on the specified identifier is locally stored, and the The service data query range is the range corresponding to the second service data; the server is triggered to search for service data based on the service data query range, so as to obtain the found second service data.
  • the specified identifier is the last identifier in the specified identifier interval
  • the start identifier of the specified identifier interval is the first identifier in the server end
  • the specified The identification interval is the interval where the identification corresponding to the first service data is located
  • the first data acquisition unit 620 is specifically configured to use the range of identifications sorted after the specified identification as the service data query range.
  • the first data obtaining unit 620 is specifically configured to obtain the device identifier of the device where the server is located from the wireless data; if the service data corresponding to the device identifier is locally stored, then it is determined that the local First service data acquired from the server based on the specified identifier. As one manner, the first data acquisition unit 620 is specifically configured to compare whether the specified identifier acquired from the wireless data is consistent with the specified identifier stored locally; The first service data obtained from the server.
  • the second data obtaining unit 630 is further configured to obtain the specified identifier from the wireless data corresponding to the server, if the first service data obtained from the server based on the specified identifier is not stored locally, then from the server Acquire the service data corresponding to the server; store the first service data in the service data corresponding to the server locally.
  • a data acquisition device 700 provided by the embodiment of the present application runs on the server side, and the device 700 includes:
  • the identification sending unit 710 is configured to send wireless data carrying a specified identification, the specified identification is used to identify the first service data in the server, and the first service data is fixed service data.
  • the identification sending unit 710 is specifically configured to send broadcast data carrying a designated identification.
  • the data search unit 720 is configured to obtain the second service data from the server in response to the obtaining request sent by the client and corresponding to the specified identifier, where the obtaining request is determined locally stored by the client. Sending after the first service data obtained from the server based on the specified identifier.
  • a data sending unit 730 configured to send the second service data to the client, so that the client uses the second service data and local first service data as the obtained service terminal service data.
  • the data search unit 720 is specifically configured to respond to the acquisition request sent by the client and corresponding to the specified identifier, obtain the service data query range from the acquisition request, and query the service data in the server.
  • the service data corresponding to the service data query range is used as the second service data.
  • the data acquisition device provided by this embodiment enables the client to obtain the first service data from the server in advance when the server distinguishes the service data into the first
  • the service data is stored locally, so that in the subsequent process of obtaining the service data corresponding to the server, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the cost of each service.
  • the amount of data that needs to be obtained from the server in the process of obtaining service data for each service improves the efficiency of obtaining service data from the server.
  • each functional module in each embodiment of the present application may be integrated into one processing module, each module may exist separately physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules.
  • the electronic device 100 includes one or more (only one is shown in the figure) processors 102 , a memory 104 and a wireless module 106 coupled to each other.
  • the memory 104 stores programs capable of executing the contents of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104 .
  • the processor 102 may include one or more processing cores.
  • the processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes or executes instructions, programs, code sets or instruction sets stored in the memory 104, and calls data stored in the memory 104 to execute Various functions of the electronic device 100 and processing data.
  • the processor 102 may adopt at least one of Digital Signal Processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). implemented in the form of hardware.
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 102 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), a modem, and the like.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • the CPU mainly handles the operating system, user interface and application programs, etc.
  • the GPU is used to render and draw the displayed content
  • the modem is used to handle wireless communication. It can be understood that the above modem may also not be integrated into the processor 102, but implemented by a communication chip alone.
  • the memory 104 may include random access memory (Random Access Memory, RAM), and may also include read-only memory (Read-Only Memory). Memory 104 may be used to store instructions, programs, codes, sets of codes, or sets of instructions.
  • a data acquisition device may be stored in the memory 104 .
  • the data acquisition device may be the aforementioned device 600 or device 700 .
  • the memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, and the like.
  • the storage data area can also store data created by the terminal 100 during use (such as phonebook, audio and video data, chat record data) and the like.
  • the wireless module 106 is used to receive and send electromagnetic waves, realize mutual conversion between electromagnetic waves and electrical signals, and communicate with communication networks or other devices, such as audio playback devices.
  • the wireless module 106 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption/decryption chips, Subscriber Identity Module (SIM) cards, memory, etc. .
  • SIM Subscriber Identity Module
  • the wireless module 106 can communicate with various networks such as the Internet, intranet, wireless network or communicate with other devices through the wireless network.
  • the wireless network mentioned above may include a cellular telephone network, a wireless local area network or a metropolitan area network.
  • the wireless module 106 can perform information exchange with the base station.
  • FIG. 13 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • Program codes are stored in the computer-readable medium 1100, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
  • the computer readable storage medium 1100 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 1100 includes a non-transitory computer-readable storage medium (non-transitory computer-readable storage medium).
  • the computer-readable storage medium 1100 has a storage space for program code 1110 for executing any method steps in the above methods. These program codes can be read from or written into one or more computer program products.
  • Program code 1110 may, for example, be compressed in a suitable form.
  • the data acquisition method, device, electronic equipment and storage medium provided by this application further determine the local Whether the first service data obtained from the server based on the specified identifier has been pre-stored, and if so, directly obtain from the server based on the specified identifier the first service data in the server other than the first service data Service data (second service data), using the second service data and the local first service data as the acquired service data of the server.
  • the client when the server distinguishes the service data into the first service data and the second service data, the client can obtain the first service data from the server in advance to store locally, and then make subsequent In the process of obtaining the service data corresponding to the server each time, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the need to obtain the second service data from the server during each service data acquisition process.
  • the amount of data for data acquisition in the server improves the efficiency of obtaining service data from the server.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

Disclosed in embodiments of the present application are a data acquisition method and apparatus, an electronic device, and a storage medium. The method comprises: obtaining a specified identifier from corresponding wireless data of a server, the specified identifier being used for identifying first service data in the server, and the first service data being fixed service data; if the first service data obtained from the server in advance on the basis of the specified identifier is stored locally, obtaining second service data from the server on the basis of the specified identifier; and using the second service data and the local first service data as the obtained service data of the server. In this way, a client can obtain the first service data from the server in advance to store same locally, such that in the subsequent process of obtaining corresponding service data from the server, the second service data can be obtained only by means of the specified identifier in corresponding wireless data of the server, thereby improving the efficiency of obtaining service data from the server.

Description

数据获取方法、装置、电子设备及存储介质Data acquisition method, device, electronic device and storage medium
相关申请的交叉引用Cross References to Related Applications
本申请要求于2021年8月20日提交的申请号为202110963349.5的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。This application claims priority to Chinese application No. 202110963349.5 filed on August 20, 2021, which is hereby incorporated by reference in its entirety for all purposes.
技术领域technical field
本申请涉及通信技术领域,更具体地,涉及一种数据获取方法、装置、电子设备及存储介质。The present application relates to the technical field of communications, and more specifically, to a data acquisition method, device, electronic device, and storage medium.
背景技术Background technique
在一些场景中,客户端在使用服务端中所提供的服务之前,需要先获取到服务端中所提供的服务。例如,在基于GATT(Generic Attribute Profile)协议的通信中,GATT客户端需要向GATT服务端发起服务发现流程来发现GATT服务端中的服务数据。但是,在相关的服务数据获取方式中的还存在效率有待提升的问题。In some scenarios, the client needs to obtain the services provided by the server before using the services provided by the server. For example, in communication based on the GATT (Generic Attribute Profile) protocol, the GATT client needs to initiate a service discovery process to the GATT server to discover service data in the GATT server. However, there is still a problem that the efficiency needs to be improved in the related service data acquisition method.
发明内容Contents of the invention
鉴于上述问题,本申请提出了一种数据获取方法、装置、电子设备及存储介质,以实现改善上述问题。In view of the above problems, the present application proposes a data acquisition method, device, electronic device, and storage medium, so as to improve the above problems.
第一方面,本申请提供了一种数据获取方法,应用于客户端,所述方法包括:从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据;若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,所述第二服务数据为所述服务端中除所述第一服务数据以外的服务数据;将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。In a first aspect, the present application provides a method for obtaining data, which is applied to a client, and the method includes: obtaining a specified identifier from the wireless data corresponding to the server, and the specified identifier is used to identify the first One service data, the first service data is fixed service data; if the first service data previously obtained from the server based on the designated identifier is stored locally, the first service data obtained from the server based on the designated identifier Obtain the second service data in the server, the second service data is the service data in the server other than the first service data; use the second service data and the local first service data as the acquired The service data of the server.
第二方面,本申请提供了一种数据获取方法,应用于服务端,所述方法包括:发送携带有指定标识的无线数据,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据;响应于客户端发送的与所述指定标识对应的获取请求,从所述服务端中获取第二服务数据,所述获取请求为所述客户端在确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据后发送;将所述第二服务数据发送给所述客户端,以用于使所述客户端将所述第二服务数据和本地的第一服务数据作为获取到的所述服务端的服务数据。In a second aspect, the present application provides a data acquisition method applied to a server, the method comprising: sending wireless data carrying a specified identifier, the specified identifier is used to identify the first service data in the server , the first service data is fixed service data; in response to the acquisition request sent by the client corresponding to the specified identifier, the second service data is acquired from the server, and the acquisition request is the After the client determines that the first service data previously obtained from the server based on the specified identifier is locally stored, the client sends the second service data to the client, so that the client will The second service data and the local first service data are used as the acquired service data of the server.
第三方面,本申请提供了一种数据获取装置,运行于客户端,所述装置包括:标识获取单元,用于从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据;第一数据获取单元,用于若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,所述第二服务数据为所述服务端中除所述第一服务数据以外的服务数据;第二数据获取单元,用于将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。In a third aspect, the present application provides a data acquisition device, which runs on a client, and the device includes: an identification acquisition unit, configured to acquire a designated identification from the wireless data corresponding to the server, and the designated identification is used to identify the The first service data in the server end, the first service data is fixed service data; the first data acquisition unit is configured to locally store the first service data acquired from the server based on the specified identifier in advance A service data, obtaining second service data from the server based on the specified identifier, the second service data being service data other than the first service data in the server; a second data acquisition unit , used to use the second service data and the local first service data as the acquired service data of the server.
第四方面,本申请提供了一种数据获取装置,运行于服务端,所述装置包括:标识发送单元,用于发送携带有指定标识的无线数据,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据;数据查找单元,用于响应于客户端发送的与所述指定标识对应的获取请求,从所述服务端中获取第二服务数据,所述获取请求为所述客户端在确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据后发送;数据发送单元,用于将所述第二服务数据发送给所述客户端,以用于使所述客户端将所述第二服务数据和本地的第一服务数据作为获取到的所述服务端的服务数据。In a fourth aspect, the present application provides a data acquisition device that runs on a server, the device includes: an identification sending unit, configured to send wireless data carrying a specified identification, and the specified identification is used to identify the server In the first service data, the first service data is fixed service data; the data search unit is configured to obtain from the server in response to the acquisition request sent by the client and corresponding to the specified identifier For the second service data, the acquisition request is sent by the client after determining that the first service data previously obtained from the server based on the specified identifier is locally stored; the data sending unit is configured to send the second service data The service data is sent to the client, so that the client uses the second service data and the local first service data as the acquired service data of the server.
第五方面,本申请提供了一种电子设备,包括一个或多个处理器以及存储器;一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执 行上述的方法。In a fifth aspect, the present application provides an electronic device, including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, The one or more programs are configured to perform the methods described above.
第六方面,本申请提供的一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码运行时执行上述的方法。In a sixth aspect, the present application provides a computer-readable storage medium, wherein program code is stored in the computer-readable storage medium, wherein the above method is executed when the program code is running.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the 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 any creative effort.
图1示出了本申请实施例提出的数据获取方法的一种应用场景的示意图;FIG. 1 shows a schematic diagram of an application scenario of a data acquisition method proposed in an embodiment of the present application;
图2示出了本申请实施例提出的一种数据获取方法的另一种应用场景的示意图;FIG. 2 shows a schematic diagram of another application scenario of a data acquisition method proposed in the embodiment of the present application;
图3示出了本申请实施例提出的一种数据获取方法的流程图;FIG. 3 shows a flow chart of a data acquisition method proposed in an embodiment of the present application;
图4示出了本申请实施例中服务端所存储的服务数据的示意图;FIG. 4 shows a schematic diagram of service data stored by the server in the embodiment of the present application;
图5示出了本申请另一实施例提出的一种数据获取方法的流程图;FIG. 5 shows a flow chart of a data acquisition method proposed by another embodiment of the present application;
图6示出了本申请再一实施例提出的一种数据获取方法的流程图;FIG. 6 shows a flow chart of a data acquisition method proposed in yet another embodiment of the present application;
图7示出了本申请又一实施例提出的一种数据获取方法的流程图;FIG. 7 shows a flow chart of a data acquisition method proposed in another embodiment of the present application;
图8示出了本申请又一实施例提出的一种数据获取方法的流程图;FIG. 8 shows a flow chart of a data acquisition method proposed in another embodiment of the present application;
图9示出了本申请又一实施例提出的一种数据获取方法的流程图;FIG. 9 shows a flow chart of a data acquisition method proposed in another embodiment of the present application;
图10示出了本申请实施例提出的一种数据获取装置的结构框图;FIG. 10 shows a structural block diagram of a data acquisition device proposed in an embodiment of the present application;
图11示出了本申请又一实施例提出的一种数据获取装置的结构框图;Fig. 11 shows a structural block diagram of a data acquisition device proposed in another embodiment of the present application;
图12示出了本申请提出的一种电子设备的结构框图;Fig. 12 shows a structural block diagram of an electronic device proposed by the present application;
图13是本申请实施例的用于保存或者携带实现根据本申请实施例的数据获取方法的程序代码的存储单元。Fig. 13 is a storage unit for storing or carrying program codes for realizing the data acquisition method according to the embodiment of the present application according to the embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
通常一些电子设备为了向另外的电子设备提供服务,在电子设备中可以配置有服务端,而在该另外的电子设备中则建立有可以与该服务端建立连接的客户端。其中,在客户端使用服务端中所提供的服务之前,客户端需要先获取到服务端中所提供的服务。例如,在基于GATT(Generic Attribute Profile)协议的通信中,GATT客户端需要向GATT服务端发起服务发现流程来发现GATT服务端中的服务数据,以实现获取到GATT服务端所能提供的服务。Generally, in order to provide services to other electronic devices, some electronic devices may be configured with a server, and the other electronic device may have a client that can establish a connection with the server. Wherein, before the client uses the service provided by the server, the client first needs to obtain the service provided by the server. For example, in communication based on the GATT (Generic Attribute Profile) protocol, the GATT client needs to initiate a service discovery process to the GATT server to discover the service data in the GATT server, so as to obtain the services that the GATT server can provide.
但是,发明人在研究中发现,在相关的服务数据获取方式中的还存在效率有待提升的问题。例如,发明人发现,若客户端在与服务端建立连接后,客户端检测到与所建立连接的服务端之间未建立授信关系,则客户端会发起服务数据发现流程以获取服务端中所有的服务数据。也就是说,在没有建立授信关系的情况下,在每次的服务数据获取过程中,客户端会将服务端中所有的服务数据均获取一遍,进而就造成服务数据的获取流程耗时较长,进而影响效率。However, the inventor found in the research that there is still a problem that the efficiency needs to be improved in the related service data acquisition method. For example, the inventors found that after the client establishes a connection with the server, if the client detects that no credit relationship has been established with the established server, the client will initiate a service data discovery process to obtain all service data. That is to say, in the absence of a credit relationship, the client will acquire all the service data from the server once during each service data acquisition process, which will result in a long time-consuming service data acquisition process. , thereby affecting the efficiency.
因此,为了改善上述问题,发明人提出了本申请所提供的一种数据获取方法、装置、电子设备及存储介质,通过从服务端对应的无线数据中获取标识服务端中的第一服务数据指定标识后,进一步的确定本地是否已经预先存储有基于所述指定标识从所述服务端获取的第一服务数据,若有则直接基于所述指定标识从所述服务端中获取服务端中除所述第一服务数据以外的服务数据(第二服务数据),以将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。Therefore, in order to improve the above problems, the inventor proposes a data acquisition method, device, electronic device and storage medium provided in the present application, which identifies the first service data specified in the server by obtaining from the wireless data corresponding to the server. After the identification, it is further determined whether the first service data obtained from the server based on the specified identification has been pre-stored locally, and if so, directly obtained from the server based on the specified identification. service data (second service data) other than the first service data, so that the second service data and the local first service data are used as the acquired service data of the server.
从而通过上述方式使得在服务端将服务数据区分为第一服务数据以及第二服务数据的情况下,使得客户端可以预先通过从服务端中获取第一服务数据以存储在本地,继而使得在后续每次需要获取服务端对应的服务数据的过程中,可以只用通过服务端对应的无线数据中的指定标识去获取第二服务数据,进而减少了每次服务数据的获取过程中需要从服务端中进行数据获取的数据量,提升了从服务端获取服务数据的效率。Therefore, through the above method, when the server distinguishes the service data into the first service data and the second service data, the client can obtain the first service data from the server in advance to store locally, and then make subsequent In the process of obtaining the service data corresponding to the server each time, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the need to obtain the second service data from the server during each service data acquisition process. The amount of data for data acquisition in the server improves the efficiency of obtaining service data from the server.
下面先对本申请实施例所涉及的一种应用场景进行介绍。An application scenario involved in the embodiment of the present application is firstly introduced below.
如图1所示,本申请实施例所涉及的一种应用场景中包括有电子设备100和电子设备200。其中,电子设备100中运行有服务端,电子设备200中运行有客户端。其中,电子设备200中的客户端可以为GATT客户端,对应的,电子设备100中的服务端可以为GATT服务端。As shown in FIG. 1 , an application scenario involved in the embodiment of the present application includes an electronic device 100 and an electronic device 200 . Wherein, the electronic device 100 runs a server, and the electronic device 200 runs a client. Wherein, the client in the electronic device 200 may be a GATT client, and correspondingly, the server in the electronic device 100 may be a GATT server.
再者,图1中所示第一电子设备和第二电子设备的类型只是示例性的。例如,如图2所示,第二电子设备除了可以为图1中所示的智能手机外还可以为无线耳机210。再者,第一电子设备除了可以为图1中所示的智能手机外,还可以为平板电脑以及计算机等设备。再者,第二电子设备除了可以为图1、图2中所示的设备外,还可以为智能手环、智能手表等设备。Furthermore, the types of the first electronic device and the second electronic device shown in FIG. 1 are only exemplary. For example, as shown in FIG. 2 , the second electronic device can also be a wireless earphone 210 in addition to the smart phone shown in FIG. 1 . Furthermore, in addition to the smart phone shown in FIG. 1 , the first electronic device can also be a tablet computer or a computer. Furthermore, besides the devices shown in FIG. 1 and FIG. 2 , the second electronic device can also be devices such as smart bracelets and smart watches.
下面将结合附图具体描述本申请的各实施例。Various embodiments of the present application will be described in detail below with reference to the accompanying drawings.
请参阅图3,本申请实施例提供的一种数据获取方法,应用于客户端,所述方法包括:Please refer to Figure 3, a data acquisition method provided by the embodiment of the present application is applied to the client, and the method includes:
S110:从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据。S110: Obtain a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
其中,服务端在运行之后可以进行无线数据的发送。并且,在不同的阶段服务端所发送的无线数据是不同的。其中,服务端在开始运行之后,在还没有与客户端建立连接之前,服务端所发送的无线数据可以为广播数据。对应的,若服务端发送的为广播数据,则服务端可以将指定标识添加到广播数据中进行发送。例如,以服务端为GATT服务端,客户端为GATT客户端为例。GATT服务端在运行后,可以触发所在电子设备发送BLE(Bluetooh Low Energy)广播数据。并且,在该BLE广播数据中可以携带有指定标识。那么GATT客户端所在电子设备扫描到该BLE广播数据后,则GATT客户端可以从该BLE广播数据中提取出指定标识。Wherein, the server can send wireless data after running. Moreover, the wireless data sent by the server is different at different stages. Wherein, the wireless data sent by the server may be broadcast data after the server starts running but before establishing a connection with the client. Correspondingly, if the server sends broadcast data, the server may add the specified identifier to the broadcast data for sending. For example, it is assumed that the server is a GATT server and the client is a GATT client. After the GATT server is running, it can trigger the electronic device to send BLE (Bluetooh Low Energy) broadcast data. In addition, the BLE broadcast data may carry a specified identifier. Then, after the electronic device where the GATT client is located scans the BLE broadcast data, the GATT client can extract the specified identifier from the BLE broadcast data.
再者,在客户端与服务端建立连接之后,服务端可以基于与客户端所建立的连接发送无线数据,那么在建立该连接后所发送的无线数据则可以为携带业务信息的无线数据。其中,业务数据可以为客户端和服务端之间互相进行业务交互的过程中所传输的数据。Furthermore, after the client establishes a connection with the server, the server may send wireless data based on the connection established with the client, then the wireless data sent after the connection is established may be wireless data carrying service information. Wherein, the business data may be data transmitted during the mutual business interaction between the client and the server.
其中,需要说明的是,服务端中的服务数据可以理解为与服务端所提供的服务有关的数据,或者可以理解为用于对所提供的服务进行描述的数据。可选的,服务数据可以包括有服务(服务的名称),该服务所对应的特征以及特征所对应的特征描述符。其中,特征可以用于描述所对应的服务所具有的功能,而特征描述符则可以用于描述所对应功能如何使用以及是否具有可扩展性等。在服务端中服务数据所包括的服务、特征以及特征描述符各自对应有标识。例如,在GATT服务端中,服务、特征以及特征描述符各自对应有handle来作为各自的标识。并且,在一些情况下,服务、特征以及特征描述符各自所对应的标识是按照一定的顺序排列的。示例性的,如图4所示,服务端中包括有服务1、服务2以及服务3。其中,服务1对应有特征1,特征1对应有特征描述符1。服务2对应有特征2,特征2对应有特征描述符2。服务3对应有特征3,特征3对应有特征描述符3。服务1对应的标识为0x0001,特征1对应的标识为0x0002,特征描述符1对应的标识为0x0003。服务2对应的标识为0x0004,特征2对应的标识为0x0005,特征描述符2对应的标识为0x0006。服务3对应的标识为0x0007,特征3对应的标识为0x0008,特征描述符3对应的标识为0x0009。Wherein, it should be noted that the service data in the server can be understood as data related to the service provided by the server, or can be understood as data used to describe the provided service. Optionally, the service data may include a service (service name), a feature corresponding to the service, and a feature descriptor corresponding to the feature. Among them, the feature can be used to describe the function of the corresponding service, and the feature descriptor can be used to describe how the corresponding function is used and whether it is scalable. The services, features, and feature descriptors included in the service data in the server are respectively identified. For example, in the GATT server, the service, feature, and feature descriptor each correspond to a handle as their respective identifiers. Moreover, in some cases, the identifiers corresponding to the services, features, and feature descriptors are arranged in a certain order. Exemplarily, as shown in FIG. 4 , the server includes service 1 , service 2 and service 3 . Wherein, Service 1 corresponds to Feature 1, and Feature 1 corresponds to Feature Descriptor 1. Service 2 corresponds to Feature 2, and Feature 2 corresponds to Feature Descriptor 2. Service 3 corresponds to feature 3, and feature 3 corresponds to feature descriptor 3. The ID corresponding to service 1 is 0x0001, the ID corresponding to feature 1 is 0x0002, and the ID corresponding to feature descriptor 1 is 0x0003. The ID corresponding to service 2 is 0x0004, the ID corresponding to feature 2 is 0x0005, and the ID corresponding to feature descriptor 2 is 0x0006. The identifier corresponding to service 3 is 0x0007, the identifier corresponding to feature 3 is 0x0008, and the identifier corresponding to feature descriptor 3 is 0x0009.
需要说明的是,图4中所示的服务端中所包括的服务的数量只是示例性的,在服务端中可以包括有比图4中所示的服务更少或者更多的服务。例如,可以仅包括服务1和服务2,也可以包括服务1、服务2以及服务3以外的服务。类似的,对于每个服务所对应的特征的数量也可以不仅仅限于图4中所示的1个,例如,服务所对应的特征可以有多个。再者,图4中所示的标识的样式也只是示例性的,本申请实施例的标识也可以有其他的样式。例如,可以直接将服务数据在服务端的存储位置作为对应的标识。需要说明的是,作为一种方式,在服务端中的存储地址是依次相邻排序的,那么将服务数据的存储地址作为标识,依然可以实现基于存储地址对服务数据进行排序。It should be noted that the number of services included in the server shown in FIG. 4 is only exemplary, and the server may include fewer or more services than those shown in FIG. 4 . For example, only Service 1 and Service 2 may be included, or services other than Service 1, Service 2, and Service 3 may be included. Similarly, the number of features corresponding to each service may not be limited to one as shown in FIG. 4 , for example, there may be multiple features corresponding to a service. Furthermore, the style of the logo shown in FIG. 4 is only exemplary, and the logo in this embodiment of the present application may also have other styles. For example, the storage location of the service data at the server end may be directly used as the corresponding identifier. It should be noted that, as a method, the storage addresses in the server are sequentially sorted adjacently, so the storage address of the service data is used as an identifier, and the service data can still be sorted based on the storage address.
其中,在服务端中所包括的服务数据中,部分服务数据可能固定不变的,对于固定不变的这部分服务数据,则可以基于其所对应的标识划分出来。例如,可以通过服务数据对应标识,将服务数据划分为第一服务数据和第二服务数据。其中,第一服务数据则表征固定不变的服务数据,第二服务数据则表征可能会进行变化的服务数据。Among the service data included in the server, part of the service data may be fixed, and the part of the service data that is fixed may be classified based on their corresponding identifiers. For example, the service data may be divided into first service data and second service data by corresponding identifiers of the service data. Wherein, the first service data represents fixed service data, and the second service data represents service data that may change.
可选的,指定标识可以包括有开始标识和截止标识,其中,开始标识用于标识第一服务数据的开始位置,而截止标识则用于表征第一服务数据的结束位置。如图4中所示,基于图4中所示的情况下,若确定的第一服务数据包括服务2、特征2、特征描述符2、服务3、特征3以及特征描述符3,那么所对应的指定标识则包括0x0004以及0x0009,其中,0x0004为开始标识,0x0009为截止标识。可选的,可以从服务端包括的服务数据中,所对应的标识排序最靠前的服务数据开始确定第一服务数据,并且是沿标识由小到大的顺序进行依次确定,直到首次检测到不是固定不变的服务数据,进而将该首次检测到不是固定不变的服务数据的前一个服务数据的标识作为指定标识。例如,请再参阅图4,其中服务1对应的标识0x0001为排序最靠前的标识,进而会从0x0001开始依次确定固定不变的服务数据,若首先检测到的不是固定不变的服务数据为服务3,那么则可以确定第一服务数据包括标识0x0001、标识0x0002、标识0x0003、标识0x0004、标识0x0005以及标识0x0006所对应的服务数据。从而会将0x0006作为指定标识。Optionally, the specified identifier may include a start identifier and an end identifier, wherein the start identifier is used to identify the start position of the first service data, and the end identifier is used to represent the end position of the first service data. As shown in FIG. 4, based on the situation shown in FIG. 4, if the determined first service data includes service 2, feature 2, feature descriptor 2, service 3, feature 3, and feature descriptor 3, then the corresponding The specified identifiers include 0x0004 and 0x0009, where 0x0004 is the start identifier and 0x0009 is the end identifier. Optionally, the first service data can be determined starting from the service data with the highest corresponding identifier among the service data included in the server, and the first service data is determined sequentially along the order of identifiers from small to large until the first detection of The service data is not constant, and the identifier of the previous service data that is detected for the first time as the service data that is not constant is used as the designated identifier. For example, please refer to Figure 4 again, where the identifier 0x0001 corresponding to service 1 is the highest-ranked identifier, and the fixed service data will be determined sequentially starting from 0x0001. If the first detected non-fixed service data is service 3, then it may be determined that the first service data includes service data corresponding to the identifier 0x0001, the identifier 0x0002, the identifier 0x0003, the identifier 0x0004, the identifier 0x0005, and the identifier 0x0006. Thus, 0x0006 will be used as the specified identifier.
再者,需要说明的是,本申请实施例中所示的固定不变的服务数据可以理解为在服务端所在设备在指定时间周期内不会变化的服务数据。其中,该指定时间周期可以为服务端所在设备的生命周期,也可以是 服务端所在设备的某一个运行周期。其中,生命周期可以理解为设备可以会被使用的时间。例如,某个设备会使用两年,那么该设备的生命周期则为两年。其中,运行周期可以为用户设定的周期,例如,用户可以设定一个星期为一个运行周期,也可以设定一个月为一个运行周期。Furthermore, it should be noted that the fixed service data shown in the embodiment of the present application can be understood as service data that does not change within a specified time period on the device where the server is located. Wherein, the specified time period may be a life cycle of the device where the server is located, or a certain operation period of the device where the server is located. Among them, the life cycle can be understood as the time when the device can be used. For example, if a device is used for two years, then the life cycle of the device is two years. Wherein, the operation period may be a period set by the user, for example, the user may set one week as one operation period, or one month as one operation period.
S120:若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,所述第二服务数据为所述服务端中除所述第一服务数据以外的服务数据。S120: If the first service data previously obtained from the server based on the specified identifier is locally stored, acquire second service data from the server based on the specified identifier, and the second service data is the Service data other than the first service data in the server.
需要说明的是,在本申请实施例中,在客户端从无线数据第一次获取到该指定标识后,则可以根据该指定标识来确定服务端中具体有哪些服务数据是第一服务数据,进而将第一服务数据存储在客户端本地。It should be noted that, in this embodiment of the application, after the client obtains the specified identifier from the wireless data for the first time, it can determine which specific service data in the server are the first service data according to the specified identifier. Furthermore, the first service data is stored locally on the client.
对应的,客户端每次从服务端发送的无线数据中获取得到指定标识后,则可以先确定本次是否已经存储有所获取的指定标识所标识的第一服务数据,若已经存储有,则可以直接基于该指定标识从服务端去获取第二服务数据。Correspondingly, each time the client obtains the specified identifier from the wireless data sent by the server, it can first determine whether the first service data identified by the acquired specified identifier has been stored this time, and if it has already been stored, then The second service data can be directly obtained from the server based on the specified identifier.
作为一种方式,所述从服务端对应的无线数据中获取指定标识之后还包括:若本地未存储有基于所述指定标识从所述服务端获取的第一服务数据,则从所述服务端获取所述服务端对应的服务数据;将所述服务端对应的服务数据中的第一服务数据存储在本地。As a manner, after obtaining the specified identifier from the wireless data corresponding to the server, it further includes: if the first service data obtained from the server based on the specified identifier is not locally stored, then from the server Acquire the service data corresponding to the server; store the first service data in the service data corresponding to the server locally.
S130:将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。S130: Use the second service data and the local first service data as the acquired service data of the server.
需要说明的是,在本申请实施例中,如前述内容所示客户端所接收到的无线数据可以为广播数据,也可以为与服务端建立连接后所接收到的服务端所发送的无线数据。而无论该无线数据具体是指的何种阶段的数据,客户端与服务端建立连接的目的是为了发现服务端所对应的服务数据,进而再根据获取的服务端所对应的服务数据进行后续的操作。那么客户端在获取到服务端返回的第二服务数据后,则可以将第二服务数据和第一服务数据进行组合,进而将组合后的服务数据作为获取到的所述服务端对应的服务数据。It should be noted that, in the embodiment of this application, the wireless data received by the client as shown in the foregoing content may be broadcast data, or it may be wireless data sent by the server received after establishing a connection with the server . No matter what stage of data the wireless data refers to, the purpose of establishing a connection between the client and the server is to discover the service data corresponding to the server, and then perform subsequent operations based on the obtained service data corresponding to the server. operate. Then, after obtaining the second service data returned by the server, the client can combine the second service data with the first service data, and then use the combined service data as the acquired service data corresponding to the server. .
其中,将第二服务数据和第一服务数据进行组合可以理解为,将第二服务数据和第一服务数据统一按既定顺序进行排序。可以理解的是,服务端中的所有服务数据都是按照一定的顺序排列的。但是,在本申请实施例中,客户端会单独将服务端对应的服务数据中的第一服务数据存储在本地,进而使得第一服务数据和第二服务数据可能是分别进行获取的,则可以通过将第二服务数据和第一服务数据统一按既定顺序进行排序,使得客户端最终所获取到的服务数据的顺序和服务端中本来的顺序是一致的。其中,既定顺序则为服务端中服务数据的排列顺序。Wherein, combining the second service data and the first service data may be understood as sorting the second service data and the first service data in a predetermined order. It can be understood that all service data in the server are arranged in a certain order. However, in this embodiment of the application, the client will separately store the first service data in the service data corresponding to the server locally, so that the first service data and the second service data may be obtained separately, then it can By uniformly sorting the second service data and the first service data in a predetermined order, the order of the service data finally acquired by the client is consistent with the original order in the server. Wherein, the predetermined order is the arrangement order of the service data in the server.
本实施例提供的一种数据获取方法,通过从服务端对应的无线数据中获取标识服务端中的第一服务数据指定标识后,进一步的确定本地是否已经预先存储有基于所述指定标识从所述服务端获取的第一服务数据,若有则直接基于所述指定标识从所述服务端中获取服务端中除所述第一服务数据以外的服务数据(第二服务数据),以将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。In the data acquisition method provided by this embodiment, after obtaining the designated identifier of the first service data in the identified server from the wireless data corresponding to the server, it is further determined whether the specified identifier based on the designated identifier has been pre-stored locally. The first service data obtained by the server, if any, directly obtain the service data (second service data) in the server other than the first service data (second service data) from the server based on the specified identifier, so that all The second service data and the local first service data are used as the acquired service data of the server.
从而通过上述方式使得在服务端将服务数据区分为第一服务数据以及第二服务数据的情况下,使得客户端可以预先通过从服务端中获取第一服务数据以存储在本地,继而使得在后续每次需要获取服务端对应的服务数据的过程中,可以只用通过服务端对应的无线数据中的指定标识去获取第二服务数据,进而减少了每次服务数据的获取过程中需要从服务端中进行数据获取的数据量,提升了从服务端获取服务数据的效率。Therefore, through the above method, when the server distinguishes the service data into the first service data and the second service data, the client can obtain the first service data from the server in advance to store locally, and then make subsequent In the process of obtaining the service data corresponding to the server each time, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the need to obtain the second service data from the server during each service data acquisition process. The amount of data for data acquisition in the server improves the efficiency of obtaining service data from the server.
请参阅图5,本申请实施例提供的一种数据获取方法,应用于客户端,所述方法包括:Please refer to Figure 5, a data acquisition method provided by the embodiment of the present application is applied to the client, and the method includes:
S210:从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据。S210: Acquire a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
S220:若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识确定服务数据查询范围,所述服务数据查询范围为第二服务数据对应的范围。S220: If the first service data previously obtained from the server based on the specified identifier is locally stored, determine a service data query range based on the specified identifier, and the service data query range is a range corresponding to the second service data.
其中,如前述实施例介绍可知,在本申请实施例中,指定标识可以有多种实施方式。而对于不同的实施方式的指定标识,则所对应的确定的数据查询范围也可能会有不同。Wherein, as can be known from the foregoing description of the embodiments, in the embodiments of the present application, there may be multiple implementation manners for specifying the identifier. For the specified identifiers in different implementations, the corresponding determined data query scope may also be different.
作为一种方式,所述指定标识为指定标识区间中排序在最后的一个标识,所述指定标识区间的开始标识为所述服务端中的排序最前的一个标识,所述指定标识区间为所述第一服务数据对应的标识所在的区间;所述基于所述指定标识确定服务数据查询范围,包括:将排序在所述指定标识之后的标识所在范围作为服务数据查询范围。也就是说,在第一服务数据是从排序在最前标识开始起算的情况下,指定标识为第一服务数据所包括的服务数据对应的标识中,排序在最后的标识。并且,在服务数据对应的标识都是从小到大进行排序的情况下,指定标识则为第一服务数据所包括的服务数据对应的标识中,最大的一个标识。示例性的,请再参阅图4,在这种方式中若指定标识为0x0006,那么所确定的服务数据查询范围则为0x0007到最后一个标识。As a method, the designated identifier is the last identifier in the designated identifier interval, the start identifier of the designated identifier interval is the first identifier in the server end, and the designated identifier interval is the The interval where the identifier corresponding to the first service data is located; the determining the service data query range based on the specified identifier includes: taking the range where the identifiers sorted after the specified identifier is located as the service data query range. That is to say, in the case that the first service data is counted from the first identifier, the designated identifier is the last identifier among the identifiers corresponding to the service data included in the first service data. Moreover, in the case that the identifiers corresponding to the service data are sorted from small to large, the designated identifier is the largest identifier among the identifiers corresponding to the service data included in the first service data. For example, please refer to FIG. 4 again. In this manner, if the designated identifier is 0x0006, then the determined service data query range is from 0x0007 to the last identifier.
作为另外一种方式,指定标识会包括有开始标识和截止标识,那么则客户端会将服务端中的排序最前的一个标识到开始标识之间的范围,以及截止标识之后的范围作为服务数据查询范围。示例 性的,请再参阅图4,在这种方式中若开始标识为0x0004,截止标识为0x0006,那么所确定的服务数据查询范围会包括0x0001(排序最前的一个标识)到0x0003,以及包括0x0007之后的范围。As another way, if the specified identifier includes the start identifier and the end identifier, then the client will use the range from the first identifier on the server to the start identifier, and the range after the end identifier as the service data query scope. For example, please refer to Figure 4 again. In this way, if the start identifier is 0x0004 and the end identifier is 0x0006, then the determined service data query range will include 0x0001 (the first identifier) to 0x0003, and include 0x0007 after the range.
S230:触发所述服务端基于所述服务数据查询范围进行服务数据查找,以获取到查找到的第二服务数据。S230: Trigger the server to search for service data based on the service data query range, so as to obtain the found second service data.
S240:将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。S240: Use the second service data and the local first service data as the acquired service data of the server.
本实施例提供的一种数据获取方法,通过上述方式使得在服务端将服务数据区分为第一服务数据以及第二服务数据的情况下,使得客户端可以预先通过从服务端中获取第一服务数据以存储在本地,继而使得在后续每次需要获取服务端对应的服务数据的过程中,可以只用通过服务端对应的无线数据中的指定标识去获取第二服务数据,进而减少了每次服务数据的获取过程中需要从服务端中进行数据获取的数据量,提升了从服务端获取服务数据的效率。并且,在本实施例中客户端还可以进一步的根据指定标识确定出服务数据查询范围,从而使得服务端能够直接基于客户端所确定的服务数据查询范围进行服务数据的获取,进一步的提升了获取效率。The data acquisition method provided by this embodiment enables the client to obtain the first service data from the server in advance when the server distinguishes the service data into the first service data and the second service The data is stored locally, so that in the subsequent process of obtaining the service data corresponding to the server, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the number of times The amount of data that needs to be obtained from the server in the process of obtaining service data improves the efficiency of obtaining service data from the server. Moreover, in this embodiment, the client can further determine the service data query range according to the specified identifier, so that the server can directly obtain the service data based on the service data query range determined by the client, further improving the efficiency.
请参阅图6,本申请实施例提供的一种数据获取方法,应用于客户端,所述方法包括:Please refer to Figure 6, a data acquisition method provided by the embodiment of the present application is applied to the client, and the method includes:
S310:从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据。S310: Acquire a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
S320:从所述无线数据中获取服务端所在设备的设备标识。S320: Obtain the device identifier of the device where the server is located from the wireless data.
其中,设备标识为用于对设备的唯一性进行标识的信息。在本申请实施例中,设备标识可以有多种的实施方式。Wherein, the device identifier is information used to identify the uniqueness of the device. In the embodiment of this application, there may be multiple implementation manners for the device identification.
作为一种方式,设备标识可以通过设备所对应的网络地址来实施。在这种方式下,可以将设备的网络地址作为设备的设备标识。例如,若服务端所在设备是通过蓝牙通信的方式发送无线数据。那么基于蓝牙通信的方式所发送的无线数据中会携带有设备的蓝牙地址,进而客户端可以将无线数据中所携带的蓝牙地址作为设备的设备标识。其中,在采用蓝牙地址作为设备标识的情况下,蓝牙地址为public类型的地址,以便使得设备的蓝牙地址是固定不变的。As a manner, the device identification can be implemented through the network address corresponding to the device. In this way, the network address of the device can be used as the device identifier of the device. For example, if the device where the server is located sends wireless data through Bluetooth communication. Then the wireless data sent based on the Bluetooth communication will carry the Bluetooth address of the device, and then the client can use the Bluetooth address carried in the wireless data as the device identifier of the device. Wherein, when the Bluetooth address is used as the device identifier, the Bluetooth address is a public address, so that the Bluetooth address of the device is fixed.
作为另外一种方式,设备标识可以为基于指定协议生成的随机数,并且每次生成的随机数可以不同,从而使得不同设备对应的设备标识可以是唯一的。在服务端每次发送无线数据的时候,可以将该作为设备标识的随机数增加到所发送的无线数据中,从而使得接收到该无线数据的客户端可以了解到当前的无线数据是由哪个服务端发送的。As another way, the device identifier can be a random number generated based on a specified protocol, and the random number generated each time can be different, so that the device identifiers corresponding to different devices can be unique. When the server sends wireless data every time, it can add the random number as the device identification to the wireless data sent, so that the client receiving the wireless data can know which server the current wireless data is from sent by the end.
那么在设备标识可以有多种实施方式的情况下,客户端则可以采用既定的方式来获取得到设备标识。Then, in the case that the device identifier can be implemented in multiple ways, the client can obtain the device identifier in a predetermined way.
可选的,若客户端所配置的既定方式为通过获取无线数据中所携带的网络地址来作为设备标识,那么客户端在获取得到服务端发送的无线数据后,则可以直接从无线数据中进行网络地址的提取,以作为服务端所在设备的设备标识。可选的,若客户端所配置的既定方式为通过获取无线数据中所携带的随机数来作为设备标识,那么客户端在获取得到服务端发送的无线数据后,则可以直接从无线数据中进行随机数的提取,以作为服务端所在设备的设备标识。Optionally, if the predetermined method configured by the client is to obtain the network address carried in the wireless data as the device identifier, then after the client obtains the wireless data sent by the server, it can directly perform The extraction of the network address is used as the device identification of the device where the server is located. Optionally, if the predetermined method configured by the client is to obtain the random number carried in the wireless data as the device identification, then after the client obtains the wireless data sent by the server, it can directly perform The extraction of the random number is used as the device identification of the device where the server is located.
再则,客户端也可以通过自适应的方式来进行设备标识的获取。需要说明的是,不同的服务端在对自己所在设备进行标识时,所采用的标识方式可能是不同的。例如,虽然设备所发送的无线数据中都可能会携带有网络地址,但是有个的设备采用的为随机网络地址(random类型的网络地址),进而就可能使得不同设备的网络地址是相同的,那么在这种情况下,网络地址就没有办法很好的对设备进行唯一性标识。Furthermore, the client may also acquire the device identifier in an adaptive manner. It should be noted that when different servers identify their own devices, they may adopt different identification methods. For example, although the wireless data sent by the device may carry a network address, some devices use a random network address (random network address), which may make the network addresses of different devices the same. In this case, there is no way for the network address to uniquely identify the device.
作为一种方式,客户端在获取设备标识的过程中,可以先检测无线数据中采用的网络地址的类型;若检测到网络地址为固定类型的网络地址,则直接将获取到的网络地址作为发送该无线数据的设备的设备标识;若检测到网络地址为随机类型的网络地址,则进一步的检测无线数据中是否携带有基于指定协议生成的随机数;若检测到有基于指定协议生成的随机数,则将该基于指定协议生成的随机数作为发送该无线数据的设备的设备标识。若未检测到有基于指定协议生成的随机数,则直接从服务端中获取所有服务数据作为所述服务端对应的服务数据。As a way, in the process of obtaining the device identification, the client can first detect the type of network address used in the wireless data; if it detects that the network address is a fixed type of network address, it will directly use the obtained network address as the sending The device identification of the device for the wireless data; if it is detected that the network address is a random type of network address, then further detect whether the wireless data carries a random number generated based on a specified protocol; if a random number generated based on a specified protocol is detected , then use the random number generated based on the specified protocol as the device identifier of the device sending the wireless data. If no random number generated based on the specified protocol is detected, all service data is directly obtained from the server as service data corresponding to the server.
需要说明的是,在本申请实施例中,客户端在获取到从服务端中获取得到第一服务数据之后,可以将设备标识与第一服务数据进行对应存储。It should be noted that, in the embodiment of the present application, after obtaining the first service data from the server, the client may store the device identifier and the first service data correspondingly.
S330:检测本地是否存储有所述设备标识对应的服务数据。S330: Detect whether service data corresponding to the device identifier is locally stored.
如前述内容接介绍,客户端在存储第一服务数据时,是可以将设备标识与第一服务数据进行对应存储。那么客户端检测本地是否存储有所述设备标识对应的服务数据则实际可以理解为,客户端确定本地是否有基于从所述服务端获取的第一服务数据。并且,该第一服务数据是由设备标识所在无线数据中的指定标识所标识的服务数据。As described above, when storing the first service data, the client may store the device identifier and the first service data correspondingly. Then, the client detects whether the service data corresponding to the device identifier is stored locally. It can actually be understood that the client determines whether there is the first service data obtained from the server locally. Moreover, the first service data is service data identified by a specified identifier in the wireless data where the device identifier is located.
S340:若本地未存储有与所述设备标识对应的服务数据,则确定本地未存储有预先基于所述指 定标识从所述服务端获取的第一服务数据。S340: If the service data corresponding to the device identifier is not stored locally, determine that the first service data previously obtained from the server based on the specified identifier is not stored locally.
S350:若本地存储有与所述设备标识对应的服务数据,则确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据。S350: If the service data corresponding to the device identifier is stored locally, determine that the first service data previously obtained from the server based on the specified identifier is stored locally.
S360:若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,所述第二服务数据为所述服务端中除所述第一服务数据以外的服务数据。S360: If the first service data previously obtained from the server based on the specified identifier is locally stored, obtain second service data from the server based on the specified identifier, and the second service data is the Service data other than the first service data in the server.
S370:将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。S370: Use the second service data and the local first service data as the acquired service data of the server.
本实施例提供的一种数据获取方法,通过上述方式使得在服务端将服务数据区分为第一服务数据以及第二服务数据的情况下,使得客户端可以预先通过从服务端中获取第一服务数据以存储在本地,继而使得在后续每次需要获取服务端对应的服务数据的过程中,可以只用通过服务端对应的无线数据中的指定标识去获取第二服务数据,进而减少了每次服务数据的获取过程中需要从服务端中进行数据获取的数据量,提升了从服务端获取服务数据的效率。并且,在本实施例中在存储第一服务数据的过程中,会将第一服务数据、服务端所在设备的设备标识进行对应的存储,从而在确定存储有设备标识对应的服务数据的情况下,可以直接确定存储有该服务端的第一服务数据。The data acquisition method provided by this embodiment enables the client to obtain the first service data from the server in advance when the server distinguishes the service data into the first service data and the second service The data is stored locally, so that in the subsequent process of obtaining the service data corresponding to the server, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the number of times The amount of data that needs to be obtained from the server in the process of obtaining service data improves the efficiency of obtaining service data from the server. Moreover, in the process of storing the first service data in this embodiment, the first service data and the device identifier of the device where the server is located will be stored correspondingly, so that when it is determined that the service data corresponding to the device identifier is stored , it can be directly determined that the first service data of the server is stored.
请参阅图7,本申请实施例提供的一种数据获取方法,应用于客户端,所述方法包括:Please refer to Figure 7, a data acquisition method provided by the embodiment of the present application is applied to the client, and the method includes:
S410:从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据。S410: Obtain a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
S420:比对从所述无线数据中获取的指定标识与本地存储的指定标识是否一致。S420: Check whether the designated identifier acquired from the wireless data is consistent with the designated identifier stored locally.
需要说明的是,服务端中是由指定标识来区分第一服务数据和第二服务数据的。那么则客户端在首次基于无线数据中的指定标识从服务端中获取到第一服务数据后,可以将获取第一服务数据所基于的指定标识同获取的第一服务数据对应存储在本地。那么也就意味着本地存储的第一服务数据和指定标识是对应的。那么客户端则可以在每次从服务端发送的无线数据中获取得到指定标识后,去检测当前从无线数据中获取到的指定标识与本地存储的指定标识是否一致,若一致,则表征服务端中第一服务数据依然是没有变换的,进而客户端也就可以确定本地实际已经存储了从基于当前从无线数据中获取到的指定标识从服务端中获取的第一服务数据。It should be noted that the first service data and the second service data are distinguished by a designated identifier in the server. Then, after the client acquires the first service data from the server based on the specified identifier in the wireless data for the first time, it can store the specified identifier based on which the first service data is obtained and the acquired first service data correspondingly locally. Then it means that the first service data stored locally corresponds to the designated identifier. Then the client can check whether the specified identifier currently obtained from the wireless data is consistent with the specified identifier stored locally after each time the specified identifier is obtained from the wireless data sent by the server. If they are consistent, it indicates that the server The first service data is still unchanged, and then the client can determine that the first service data obtained from the server based on the specified identifier currently obtained from the wireless data has actually been stored locally.
示例性的,若当前从无线数据中获取的指定标识为标识1,且客户端在本地获取到的指定标识也为标识1,那么则客户度可以确定从无线数据中获取的指定标识与本地存储的指定标识是一致的。若当前从无线数据中获取的指定标识为标识2,且客户端在本地获取到的指定标识也为标识2,那么则客户度可以确定从无线数据中获取的指定标识与本地存储的指定标识是不一致的。Exemplarily, if the specified identifier currently obtained from wireless data is identifier 1, and the specified identifier obtained locally by the client is also identifier 1, then the client can determine the specified identifier obtained from wireless data and the locally stored The specified identifiers are consistent. If the designated identifier currently obtained from the wireless data is identifier 2, and the designated identifier obtained locally by the client is also identifier 2, then the client can determine that the designated identifier obtained from the wireless data and the designated identifier stored locally are inconsistent.
再者,需要说明的是,客户端可能会和多种服务端建立过连接,并且,不同服务端各自所对应的指定标识可能是相同的。那么在这种方式中,客户端可以将指定标识以及设备标识(服务端所在设备的设备标识)进行对应的存储,以区别不同服务端各自所对应的指定标识。示例性的,客户端在本地存储的指定标识可以如下表所示。Furthermore, it should be noted that the client may have established connections with various servers, and the designated identifiers corresponding to different servers may be the same. Then in this way, the client can store the specified identifier and the device identifier (the device identifier of the device where the server is located) correspondingly, so as to distinguish the specified identifiers corresponding to different servers. Exemplarily, the specified identifier stored locally by the client may be as shown in the following table.
IDID 指定标识designated logo 设备标识Equipment Identity
11 标识1Logo 1 设备1equipment 1
22 标识2Logo 2 设备2device 2
33 标识3Logo 3 设备3device 3
其中,若当前从无线数据中获取的指定标识为标识2,设备标识为设备2,那么则客户端可以在本地存储的指定标识中查询到该指定标识为标识2且设备标识为设备2的数据(即ID为2所对应的数据),则客户端确定从无线数据中获取的指定标识与本地存储的指定标识是一致的。若当前从无线数据中获取的指定标识为标识2,设备标识为设备1,则确定从无线数据中获取的指定标识与本地存储的指定标识不是一致的。并且,在这种情况下,还可以进一步的确定设备1中服务端对应第一服务数据实际已经发生变化,从而用于标识第一服务数据的指定标识也发生了变化,并且,在确定服务端对应第一服务数据实际已经发生变化的情况下,服务端对应的服务数据则需要全部从服务端中重新获取。Wherein, if the specified identifier currently obtained from the wireless data is identifier 2 and the device identifier is device 2, then the client can query the data in which the specified identifier is identifier 2 and the device identifier is device 2 in the specified identifier stored locally (that is, the data corresponding to the ID being 2), the client determines that the specified identifier obtained from the wireless data is consistent with the specified identifier stored locally. If the specified identifier currently obtained from the wireless data is identifier 2 and the device identifier is device 1, it is determined that the specified identifier obtained from the wireless data is not consistent with the specified identifier stored locally. Moreover, in this case, it can be further determined that the first service data corresponding to the server in device 1 has actually changed, so that the specified identifier used to identify the first service data has also changed, and, after determining that the server In the case that the corresponding first service data has actually changed, all the service data corresponding to the server needs to be reacquired from the server.
S440:若不一致,则确定本地未存储有预先基于所述指定标识从所述服务端获取的第一服务数据。S440: If not, determine that the first service data previously acquired from the server based on the specified identifier is not locally stored.
S450:若一致,则确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据。S450: If they are consistent, determine that the first service data previously obtained from the server based on the specified identifier is locally stored.
S460:若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,所述第二服务数据为所述服务端中除所述第一服务数据以外的服务数据。S460: If the first service data previously obtained from the server based on the specified identifier is locally stored, acquire second service data from the server based on the specified identifier, and the second service data is the Service data other than the first service data in the server.
S470:将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。S470: Use the second service data and the local first service data as the acquired service data of the server.
本实施例提供的一种数据获取方法,通过上述方式使得在服务端将服务数据区分为第一服务数 据以及第二服务数据的情况下,使得客户端可以预先通过从服务端中获取第一服务数据以存储在本地,继而使得在后续每次需要获取服务端对应的服务数据的过程中,可以只用通过服务端对应的无线数据中的指定标识去获取第二服务数据,进而减少了每次服务数据的获取过程中需要从服务端中进行数据获取的数据量,提升了从服务端获取服务数据的效率。并且,在本实施例中,在向本地存储第一服务数据的过程中,还会将获取第一服务数据所基于的指定标识存储在本地,从而在后续的获取服务端对应的服务数据的过程中,可以通过检测本地是否存储有从无线数据中获取的指定标识就可以快速的确定本地是否预先存储有第一服务数据,进而有利于提升获取服务数据的效率。The data acquisition method provided by this embodiment enables the client to obtain the first service data from the server in advance when the server distinguishes the service data into the first service data and the second service The data is stored locally, so that in the subsequent process of obtaining the service data corresponding to the server, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the number of times The amount of data that needs to be obtained from the server in the process of obtaining service data improves the efficiency of obtaining service data from the server. Moreover, in this embodiment, in the process of storing the first service data locally, the specified identifier on which the first service data is obtained will also be stored locally, so that in the subsequent process of obtaining the service data corresponding to the server Among them, whether the first service data is pre-stored locally can be quickly determined by detecting whether the specified identifier obtained from the wireless data is stored locally, which is beneficial to improving the efficiency of obtaining service data.
请参阅图8,本申请实施例提供的一种数据获取方法,应用于服务端,所述方法包括:Please refer to Figure 8, a data acquisition method provided by the embodiment of the present application is applied to the server, and the method includes:
S510:发送携带有指定标识的无线数据,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据。S510: Send wireless data carrying a specified identifier, where the specified identifier is used to identify first service data in the server, where the first service data is constant service data.
作为一种方式,所述无线数据为广播数据,所述发送携带有指定标识的无线数据,包括:发送携带有指定标识的广播数据。As a manner, the wireless data is broadcast data, and the sending the wireless data carrying the specified identifier includes: sending the broadcast data carrying the specified identifier.
S520:响应于客户端发送的与所述指定标识对应的获取请求,从所述服务端中获取第二服务数据,所述获取请求为所述客户端在确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据后发送。S520: Obtain second service data from the server in response to an acquisition request sent by the client and corresponding to the specified identifier, where the acquisition request is determined locally stored by the client in advance based on the specified identifier. The first service data obtained from the server is sent later.
S530:将所述第二服务数据发送给所述客户端,以用于使所述客户端将所述第二服务数据和本地的第一服务数据作为获取到的所述服务端的服务数据。S530: Send the second service data to the client, so that the client uses the second service data and the local first service data as the acquired service data of the server.
作为一种方式,所述响应于客户端发送的与所述指定标识对应的获取请求,从所述服务端中获取第二服务数据包括:响应于客户端发送的与所述指定标识对应的获取请求,从所述获取请求中获取服务数据查询范围,在所述服务端中查询所述服务数据查询范围对应的服务数据作为第二服务数据。As a manner, the obtaining the second service data from the server in response to the obtaining request sent by the client corresponding to the specified identifier includes: responding to the obtaining request corresponding to the specified identifier sent by the client request, obtaining the service data query range from the acquisition request, and querying the service data corresponding to the service data query range as the second service data in the server.
需要说明的是,本实施例中的步骤所对应的具体详细解释可以参见前述实施例中相关的内容。It should be noted that, for specific detailed explanations corresponding to the steps in this embodiment, reference may be made to relevant content in the foregoing embodiments.
本实施例提供的一种数据获取方法,通过服务端将用于标识所述服务端中的第一服务数据的指定标识增加到所发送的无线数据的方式,使得客户端可以通过服务端所发送的无线数据获取到该指定标识,从而使得在客户端预先存储有基于该指定标识获取的第一服务数据的情况下,可以在需要获取服务端整体的服务数据的过程中,仅从服务端获取第二服务数据即可。进而减少了每次服务数据的获取过程中需要从服务端中进行数据获取的数据量,提升了从服务端获取服务数据的效率。In the data acquisition method provided by this embodiment, the server adds the specified identifier used to identify the first service data in the server to the wireless data sent, so that the client can pass the data sent by the server. The wireless data obtained by the designated identifier, so that in the case that the client pre-stores the first service data obtained based on the designated identifier, it can only obtain the service data from the server in the process of obtaining the entire service data of the server. The second service data is enough. This further reduces the amount of data that needs to be acquired from the server in each service data acquisition process, and improves the efficiency of acquiring service data from the server.
需要说明的是,在本申请实施例中,在客户端从服务端对应的无线数据中获取指定标识之前,客户端可以先检测与发射无线数据的服务端之间是否已经建立授信关系,若已经建立授信关系,则可以直接按照已经建立授信关系所对应的服务获取方式进行服务端中的服务获取。若未建立授信关系,则可以执行后续的从服务端对应的无线数据中获取指定标识。其中,若客户端与服务端之间已经建立授信关系,则表征客户端和服务端之间已经进行了身份认证。It should be noted that, in the embodiment of this application, before the client obtains the specified identifier from the wireless data corresponding to the server, the client can first detect whether a credit relationship has been established with the server that transmits the wireless data. After establishing a credit relationship, you can directly acquire services in the server according to the service acquisition method corresponding to the established credit relationship. If the credit relationship is not established, the subsequent acquisition of the specified identifier from the corresponding wireless data of the server may be performed. Wherein, if a trust relationship has been established between the client and the server, it means that identity authentication has been performed between the client and the server.
下面再通过一个示例来对本申请实施例所涉及的一个实际场景的流程进行介绍。如图9所示,图9所示的流程包括:Next, an example is used to introduce the process of an actual scenario involved in the embodiment of the present application. As shown in Figure 9, the process shown in Figure 9 includes:
S610:GATT客户端获取GATT服务端发送的广播数据,并从中获取到指定标识。S610: The GATT client obtains the broadcast data sent by the GATT server, and obtains a specified identifier from it.
S620:GATT客户端与GATT服务端建立连接。S620: The GATT client establishes a connection with the GATT server.
S630:GATT客户端检测是否与该服务端是第一次建立连接。S630: The GATT client detects whether it is the first time to establish a connection with the server.
其中,GATT客户端检测是否与该服务端是第一次建立连接的方式可以有多种。例如,可以采用前述实施例中的检测本地是否存储有与GATT服务端所在设备的设备标识对应的服务数据的方式进行检测,对应的,若本地存储有设备标识对应的服务数据,则确定不是第一次连接,反之,若本地未存储有设备标识对应的服务数据,则确定是第一次连接。再例如,也可以采用检测从广播数据中获取的指定标识与本地存储的指定标识是否一致的方式进行检测,对应的,若检测到从广播数据中获取的指定标识与本地存储的指定标识一致,则确定不是第一次连接,反之,若检测到从广播数据中获取的指定标识与本地存储的指定标识一致,或者,本地并未存储过指定标识,则确定是第一次连接。Among them, the GATT client may have multiple ways to detect whether it is the first time to establish a connection with the server. For example, the method of detecting whether the service data corresponding to the device identifier of the device where the GATT server is located can be detected locally in the foregoing embodiments. Correspondingly, if the service data corresponding to the device identifier is stored locally, it is determined that it is not the first A connection, otherwise, if the service data corresponding to the device identification is not stored locally, it is determined to be the first connection. For another example, it is also possible to detect whether the specified identifier obtained from the broadcast data is consistent with the specified identifier stored locally. Correspondingly, if it is detected that the specified identifier obtained from the broadcast data is consistent with the specified identifier stored locally, Then it is determined that it is not the first connection. On the contrary, if it is detected that the specified identifier obtained from the broadcast data is consistent with the specified identifier stored locally, or if the specified identifier has not been stored locally, it is determined that it is the first connection.
S640:若是第一次连接,GATT客户端触发从服务端的所有服务数据中排序在最前的一个服务数据开始进行服务搜索。S640: If it is the first connection, the GATT client triggers the service search from the first service data in all the service data of the server.
其中,服务端中的服务数据可以是按照一定的顺序排列的。例如,如图4中,对应的标识为0x0001的服务数据则为服务端的所有服务数据中排序在最前的一个服务数据。那么在GATT客户端在确定是与该GATT服务端为第一次建立连接的情况下,则会触发开始从GATT服务端中标识为0x0001的服务数据进行服务搜索。Wherein, the service data in the server may be arranged in a certain order. For example, as shown in FIG. 4 , the service data whose corresponding identifier is 0x0001 is the first service data among all the service data of the server. Then, when the GATT client determines that it is the first time to establish a connection with the GATT server, it will trigger to start searching for services from the service data identified as 0x0001 in the GATT server.
S641:GATT客户端将搜索到的服务数据中第一服务数据存储在本地。S641: The GATT client locally stores the first service data among the searched service data.
在GATT客户端在确定是与该GATT服务端为第一次建立连接的情况下,GATT客户端实际会 是对GATT服务端中的所有服务数据均搜索一遍,从而发现GATT服务端中的所有服务数据。那么为了便于When the GATT client determines that it is the first time to establish a connection with the GATT server, the GATT client will actually search all the service data in the GATT server to find all the services in the GATT server data. then for convenience
S650:若不是第一次连接,GATT客户端触发从本地读取第一服务数据。S650: If it is not the first connection, the GATT client triggers to read the first service data locally.
S651:GATT客户端触发从指定标识后的第一个服务数据开始进行服务搜索,以得到第二服务数据。S651: The GATT client triggers a service search starting from the first service data after the specified identifier, so as to obtain the second service data.
需要说明的是,在图9所示的实施例中,指定标识表征的是从排序在最前的一个服务数据开始进行固定数据检测的方式中,对应的排序最后的一个服务数据所对应的标识。也可以理解为指定标识是固定不变的服务数据中对应的标识最大的一个标识。其中,服务数据的排序等同于服务数据对应的标识的排序。例如,请在参阅图4,若从0x0001开始确定固定不变的服务数据,并且,确定的固定不变的服务数据包括服务1、特征1、特征描述符1、服务2、特征2以及特征描述符2。那么在确定的不变的固定不变的服务数据中,对应的标识最大的一个标识则为0x0006,那么所确定的指定标识为0x0006。那么在GATT客户端确定与GATT服务端第一次建立连接后,所存储在本地的第一服务数据则会包括服务1、特征1、特征描述符1、服务2、特征2以及特征描述符2。那么再后续的非首次建立连接后,则会从0x0007开始进行服务数据的搜索。It should be noted that, in the embodiment shown in FIG. 9 , the designated identifier represents the identifier corresponding to the last service data in the manner of performing fixed data detection starting from the first service data. It can also be understood that the specified identifier is an identifier with the largest corresponding identifier in the fixed service data. Wherein, the ordering of the service data is equivalent to the ordering of the identifiers corresponding to the service data. For example, please refer to Figure 4, if the fixed service data is determined starting from 0x0001, and the determined fixed service data includes service 1, feature 1, feature descriptor 1, service 2, feature 2, and feature description character 2. Then, among the determined and constant service data, the one with the largest corresponding identifier is 0x0006, and the determined specified identifier is 0x0006. Then after the GATT client determines to establish a connection with the GATT server for the first time, the first service data stored locally will include service 1, feature 1, feature descriptor 1, service 2, feature 2, and feature descriptor 2 . Then after the subsequent connection is not established for the first time, the service data search will start from 0x0007.
其中,在得到第一服务数据和第二服务数据之后的处理方式可以参见前述实施例中的内容。Wherein, the processing manner after obtaining the first service data and the second service data can refer to the contents in the foregoing embodiments.
请参阅图10,本申请实施例提供的一种数据获取装置600,运行于客户端,所述装置600包括:Please refer to FIG. 10 , a data acquisition device 600 provided by the embodiment of the present application runs on a client, and the device 600 includes:
标识获取单元610,用于从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据。An identifier acquiring unit 610, configured to acquire a specified identifier from the wireless data corresponding to the server, the specified identifier is used to identify the first service data in the server, and the first service data is fixed service data .
作为一种方式,标识获取单元610,具体用于从服务端对应的广播数据中获取指定标识。As a manner, the identifier acquiring unit 610 is specifically configured to acquire a specified identifier from broadcast data corresponding to the server.
第一数据获取单元620,用于若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,所述第二服务数据为所述服务端中除所述第一服务数据以外的服务数据。The first data acquiring unit 620 is configured to acquire second service data from the server based on the specified identifier if the first service data previously acquired from the server based on the specified identifier is locally stored, the The second service data is service data in the server other than the first service data.
第二数据获取单元630,用于将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。The second data acquiring unit 630 is configured to use the second service data and the local first service data as the acquired service data of the server.
作为一种方式,第一数据获取单元620,具体用于若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识确定服务数据查询范围,所述服务数据查询范围为第二服务数据对应的范围;触发所述服务端基于所述服务数据查询范围进行服务数据查找,以获取到查找到的第二服务数据。在这种方式中,可选的,所述指定标识为指定标识区间中排序在最后的一个标识,所述指定标识区间的开始标识为所述服务端中的排序最前的一个标识,所述指定标识区间为所述第一服务数据对应的标识所在的区间,那么第一数据获取单元620,具体用于将排序在所述指定标识之后的标识所在范围作为服务数据查询范围。As a manner, the first data acquisition unit 620 is specifically configured to determine the service data query range based on the specified identifier if the first service data previously acquired from the server based on the specified identifier is locally stored, and the The service data query range is the range corresponding to the second service data; the server is triggered to search for service data based on the service data query range, so as to obtain the found second service data. In this manner, optionally, the specified identifier is the last identifier in the specified identifier interval, the start identifier of the specified identifier interval is the first identifier in the server end, and the specified The identification interval is the interval where the identification corresponding to the first service data is located, then the first data acquisition unit 620 is specifically configured to use the range of identifications sorted after the specified identification as the service data query range.
作为一种方式,第一数据获取单元620,具体用于从所述无线数据中获取服务端所在设备的设备标识;若本地存储有与所述设备标识对应的服务数据,则确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据。作为一种方式,第一数据获取单元620,具体用于比对从所述无线数据中获取的指定标识与本地存储的指定标识是否一致;若一致,则确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据。As a method, the first data obtaining unit 620 is specifically configured to obtain the device identifier of the device where the server is located from the wireless data; if the service data corresponding to the device identifier is locally stored, then it is determined that the local First service data acquired from the server based on the specified identifier. As one manner, the first data acquisition unit 620 is specifically configured to compare whether the specified identifier acquired from the wireless data is consistent with the specified identifier stored locally; The first service data obtained from the server.
第二数据获取单元630,还用于服务端对应的无线数据中获取指定标识之后,若本地未存储有基于所述指定标识从所述服务端获取的第一服务数据,则从所述服务端获取所述服务端对应的服务数据;将所述服务端对应的服务数据中的第一服务数据存储在本地。The second data obtaining unit 630 is further configured to obtain the specified identifier from the wireless data corresponding to the server, if the first service data obtained from the server based on the specified identifier is not stored locally, then from the server Acquire the service data corresponding to the server; store the first service data in the service data corresponding to the server locally.
请参阅图11,本申请实施例提供的一种数据获取装置700,运行于服务端,所述装置700包括:Please refer to FIG. 11 , a data acquisition device 700 provided by the embodiment of the present application runs on the server side, and the device 700 includes:
标识发送单元710,用于发送携带有指定标识的无线数据,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据。The identification sending unit 710 is configured to send wireless data carrying a specified identification, the specified identification is used to identify the first service data in the server, and the first service data is fixed service data.
标识发送单元710,具体用于发送携带有指定标识的广播数据。The identification sending unit 710 is specifically configured to send broadcast data carrying a designated identification.
数据查找单元720,用于响应于客户端发送的与所述指定标识对应的获取请求,从所述服务端中获取第二服务数据,所述获取请求为所述客户端在确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据后发送。The data search unit 720 is configured to obtain the second service data from the server in response to the obtaining request sent by the client and corresponding to the specified identifier, where the obtaining request is determined locally stored by the client. Sending after the first service data obtained from the server based on the specified identifier.
数据发送单元730,用于将所述第二服务数据发送给所述客户端,以用于使所述客户端将所述第二服务数据和本地的第一服务数据作为获取到的所述服务端的服务数据。A data sending unit 730, configured to send the second service data to the client, so that the client uses the second service data and local first service data as the obtained service terminal service data.
作为一种方式,数据查找单元720,具体用于响应于客户端发送的与所述指定标识对应的获取请求,从所述获取请求中获取服务数据查询范围,在所述服务端中查询所述服务数据查询范围对应的服务数据作为第二服务数据。As a method, the data search unit 720 is specifically configured to respond to the acquisition request sent by the client and corresponding to the specified identifier, obtain the service data query range from the acquisition request, and query the service data in the server. The service data corresponding to the service data query range is used as the second service data.
本实施例提供的一种数据获取装置,从而通过上述方式使得在服务端将服务数据区分为第一服务数据以及第二服务数据的情况下,使得客户端可以预先通过从服务端中获取第一服务数据以存储 在本地,继而使得在后续每次需要获取服务端对应的服务数据的过程中,可以只用通过服务端对应的无线数据中的指定标识去获取第二服务数据,进而减少了每次服务数据的获取过程中需要从服务端中进行数据获取的数据量,提升了从服务端获取服务数据的效率。The data acquisition device provided by this embodiment enables the client to obtain the first service data from the server in advance when the server distinguishes the service data into the first The service data is stored locally, so that in the subsequent process of obtaining the service data corresponding to the server, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the cost of each service. The amount of data that needs to be obtained from the server in the process of obtaining service data for each service improves the efficiency of obtaining service data from the server.
需要说明的是,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性。另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。It should be noted that those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described devices and units can refer to the corresponding process in the foregoing method embodiment, and will not be repeated here. . In several embodiments provided in the present application, the coupling between the modules may be electrical. In addition, each functional module in each embodiment of the present application may be integrated into one processing module, each module may exist separately physically, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules.
下面将结合图12对本申请提供的一种电子设备进行说明。An electronic device provided by the present application will be described below with reference to FIG. 12 .
请参阅图12,基于上述的数据获取方法、装置,本申请实施例还提供的另一种可以执行前述数据获取方法的电子设备100。电子设备100包括相互耦合的一个或多个(图中仅示出一个)处理器102、存储器104以及无线模块106。其中,该存储器104中存储有可以执行前述实施例中内容的程序,而处理器102可以执行该存储器104中存储的程序。Please refer to FIG. 12 , based on the above data acquisition method and apparatus, another electronic device 100 that can implement the aforementioned data acquisition method is provided in the embodiment of the present application. The electronic device 100 includes one or more (only one is shown in the figure) processors 102 , a memory 104 and a wireless module 106 coupled to each other. Wherein, the memory 104 stores programs capable of executing the contents of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104 .
其中,处理器102可以包括一个或者多个处理核。处理器102利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器104内的指令、程序、代码集或指令集,以及调用存储在存储器104内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器102可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器102可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器102中,单独通过一块通信芯片进行实现。Wherein, the processor 102 may include one or more processing cores. The processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes or executes instructions, programs, code sets or instruction sets stored in the memory 104, and calls data stored in the memory 104 to execute Various functions of the electronic device 100 and processing data. Optionally, the processor 102 may adopt at least one of Digital Signal Processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). implemented in the form of hardware. The processor 102 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), a modem, and the like. Among them, the CPU mainly handles the operating system, user interface and application programs, etc.; the GPU is used to render and draw the displayed content; the modem is used to handle wireless communication. It can be understood that the above modem may also not be integrated into the processor 102, but implemented by a communication chip alone.
存储器104可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器104可用于存储指令、程序、代码、代码集或指令集。例如,存储器104中可以存储有数据获取装置。该数据获取装置可以为前述的装置600或者装置700。存储器104可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 104 may include random access memory (Random Access Memory, RAM), and may also include read-only memory (Read-Only Memory). Memory 104 may be used to store instructions, programs, codes, sets of codes, or sets of instructions. For example, a data acquisition device may be stored in the memory 104 . The data acquisition device may be the aforementioned device 600 or device 700 . The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, and the like. The storage data area can also store data created by the terminal 100 during use (such as phonebook, audio and video data, chat record data) and the like.
所述无线模块106用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯,例如和音频播放设备进行通讯。所述无线模块106可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。所述无线模块106可与各种网络如互联网、企业内部网、无线网络进行通讯或者通过无线网络与其他设备进行通讯。上述的无线网络可包括蜂窝式电话网、无线局域网或者城域网。例如,无线模块106可以与基站进行信息交互。The wireless module 106 is used to receive and send electromagnetic waves, realize mutual conversion between electromagnetic waves and electrical signals, and communicate with communication networks or other devices, such as audio playback devices. The wireless module 106 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption/decryption chips, Subscriber Identity Module (SIM) cards, memory, etc. . The wireless module 106 can communicate with various networks such as the Internet, intranet, wireless network or communicate with other devices through the wireless network. The wireless network mentioned above may include a cellular telephone network, a wireless local area network or a metropolitan area network. For example, the wireless module 106 can perform information exchange with the base station.
请参考图13,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质1100中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 13 , which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. Program codes are stored in the computer-readable medium 1100, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
计算机可读存储介质1100可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质1100包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质1100具有执行上述方法中的任何方法步骤的程序代码1110的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码1110可以例如以适当形式进行压缩。The computer readable storage medium 1100 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1100 includes a non-transitory computer-readable storage medium (non-transitory computer-readable storage medium). The computer-readable storage medium 1100 has a storage space for program code 1110 for executing any method steps in the above methods. These program codes can be read from or written into one or more computer program products. Program code 1110 may, for example, be compressed in a suitable form.
综上所述,本申请提供的一种数据获取方法、装置、电子设备及存储介质,通过从服务端对应的无线数据中获取标识服务端中的第一服务数据指定标识后,进一步的确定本地是否已经预先存储有基于所述指定标识从所述服务端获取的第一服务数据,若有则直接基于所述指定标识从所述服务端中获取服务端中除所述第一服务数据以外的服务数据(第二服务数据),以将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。To sum up, the data acquisition method, device, electronic equipment and storage medium provided by this application further determine the local Whether the first service data obtained from the server based on the specified identifier has been pre-stored, and if so, directly obtain from the server based on the specified identifier the first service data in the server other than the first service data Service data (second service data), using the second service data and the local first service data as the acquired service data of the server.
从而通过上述方式使得在服务端将服务数据区分为第一服务数据以及第二服务数据的情况下,使得客户端可以预先通过从服务端中获取第一服务数据以存储在本地,继而使得在后续每次需要获取服务端对应的服务数据的过程中,可以只用通过服务端对应的无线数据中的指定标识去获取第二服务数据,进而减少了每次服务数据的获取过程中需要从服务端中进行数据获取的数据量,提升了从服务端获取服务数据的效率。Therefore, through the above method, when the server distinguishes the service data into the first service data and the second service data, the client can obtain the first service data from the server in advance to store locally, and then make subsequent In the process of obtaining the service data corresponding to the server each time, the second service data can be obtained only through the specified identifier in the wireless data corresponding to the server, thereby reducing the need to obtain the second service data from the server during each service data acquisition process. The amount of data for data acquisition in the server improves the efficiency of obtaining service data from the server.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案 进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not drive the essence of the corresponding technical solutions away from the spirit and scope of the technical solutions of the various embodiments of the present application.

Claims (19)

  1. 一种数据获取方法,其特征在于,应用于客户端,所述方法包括:A data acquisition method, characterized in that it is applied to a client, the method comprising:
    从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据;Acquiring a specified identifier from the wireless data corresponding to the server, where the specified identifier is used to identify first service data in the server, and the first service data is fixed service data;
    若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,所述第二服务数据为所述服务端中除所述第一服务数据以外的服务数据;If the first service data previously acquired from the server based on the specified identifier is locally stored, the second service data is obtained from the server based on the specified identifier, and the second service data is the Service data other than the first service data;
    将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。The second service data and the local first service data are used as the acquired service data of the server.
  2. 根据权利要求1所述的方法,其特征在于,所述若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,包括:The method according to claim 1, wherein if the first service data previously acquired from the server based on the specified identifier is locally stored, the second service data is obtained from the server based on the specified identifier. 2. Service data, including:
    若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识确定服务数据查询范围,所述服务数据查询范围为第二服务数据对应的范围;If the first service data previously acquired from the server based on the specified identifier is stored locally, determine a service data query range based on the specified identifier, and the service data query range is a range corresponding to the second service data;
    触发所述服务端基于所述服务数据查询范围进行服务数据查找,以获取到查找到的第二服务数据。The server is triggered to search for service data based on the service data query range, so as to obtain the found second service data.
  3. 根据权利要求2所述的方法,其特征在于,所述指定标识为指定标识区间中排序在最后的一个标识,所述指定标识区间的开始标识为所述服务端中的排序最前的一个标识,所述指定标识区间为所述第一服务数据对应的标识所在的区间;所述基于所述指定标识确定服务数据查询范围,包括:The method according to claim 2, wherein the designated identifier is the last identifier in the designated identifier interval, and the start identifier of the designated identifier interval is the first identifier in the server, The specified identifier interval is the interval where the identifier corresponding to the first service data is located; the determination of the service data query range based on the specified identifier includes:
    将排序在所述指定标识之后的标识所在范围作为服务数据查询范围。The scope of the identifiers sorted after the specified identifier is used as the scope of the service data query.
  4. 根据权利要求2所述的方法,其特征在于,所述指定标识包括开始标识和截止标识,所述基于所述指定标识确定服务数据查询范围,包括:The method according to claim 2, wherein the specified identifier includes a start identifier and an end identifier, and determining the service data query range based on the specified identifier includes:
    将服务端中的排序最前的一个标识到所述开始标识之间的范围,以及所述截止标识之后的范围作为服务数据查询范围。The range from the first identifier on the server side to the start identifier and the range after the end identifier are used as service data query ranges.
  5. 根据权利要求1所述的方法,其特征在于,所述若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据之前还包括:The method according to claim 1, wherein if the first service data previously acquired from the server based on the specified identifier is locally stored, the second service data is obtained from the server based on the specified identifier. Before the second service data also included:
    从所述无线数据中获取服务端所在设备的设备标识;Obtain the device identification of the device where the server is located from the wireless data;
    若本地存储有与所述设备标识对应的服务数据,则确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据。If the service data corresponding to the device identifier is stored locally, it is determined that the first service data previously obtained from the server based on the specified identifier is stored locally.
  6. 根据权利要求5所述的方法,其特征在于,所述从所述无线数据中获取服务端所在设备的设备标识,包括:The method according to claim 5, wherein the obtaining the device identification of the device where the server is located from the wireless data includes:
    采用既定的方式从所述无线数据中获取服务端所在设备的设备标识。Obtain the device identifier of the device where the server is located from the wireless data in a predetermined manner.
  7. 根据权利要求6所述的方法,其特征在于,所述采用既定的方式从所述无线数据中获取服务端所在设备的设备标识,包括:The method according to claim 6, wherein said obtaining the device identification of the device where the server is located from the wireless data in a predetermined manner comprises:
    获取得到服务端发送的无线数据;Get the wireless data sent by the server;
    从所述无线数据中进行网络地址的提取,以作为服务端所在设备的设备标识。The network address is extracted from the wireless data as the device identifier of the device where the server is located.
  8. 根据权利要求6所述的方法,其特征在于,所述采用既定的方式从所述无线数据中获取服务端所在设备的设备标识,包括:The method according to claim 6, wherein said obtaining the device identification of the device where the server is located from the wireless data in a predetermined manner comprises:
    获取得到服务端发送的无线数据;Get the wireless data sent by the server;
    从无线数据中进行随机数的提取,以作为服务端所在设备的设备标识。The random number is extracted from the wireless data as the device identification of the device where the server is located.
  9. 根据权利要求5所述的方法,其特征在于,所述从所述无线数据中获取服务端所在设备的设备标识,包括:The method according to claim 5, wherein the obtaining the device identification of the device where the server is located from the wireless data includes:
    检测服务端发送的无线数据中采用的网络地址的类型;Detect the type of network address used in the wireless data sent by the server;
    若检测到网络地址为固定类型的网络地址,则将获取到的网络地址作为发送所述无线数据的设备的设备标识;If it is detected that the network address is a fixed type of network address, the obtained network address is used as the device identifier of the device sending the wireless data;
    若检测到网络地址为随机类型的网络地址,则将所述无线数据中携带的基于指定协议生成的随机数作为发送所述无线数据的设备的设备标识。If it is detected that the network address is a random network address, the random number carried in the wireless data generated based on a specified protocol is used as the device identifier of the device sending the wireless data.
  10. 根据权利要求1-9任一所述的方法,其特征在于,所述若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据之前还包括:The method according to any one of claims 1-9, wherein if the first service data previously obtained from the server based on the designated identifier is locally stored, the first service data obtained from the service end based on the designated identifier is Before obtaining the second service data in the terminal, it also includes:
    比对从所述无线数据中获取的指定标识与本地存储的指定标识是否一致;comparing whether the specified identifier obtained from the wireless data is consistent with the specified identifier stored locally;
    若一致,则确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据。If they are consistent, it is determined that the first service data previously obtained from the server based on the specified identifier is locally stored.
  11. 根据权利要求1-10任一所述的方法,其特征在于,所述从服务端对应的无线数据中获取指定 标识之后还包括:According to the method according to any one of claims 1-10, it is characterized in that, after obtaining the specified identification from the wireless data corresponding to the server, it also includes:
    若本地未存储有基于所述指定标识从所述服务端获取的第一服务数据,则从所述服务端获取所述服务端对应的服务数据;If the first service data obtained from the server based on the specified identifier is not stored locally, obtain the service data corresponding to the server from the server;
    将所述服务端对应的服务数据中的第一服务数据存储在本地。The first service data in the service data corresponding to the server is stored locally.
  12. 根据权利要求1-11任一所述的方法,其特征在于,所述无线数据包括广播数据,所述从服务端对应的无线数据中获取指定标识,包括:The method according to any one of claims 1-11, wherein the wireless data includes broadcast data, and the obtaining the specified identifier from the wireless data corresponding to the server includes:
    从服务端对应的广播数据中获取指定标识。Obtain the specified identifier from the broadcast data corresponding to the server.
  13. 一种数据获取方法,其特征在于,应用于服务端,所述方法包括:A data acquisition method, characterized in that it is applied to a server, and the method includes:
    发送携带有指定标识的无线数据,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据;Sending wireless data carrying a specified identifier, the specified identifier is used to identify the first service data in the server, and the first service data is fixed service data;
    响应于客户端发送的与所述指定标识对应的获取请求,从所述服务端中获取第二服务数据,所述获取请求为所述客户端在确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据后发送;Responding to an acquisition request sent by the client corresponding to the specified identifier, acquire the second service data from the server, where the acquisition request is determined locally stored by the client in advance based on the specified identifier. Send after the first service data acquired by the server;
    将所述第二服务数据发送给所述客户端,以用于使所述客户端将所述第二服务数据和本地的第一服务数据作为获取到的所述服务端的服务数据。and sending the second service data to the client, so that the client uses the second service data and the local first service data as the acquired service data of the server.
  14. 根据权利要求13所述的方法,其特征在于,所述响应于客户端发送的与所述指定标识对应的获取请求,从所述服务端中获取第二服务数据包括:The method according to claim 13, wherein, in response to the acquisition request sent by the client and corresponding to the specified identifier, acquiring the second service data from the server comprises:
    响应于客户端发送的与所述指定标识对应的获取请求,从所述获取请求中获取服务数据查询范围,在所述服务端中查询所述服务数据查询范围对应的服务数据作为第二服务数据。Responding to an acquisition request sent by the client corresponding to the specified identifier, acquiring a service data query range from the acquisition request, and querying the service data corresponding to the service data query range in the server as second service data .
  15. 根据权利要求13或14所述的方法,其特征在于,所述无线数据为广播数据,所述发送携带有指定标识的无线数据,包括:The method according to claim 13 or 14, wherein the wireless data is broadcast data, and the sending of the wireless data carrying a specified identifier includes:
    发送携带有指定标识的广播数据。Send broadcast data with a specified identifier.
  16. 一种数据获取装置,其特征在于,运行于客户端,所述装置包括:A data acquisition device, characterized in that it runs on a client, and the device includes:
    标识获取单元,用于从服务端对应的无线数据中获取指定标识,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据;An identifier acquiring unit, configured to acquire a specified identifier from the wireless data corresponding to the server, the specified identifier is used to identify the first service data in the server, and the first service data is fixed service data;
    第一数据获取单元,用于若本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据,基于所述指定标识从所述服务端中获取第二服务数据,所述第二服务数据为所述服务端中除所述第一服务数据以外的服务数据;The first data acquiring unit is configured to acquire second service data from the server based on the specified identifier if the first service data previously obtained from the server based on the specified identifier is locally stored, and the second service data is obtained from the server based on the specified identifier. The second service data is service data other than the first service data in the server;
    第二数据获取单元,用于将所述第二服务数据和本地的所述第一服务数据作为获取到的所述服务端的服务数据。The second data acquiring unit is configured to use the second service data and the local first service data as the acquired service data of the server.
  17. 一种数据获取装置,其特征在于,运行于服务端,所述装置包括:A data acquisition device, characterized in that it runs on a server, and the device includes:
    标识发送单元,用于发送携带有指定标识的无线数据,所述指定标识用于标识所述服务端中的第一服务数据,所述第一服务数据为固定不变的服务数据;An identification sending unit, configured to send wireless data carrying a specified identification, the specified identification is used to identify the first service data in the server, and the first service data is fixed service data;
    数据查找单元,用于响应于客户端发送的与所述指定标识对应的获取请求,从所述服务端中获取第二服务数据,所述获取请求为所述客户端在确定本地存储有预先基于所述指定标识从所述服务端获取的第一服务数据后发送;A data search unit, configured to obtain the second service data from the server in response to the obtaining request sent by the client and corresponding to the specified identifier, the obtaining request is determined locally stored by the client based on the The specified identifier is sent after the first service data obtained from the server;
    数据发送单元,用于将所述第二服务数据发送给所述客户端,以用于使所述客户端将所述第二服务数据和本地的第一服务数据作为获取到的所述服务端的服务数据。a data sending unit, configured to send the second service data to the client, so that the client uses the second service data and the local first service data as the acquired service data.
  18. 一种电子设备,其特征在于,包括一个或多个处理器以及存储器;An electronic device, characterized in that it includes one or more processors and memory;
    一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行权利要求1-12任一所述的方法。One or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any one of claims 1-12.
  19. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被处理器运行时执行权利要求1-12任一所述的方法。A computer-readable storage medium, wherein a program code is stored in the computer-readable storage medium, wherein the method according to any one of claims 1-12 is executed when the program code is run by a processor.
PCT/CN2022/108839 2021-08-20 2022-07-29 Data acquisition method and apparatus, electronic device, and storage medium WO2023020253A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110963349.5 2021-08-20
CN202110963349.5A CN113691609B (en) 2021-08-20 2021-08-20 Data acquisition method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2023020253A1 true WO2023020253A1 (en) 2023-02-23

Family

ID=78581083

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/108839 WO2023020253A1 (en) 2021-08-20 2022-07-29 Data acquisition method and apparatus, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN113691609B (en)
WO (1) WO2023020253A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113691610B (en) * 2021-08-20 2024-04-09 Oppo广东移动通信有限公司 Data acquisition method and device, electronic equipment and storage medium
CN113691609B (en) * 2021-08-20 2024-04-09 Oppo广东移动通信有限公司 Data acquisition method and device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528578A (en) * 2015-09-15 2017-03-22 阿里巴巴集团控股有限公司 An information display method and device
CN107092634A (en) * 2017-02-13 2017-08-25 口碑控股有限公司 The implementation method and device of page preview
US20170279929A1 (en) * 2016-03-25 2017-09-28 The Trustees Of The Stevens Institute Of Technology High-performance web server, protocol and client
CN110020278A (en) * 2017-09-08 2019-07-16 阿里巴巴集团控股有限公司 Displaying, providing method, client and the server of page data
CN110598149A (en) * 2019-08-15 2019-12-20 平安普惠企业管理有限公司 Webpage access method, device and storage medium
CN113691610A (en) * 2021-08-20 2021-11-23 Oppo广东移动通信有限公司 Data acquisition method and device, electronic equipment and storage medium
CN113691609A (en) * 2021-08-20 2021-11-23 Oppo广东移动通信有限公司 Data acquisition method and device, electronic equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350841A (en) * 2007-07-17 2009-01-21 华为技术有限公司 Method for establishing medium resource access relation as well as communication system and relevant equipment
CN104683459B (en) * 2015-02-13 2018-05-11 华为技术有限公司 A kind of method and storage system for sending business datum
CN105553954B (en) * 2015-12-09 2020-01-21 百度在线网络技术(北京)有限公司 Data processing method and system
CN105704252B (en) * 2016-04-26 2019-05-07 青岛海信电器股份有限公司 Bluetooth low energy device data transmission method and device
CN108170723B (en) * 2017-12-07 2020-09-29 维沃移动通信有限公司 Webpage resource acquisition method, terminal equipment, server and system
CN110049503B (en) * 2018-01-15 2022-07-15 中国移动通信有限公司研究院 Method and equipment for acquiring data
CN110830538B (en) * 2018-08-13 2022-06-14 华为技术有限公司 Message transmission method, device and storage medium
CN109120851B (en) * 2018-09-21 2020-09-22 维沃移动通信有限公司 Image processing method and device and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528578A (en) * 2015-09-15 2017-03-22 阿里巴巴集团控股有限公司 An information display method and device
US20170279929A1 (en) * 2016-03-25 2017-09-28 The Trustees Of The Stevens Institute Of Technology High-performance web server, protocol and client
CN107092634A (en) * 2017-02-13 2017-08-25 口碑控股有限公司 The implementation method and device of page preview
CN110020278A (en) * 2017-09-08 2019-07-16 阿里巴巴集团控股有限公司 Displaying, providing method, client and the server of page data
CN110598149A (en) * 2019-08-15 2019-12-20 平安普惠企业管理有限公司 Webpage access method, device and storage medium
CN113691610A (en) * 2021-08-20 2021-11-23 Oppo广东移动通信有限公司 Data acquisition method and device, electronic equipment and storage medium
CN113691609A (en) * 2021-08-20 2021-11-23 Oppo广东移动通信有限公司 Data acquisition method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113691609B (en) 2024-04-09
CN113691609A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
WO2023020253A1 (en) Data acquisition method and apparatus, electronic device, and storage medium
WO2023020187A1 (en) Data obtaining methods and apparatuses, electronic device and storage medium
US10028319B2 (en) Wi-fi connection method and wi-fi connection system for mobile terminal
US8572248B2 (en) Efficient service discovery for peer-to-peer networking devices
EP3413594B1 (en) Methods for connecting communication devices, terminal device and server system
WO2020156256A1 (en) Data packet forwarding method and apparatus, and terminal device and storage medium
CN110730445A (en) Paging processing method, device, electronic equipment and storage medium
WO2020156255A1 (en) Payment method, device, system, mobile terminal, payment machine, and server
WO2020206660A1 (en) Network resource request method and apparatus, electronic device and storage medium
WO2020228038A1 (en) Domain name processing method, apparatus, electronic device, and storage medium
WO2015010591A1 (en) Method and terminal device for adding contacts
CN111338710A (en) Application program control method and device, electronic equipment and storage medium
CN109725543B (en) Equipment control code configuration method and device, cloud server and network system
CN103413091B (en) The method for supervising of malicious act and device
CN114745324A (en) Equipment identification method, device, storage medium and routing equipment
CN110166823B (en) Screen projection method and related device
WO2020043059A1 (en) Method and apparatus for displaying service identifier and storage medium
CN111511043A (en) Network connection method, device, electronic equipment and storage medium
CN108174378B (en) Number identification method, device, terminal and storage medium
CN103763087B (en) Information processing method and electronic equipment
CN112738789B (en) SIM card locking method and device, storage medium and electronic equipment
CN112994849B (en) Method, apparatus, device and medium for determining mobile communication terminal information
CN113677039A (en) Bluetooth-based equipment connection method and device, electronic equipment and storage medium
CN113596827A (en) Key generation method and device, electronic equipment and storage medium
CN104113837A (en) Method and device for access authentication of wireless local area network

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22857565

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE