A far-field communication method, a terminal device and a readable storage medium

By pre-storing business server information in the terminal device and retrieving it directly from the memory, the problem of long connection time between the terminal device and the business server is solved, thus improving the user experience.

CN119316421BActive Publication Date: 2025-12-12HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310859982.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-12
Publication Date
2025-12-12
Estimated Expiration
2043-07-12

AI Technical Summary

Technical Problem

The long-term remote communication connection between the terminal device and the business server affects the user experience.

Method used

Terminal devices pre-store business server information, including address and validity period, and retrieve it directly from memory to establish a connection, reducing the interaction time with the retrieval server.

Benefits of technology

This reduces the time required to establish a connection between the terminal device and the server, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316421B_ABST
    Figure CN119316421B_ABST
Patent Text Reader

Abstract

The application relates to the field of communication, in particular to a far field communication method, a terminal device and a readable storage medium. The far field communication method comprises the following steps: a terminal device stores service server information acquired through a retrieval server in the terminal device, the service server information can comprise a service server address and information validity time, etc. When the terminal device needs to acquire the service server information next time, the terminal device can directly acquire the stored service server information under the condition that the stored service server information is determined to be valid, and realizes connection with a service server corresponding to the service server information. In this way, the long time consumption in the interaction process of the terminal device and the retrieval server can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication, in particular to a far field communication method, a terminal device and a readable storage medium. BACKGROUND

[0002] With the development of communication technology, different terminal devices can establish far field communication through a server. Far field communication refers to long distance communication. Far field communication technology can include client / server (C / S) technology, peer-to-peer (P2P) technology, etc.

[0003] For example, Figure 1 A scenario diagram of far field communication between terminal devices is shown, for example, a mobile phone 10 and a smart watch 20 establish a far field communication connection. Specifically, as shown in Figure 1 The mobile phone 10 sends a request to retrieve the address of a service server 1 to a retrieval server 1, and the smart watch 20 sends a request to retrieve the address of a service server 2 to a retrieval server 2. The retrieval server 1 and the retrieval server 2 allocate the address of the service server 1 to the mobile phone 10 and the address of the service server 2 to the smart watch 20 based on the query requests sent by the mobile phone 10 and the smart watch 20, and then return the results to the mobile phone 10 and the smart watch 20. Further, the mobile phone 10 connects to the service server 1 based on the address of the service server 1 returned by the retrieval server 1, and the smart watch 20 connects to the service server 2 based on the address of the service server 2 returned by the retrieval server 2. Finally, the service server 1 and the service server 2 establish a communication connection by sending a handshake protocol to each other for connection authentication, i.e., establishing a far field communication transmission channel, and completing the far field communication connection between the mobile phone 10 and the smart watch 20.

[0004] However, the interaction process of the terminal device, such as the smart watch, based on the retrieval server to obtain information takes a long time, so that the connection between the smart watch and the service server takes a long time, which further causes the time required for the smart watch to establish a far field communication connection with other terminal devices, such as a mobile phone, based on the service server to be longer, affecting the user experience. SUMMARY

[0005] Therefore, the present application provides a far field communication method, a terminal device and a readable storage medium.

[0006] In a first aspect, a method for long-range communication is provided. A first terminal device determines that the first terminal device stores first long-range communication information, the first long-range communication information including a first address, wherein the first address is a first server address required for the first terminal device to establish a long-range communication; in response to the first long-range communication information satisfying an information validity condition, the first terminal device establishes a connection with a second terminal device via the first server address; wherein the information validity condition includes that the first long-range communication information is within a first validity time of the first long-range communication information.

[0007] In some embodiments, the first long-range server information can be first service server information, the first server can be a first service server, and the first server address can be a first service server address. When the first terminal device determines that the first terminal device stores the first service server information, the first service server information includes the first service server address; when it is determined that the first service server information satisfies the information validity condition, the first terminal device can establish a connection with the second terminal device via the first service server address. The information validity condition can be that the time at which the first terminal device obtains the first service server information is within the first validity time of the first service server information, i.e., within the first valid storage time of the first service server information in the first terminal device.

[0008] Based on the above scheme, the first terminal device can directly obtain the first long-range communication information stored in the first terminal device when the first terminal device stores valid first long-range communication information. Then, the first terminal device can connect to the corresponding first server based on the first server address in the first long-range communication information, and thus the connection between the first terminal device and the second terminal device can be established. This reduces the time consumption of the connection establishment process between the first terminal device and the first server, and further reduces the time consumption of the connection establishment process between the first terminal device and the second terminal device, thereby improving the user experience.

[0009] In a possible implementation of the first aspect, the first terminal device determining that the first terminal device stores the first long-range communication information includes: the first terminal device determining whether the first storage space stores the first long-range communication information; in response to the first storage space storing the first long-range communication information, it is determined that the first terminal device stores the first long-range communication information; in response to the first storage space not storing the first long-range communication information, it is determined whether the second storage space exists and whether the second storage space stores the first long-range communication information; in response to the second storage space existing and storing the first long-range communication information, it is determined that the first terminal device stores the first long-range communication information.

[0010] In some embodiments, the first storage space can be a first cache of the first terminal device, and the second storage space can be a second cache of the first terminal device. The first storage space can be a storage space that is present by default in the first terminal device. When the first terminal device determines that the first storage space stores the first service server information, it is determined that the first terminal device stores the first service server information. When the first storage space does not store the first service server information, the first terminal device can determine and confirm that the second storage space exists and that the second storage space has the first service server information, and then it is determined that the first terminal device stores the first service server information.

