Far field communication method, terminal equipment and readable storage medium
By storing effective far-field communication information in the terminal device and directly obtaining and using the service server address, the time-consuming problem of terminal devices when establishing a far-field communication connection is solved, improving user experience and reducing power consumption.
Patent Information
- Application Number
- CN202310859982.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-12
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2043-07-12
AI Technical Summary
When a terminal device establishes a far-field communication connection, the process of retrieving the server information of the server takes a long time, resulting in an extended connection establishment time and affecting the user experience.
Store valid far-field communication information in the terminal device, including the service server address and the information valid time, and directly obtain the stored information to establish a connection with the service server, reducing the number of interactions and time with the retrieval server.
By directly obtaining stored service server information, the time spent establishing connections between terminal devices and servers is reduced, the user experience is improved, and the time and power consumption of far-field communication establishment between terminal devices is reduced.
Smart Images

Figure CN119316421A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a far-field communication method, a terminal device, and a readable storage medium. Background Art
[0002] With the development of communication technology, different terminal devices can establish far-field communication through a server. Far-field communication is long-distance communication. Far-field communication technology may include client / server (C / S) technology, peer-to-peer (P2P) technology, etc.
[0003] For example, Figure 1 1 shows a schematic diagram of a scenario of far-field communication between terminal devices, for example, showing a far-field communication connection established between a mobile phone 10 and a smart watch 20. Specifically, as Figure 1 As shown, the mobile phone 10 sends a request to query the address of the business server 1 to the search server 1, and the smart watch 20 sends a request to query the address of the business server 2 to the search server 2. Based on the query requests sent by the mobile phone 10 and the smart watch 20, the search server 1 and the search server 2 assign the address of the business server 1 to the mobile phone 10 and return the result to the mobile phone 10, and assign the address of the business server 2 to the smart watch 20 and return the result to the smart watch 20. Further, the mobile phone 10 connects with the business server 1 based on the address of the business server 1 returned by the search server 1, and the smart watch 20 connects with the business server 2 based on the address of the business server 2 returned by the search server 2. Finally, the business server 1 and the business server 2 perform connection authentication by sending handshake protocols to each other, establish a communication connection, that is, establish a far-field communication transmission channel, and complete the far-field communication connection between the mobile phone 10 and the smart watch 20.
[0004] However, the interactive process of a terminal device such as a smart watch obtaining information based on a retrieval server takes a long time, which makes the connection between the smart watch and the business server take a long time. This will further cause the smart watch to take a longer time to establish a far-field communication connection with other terminal devices such as a mobile phone based on the business server, affecting the user experience. Summary of the invention
[0005] In view of this, the present application provides a far-field communication method, a terminal device and a readable storage medium.
[0006] In a first aspect, the present application provides a far-field communication method, in which a first terminal device determines that the first terminal device stores first far-field communication information, and the first far-field communication information includes a first address, wherein the first address is a first server address required for the first terminal device to establish far-field communication; corresponding to the first far-field communication information satisfying an information validity condition, the first terminal device establishes a connection with a second terminal device through the first server address; wherein the information validity condition includes that the first far-field communication information is within a first valid time of the first far-field communication information.
[0007] In some embodiments, the first far-field server information may be first business server information, the first server may be a first business server, and the first server address may be a first business server address. When the first terminal device determines that the first business server information is stored, the first business server information includes the first business server address; when it is determined that the first business server information meets the information validity condition, the first terminal device may establish a connection with the second terminal device through the first business server address. The information validity condition may be that the moment when the first terminal device currently obtains the first business server information is within the first valid time of the first business server information, that is, the first valid storage time of the first business server information in the first terminal device.
[0008] Based on the above solution, the first terminal device can directly obtain the first far-field communication information stored in the first terminal device when valid first far-field communication information is stored in the first terminal device, and then the first terminal device can connect to the corresponding first server based on the first server address in the first far-field communication information, thereby realizing the connection between the first terminal device and the second terminal device. The time consumption of the process of establishing the connection between the first terminal device and the first server is reduced, and the time consumption of the process of establishing the connection between the first terminal device and the second terminal device is further reduced, thereby improving the user experience.
[0009] In a possible implementation of the first aspect above, the first terminal device determines that the first terminal device stores first far-field communication information, including: the first terminal device determines whether the first storage space stores the first far-field communication information; corresponding to the first storage space storing the first far-field communication information, determining that the first terminal device stores the first far-field communication information; corresponding to the first storage space not storing the first far-field communication information, determining whether the second storage space exists and whether the second storage space stores the first far-field communication information; corresponding to the second storage space existing and storing the first far-field communication information, determining that the first terminal device stores the first far-field communication information.
[0010] In some embodiments, the first storage space may be a first cache of the first terminal device, and the second storage space may be a second cache of the first terminal device. The first storage space may be a storage space that exists by default in the first terminal device. When the first terminal device determines that the first storage space stores the first business server information, it is determined that the first terminal device stores the first business server information. When the first storage space does not store the first business server information, the first terminal device may determine and determine that the second storage space exists and that the second storage space contains the first business server information, and then it is determined that the first terminal device stores the first business server information.
[0011] Based on the above scheme, the first terminal device can obtain the first far-field communication information from the first storage space or the second storage space, and then the first terminal device can connect to the corresponding first server based on the first server address in the first far-field communication information, thereby realizing the connection between the first terminal device and the second terminal device, reducing the time spent in the process of establishing the connection between the first terminal device and the first server.
[0012] In a possible implementation of the first aspect, the method for determining whether the second storage space exists includes: when a first callback interface corresponding to the first terminal device and a second callback interface of the first terminal device are both not empty, determining that the second storage space exists.
[0013] In some embodiments, a first callback interface and a second callback interface can be preset in the terminal device, wherein the first callback interface can be an interface for obtaining a cache, and the second callback interface can be an interface for saving a cache. The first terminal device can quickly determine that the second storage space exists by virtue of the fact that both callback interfaces are not empty, thereby improving the efficiency of determining whether the second storage space exists.
[0014] In a possible implementation of the first aspect above, the method includes: corresponding to the first far-field communication information stored in the second storage space of the first terminal device satisfying the information validity condition, the first far-field communication information stored in the second storage space is stored in the first storage space of the first terminal device; the first terminal device quickly obtains the first server address from the first far-field communication information stored in the first storage space.
[0015] In some embodiments, if the first terminal device acquires the first business server information from the first storage space at a higher speed than the first business server information from the second storage space, the first business server information stored in the second storage space may be stored in the first storage space, so that the first terminal device may acquire the first business server information directly based on the first storage space, thereby improving the efficiency of the first terminal device acquiring the first far-field communication information.
[0016] In a possible implementation of the first aspect above, the information validity condition further includes: there is no error status code in the first far-field communication information, wherein the error status code indicates that the first server does not support normal communication.
[0017] In some embodiments, the error status code may be "503", indicating that the status of the first service server does not support normal communication.
[0018] In a possible implementation of the first aspect above, determining that the first far-field communication information is within a first valid time of the first far-field communication information includes: acquiring a current moment of acquiring the first far-field communication information, a preset valid time duration and a preset reserved time duration of the first far-field communication information, the preset valid time duration indicating a valid storage time of the first far-field communication information stored in a first terminal device; determining a valid time of the first far-field communication information based on a moment of storing the first far-field communication information by the terminal device, the preset valid time duration and the preset reserved time duration; corresponding to a moment of currently acquiring the first far-field communication information being before the first valid time duration, determining that the first far-field communication information is within the first valid time of the first far-field communication information.
[0019] In some embodiments, for example, the current time to obtain the first business server information is 7:00 am, the preset valid time is 1 hour, the preset reserved time may be 1 minute, and the valid time of the first business server information is 7:59.
[0020] In a possible implementation of the first aspect above, the first terminal device establishes a connection with the second terminal device through the first server address; including: the first terminal device is connected to the first server corresponding to the first server address; the first server establishes a connection with the second server corresponding to the second terminal device.
[0021] In some embodiments, the first terminal device can establish a connection with the second terminal device through the first service server address, wherein the first terminal device establishes a connection with the first service server, and the second terminal device connects with its corresponding second service server, and then the first service server and the second service server can be used to establish a far-field communication connection between the first terminal device and the second terminal device. Based on this, when the near-field communication between the first terminal device and the second terminal device is disconnected, a far-field communication connection can be established through the service server.
[0022] In a possible implementation of the first aspect above, the first terminal device is connected to the first server corresponding to the first server address; it also includes: the first terminal device establishes a full-duplex communication connection with the first server corresponding to the first server address; the first terminal device obtains a status code of the first server; corresponding to the status code not being an error status code, the first terminal establishes a communication connection with the first server.
[0023] In some embodiments, the first terminal device may send a request to establish a full-duplex communication connection to the corresponding first business server based on the first business server address in the first business server information, and the request may include a message header carrying specific content. After the first business server receives the request to establish a full-duplex communication connection sent by the first terminal device, it may determine to establish a full-duplex communication connection with the terminal device based on the message header carrying specific content in the request sent by it and return the full-duplex communication connection result to the first terminal device, so that the first terminal device can further determine whether it supports normal communication based on the first business server status code after successfully establishing the full-duplex communication connection. For example, in some embodiments, when the status code is an error status code "503", it indicates that the status of the first business server does not support it to establish a communication connection with the first terminal device. That is, based on whether the status code is 503, it can be quickly determined whether the status of the first server supports normal communication.
[0024] In some embodiments, when it is determined that the status code of the first business server is the error status code "503", it means that the current first business server is unavailable, and the first terminal device clears the cache, that is, clears the information stored in the storage space, such as clearing the first business server address and other information stored in the cache.
[0025] In a possible implementation of the first aspect, corresponding to the first far-field communication information not satisfying the information validity condition, the first terminal device sends a request to the fourth server to obtain the third far-field communication information corresponding to the third server.
[0026] In some embodiments, when the first business server information does not meet the information validity condition, the first terminal device can send a request to the fourth server to obtain the third business server information corresponding to the third business server, wherein the fourth server can be a retrieval server, and the first terminal device can send a request to the retrieval server to obtain the third business server information corresponding to the third business server, and then the retrieval server can allocate the third business server information corresponding to the third business server to the first terminal device, so that the first terminal device can connect to the third business server based on the third business server address in the third business server information, thereby realizing the connection between the first terminal device and the second terminal device based on the third business server.
[0027] In a possible implementation of the first aspect above, the first storage space is a memory, and the second storage space is a hard disk.
[0028] In a possible implementation of the first aspect above, the first server and the third server are business servers, and the fourth server is a retrieval server.
[0029] It can be understood that in some embodiments, the fourth server can allocate the first business server information corresponding to the first business server to the first terminal device or allocate the third business server information corresponding to the third business server to the first terminal device based on the request of the first terminal device. When there is no business server information in the first terminal device, new business server information can still be obtained through the fourth server, i.e., the retrieval server, and then a far-field communication connection can be established with the second terminal device based on the business server address corresponding to the new business server information.
[0030] In a second aspect, the present application provides a terminal device, comprising: a memory for storing instructions; a processor for executing instructions to implement the far-field communication method provided in the first aspect and any possible implementation of the first aspect.
[0031] In a third aspect, the present application provides a readable storage medium having instructions stored thereon, which, when executed, enables a terminal device to implement the far-field communication method provided by the first aspect and any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 According to some embodiments of the present application, a schematic diagram of establishing a far-field communication connection is shown;
[0033] Figure 2 According to some embodiments of the present application, a schematic diagram of a far-field communication system 200 is shown;
[0034] Figure 3 According to some embodiments of the present application, a flowchart of a far-field communication method is shown;
[0035] Figure 4 According to some embodiments of the present application, an interaction schematic diagram of a far-field communication method is shown;
[0036] Figure 5 According to some embodiments of the present application, a schematic diagram of the hardware structure of a terminal device 100 is shown. DETAILED DESCRIPTION
[0037] The illustrative embodiments of the present application include, but are not limited to, a far-field communication method, a terminal device, and a readable storage medium.
[0038] The technical solution of the present application is described below in conjunction with the accompanying drawings.
[0039] As mentioned above, the business server information requires the mobile phone and smart watch to send query requests to the search server respectively, and then the search server returns the business server address to the mobile phone and smart watch respectively, so that the mobile phone and smart watch can establish a far-field communication transmission channel between the mobile phone and the smart watch through their respective business server information to achieve far-field communication. However, the interaction process between the smart watch and the search server takes a long time, which will further lead to a long connection process between the smart watch and the business server, and the time required for the smart watch to establish far-field communication with the mobile phone will also be longer, affecting the user experience.
[0040] In order to solve the above problems, an embodiment of the present application provides a far-field communication method, which stores the business server information obtained by the terminal device through the retrieval server in the memory of the terminal device. The business server information may include the business server address, interface information, and information validity period, etc. The next time the terminal device needs to obtain the business server information, the terminal device can directly obtain the business server information stored in its memory to achieve a connection with the business server corresponding to the business server information. Among them, the information validity period can represent the effective storage time of the business server information stored in the terminal device memory. When the storage time of the business server information in the memory exceeds the information validity period, the terminal device can obtain the business server information again through the retrieval server.
[0041] Based on the above scheme, when the terminal device obtains business server information based on the retrieval server, it can directly obtain the business server information stored in the terminal device memory if there is valid business server information in the terminal device memory, and then the terminal device can connect to the corresponding business server based on the business server address in the obtained business server information, thereby reducing the long time consumed in the interaction between the terminal device and the retrieval server, and further reducing the time consumed in establishing far-field communication between terminal devices, thereby improving the user experience.
[0042] It can be understood that in some embodiments, the memory of the terminal device can be called the cache of the terminal device, and the memory of the terminal device can include a first cache (storage) and a second cache, the first cache is the first storage space, and the second cache is the second storage space.
[0043] For example, the first cache may be the memory of the terminal device, and the second cache may be the hard disk of the terminal device, which is not limited here. By adding a second cache, when the first cache of the terminal device is unavailable, but there is a second cache storing valid business server information, communication can be established with the corresponding business server based on the business server address stored in the second cache, and further communication can be made with other terminal devices through the business server, effectively reducing the time consumption of interaction between the terminal device and the retrieval server and establishment of far-field communication between terminal devices, and reducing the power consumption of the terminal device.
[0044] In some embodiments, callback interfaces for obtaining the retrieval server cache (GET) and saving the retrieval server cache (SAVE) may be preset in advance in different terminal devices, i.e., an interface for obtaining business server information and an interface for storing business server information. If both interfaces are not empty, it can be indicated that the terminal device supports the second cache. If any one of the interfaces is empty, it can be indicated that the terminal device does not support the second cache.
[0045] In some embodiments, the search server may preset different information validity periods for different terminal devices in the service server information when returning the service server information to the terminal device. For example, when the terminal device is a mobile phone, the information validity period in the service server information obtained by the mobile phone may be 1 hour; when the terminal device is a smart watch, the information validity period in the service server information obtained by the smart watch may be 24 hours.
[0046] It is understandable that different terminal devices require different power consumption when obtaining information from the retrieval server. For example, the time and power consumption required for a smart watch to obtain information based on the retrieval server are much greater than those of a mobile phone. Therefore, when the retrieval server returns information to the smart watch, a longer information validity time can be set for the smart watch to avoid frequent interaction between the terminal device and the retrieval server, thereby reducing the power consumption of the terminal device.
[0047] In some embodiments, the validity of the business server information stored in the first cache or the second cache can be determined based on the following principles: first, there is no error code in the cache, such as error code 503, where the error code can refer to the status of the hypertext transfer protocol secure (HTTPS) or the status code returned by the business server; second, the validity period of the information in the cache cannot be less than the reserved time, where the reserved time refers to the preset time for data transmission. For example, if the information validity period is 1 hour, the reserved time can be preset to 1 minute, and the actual information validity period is 59 minutes; third, the current time < (the time to obtain the information from the search server + the cache validity period - the reserved time), where the current time refers to the time to start obtaining the business server information from the search server; the time to obtain the information from the search server refers to the time to obtain the business server information through the search server and then store it in the cache; the cache validity period is the effective storage time of the business server information stored in the cache.
[0048] In some embodiments, if the business server information in the first cache does not exist or is invalid, the existence of the second cache is determined by whether the above two callback interfaces are empty. If both callback interfaces are empty, the second cache does not exist; if both callback interfaces are not empty, the second cache exists. If it is further determined that the second cache is an invalid cache, the terminal device can reconnect to the retrieval server to obtain the latest business server information, and after obtaining the latest business server information, update it to the first cache for storage.
[0049] It can be understood that the handshake protocol refers to a type of network protocol that can be used to allow a client and a server to confirm each other's identity. The client or the server can determine that a communication connection can be established between each other based on the handshake protocol.
[0050] The far-field communication system mentioned in this application is introduced below. Figure 2 As shown, the system may include a terminal device, a retrieval server, and a business server.
[0051] The search server can be used to allocate a service server address to the terminal device, and then return service server information including the service server address to the terminal device. The service server information can also include information such as the validity period of the information.
[0052] The service server can be used as a communication medium so that multiple terminal devices can establish communication connections with each other based on service servers corresponding to different service server addresses.
[0053] The terminal device may include functional modules such as a user module, a channel module, a retrieval module and a product module.
[0054] Among them, the user module can be used to manage user information in the terminal device system, such as user registration, login, logout, password retrieval and other operations, and manage system notification reminders of the terminal device, such as system updates, prompting user operations, etc. In some embodiments, the user module can detect the operations performed by the user based on the terminal device interaction interface, and can send a request to create a far-field communication connection to the corresponding module, such as the channel module, based on the user operation.
[0055] The channel module can be used to provide a communication transmission channel for the communication between the terminal device and the server or other terminal devices; the product module can be used to store cache information in the terminal device. In some embodiments, the channel module can establish a connection with the corresponding business server based on the business server address and perform data transmission.
[0056] The retrieval module can be used to retrieve the product module to obtain the required cache information or request the retrieval server to obtain business server information, etc. In some embodiments, the retrieval module can respond to the request to create far field communication sent by the user module to the retrieval server or the retrieval server to send a request to obtain business server information.
[0057] The far-field communication method mentioned in the embodiments of the present application is described in detail below. Figure 3 A schematic diagram of a far-field communication method is shown. The execution subject is a terminal device, such as Figure 3 As shown, the specific process of the far-field communication method includes:
[0058] S101: Obtain a far field communication request.
[0059] In some embodiments, when the near-field communication between a terminal device (such as a smart watch) and another terminal device (such as a mobile phone) is disconnected, for example, the distance between the smart watch and the mobile phone increases, causing the Bluetooth communication to be disconnected, in order to enable the mobile phone to continue to communicate with the smart watch, the user can create far-field communication based on the interactive interface of the smart watch. For example, the far-field communication connection mode can be selected in the setting interface of the smart watch, and then the smart watch obtains the business server information after receiving the far-field communication request.
[0060] S102: Detect whether service server information is stored in the terminal device.
[0061] In some embodiments, the terminal device can detect whether it has stored business server information and whether the stored business server information is valid. If the terminal device has stored valid business server information, the process goes to step S103, and the terminal device can directly obtain the stored business server information; if the terminal device does not store business server information or the stored business server information is invalid, the process goes to step S104, and the terminal device can send a request to the search server to obtain new business server information.
[0062] For example, when the first cache in the terminal device exists and the business server information stored in the first cache is valid, the terminal device can directly obtain the business server information stored in the first cache, and connect to the corresponding business server based on the business server address in the business server information. When the first cache exists, but the business server information stored in the first cache is invalid, the terminal device can determine whether the second cache exists by determining whether the two callback interfaces are empty. If the two callback interfaces are not empty, that is, the second cache exists, it is further determined whether the business server information stored in the second cache is valid. If the business server information stored in the second cache is valid, the business server information stored in the second cache can be stored in the first cache, so that the terminal device can quickly obtain the business server address from the business server information stored in the first cache, and connect to the corresponding business server based on the business server address.
[0063] It is understandable that in other embodiments, the business server information stored in the second cache may not be stored in the first cache, and the terminal device may directly obtain the business server address based on the business server information stored in the second cache, and connect to the corresponding business server based on the business server address, which is not limited here.
[0064] S103: The terminal device directly obtains the service server information.
[0065] In some embodiments, if valid service server information is stored in the terminal device, the terminal device may directly obtain the service server address from the service server information stored therein, so as to connect to the corresponding service server based on the service server address.
[0066] S104: Acquire the service server information through the search server, record the acquisition time point, and store the service server information etc. in the cache of the terminal device.
[0067] In some embodiments, when the business server information is not stored in the terminal device or the stored business server information is invalid, the terminal device may send a request to the retrieval server to obtain new business server information. The retrieval server may reallocate the business server address for the terminal device based on the request, and return the business server information including the business server address to the terminal device. After the terminal device obtains the business server information returned by the retrieval server, it records the time point of acquisition and stores the business server information in multiple caches of the terminal device, so that the terminal device can directly obtain the business server information from its cache next time when it determines that its cache exists and is valid.
[0068] S105: The terminal device establishes a Websocket connection with the corresponding business server based on the business server address in the business server information obtained through the search server.
[0069] In some embodiments, the terminal device may send a request to establish a Websocket connection to the corresponding business server based on the business server address in the business server information, and the request may include a message header carrying specific content. After the business server receives the request to establish far-field communication sent by the terminal device, it may determine to establish a Websocket communication connection with the terminal device based on the message header carrying specific content in the request sent by it and return the result to the terminal device.
[0070] It can be understood that Websocket is full-duplex communication, which is essentially a protocol based on the transmission control protocol (TCP) TCP. HTML5 is a language description method for building network (Web) content. The TCP protocol is a communication protocol for connection. The TCP data packet consists of two parts: the header and the data. The TCP protocol can establish a connection through a three-way handshake (Three-Way Handshake).
[0071] It is understandable that in other embodiments, if the business server cannot establish a Websocket communication connection based on the message header carrying specific content sent by the channel module, it can return to the above step S104 and resend a request to create far-field communication to the channel module through the user module.
[0072] S106: Determine whether the service server supports normal communication.
[0073] In some embodiments, after the business server establishes a Websocket connection with the terminal device, the terminal device can determine whether the current state of the business server supports normal communication by retrieving the business server status code returned by the server, that is, determining the state of HTTP (Hypertext Transfer Protocol). For example, when the business server status code is "503", it is determined that the current business server is unavailable, and the channel module notifies the retrieval module to clear the cache, that is, clear the business server information, and return to step S104. The retrieval module resends a request to the retrieval server to obtain the business server information. Otherwise, it indicates that the current state of the business server supports normal communication. When it is determined that the business server status code is correct and normal communication can be carried out, go to step S107, and the business server can synchronize its cloud parameters to the terminal device.
[0074] It can be understood that "503" is an HTTP status code, which is a return status of a server error. The channel module can determine that the current business server is unavailable based on the recognition of this status code.
[0075] S107: The terminal device obtains the cloud synchronization parameters of the business server.
[0076] In some embodiments, when it is determined that the service server status code is correct and normal communication can be carried out, the service server can synchronize its cloud parameters to the terminal device, wherein the synchronized cloud parameters can be the address information (internet protocol address, IP) and software and hardware parameters of the service server.
[0077] S108: The terminal device and the service server respectively determine a communication connection based on the handshake message.
[0078] In some embodiments, after the business server synchronizes the cloud parameters to the terminal device, the terminal device can send a handshake message to the business server, and the handshake message can include authentication parameters. After receiving the handshake message, the business server performs authentication based on the authentication parameters it carries. If the authentication is correct, the handshake message is forwarded to the terminal device, and the handshake message can also include authentication parameters. After the terminal device receives the handshake message forwarded by the business server, it authenticates the authentication parameters. If the authentication is correct, it means that the terminal device and the business server can establish a far-field communication connection. After the connection is established, the terminal device can perform far-field communication with other terminal devices through the business server.
[0079] The far-field communication method mentioned in the embodiments of the present application is described in detail below. Figure 4 FIG. 1 shows an interactive flow chart of a far-field communication method. Figure 4 As shown, the specific interaction process of the far-field communication method includes:
[0080] S201: establishing far-field communication.
[0081] In some embodiments, when the near field communication between a terminal device and another terminal device is disconnected, for example, the distance between a mobile phone and a smart watch increases, causing their Bluetooth to be disconnected and unable to continue to communicate via Bluetooth. In order for the terminal device to continue to communicate with other terminal devices, the user can create far field communication based on the interactive interface of the terminal device, and then the user module detects the user's operation and can send a request to the channel module to create far field communication.
[0082] S202: The user module sends a request for establishing far-field communication to the channel module.
[0083] In some embodiments, the user module of the terminal device may send a request for establishing the far-field communication to the channel module of the terminal device based on the terminal device starting to establish the far-field communication.
[0084] S203: The channel module sends a request for obtaining the address of the business server to the search module.
[0085] In some embodiments, after receiving the request sent by the user module to establish far-field communication, the channel module of the terminal device can further send a request to the retrieval module of the terminal device to obtain the business server address. The business server address refers to the communication medium used as a terminal device to communicate with other terminal devices in the far field. The terminal device can be connected to the corresponding business server based on the business server address, and then the terminal device can communicate with other terminal devices in the far field based on the business server. It can be understood that the channel module as a functional module of the terminal device can be used to provide a communication transmission channel for the terminal device to communicate with the server or other terminal devices.
[0086] S204: The search module determines whether the first cache exists.
[0087] In the embodiment of the present application, determining whether the first cache exists may refer to determining whether the service server information stored in the first cache exists.
[0088] In some embodiments, the retrieval module determines whether the first cache exists based on the request for obtaining the business server address sent by the channel module. The first cache refers to the default storage space in the terminal device, which can be used to store information about servers that can communicate with the terminal device, such as the address of the business server. When the first cache exists, go to step S205 to further determine whether the business server information stored in the first cache is valid, otherwise go to step S206, and the retrieval module sends a request to the product module to obtain the second cache.
[0089] It can be understood that in some embodiments, the first cache may be an internal memory of the terminal device, which is not limited here.
[0090] It can be understood that the information stored in the first cache may be business server information, wherein the business server information may include a business server address, interface information, and information validity period, etc., which is not limited here.
[0091] S205: The retrieval module determines whether the first cache is valid.
[0092] In the embodiment of the present application, determining whether the first cache is valid may refer to determining whether the service server information stored in the first cache is valid.
[0093] In some embodiments, when it is determined that the first cache exists, the search module further determines whether the business server information stored in the first cache is valid. When it is determined that the stored business server information is valid, the business server information stored in the first cache can be directly obtained, and the process goes to step S213, and the business server address in the obtained business server information can be sent to the channel module. When it is determined that the stored business server information is invalid, the process goes to step S206', and the search module sends a request to the product module to obtain the second cache.
[0094] In some embodiments, whether the information stored in the first cache is valid can be determined from the following aspects. First, there is no error code in the first cache of the terminal device. For example, the error code can refer to the status code of the Hypertext Transfer Security Protocol HTTPS, whether the status code returned by the business server is "503", etc., which is not limited here. Second, the information validity period of the business server information stored in the first cache cannot be less than the reserved time, wherein the information validity period refers to the effective storage time of the business server information stored in the terminal device memory, that is, the cache, and the reserved time means that if the information validity period is 1 hour, the reserved time can be preset to 1 minute, and the actual information validity period is 59 minutes. Third, the current time < (the time to obtain the information from the retrieval server + the cache validity period - the reserved time), wherein the current time refers to the time to prepare to obtain the business server information; the time to obtain the information from the retrieval server refers to the time to obtain the business server information through the retrieval server and then store it in the first cache; the cache validity period refers to the effective storage time of the business server information stored in the first cache, wherein the cache validity period minus the reserved time is the actual effective storage time of the business server information stored in the first cache.
[0095] S206: The retrieval module sends a request for acquiring the second cache to the product module.
[0096] In the embodiment of the present application, the request for obtaining the second cache may refer to a request for obtaining the service server information stored in the second cache.
[0097] In some embodiments, when the retrieval module determines that the information stored in the first cache in the product module does not exist, a request for obtaining the second cache can be sent to the product module. The second cache refers to a storage space in the terminal device, which can be used to store information about a server that can communicate with the terminal device, such as the address of a business server, and the terminal device can use the address of the business server stored in the second cache to connect to the corresponding business server.
[0098] It is understood that a get cache (GET) callback interface and a save cache (SAVE) callback interface can be preset in the terminal device, that is, an interface for obtaining business server information and an interface for storing business server information. Then, whether the second cache exists can be determined by whether the two callback interfaces are empty. In some embodiments, if both callback interfaces are not empty, it can be said that the second cache exists; in other embodiments, if any one of the callback interfaces is empty, it can be said that the second cache does not exist. It is understood that the second cache can be a flash memory / hard disk storage of the terminal device, which is not limited here.
[0099] S206′: The search module sends a request for acquiring the second cache to the product module.
[0100] In some embodiments, when the retrieval module determines that the information stored in the first cache in the product module is invalid, a request for obtaining the second cache may be sent to the product module.
[0101] S207: The product module returns the decrypted second cache to the retrieval module.
[0102] In the embodiment of the present application, the decrypted second cache that is returned may refer to the service server information stored in the decrypted second cache that is returned.
[0103] In some embodiments, when the retrieval module determines that the second cache exists, the service server information stored in the decrypted second cache may be read through a callback interface (GET).
[0104] It can be understood that in some embodiments, the speed at which the terminal device obtains business server information from the first cache is higher than the speed at which the terminal device obtains business server information from the second cache. In this case, the business server information stored in the second cache can be stored in the first cache, so that the terminal device can subsequently obtain the business server information directly based on the first cache, thereby improving the efficiency of the terminal device in obtaining the business server information.
[0105] It is understandable that in other embodiments, the product module may not store the business server information stored in the second cache in the first cache, which is not limited here.
[0106] S208: The retrieval module determines whether the second cache is valid.
[0107] In the embodiment of the present application, determining whether the second cache is valid may refer to determining whether the service server information stored in the second cache is valid.
[0108] In some embodiments, after the retrieval module receives the decrypted business server information stored in the second cache, it further determines whether the business server information stored in the second cache is valid. If it is determined to be valid, it goes to step S213 and sends the business server address in the acquired business server information to the channel module; if it is determined to be invalid, it goes to step S209 and the retrieval module sends a request to query the business server address to the retrieval server.
[0109] In some embodiments, whether the information stored in the second cache is valid can be determined from the following aspects: First, there is no error code in the second cache of the terminal device. For example, the error code can refer to the status code of the Hypertext Transfer Security Protocol HTTPS, whether the status code returned by the business server is "503", etc., which is not limited here. Second, the information validity period of the business server information stored in the second cache cannot be less than the reserved time, wherein the information validity period refers to the effective storage time of the business server information stored in the terminal device memory, that is, the cache, and the reserved time means that if the information validity period is 1 hour, the reserved time can be preset to 1 minute, and the actual information validity period is 59 minutes. Third, the current time < (the time to obtain the information from the retrieval server + the cache validity period - the reserved time), wherein the current time refers to the time to prepare to obtain the business server information; the time to obtain the information from the retrieval server refers to the time to obtain the business server information through the retrieval server and then store it in the second cache; the cache validity period refers to the effective storage time of the business server information stored in the second cache, wherein the cache validity period minus the reserved time is the actual effective storage time of the business server information stored in the second cache.
[0110] S209: The search module sends a request for querying business server information to the search server.
[0111] In some embodiments, when the search module determines that the second cache in the product module does not exist or the business server information stored in the second cache is invalid, in order to obtain the business server information, the search module may send a request to the search server to obtain the business server information.
[0112] It can be understood that the retrieval server refers to a server that can allocate a service server to the terminal device based on a request sent by the retrieval module of the terminal device, and can return service server information including the service server address to the retrieval module.
[0113] S210: The search server returns the business server information and status code to the search module.
[0114] In some embodiments, after receiving a request for obtaining business server information sent by the retrieval module, the retrieval server can assign a business server to the terminal device, and return the business server information stored in the JSON data exchange format including the business server address and the status code to the retrieval module after parsing, so that the terminal device can connect to the corresponding business server based on the business server address received by the retrieval module, wherein the status code can indicate whether the status of the business server is available, that is, whether it supports normal communication.
[0115] As you can understand, JSON is a lightweight data exchange format that can exchange data between multiple computer languages and is easy for machines to parse and generate.
[0116] S211: The retrieval module records the time point of receiving the service server information and the status code, and stores the service server information in the first cache.
[0117] In some embodiments, after receiving the business server information and status code returned by the search server, the search module records the time point when the search module receives the business server information, and stores the received business server information and status code in the first cache. It can be understood that in some embodiments, the business server information and the time point when it reaches the search module can also be obtained through the callback interface (SAVE).
[0118] S212: The retrieval module sends an instruction to save the second cache to the product module.
[0119] In some embodiments, after the retrieval module receives the business server information and status code returned by the retrieval server, it can send an instruction to save the second cache to the product module, so that the product module encrypts the obtained business server information and stores it in the second cache, which can be used to protect communication privacy.
[0120] S213: The retrieval module sends the business server address in the business server information to the channel module.
[0121] In some embodiments, the retrieval module may send the business server in the business server information obtained through the first cache, the second cache and the retrieval server to the channel module, so that the channel module can establish a communication connection with the corresponding business server based on the business server address.
[0122] S214: The channel module sends a request to establish a Websocket connection to the corresponding business server based on the business server address.
[0123] In some embodiments, the channel module may send a request to establish a Websocket connection to the corresponding business server based on the business server address in the acquired business server information, and the request may include a message header carrying specific content.
[0124] It can be understood that Websocket is a two-way network transmission protocol based on the Transmission Control Protocol TCP.
[0125] S215: The business server returns the result of establishing the Websocket connection to the channel module.
[0126] In some embodiments, after the business server receives a request to establish far-field communication sent by the channel module based on its corresponding business server address, it can determine to establish a Websocket communication connection with the channel module based on the message header carrying specific content sent by the channel module and return the result to the channel module.
[0127] It can be understood that Websocket is essentially a TCP-based protocol, in which HTML5 is a language description method for building network (Web) content. The TCP protocol is a communication protocol used for connection. The TCP data packet consists of two parts: the header and the data. The TCP protocol can establish a connection through a three-way handshake.
[0128] S216: The channel module determines whether the service server status is 503.
[0129] In some embodiments, after the business server establishes a Websocket connection with the channel module, the channel module can determine whether the status of the current business server supports normal communication by whether the business server status code is "503", that is, determine the status of HTTP (Hypertext Transfer Protocol). When it is determined that the status code of the business server is "503", it means that the current business server is unavailable, and go to step S217 to notify the retrieval module to clear the cache, that is, clear the business server address and other information stored in the cache, and return to step S203 to notify the retrieval module to send a request to the retrieval server to obtain the business server information. Otherwise, it means that the current state of the channel module supports normal communication. When it is determined that the status code of the business server is not "503", it means that the current business server supports normal communication, and go to step S218 to wait for the business server to synchronize the cloud parameters to the channel module.
[0130] It can be understood that "503" is an HTTP status code, which is a return status of a server error. The channel module can determine that the current business server is unavailable based on the recognition of this status code.
[0131] S217: The channel module notifies the retrieval module to clear the cache.
[0132] In some embodiments, when it is determined that the status code of the business server is "503", it means that the current business server is unavailable, and the retrieval module is notified to clear the cache, for example, clear the business server address and other information stored in the cache, and return to step S203, so that the channel module sends a request to the retrieval module to obtain the business server address.
[0133] S218: The channel module waits for the business server to synchronize cloud parameters.
[0134] In some embodiments, when it is determined that the status code of the service server is not "503", the channel module waits for the service server to synchronize cloud parameters.
[0135] S219: The business server synchronizes the cloud parameters to the channel module.
[0136] In some embodiments, when it is determined that the business server status code is correct and normal communication can be carried out, the business server can synchronize its cloud parameters to the channel module, wherein the synchronized cloud parameters can be the address information, software and hardware parameters, etc. of the business server.
[0137] S220: The channel module sends a handshake message to the service server, and carries authentication parameters.
[0138] In some embodiments, after the business server synchronizes the cloud parameters to the channel module, the channel module may send a handshake message to the business server, and the handshake message may include authentication parameters.
[0139] S221: The business server replies to the channel module with a handshake message that carries authentication parameters.
[0140] In some embodiments, after receiving the handshake message, the service server performs authentication based on the authentication parameters carried in the handshake message. If the authentication is correct, the service server replies to the channel module with a handshake message, which may also include the authentication parameters.
[0141] S222: The channel module authenticates the authentication parameters of the other end.
[0142] In some embodiments, after receiving the handshake message forwarded by the service server, the channel module authenticates the authentication parameters. If the authentication is correct, it means that the terminal device and the service server can establish a communication connection.
[0143] S223: The channel module sends the far field communication establishment result to the user module.
[0144] In some embodiments, after the channel module successfully establishes a communication connection with the service processor, the channel module may send a successful establishment result of the far-field communication to the user module, and the terminal device may perform data transmission with the service server based on the channel module.
[0145] Through the far-field communication method provided in the embodiment of the present application, before the terminal device obtains the business server information based on the retrieval server, it can directly obtain the business server information stored in the terminal device memory when there is valid business server information in the terminal device memory, and then the terminal device can connect to the corresponding business server based on the business server address in the obtained business server information, thereby reducing the long time consumed in the interaction between the terminal device and the retrieval server, and further reducing the time consumed in establishing far-field communication between terminal devices, thereby improving the user experience.
[0146] To facilitate understanding of the technical solutions of the various embodiments of the present application, the hardware structure of the terminal device 100 is introduced below.
[0147] It can be understood that the terminal device 100 can be any terminal device that can run a neural network model, including but not limited to mobile phones, wearable devices (such as smart watches, smart bracelets, etc.), tablet computers, desktops, laptops, handheld computers, notebook computers, ultra-mobile personal computers (ultra-mobile personal computers, UMPC), netbooks, augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) devices, etc., and the embodiments of the present application are not limited thereto.
[0148] For example Figure 5 According to some embodiments of the present application, a schematic diagram of the structure of a terminal device 100 is shown. Figure 5 The terminal device 100 shown includes one or more processors 101 , system memory 102 , non-volatile memory (NVM) 103 , a communication interface 104 , an input / output (I / O) device 105 , a system control logic 106 , and instructions 107 .
[0149] Wherein: the processor 101 may include one or more processing units, for example, may include a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a microprocessor MCU (micro-programmed control unit), an artificial intelligence (AI) processor or a processing module or processing circuit of a programmable logic device (field programmable gate array, FPGA) may include one or more single-core or multi-core processors.
[0150] The system memory 102 is a volatile memory, such as a random-access memory (RAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), etc. The system memory is used to temporarily store data and / or instructions. For example, in some embodiments, the system memory 102 can be used to store the above-mentioned business server information, etc.
[0151] The non-volatile memory 103 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, the non-volatile memory 103 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as a hard disk drive (HDD), a compact disc (CD), a digital versatile disc (DVD), a solid-state drive (SSD), etc. In some embodiments, the non-volatile memory 103 may also be a removable storage medium, such as a secure digital (SD) memory card, etc. The non-volatile memory 103 may be used to store the above-mentioned business server information, etc.
[0152] The instruction 107 may include: being executed by at least one of the processors 101 to enable the terminal device 100 to implement the far-field communication method provided by each embodiment of the present application.
[0153] The communication interface 104 may include a transceiver for providing a wired or wireless communication interface for the terminal device 100, thereby communicating with any other suitable device through one or more networks. In some embodiments, the communication interface 104 may be integrated into other components of the terminal device 100, for example, the communication interface 104 may be integrated into the processor 101.
[0154] The input / output (I / O) device 105 may include input devices such as a keyboard, a mouse, etc., and output devices such as a display, etc. A user may interact with the terminal device 100 via the input / output (I / O) device 105 .
[0155] System control logic 106 may include any suitable interface controller to provide any suitable interface with other modules of terminal device 100. For example, in some embodiments, system control logic 106 may include one or more memory controllers to provide interfaces to system memory 102 and non-volatile memory 103.
[0156] In some embodiments, at least one of the processors 101 may be packaged together with the logic of one or more controllers for the system control logic 106 to form a system in package (SiP). In other embodiments, at least one of the processors 101 may also be integrated with the logic of one or more controllers for the system control logic 106 on the same chip to form a system-on-chip (SoC).
[0157] The various embodiments disclosed in the present application may be implemented in hardware, software, firmware, or a combination of these implementation methods. The embodiments of the present application may be implemented as a computer program or program code executed on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0158] Program code can be applied to input instructions to perform the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0159] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.
[0160] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.
[0161] In the accompanying drawings, some structural or method features may be shown in a particular arrangement and / or order. However, it should be understood that such a particular arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0162] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0163] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0164] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the present application.
Claims
1. A far-field communication method, characterized in that: include: The first terminal device determines that the first terminal device stores first far-field communication information, where the first far-field communication information includes a first address, wherein the first address is a first server address required for the first terminal device to establish far-field communication; Corresponding to the first far-field communication information satisfying the information validity condition, the first terminal device establishes a connection with the second terminal device through the first server address; The information validity condition includes that the first far-field communication information is within a first valid time of the first far-field communication information.
2. The method according to claim 1, characterized in that: The first terminal device determines that the first terminal device stores first far-field communication information, including: The first terminal device determines whether the first storage space of the first terminal device stores the first far-field communication information; Corresponding to the first storage space storing the first far-field communication information, determining that the first terminal device stores the first far-field communication information; Corresponding to the first storage space not storing the first far-field communication information, determining whether a second storage space of the first terminal device exists and whether the second storage space stores the first far-field communication information; Corresponding to the existence of the second storage space and the storage of the first far-field communication information, it is determined that the first terminal device stores the first far-field communication information.
3. The method according to claim 2, characterized in that Methods for determining whether the second storage space exists include: The first callback interface corresponding to the first terminal device and the second callback interface corresponding to the first terminal device are both not empty, and it is determined that the second storage space exists.
4. The method according to claim 3, characterized in that The method comprises: Corresponding to the first far-field communication information stored in the second storage space satisfying an information validity condition, storing the first far-field communication information stored in the second storage space into the first storage space of the first terminal device; The first terminal device quickly obtains the first server address from the first far-field communication information stored in the first storage space.
5. The method according to any one of claims 1 to 4, characterized in that: The information validity condition also includes: there is no error status code in the first far-field communication information, wherein the error status code indicates that the first server does not support normal communication.
6. The method according to claim 5, characterized in that The determining that the first far-field communication information is within a first valid time of the first far-field communication information includes: Acquire the moment when the first terminal device currently acquires the first far-field communication information, a preset effective duration and a preset reserved duration of the first far-field communication information, wherein the preset effective duration indicates the effective storage time of the first far-field communication information stored in the first terminal device; The effective time of the first far-field communication information is determined based on the time when the first terminal device stores the first far-field communication information, the preset effective time and the preset reserved time; corresponding to the time when the current first terminal device acquires the first far-field communication information being before the first effective time, it is determined that the first far-field communication information is within the first effective time of the first far-field communication information.
7. The method according to claim 1, characterized in that The first terminal device establishes a connection with the second terminal device through the first server address; comprising: The first terminal device is connected to a first server corresponding to the first server address; The first server establishes a connection with a second server corresponding to the second terminal device.
8. The method according to claim 1, characterized in that: The first terminal device is connected to a first server corresponding to the first server address; and further comprising: The first terminal device establishes a full-duplex communication connection with the first server corresponding to the first server address; The first terminal device obtains a status code of the first server; Corresponding to the status code not being an error status code, the first terminal establishes a communication connection with the first server.
9. The method according to claim 1, characterized in that: Corresponding to the first far-field communication information not satisfying the information validity condition, the first terminal device sends a request to the fourth server to obtain the third far-field communication information corresponding to the third server.
10. The method according to claim 2, characterized in that The first storage space is a memory, and the second storage space is a hard disk.
11. The method according to claim 9, characterized in that The first server and the third server are business servers, and the fourth server is a retrieval server.
12. A terminal device, characterized in that: include: A memory for storing instructions; A processor, configured to execute the instructions to implement the far-field communication method according to any one of claims 1 to 11.
13. A readable storage medium, characterized in that: The readable medium stores instructions, which, when executed on a terminal device, enable the terminal device to execute the far-field communication method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Connection establishing method, connection establishing module and terminal device
CN103138806A
User type identification method and device of terminal, electronic equipment and storage medium
CN115967943A
Connectivity System and Method for High Speed Aircraft Internet
US20190207671A1