Disclosure of Invention
The invention aims to provide a near-field information transmission method which can conveniently and quickly realize information transmission among different terminals.
To achieve the above object, the present invention provides a near field information transfer method for performing near field information transfer between a first terminal and a second terminal. The near field information transfer method comprises the following steps: the method comprises the steps that a server receives a registration request sent by a first terminal, wherein the registration request comprises registration information, the registration information comprises service set identification information of WIFI, and the service set identification information of the WIFI comprises terminal pairing information; the server registers the first terminal according to the registration information and stores terminal pairing information of the first terminal, and a first long connection service based on Websocket is established between the server and the first terminal; the server informs the first terminal of broadcasting the service set identification information of the WIFI; the server receives terminal pairing information of the second terminal, detects whether the terminal pairing information of the second terminal is the same as terminal pairing information stored in the server, and if the terminal pairing information of the second terminal is the same as the terminal pairing information stored in the server, a second long connection service based on Websocket is established between the server and the second terminal, wherein the terminal pairing information of the second terminal is obtained by the second terminal from received service set identification information of the WIFI broadcasted by the first terminal.
In a preferred embodiment, the service set identification information of WIFI is generated by the first terminal, the first terminal is further configured to generate a different unique code each time a registration request is made to the server, and the terminal pairing information is a sub-character string extracted from the unique code.
In a preferred embodiment, before the server registers the first terminal according to the registration information, the method further includes: and the server detects the terminal pairing information of the first terminal, if the terminal pairing information of the first terminal is not registered in the server, the detection is successful, and the next step is carried out.
In a preferred embodiment, the service set identification information of the WIFI further includes first terminal identification information and first terminal state information, where the first terminal identification information is used to identify a first terminal that generates the service set identification information of the WIFI, and the first terminal state information is used to identify a current state of the first terminal.
In a preferred embodiment, the second terminal is further configured to scan a surrounding WIFI list, store a service set identifier including the first terminal identification information, and judge a current state of the first terminal according to first terminal state information in the service set identifier stored in the second terminal, and extract and display the service set identifier that meets a requirement of the current state of the first terminal.
In a preferred embodiment, the first terminal is further configured to set a password for connecting to the WIFI, the password is not broadcasted, and the second terminal is further configured to crack the password for connecting to the WIFI according to terminal pairing information in the service set identification information stored by the second terminal.
In a preferred embodiment, the near field information transfer method further includes: and the server receives the instruction information sent by the second terminal and forwards the instruction information to the first terminal for execution.
In a preferred embodiment, the near field information transfer method further includes: and the server receives the instruction execution information fed back by the first terminal and sends the instruction execution result of the first terminal to the first terminal for displaying.
Compared with the prior art, according to the near field information transmission method, the first terminal transmits information to the second terminal through the service set identification information of the WIFI instead of after the WIFI is connected, so that the speed of the second terminal for acquiring the information of the first terminal can be greatly improved. The terminal pairing information is a sub-character string extracted from the unique code, the unique code is different in each registration, the first terminal can detect the terminal pairing information of the first terminal before being connected with the server, whether the terminal pairing information is repeated or not is detected, the server can verify the terminal pairing information of the second terminal before being connected with the second terminal, and the safety of information transmission can be greatly guaranteed. The password for connecting the WIFI is generated according to the terminal pairing information, the first terminal does not broadcast the password for connecting the WIFI, and the safety of information transmission is further improved. In addition, in an embodiment, in addition to the terminal pairing information, the service set identification information of the WIFI generated by the first terminal further includes first terminal identification information and first terminal state information, and the second terminal can quickly find the first terminal with the identification and the state meeting the requirements according to the first terminal identification information and the first terminal state information of the WIFI by scanning a surrounding WIFI list, so that the rapidness and convenience of information transmission between terminals are further improved.
Detailed Description
The following detailed description of the present invention is provided in conjunction with the accompanying drawings, but it should be understood that the scope of the present invention is not limited to the specific embodiments.
Throughout the specification and claims, unless explicitly stated otherwise, the word "comprise", or variations such as "comprises" or "comprising", will be understood to imply the inclusion of a stated element or component but not the exclusion of any other element or component.
Fig. 1 is a diagram of a near field information transfer method according to an embodiment of the present invention, in which a first terminal transfers information to a second terminal through service set identification information of WIFI, instead of after connecting to the WIFI, so that a speed of acquiring information of the first terminal by the second terminal may be greatly increased. The near field information transfer method includes steps S1 to S4.
In step S1, the server receives the registration request sent by the first terminal: the server receives a registration request sent by the first terminal, the registration request comprises registration information, the registration information comprises service set identification information of WIFI, and the service set identification information of the WIFI comprises terminal pairing information.
The server saves the terminal pairing information of the first terminal and establishes the first long connection service in step S2: the server registers the first terminal according to the registration information and stores terminal pairing information of the first terminal, and a first long connection service based on Websocket is established between the server and the first terminal.
The server notifies the first terminal of broadcasting service set identification information of WIFI at step S3.
In step S4, the server detects the terminal pairing information of the second terminal and establishes the second long connection service: and the server receives and detects the terminal pairing information of the second terminal, and if the detection is successful, a second long connection service based on Websocket is established between the server and the second terminal. The terminal pairing information of the second terminal is obtained by the second terminal from the received service set identification information of the WIFI broadcasted by the first terminal. In one embodiment, the server detecting the terminal pairing information of the second terminal includes: and the server detects whether the terminal pairing information of the second terminal is the same as the terminal pairing information stored by the server, if so, the detection is successful, and a second long connection service based on Websocket is established between the server and the second terminal.
In one embodiment, the service set identification information of WIFI is generated by the first terminal, the first terminal generates a different unique code each time a registration request is made to the server, and the terminal pairing information is a substring extracted from the unique code. Before the server registers the first terminal, the method further comprises the following steps: the server detects the terminal pairing information of the first terminal, if the terminal pairing information of the first terminal is never registered in the server, namely the terminal pairing information of the first terminal is unique, the detection is successful, and then the server registers the first terminal. This may improve the security of the information transfer.
In order to further improve the safety of information transmission, the first terminal is also used for setting a password for connecting WIFI, and the password is not broadcasted. The password can be generated through a certain rule on the basis of the terminal pairing information, so that the terminal pairing information and the password can be changed along with the unique code which is different in each registration, and the safety of information transmission between terminals is further improved.
In order to enable the second terminal to further quickly obtain the information of the first terminal, in an embodiment, the service set identification information of the WIFI further includes first terminal identification information and first terminal state information, the first terminal identification information is used for identifying the first terminal generating the service set identification information of the WIFI, and the first terminal state information is used for identifying the current state of the first terminal. And the second terminal scans surrounding WIFI lists at regular time or on demand, and if the service set identifier containing the identification information of the first terminal is found, the service set identifier of the WIFI is temporarily stored. When the terminals are interacted, the second terminal judges the current state (such as idle, busy, normal or fault states and the like) of the first terminal according to the first terminal state information in the service set identification information stored by the second terminal, extracts and displays the service set identification of which the current state of the first terminal meets the requirements so that a user can use the service set identification quickly, when the user operates quickly, the second terminal extracts the terminal pairing information in the service set identification and sends an operation request to the server, and if the request is successful, a second long connection service based on Websoket is established between the server and the second terminal. The second terminal is also used for cracking a password for connecting WIFI according to terminal pairing information in the service set identification information stored by the second terminal. For convenience of understanding, it is assumed that service set identification information of WIFI generated by the first terminal is ZMRHRSD7F12a230, ZMRHRS represents first terminal identification information, D7F12a23 represents terminal pairing information, and 0 is first terminal state information, when the second terminal scans the WIFI, it can be quickly determined whether the first terminal device is a device that the second terminal wants to perform information interaction according to the first terminal identification information ZMRHRS, if so, it can be determined whether a device state meets requirements according to the first terminal state information before the second terminal performs information interaction with the first terminal, and if so, a service set identification of the WIFI is displayed so that a user can use the WIFI quickly. The process can enable the user to find the appropriate terminal device for connection more quickly, and the experience and timeliness of the user are improved.
In one embodiment, the near field information transfer method further includes: and the server receives the instruction information sent by the second terminal and forwards the instruction information to the first terminal for execution. And the server receives the instruction execution information fed back by the first terminal and sends the instruction execution result of the first terminal to the first terminal for displaying.
In summary, according to the near field information delivery method in this embodiment, the first terminal delivers information to the second terminal through the service set identification information of the WIFI, instead of after connecting the WIFI, so that the speed of the second terminal acquiring the information of the first terminal can be greatly increased. And the terminal pairing information is a sub-character string extracted from the unique code, the unique code is different in each registration, the terminal pairing information of the second terminal can be detected before the second terminal is connected with the server, whether the terminal pairing information is repeated or not is detected, the information transmission safety can be guaranteed, the password for connecting WIFI is generated according to the terminal pairing information, the password for connecting WIFI is not broadcasted by the first terminal, and the information transmission safety is further improved.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing descriptions of specific exemplary embodiments of the present invention have been presented for purposes of illustration and description. It is not intended to limit the invention to the precise form disclosed, and obviously many modifications and variations are possible in light of the above teaching. The exemplary embodiments were chosen and described in order to explain certain principles of the invention and its practical application to enable one skilled in the art to make and use various exemplary embodiments of the invention and various alternatives and modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims and their equivalents.