[0011] Based on the above scheme, the first terminal device can obtain the first long-range 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 long-range communication information, thereby realizing the connection between the first terminal device and the second terminal device and reducing the time consumption of the connection establishment process between the first terminal device and the first server.

[0012] In a possible implementation of the first aspect, the manner of determining whether the second storage space exists includes: determining that the second storage space exists when both the first callback interface corresponding to the first terminal device and the second callback interface of the first terminal device are not empty.

[0013] In some embodiments, the first callback interface and the second callback interface can be preset in the terminal device, where the first callback interface can be an acquisition cache interface, and the second callback interface can be a save cache interface. The first terminal device can quickly determine that the second storage space exists by determining that both the two 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, the method includes: storing the first long-range communication information stored in the second storage space of the first terminal device to the first storage space of the first terminal device when the first long-range communication information stored in the second storage space of the first terminal device meets an information validity condition; and quickly obtaining the first server address from the first long-range communication information stored in the first storage space of the first terminal device.

[0015] In some embodiments, the speed of the first terminal device obtaining the first service server information from the first storage space is higher than the speed of the first terminal device obtaining the first service server information from the second storage space. Therefore, the first terminal device can store the first service server information stored in the second storage space into the first storage space, so that the first terminal device can directly obtain the first service server information based on the first storage space, thereby improving the efficiency of the first terminal device obtaining the first long-range communication information.

[0016] In a possible implementation of the first aspect, the information validity condition further includes: the first remote field communication information does not include an error status code, where the error status code indicates that the first server does not support normal communication.

[0017] In some embodiments, the error status code can 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, determining that the first remote field communication information is within the first validity time of the first remote field communication information includes: obtaining a time at which the first remote field communication information is currently acquired, a preset validity duration of the first remote field communication information, and a preset reservation duration, where the preset validity duration indicates an effective storage time of the first remote field communication information in the first terminal device; determining an effective time of the first remote field communication information based on a time at which the first terminal device stores the first remote field communication information, the preset validity duration, and the preset reservation duration; and determining that the first remote field communication information is within the first validity time of the first remote field communication information, in response to the time at which the first remote field communication information is currently acquired being before the first effective time.

[0019] In some embodiments, for example, the time at which the first service server information is currently acquired is 7:00 am, the preset validity duration is 1 hour, and the preset reservation duration can be 1 minute, the effective time of the first service server information is 7:59.

[0020] In a possible implementation of the first aspect, the first terminal device establishes a connection with the second terminal device through the first server address; including: the first terminal device connects with a first server corresponding to the first server address; and the first server establishes a connection with a 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, where the first terminal device and the first service server establish a connection, the second terminal device and a second service server corresponding to the second terminal device establish a connection, and then the first terminal device and the second terminal device can establish a remote field communication connection through the first service server and the second service server. Based on this, when the near field communication between the first terminal device and the second terminal device is disconnected, the remote field communication connection can be established through the service server.

[0022] In a possible implementation of the first aspect, the first terminal device connects with a first server corresponding to the first server address; and further including: 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; and in response to the status code not being an error status code, the first terminal device establishes a communication connection with the first server.

[0023] In some embodiments, the first terminal device can send a request for establishing a full-duplex communication connection to the corresponding first service server based on the first service server address in the first service server information, and the request can include a message header carrying specific content. After receiving the request for establishing a full-duplex communication connection sent by the first terminal device, the first service server can 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 the first terminal device, and return the full-duplex communication connection result to the first terminal device, so that the first terminal device can further determine whether the first service server supports normal communication based on the first service server status code after successfully establishing a 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 service server does not support the establishment of a communication connection with the first terminal device. That is, whether the status of the first server supports normal communication can be quickly determined based on whether the status code is 503.

[0024] In some embodiments, when it is determined that the status code of the first service server is an error status code "503", it indicates that the current first service 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 service server address and other information stored in the cache.

[0025] In a possible implementation of the first aspect, when the first far-field communication information does not meet the information validity condition, the first terminal device sends a request to the fourth server for obtaining third far-field communication information corresponding to the third server.

[0026] In some embodiments, when the first service server information does not meet the information validity condition, the first terminal device can send a request to the fourth server for obtaining third service server information corresponding to the third service server, wherein the fourth server can be a retrieval server, the first terminal device can send a request to the retrieval server for obtaining the third service server information corresponding to the third service server, and then the retrieval server can allocate the third service server information corresponding to the third service server to the first terminal device, so that the first terminal device can connect with the third service server based on the third service server address in the third service server information, and then the first terminal device can realize the connection with the second terminal device based on the third service server.

[0027] In a possible implementation of the first aspect, 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, the first server and the third server are service servers, and the fourth server is a retrieval server.

[0029] It can be understood that in some embodiments, the fourth server can assign the first terminal device with the first service server information corresponding to the first service server or assign the first terminal device with the third service server information corresponding to the third service server based on the request of the first terminal device. When there is no service server information in the first terminal device, the new service server information can still be obtained through the fourth server, i.e., the retrieval server, and then the far-field communication connection can be established between the second terminal device and the service server corresponding to the new service server information based on the service server address.

[0030] In a second aspect, the present application provides a terminal device, comprising: a memory configured to store instructions; and a processor configured to execute the 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, when the instructions are executed, causing a terminal device to implement the far-field communication method provided in the first aspect and any possible implementation of the first aspect. BRIEF DESCRIPTION OF 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 diagram of a far-field communication method is shown;

[0036] Figure 5 According to some embodiments of the present application, a hardware structure diagram 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 solutions of the present application will be described below in conjunction with the drawings.

[0039] As described above, the service server information needs the mobile phone and the smart watch to send a query request to the retrieval server respectively, and then the retrieval server returns the service server address to the mobile phone and the smart watch respectively, so that the mobile phone and the smart watch can establish a long-range communication transmission channel between the mobile phone and the smart watch through the respective service server information to realize long-range communication. However, the interaction process between the smart watch and the retrieval server is time-consuming, which will further cause the connection process between the smart watch and the service server to be time-consuming, and cause the time required for the smart watch to establish long-range communication with the mobile phone to be also long, affecting the user experience.

[0040] To solve the above problems, the embodiment of the present application provides a long-range communication method, which stores the service server information obtained by the terminal device through the retrieval server in the storage of the terminal device. The service server information can include service server address, interface information, and information validity time, etc. When the terminal device needs to obtain the service server information next time, the terminal device can directly obtain the service server information stored in the storage of the terminal device, and realize the connection with the service server corresponding to the service server information. The information validity time can represent the effective storage time of the service server information stored in the storage of the terminal device. When the storage time of the service server information in the storage exceeds the information validity time, the terminal device can reacquire the service server information through the retrieval server.

[0041] Based on the above scheme, when the terminal device acquires the service server information based on the retrieval server, the terminal device can directly acquire the service server information stored in the storage of the terminal device in the case that there is valid service server information in the storage of the terminal device. Then, the terminal device can connect with the corresponding service server based on the service server address in the acquired service server information, reduce the long time consumption in the interaction process between the terminal device and the retrieval server, and further reduce the time consumption in establishing long-range communication between the terminal devices, and improve the user experience.

[0042] It can be understood that in some embodiments, the storage of the terminal device can be referred to as the cache of the terminal device, and the storage of the terminal device can include a first cache (storage) and a second cache. The first cache is a first storage space, and the second cache is a second storage space.

[0043] For example, the first cache can be the memory of the terminal device, and the second cache can be the hard disk of the terminal device, which is not limited herein. By adding a second cache, when the first cache of the terminal device is unavailable, and the second cache storing the valid service server information exists, communication can be established with the corresponding service server based on the service server address stored in the second cache, and further communication can be established with other terminal devices through the service server, effectively reducing the time consumption of interaction between the terminal device and the retrieval server and the time consumption of establishing far-field communication between terminal devices, and reducing the power consumption of the terminal device.

[0044] In some embodiments, the callback interfaces for obtaining the retrieval server cache (GET) and saving the retrieval server cache (SAVE), i.e., the interfaces for obtaining the service server information and the interfaces for storing the service server information, can be preset in different terminal devices in advance. If both interfaces are not empty, it can be indicated that the terminal device supports the second cache, and 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 retrieval server can preset different information valid times 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 valid time in the service server information obtained by the mobile phone can be 1 hour; when the terminal device is a smart watch, the information valid time in the service server information obtained by the smart watch can be 24 hours.

[0046] It can be understood that, since different terminal devices require different power consumptions when obtaining information from the retrieval server, for example, the time and power consumption required by the smart watch to obtain information based on the retrieval server are much greater than those of the mobile phone, therefore, the retrieval server can set a longer information valid time for the smart watch when returning information to the smart watch, thereby avoiding frequent interaction between the terminal device and the retrieval server and reducing the power consumption of the terminal device.

[0047] In some embodiments, the service server information stored in the first cache or the second cache can be determined to be valid based on the following principles: first, there is no error code in the cache, for example, error code 503, wherein the error code can refer to the status of hypertext transfer protocol secure (HTTPS), the status code returned by the service server; second, the information valid time in the cache cannot be lower than the reserved time, wherein the reserved time refers to the preset time for data transmission. For example, if the information valid time is 1 hour, the reserved time can be preset to 1 minute, and the actual information valid time is 59 minutes; third, the current time < (the time of retrieving the server + cache valid time - reserved time), wherein the current time refers to the time when the terminal device starts to retrieve the service server information from the retrieval server; the time of retrieving the server refers to the time when the service server information is retrieved from the retrieval server and then stored in the cache; the cache valid time refers to the valid storage time of the service server information stored in the cache.

[0048] In some embodiments, if the service server information in the first cache does not exist or is invalid, whether the second cache exists can be determined by whether the two callback interfaces are empty. If both callback interfaces are empty, the second cache does not exist, or if both callback interfaces are not empty, the second cache exists. If it is further determined that the second cache is invalid cache, the terminal device can reconnect the retrieval server to obtain the latest service server information, and update the latest service server information to the first cache after obtaining the latest service server information.

[0049] It can be understood that the handshake protocol refers to a type of network protocol that can be used to confirm the identity of each other for the client and the server. 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 the present application will be introduced as follows, as shown in FIG. 1, the system can include a terminal device, a retrieval server and a service server. Figure 2

[0051] The retrieval server can be used to allocate the service server address for the terminal device, and then return the service server information including the service server address to the terminal device. The information valid time and other information can also be included in the service server information.

[0052] The service server can serve as a communication medium so that multiple terminal devices can establish a communication connection between each other based on the service server corresponding to different service server addresses.

[0053] The terminal device can include functional modules such as a user module, a channel module, a retrieval module and a product module.

[0054] ​The user module can be used to manage user information in the terminal device system, such as user registration, login, logout, password recovery, and other operations, and manage system notification reminders of the terminal device, such as system updates, user operation prompts, and the like. In some embodiments, the user module can detect 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 communication between the terminal device and a server or other terminal device; and 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 a corresponding business server based on a business server address and perform data transmission and the like.

[0056] The retrieval module can be used to retrieve the product module to obtain required cache information or request business server information from a retrieval server and the like. In some embodiments, the retrieval module can send a request to obtain business server information to the retrieval server or the retrieval server in response to a request to create a far-field communication sent by the user module.

[0057] The far-field communication method mentioned in the embodiments of the present application will be described in detail below. For example Figure 3 A flowchart 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 near-field communication between a terminal device (for example, a smart watch) and another terminal device (for example, a mobile phone) is disconnected, for example, the distance between the smart watch and the mobile phone increases to cause 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 interaction interface of the smart watch, for example, can select a far-field communication connection method in the settings interface of the smart watch, and then the smart watch obtains business server information after obtaining the far-field communication request.

[0060] S102: Detect whether business server information is stored in the terminal device.

[0061] In some embodiments, the terminal device can detect whether it stores service server information and whether the stored service server information is valid. If the terminal device stores valid service server information, go to step S103, and the terminal device can directly acquire the stored service server information. If the terminal device does not store service server information or the stored service server information is invalid, go to step S104, and the terminal device can send a request for acquiring new service server information to the retrieval server.

[0062] For example, when the first cache in the terminal device exists and the service server information stored in the first cache is valid, the terminal device can directly acquire the service server information stored in the first cache and connect to the corresponding service server based on the service server address in the service server information. When the first cache exists but the service server information stored in the first cache is invalid, the terminal device can determine whether the second cache exists by judging whether the two callback interfaces are empty. If the two callback interfaces are not empty, i.e., the second cache exists, it is further determined whether the service server information stored in the second cache is valid. If the service server information stored in the second cache is valid, the service server information stored in the second cache can be stored in the first cache, so that the terminal device can quickly acquire the service server address from the service server information stored in the first cache and connect to the corresponding service server based on the service server address.

[0063] It can be understood that in other embodiments, the service server information stored in the second cache can not be stored in the first cache, and the terminal device can also directly acquire the service server address based on the service server information stored in the second cache and connect to the corresponding service server based on the service server address, which is not limited herein.

[0064] S103: The terminal device directly acquires the service server information.

[0065] In some embodiments, the terminal device stores valid service server information, and the terminal device can directly acquire the service server address from the stored service server information to connect to the corresponding service server based on the service server address.

[0066] S104: Acquire the service server information through the retrieval server, record the acquisition time point, and store the service server information in the cache of the terminal device.

[0067] In some embodiments, when the terminal device does not store service server information or the stored service server information is invalid, the terminal device can send a request to retrieve a new service server information to the retrieval server, the retrieval server can reassign a service server address to the terminal device based on the request, and return the service server information including the service server address to the terminal device. After the terminal device obtains the service server information returned by the retrieval server, it records the time point of obtaining and stores the service server information in multiple caches of the terminal device, so that the terminal device can directly obtain the service server information from its cache when judging that its cache exists and is valid next time.

[0068] S105: The terminal device establishes a Websocket connection with the corresponding service server based on the service server address in the service server information obtained through the retrieval server.

[0069] In some embodiments, the terminal device can send a request to establish a Websocket connection to the corresponding service server based on the service server address in the service server information, and the request can include a message header carrying specific content. After receiving the request to establish a Websocket connection sent by the terminal device, the service server can determine to establish a Websocket communication connection with the terminal device based on the message header carrying specific content in the request sent by the terminal device and return the result to the terminal device.

[0070] It can be understood that Websocket is a full-duplex communication, which is essentially a transmission control protocol (TCP) TCP-based protocol, where HTML5 is a language description way of building web (Web) content, TCP protocol is a communication protocol for connection, and TCP packet is composed of two parts of header and data. TCP protocol can establish a connection through three times of handshaking (Three-Way Handshake).

[0071] It can be understood that in some other embodiments, if the service 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 to re-send a request to create a Websocket connection 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 business server state supports normal communication by retrieving the business server state code returned by the server, that is, determine the HTTP (Hypertext Transfer Protocol) state. For example, when the business server state 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, to clear the business server information, and returns to step S104, and the retrieval module re-sends a request for obtaining business server information to the retrieval server. Otherwise, it indicates that the current business server state supports normal communication. When it is determined that the business server state code is correct and normal communication can be performed, 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 state of server error, and the channel module can determine that the current business server is unavailable based on the identification of the 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 business server state code is correct and normal communication can be performed, the business server can synchronize its cloud parameters to the terminal device, wherein the synchronized cloud parameters can be address information (Internet Protocol Address, IP) and software and hardware parameters of the business server.

[0077] S108: The terminal device and the business server determine the communication connection based on the handshake message respectively.

[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. When the business server receives the handshake message, it performs authentication based on the authentication parameters carried by the handshake message. If the authentication is correct, the business server forwards the handshake message 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 performs authentication on the authentication parameters. If the authentication is correct, it indicates 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 will be described in detail below. For example Figure 4 An interaction flowchart of a far-field communication method is shown. As Figure 4 shown, the specific interaction process of the far-field communication method includes:

[0080] S201: Create a far field communication.

[0081] In some embodiments, when the near field communication between the terminal device and another terminal device is disconnected, for example, the distance between the mobile phone and the smart watch increases to cause the Bluetooth to be disconnected, the Bluetooth communication cannot be continued. In order to enable the terminal device to continue to communicate with other terminal devices, the user can create a far field communication based on the interaction interface of the terminal device, and then the user module detects the operation of the user, and sends a request for creating a far field communication to the channel module.

[0082] S202: The user module sends a request for creating a far field communication to the channel module.

[0083] In some embodiments, the user module of the terminal device can create a far field communication based on the terminal device, and send a request for creating a far field communication to the channel module of the terminal device.

[0084] S203: The channel module sends a request for obtaining a service server address to the retrieval module.

[0085] In some embodiments, after receiving the request for establishing a far field communication sent by the user module, the channel module of the terminal device further sends a request for obtaining a service server address to the retrieval module of the terminal device. The service server address refers to a communication medium for the terminal device to communicate with other terminal devices in a far field. The terminal device can connect to the corresponding service server based on the service server address, and then the terminal device can communicate with other terminal devices in a far field based on the service 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 retrieval module determines whether the first cache exists.

[0087] In the embodiments of the present application, determining whether the first cache exists can 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 service server address sent by the channel module. The first cache refers to a storage space that exists by default in the terminal device, which can be used to store information of servers that can be connected and communicated with the terminal device, such as address information of service servers. When the first cache exists, go to step S205, further determine whether the service server information stored in the first cache is valid, otherwise go to step S206, the retrieval module sends a request for obtaining the second cache to the product module.

[0089] It is understood that in some embodiments, the first cache may be the internal memory of the terminal device, and this is not limited here.

[0090] It is understood that the information stored in the first cache can be business server information, which may include the business server address, interface information, and information validity period, etc., without being limited here.

[0091] S205: The retrieval module determines whether the first cache is valid.

[0092] In this embodiment of the application, determining whether the first cache is valid may refer to determining whether the business server information stored in the first cache is valid.

[0093] In some embodiments, when the existence of the first cache is determined, the retrieval module further determines whether the business server information stored in the first cache is valid. When the stored business server information is determined to be valid, the business server information stored in the first cache can be directly obtained, and the process proceeds to step S213, where the business server address in the obtained business server information can be sent to the channel module. When the stored business server information is determined to be invalid, the process proceeds to step S206', where the retrieval module sends a request to the product module to obtain the second cache.

[0094] In some embodiments, the validity of information stored in the first cache can be determined from the following aspects. First, there are no error codes in the first cache of the terminal device. For example, error codes can refer to the status codes of the Hypertext Transfer Security Protocol (HTTPS), whether the status code returned by the business server is "503", etc., which are not limited here. Second, the validity period of the business server information stored in the first cache cannot be less than the reserved time. Here, the validity period of information refers to the effective storage time of the business server information stored in the terminal device's memory, i.e., the cache. The reserved time means that if the validity period of information is 1 hour, the reserved time can be preset to 1 minute, so the actual validity period of information is 59 minutes. Third, the current time < (time obtained from the retrieval server + cache validity period - reserved time). Here, the current time refers to the time when preparation for obtaining business server information begins; the time obtained from the retrieval server refers to the time when the business server information is obtained through the retrieval server and then stored in the first cache; the cache validity period refers to the effective storage time of the business server information stored in the first cache. 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 to the product module to retrieve the second cache.

[0096] In the embodiments of the present application, the request for obtaining the second cache can 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, the retrieval module can send a request for obtaining the second cache to the product module. The second cache refers to a storage space in the terminal device, which can be used to store information of servers that can be connected and communicated with the terminal device, such as address information of service servers, so that the terminal device can connect with the corresponding service servers by using the address information of the service servers stored in the second cache.

[0098] It can be understood that the GET (Get) callback interface and the SAVE (Save) callback interface, i.e., the interface for obtaining the service server information and the interface for storing the service server information, can be preset in the terminal device. Then, whether the second cache exists can be determined by whether the two callback interfaces are empty. In some embodiments, if neither of the two callback interfaces is empty, it can be determined that the second cache exists; in other embodiments, if any of the callback interfaces is empty, it can be determined that the second cache does not exist. It can be understood that the second cache can be a flash memory / hard disk memory of the terminal device, which is not limited herein.

[0099] S206′: The retrieval module sends a request for obtaining 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, the retrieval module can send a request for obtaining the second cache to the product module.

[0101] S207: The product module returns the decrypted second cache to the retrieval module.

[0102] In the embodiments of the present application, the returned decrypted second cache can refer to the service server information stored in the returned decrypted second cache.

[0103] In some embodiments, when the retrieval module determines that the second cache exists, the retrieval module can read the service server information stored in the decrypted second cache through the callback interface (GET).

[0104] It can be understood that in some embodiments, the speed of the terminal device for obtaining the service server information from the first cache is higher than the speed of the terminal device for obtaining the service server information from the second cache, and therefore the service server information stored in the second cache can be stored in the first cache, so that the terminal device can subsequently obtain the service server information based on the first cache directly, and the efficiency of the terminal device for obtaining the service server information is improved.

[0105] It can be understood that in other embodiments, the product module can not store the service server information stored in the second cache into the first cache, which is not limited herein.

[0106] S208: The retrieval module determines whether the second cache is valid.

[0107] In the embodiments of the present application, it is determined whether the second cache is valid. It can 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 service server information stored in the second cache, it is further determined whether the service server information stored in the second cache is valid. If it is determined to be valid, it is switched to step S213, and the service server address in the obtained service server information can be sent to the channel module; if it is determined to be invalid, it is switched to step S209, and the retrieval module sends a request for querying the service server address to the retrieval server.

[0109] In some embodiments, it can be determined whether the information stored in the second cache is valid 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 Protocol Secure (HTTPS), whether the status code returned by the service server is “503”, etc., which is not limited herein. Second, the information validity time of the service server information stored in the second cache cannot be lower than the reserved time, wherein the information validity time refers to the valid storage time of the service server information stored in the memory of the terminal device, i.e., the cache, and the reserved time refers to that if the information validity time is 1 hour, the reserved time can be preset to 1 minute, and the actual information validity time is 59 minutes. Third, the current time < (the time of obtaining from the retrieval server + cache validity time - reserved time), wherein the current time refers to the time of starting to prepare to obtain the service server information; the time of obtaining from the retrieval server refers to the time of obtaining the service server information through the retrieval server and then storing it in the second cache; the cache validity time refers to the valid storage time of the service server information stored in the second cache, wherein the cache validity time minus the reserved time is the actual valid storage time of the service server information stored in the second cache.

[0110] S209: The retrieval module sends a request for querying the service server information to the retrieval server.

[0111] In some embodiments, when the retrieval module determines that the second cache in the product module does not exist or the service server information stored in the second cache is invalid, in order to obtain the service server information, the retrieval module can send a request for obtaining the service server information to the retrieval server.

[0112] It can be understood that the retrieval server refers to a server that can assign a service server to the terminal device based on the request sent by the retrieval module of the terminal device, and can return the service server information containing the address of the service server to the retrieval module.

[0113] S210: The retrieval server returns the service server information and the status code to the retrieval module.

[0114] In some embodiments, after receiving the request for obtaining the service server information sent by the retrieval module, the retrieval server can assign a service server to the terminal device, and return the service server information stored in the JSON data exchange format containing the address of the service server and the status code after parsing to the retrieval module, so that the terminal device can connect to the corresponding service server based on the address of the service server received by the retrieval module, wherein the status code can indicate whether the state of the service server is available, that is, whether it supports normal communication.

[0115] It can be understood that JSON is a lightweight data exchange format that can exchange data between various computer languages and is easy to parse and generate by machines.

[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 service server information and the status code returned by the retrieval server, the retrieval module records the time point of receiving the service server information, and stores the received service server information and the status code in the first cache. It can be understood that in some embodiments, the service server information and the time point of reaching the retrieval 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 receiving the service server information and the status code returned by the retrieval server, the retrieval module can send an instruction to save the second cache to the product module, so that the product module stores the obtained service server information in the second cache after encryption, which can be used to protect communication privacy.

[0120] S213: The retrieval module sends the service server address in the service server information to the channel module.

[0121] In some embodiments, the retrieval module can send the service server in the service 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 service server based on the service server address.

[0122] S214: The channel module sends a request for establishing a Websocket connection to the corresponding service server based on the service server address.

[0123] In some embodiments, the channel module can send a request for establishing a Websocket connection to the corresponding service server based on the service server address in the obtained service server information, and the request can include a message header carrying specific content.

[0124] It can be understood that Websocket is a bidirectional network transmission protocol, which is established based on Transmission Control Protocol (TCP).

[0125] S215: The service server returns the result of establishing a Websocket connection to the channel module.

[0126] In some embodiments, after receiving the request for establishing a Websocket connection sent by the channel module based on the corresponding service server address, the service server can determine to establish a Websocket 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, where HTML5 is a language description method for building web content, and TCP is a communication protocol for connection. A TCP packet consists of two parts: header and data, and TCP protocol can establish a connection through three-way handshake.

[0128] S216: The channel module determines whether the service server status is 503.

[0129] In some embodiments, after the service server establishes a Websocket connection with the channel module, the channel module can determine whether the current service server supports normal communication by determining whether the service server status code is "503", i.e., determining the status of HTTP (Hypertext Transfer Protocol). When it is determined that the service server status code is "503", it indicates that the current service server is unavailable, and the process proceeds to step S217, which notifies the retrieval module to clear the cache, i.e., to clear the service server address and other information stored in the cache, and returns to step S203 to notify the retrieval module to send a request for obtaining service server information to the retrieval server. Otherwise, it indicates that the current channel module supports normal communication. When it is determined that the service server status code is not "503", it indicates that the current service server supports normal communication, and the process proceeds to step S218, which waits for the service server to synchronize cloud parameters to the channel module.

[0130] It can be understood that "503" is an HTTP status code, which is a return state of an error of a server, and the channel module can determine that the current service server is unavailable based on identifying the status code.

[0131] S217: The channel module informs the retrieval module to clear the cache.

[0132] In some embodiments, when it is determined that the status code of the service server is "503", it indicates that the current service server is unavailable, the retrieval module is informed to clear the cache, for example, to clear the information such as the address of the service server stored in the cache, and the step S203 is returned, so that the channel module sends a request for obtaining the address of the service server to the retrieval module.

[0133] S218: The channel module waits for the service server to synchronize the 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 the cloud parameters.

[0135] S219: The service server synchronizes the cloud parameters to the channel module.

[0136] In some embodiments, after it is determined that the status code of the service server is correct and normal communication can be performed, the service server can synchronize the cloud parameters to the channel module, wherein the synchronized cloud parameters can be address information, software and hardware parameters, etc. of the service server.

[0137] S220: The channel module sends a handshake message to the service server, and carries authentication parameters.

[0138] In some embodiments, after the service server synchronizes the cloud parameters to the channel module, the channel module can send a handshake message to the service server, and the handshake message can include authentication parameters.

[0139] S221: The service server replies to the handshake message to the channel module, and carries authentication parameters.

[0140] In some embodiments, after receiving the handshake message, the service server performs authentication based on the authentication parameters carried by the handshake message, and if the authentication is correct, the service server replies to the handshake message to the channel module, and the handshake message can also include authentication parameters.

[0141] S222: The channel module authenticates the authentication parameters of the opposite end.

[0142] In some embodiments, after receiving the handshake message forwarded by the service server, the channel module authenticates the authentication parameters, and if the authentication is correct, it indicates that the terminal device and the service server can establish a communication connection.

[0143] S223: The channel module sends the result of establishing the far-field communication to the user module.

[0144] In some embodiments, after the channel module successfully establishes the communication connection with the service processor, the channel module can send the result of successfully establishing the far-field communication to the user module, and the terminal device can perform data transmission with the service server based on the channel module.

[0145] Through the far-field communication method provided by the embodiments of the present application, before the terminal device obtains the service server information based on the retrieval server, the terminal device can directly obtain the service server information stored in the terminal device memory in the case that there is valid service server information in the terminal device memory, and then the terminal device can connect with the corresponding service server based on the service server address in the obtained service server information, reducing the long time consumption in the interaction process between the terminal device and the retrieval server, further reducing the time consumption in establishing the far-field communication between the terminal devices, and improving the user experience.

[0146] To facilitate understanding of the technical solutions of the 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 capable of running a neural network model, including but not limited to a mobile phone, a wearable device (such as a smart watch, a smart bracelet, etc.), a tablet computer, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, an augmented reality (AR) / virtual reality (VR) device, 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 structural schematic diagram of a terminal device 100 is shown. As shown in Figure 5 The terminal device 100 shown includes one or more processors 101, a system memory 102, a non-volatile memory (NVM) 103, a communication interface 104, an input / output (I / O) device 105, system control logic 106, and instructions 107.

[0149] The processor 101 can include one or more processing units, such as a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a micro-programmed control unit (MCU), an artificial intelligence (AI) processor, or a processing module or processing circuit of a field programmable gate array (FPGA). The processing circuit can 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 service server information, etc.

[0151] The non-volatile memory 103 can include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, the non-volatile memory 103 can include any suitable non-volatile memory, such as a 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 can also be a removable storage medium, such as a secure digital (SD) memory card, etc. The non-volatile memory 103 can be used to store the above-mentioned service server information, etc.

[0152] The instructions 107 can include instructions for causing the terminal device 100 to implement the far-field communication method provided by the embodiments of the present application.

[0153] The communication interface 104 can include a transceiver to provide a wired or wireless communication interface for the terminal device 100 to communicate with any other suitable device over one or more networks. In some embodiments, the communication interface 104 can be integrated with other components of the terminal device 100, for example the communication interface 104 can be integrated with the processor 101.

[0154] The input / output (I / O) device 105 can include input devices such as a keyboard, mouse, etc., output devices such as a display, etc., through which a user can interact with the terminal device 100.

[0155] The system control logic 106 can include any suitable interface controllers to provide any suitable interfaces for other modules of the terminal device 100. For example, in some embodiments, the system control logic 106 can include one or more memory controllers to provide an interface to the system memory 102 and the non-volatile memory 103.

[0156] In some embodiments, at least one of the processors 101 can be packaged together with logic for one or more controllers of the system control logic 106 to form a system in package (SiP). In other embodiments, at least one of the processors 101 can also be integrated on the same die with logic for one or more controllers of the system control logic 106 to form a system-on-chip (SoC).

[0157] Embodiments disclosed herein can be implemented in hardware, software, firmware, or any combination thereof. Embodiments of the application can be implemented as computer programs or program code executing on programmable systems comprising 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 herein and generate output information. The output information can be applied to one or more output devices, in known fashion. For purposes of this application, a processing system includes any system that has a processor, such as a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0159] The program code can be implemented in a high level procedural or object oriented programming language to communicate with a processing system. The program code can be implemented in assembly or machine language, if desired. In fact, the mechanisms described herein are not limited in scope to any particular programming language. In any case, the language can be a compiled or interpreted language.

[0160] In some cases, the disclosed embodiments can be implemented in hardware, firmware, software, or any combination thereof. Embodiments disclosed can be implemented as instructions carried by or stored on one or more transitory or non-transitory machine- readable (e.g., computer-readable) media, which can be read and executed by one or more processors. For example, the instructions can be downloaded over the network or by another computer readable medium from a remote site. Thus, a machine-readable medium can include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including without limitation floppy disks, optical disks, optical fiber, ROMs, RAMs, EPROMs, EEPROMs, magnetic or optical cards, flash memory, or tangible machine-readable storage media. Accordingly, a machine-readable medium includes any type of media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).

[0161] In the drawings, some of the structural or methodological features can be shown in particular arrangements and / or orders. However, it should be understood that such particular arrangements and / or orders can not be required. Instead, these features can be arranged in a different manner and / or order than shown in the illustrative figures, in some embodiments. Additionally, the inclusion of a structural or methodological feature in a particular figure is not meant to imply that such feature is required in all embodiments, and in some embodiments, these features can not be included or can be combined with other features.

[0162] It should be noted that each unit / module mentioned in the device embodiments of the present application is a logical unit / module, in the physical world, one logical unit / module can be one physical unit / module, also can be a part of one physical unit / module, also can be realized in combination of multiple physical unit / modules, the physical realization of these logical units / modules is not the most important, the combination of the functions realized by these logical units / modules is the key to solve the technical problems proposed in 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 the units / modules which are not closely related to solving the technical problems proposed in the present application, which does not mean that the above-mentioned device embodiments do not have other units / modules.

[0163] It has to be noted that, in the description of the application, the terms "first", "second", etc. are used only for distinguishing between similar elements, and do not connote any order, sequence or priority. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a", "comprises", or "comprising", does not, without more constraints, preclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0164] While the application has been illustrated and described in detail in the drawings and foregoing description, the same is to be considered as illustrative and not restrictive in character, it being understood that only the preferred embodiments have been shown and described and that all changes and modifications that come within the spirit of the application are desired to be protected.

Claims

1. A method of far field communication, characterized by, The method comprises: The first terminal device determines that the first terminal device stores first long-range communication information, the first long-range communication information comprising a first address, wherein the first address is a first server address required for the first terminal device to establish long-range communication; Corresponding to the first long-range communication information satisfying an information validity condition, the first terminal device establishes a connection with a second terminal device through the first server address; The information validity condition comprises the first long-range communication information being within a first validity time of the first long-range communication information.

2. The method of claim 1, wherein, The first terminal device determines that the first terminal device stores first long-range communication information, comprising: The first terminal device determines that the first terminal device stores first long-range communication information, comprising: Corresponding to the first storage space storing the first long-range communication information, it is determined that the first terminal device stores the first long-range communication information; Corresponding to the first storage space not storing the first long-range communication information, it is determined whether a second storage space of the first terminal device exists and whether the second storage space stores the first long-range communication information; Corresponding to the second storage space existing and storing the first long-range communication information, it is determined that the first terminal device stores the first long-range communication information.

3. The method of claim 2, wherein, The manner of determining whether the second storage space exists comprises: Corresponding to the first callback interface of the first terminal device and the second callback interface of the first terminal device being empty, it is determined that the second storage space exists.

4. The method of claim 3, wherein, The method comprises: Corresponding to the first long-range communication information stored in the second storage space satisfying an information validity condition, the first long-range 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 acquires the first server address from the first long-range 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 further comprises the first long-range communication information not existing an error status code, wherein the error status code indicates that the first server does not support normal communication.

6. The method of claim 5, wherein, Determining that the first long-range communication information is within a first validity time of the first long-range communication information comprises: Acquiring a time at which the first terminal device currently acquires the first long-range communication information, a preset validity duration of the first long-range communication information, and a preset reserved duration, wherein the preset validity duration represents an effective storage time of the first long-range communication information in the first terminal device; Based on the time at which the first terminal device stores the first long-range communication information, the preset validity duration, and the preset reserved duration, an effective time of the first long-range communication information is determined; corresponding to the time at which the first terminal device currently acquires the first long-range communication information being before the first effective time, it is determined that the first long-range communication information is within the first validity time of the first long-range communication information.

7. The method of claim 1, wherein, The first terminal device establishes a connection with a second terminal device through the first server address; comprising: The first terminal device is connected with 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 of claim 1, wherein, The first terminal device is connected with a first server corresponding to the first server address; 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 acquires a status code of the first server; Corresponding to the status code being not an error status code, the first terminal establishes a communication connection with the first server.

9. The method of claim 1, wherein, Corresponding to the first remote field communication information not satisfying the information validity condition, the first terminal device sends a request to a fourth server to acquire third remote field communication information corresponding to a third server.

10. The method of claim 2, wherein, The first storage space is a memory, and the second storage space is a hard disk.

11. The method of claim 9, wherein, The first server and the third server are service servers, and the fourth server is a retrieval server.

12. A terminal device, comprising: Comprising: a memory for storing instructions; a processor for executing the instructions to implement the remote field communication method of any one of claims 1-11.

13. A readable storage medium, characterized by, The readable storage medium has instructions stored thereon, which, when executed on a terminal device, cause the terminal device to perform the remote field communication method of any one of claims 1-11.

Citation Information

Patent Citations

  • User type identification method and device of terminal, electronic equipment and storage medium

    CN115967943A

  • Connectivity System and Method for High Speed Aircraft Internet

    US20190207671A1