A method and system for achieving rapid device interconnection

By broadcasting IP and port information via the CoAP protocol, automatic discovery and rapid interconnection between Android devices and Harmony devices are achieved, solving the problems of manual operation and high development costs in traditional interconnection methods, and improving the convenience and scalability of interconnection.

CN114390488BActive Publication Date: 2026-01-30FUJIAN WISBO DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210031685.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-12
Publication Date
2026-01-30
Estimated Expiration
2042-01-12

AI Technical Summary

Technical Problem

In existing technologies, the discovery and interconnection between Android devices and Harmony devices requires manual operation, and traditional interconnection methods suffer from network isolation and high development costs.

Method used

The CoAP protocol is used to broadcast IP and port information, and the IP multicast feature is used to realize automatic terminal discovery. The interconnection channel is selected through the identity authentication mechanism to automatically establish device interconnection.

Benefits of technology

It enables fast and automatic interconnection between Android devices and Harmony devices, reducing user operations, lowering development costs, and improving network scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114390488B_ABST
    Figure CN114390488B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for achieving rapid device interconnection. The invention involves a first terminal and a second terminal acquiring their own IP and port information, broadcasting this information via the CoAP protocol, and continuously monitoring surrounding broadcast information. Upon detecting the first terminal's broadcast information, the second terminal establishes a session connection with the first terminal based on the IP and port information in the broadcast. The second terminal receives an application service request and sends an interconnection request along with its own terminal information to the first terminal based on the application service request. The first terminal receives the interconnection request and, after successful authentication via the identity authentication mechanism, selects an interconnection channel based on its terminal information to establish an interconnection with the second terminal. This invention achieves device interconnection more quickly and conveniently. Furthermore, because it can automatically select an interconnection channel, it avoids the need for developers to deal with heterogeneous networks, reducing development costs and offering better scalability.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of mobile communication technology, in particular to a method and system for realizing fast interconnection of devices. BACKGROUND

[0002] With the continuous development of the Android system, the Android system is used in more and more devices, such as mobile phones, POS machines, cash registers and the like. With the promotion of manufacturers and the open source application of the Harmony system, more and more Harmony devices are used in the market; at present, the discovery and interconnection between Harmony devices on the market can realize fast discovery and interconnection; however, the discovery and interconnection between Android devices and between Android devices and Harmony devices can only be realized through traditional interconnection modes such as Wi-Fi, Bluetooth and NFC; such device discovery and interconnection mode has not small defects in terms of the convenience of use for users and the convenience of development for developers.

[0003] Firstly, based on the traditional device interconnection mode, the user needs to manually turn on Wi-Fi, Bluetooth and the like, manually discover the target device, select connection, click confirmation and the like. The user needs to perform many operation selections and interactive operations to realize the connection between devices; in addition, based on the network isolation of the Wi-Fi, Bluetooth and the like interconnection channels, intercommunication cannot be performed, the developer needs to face heterogeneous networks and needs to adapt to different network protocols and standard specifications, the business development cost is high, and the network scalability is poor. SUMMARY

[0004] The technical problem to be solved by the present application is to provide a method and system for realizing fast interconnection of devices, which can more quickly and conveniently realize fast interconnection between Android devices and between Android devices and Harmony devices.

[0005] In order to solve the above technical problems, the technical scheme adopted by the present application is:

[0006] A method for realizing fast interconnection of devices, comprising the steps of:

[0007] S1, a first terminal and a second terminal respectively acquire IP and port information of themselves, broadcast the IP and port information through a CoAP protocol, and continuously listen to surrounding broadcast information;

[0008] S2, after the second terminal listens to the broadcast information of the first terminal, a session connection is established with the first terminal according to the IP and port information in the broadcast information;

[0009] S3, the second terminal receives an application service request, sends an interconnection request and terminal information of itself to the first terminal according to the application service request;

[0010] S4, the first terminal receives the interconnection request, and after the authentication of the identity authentication mechanism is passed, an interconnection channel is selected according to the terminal information to establish interconnection with the second terminal;

[0011] The first terminal is an Android terminal or a Hongmeng terminal, and the second terminal is an Android terminal or a Hongmeng terminal.

[0012] In order to solve the above technical problems, another technical solution adopted by the present application is:

[0013] A system for realizing fast interconnection of devices includes a first terminal and a second terminal, the first terminal includes a first processor, a first memory, and a first computer program stored in the first memory and executable on the first processor, the second terminal includes a second processor, a second memory, and a second computer program stored in the second memory and executable on the second processor, the first terminal is an Android terminal or a Hongmeng terminal, the second terminal is an Android terminal, and the first processor implements the following steps when executing the first computer program:

[0014] S1, obtaining IP and port information of itself, broadcasting the IP and port information through a CoAP protocol, and continuously listening to surrounding broadcast information;

[0015] S4, receiving an interconnection request from the second terminal, and after the authentication of the identity authentication mechanism is passed, an interconnection channel is selected according to the terminal information to establish interconnection with the second terminal;

[0016] The second processor implements the following steps when executing the second computer program:

[0017] S1, obtaining IP and port information of itself, broadcasting the IP and port information through a CoAP protocol, and continuously listening to surrounding broadcast information;

[0018] S2, after listening to the broadcast information of the first terminal, a session connection is established with the first terminal according to the IP and port information in the broadcast information;

[0019] S3, receiving an application service request, and sending an interconnection request and terminal information of itself to the first terminal according to the application service request.

[0020] The application has the beneficial effects that: the application is different from the terminal discovery protocol of the traditional Wi-Fi, Bluetooth and the like, utilizes the IP multicast characteristics of the CoAP protocol, can realize the automatic discovery of the terminal when the service is needed, can acquire the terminal information through the CoAP protocol, automatically selects the interconnection channel according to the terminal information to establish the interconnection, and does not need the user to manually open the Wi-Fi or Bluetooth of the two terminals correspondingly when the service is needed, reduces the necessary operation of the user, and more quickly and conveniently realizes the device interconnection; and since the interconnection channel can be automatically selected, the situation that the developer needs to face the heterogeneous network is avoided, the development cost is reduced, and the scalability is better. BRIEF DESCRIPTION OF DRAWINGS

[0021] Figure 1 A flow chart of a method for realizing the fast interconnection of devices according to an embodiment of the application;

[0022] Figure 2 A structural diagram of a system for realizing the fast interconnection of devices according to an embodiment of the application;

[0023] Figure 3 A timing diagram of a method for realizing the fast interconnection of devices according to an embodiment of the application;

[0024] Figure 4 A terminal architecture schematic diagram of a method for realizing the fast interconnection of devices according to an embodiment of the application;

[0025] Label explanation:

[0026] 1. A system for realizing the fast interconnection of devices; 2. A first terminal; 3. A first processor; 4. A first memory; 5. A second terminal; 6. A second processor; 7. A second memory. DETAILED DESCRIPTION

[0027] To make the technical content, the achieved purposes and the effects of the application clear, the following will be described in detail in combination with the embodiments and the drawings.

[0028] Please refer to Figure 1 and Figure 3 A method for realizing the fast interconnection of devices, comprising the steps of:

[0029] S1. The first terminal and the second terminal respectively acquire the IP and port information of themselves, broadcast the IP and port information through the CoAP protocol, and continuously listen to the broadcast information around;

[0030] S2. After the second terminal listens to the broadcast information of the first terminal, a session connection is established with the first terminal according to the IP and port information in the broadcast information;

[0031] S3, the second terminal receives an application service request, and sends an interconnection request and terminal information of the second terminal to the first terminal according to the application service request;

[0032] S4, the first terminal receives the interconnection request, and establishes interconnection with the second terminal according to the terminal information after identity authentication mechanism authentication is passed;

[0033] The first terminal is an Android terminal or a HongMeng terminal, and the second terminal is an Android terminal or a HongMeng terminal.

[0034] From the above description, the beneficial effects of the present application are that the present application is different from the terminal discovery protocol of the traditional Wi-Fi, Bluetooth and the like, the IP multicast characteristics of the CoAP protocol are used, the automatic discovery of the terminal can be realized when the service is needed, the terminal information can be obtained through the CoAP protocol, the interconnection channel is automatically selected according to the terminal information to establish interconnection, and the user does not need to manually open the Wi-Fi or Bluetooth of the two terminals corresponding to the service, the necessary operation of the user is reduced, the device interconnection is more quickly and conveniently realized, the interconnection channel can be automatically selected, the situation that the developer needs to face the heterogeneous network is avoided, the development cost is reduced, and the scalability is better.

[0035] Further, the terminal information includes current Wi-Fi information, Bluetooth information, USB port information and NFC information of the terminal.

[0036] The step S4 of selecting the interconnection channel according to the terminal information is specifically:

[0037] According to the preset priority sequence and the current Wi-Fi information, Bluetooth information, USB port information, Ethernet information and NFC information of the first terminal, the optimal interconnection channel is selected from the available interconnection channels.

[0038] The priority sequence is:

[0039] USB communication> Bluetooth networking> Wi-Fi P2P networking> Wi-Fi AP networking> NFC networking.

[0040] From the above description, when the interconnection channel is selected, the optimal interconnection channel is selected from the available interconnection channels according to the preset priority, so that the stability of data interconnection is effectively improved.

[0041] Further, if the first terminal is a HongMeng terminal, the steps S1 and S2 further include the following step:

[0042] S11, the first terminal creates a session server of the CoAP protocol;

[0043] The step S2 is specifically establishing a session connection with the first terminal according to the IP and port in the broadcast information.

[0044] The second terminal establishes a session connection with the session server created by the first terminal in a CoAP protocol.

[0045] If the first terminal is an Android terminal, the steps S1 and S2 further include the following steps:

[0046] S11, the first terminal creates a TCP Socket session server.

[0047] The step S2 is specifically establishing a session connection with the first terminal according to the IP and port in the broadcast information.

[0048] The second terminal establishes a session connection with the session server created by the first terminal in a TCP protocol.

[0049] As can be seen from the above description, after broadcasting the IP and port information in the CoAP protocol, the first terminal and the second terminal communicate data by implementing a session server to obtain terminal information to select a suitable interconnection channel for interconnection.

[0050] Further, if the first terminal is a Hongmeng terminal, the terminal information includes user account system information and user login information, and the step S4 specifically includes the following steps:

[0051] S41, the first terminal receives the interconnection request, judges whether the user account information and the login user information of the second terminal are consistent with itself, if yes, establishes interconnection with the second terminal, otherwise generates a PIN code and displays it;

[0052] S42, the second terminal initiates an interconnection request again according to the PIN code input by the user.

[0053] S43, the first terminal verifies the PIN code in the interconnection request with the PIN code generated by itself, if the verification is passed, selects an interconnection channel to establish interconnection with the second terminal.

[0054] If the first terminal is an Android terminal, the terminal information includes user account system information, user login information and owner information, and the step S4 is specifically:

[0055] The first terminal receives the interconnection request, checks the user account system information, the user login information and the owner information of the second terminal, and if the user account system information and the user login information are consistent with itself or the owner information is consistent with itself, establishes interconnection with the second terminal, otherwise, displays a connection authorization prompt, and after the user confirms the consent, selects an interconnection channel according to the terminal information, and establishes interconnection with the second terminal.

[0056] From the above description, according to the system type of the first terminal, the second terminal is authenticated through the corresponding authentication mechanism, and interconnection is performed after authentication.

[0057] Further, the terminal data is pre-set with a security level, including an encryption type, a specific type and a general type, and the terminal information includes owner information, a device ID or login user information.

[0058] When data transmission is performed after interconnection is established in step S4, the method further includes the following steps:

[0059] S51, the data sender judges the security level of the data to be transmitted, if the data to be transmitted is of the encryption type, steps S52 and S53 are performed, if it is of the specific type, step S54 is performed, and if it is of the general type, direct transmission is performed;

[0060] S52, the data sender generates and displays an identification code, the data receiver communicates with the data sender according to the identification code input by the user and the PAKE protocol, and generates a session key based on a preset algorithm;

[0061] S53, the data sender encrypts the data to be transmitted through the session key;

[0062] S54, the data sender compares and checks the IP, owner information, device ID or login user information of the data receiver with the data in the preset transmissible list, and transmits the data to be transmitted after the check is passed.

[0063] From the above description, when data is transmitted, different processing is performed according to the security level of different data, thereby ensuring the security of data transmission.

[0064] Please refer to Figure 2The application discloses a system for realizing fast interconnection of devices, which comprises a first terminal and a second terminal, the first terminal comprises a first processor, a first memory and a first computer program stored in the first memory and capable of running on the first processor, the second terminal comprises a second processor, a second memory and a second computer program stored in the second memory and capable of running on the second processor, the first terminal is an Android terminal or a Hongmeng terminal, the second terminal is an Android terminal, and the first processor realizes the following steps when the first computer program is executed:

[0065] S1, obtaining IP and port information of itself, broadcasting the IP and port information through a CoAP protocol, and continuously listening to surrounding broadcast information;

[0066] S4, receiving an interconnection request from the second terminal, and establishing interconnection with the second terminal according to terminal information after identity authentication mechanism authentication is passed;

[0067] The second processor realizes the following steps when the second computer program is executed:

[0068] S1, obtaining IP and port information of itself, broadcasting the IP and port information through a CoAP protocol, and continuously listening to surrounding broadcast information;

[0069] S2, after listening to the broadcast information of the first terminal, establishing a session connection with the first terminal according to the IP and port information in the broadcast information;

[0070] S3, receiving an application service request, and sending an interconnection request and terminal information of itself to the first terminal according to the application service request.

[0071] From the above description, the application has the beneficial effects that the application is different from a terminal discovery protocol of traditional Wi-Fi, Bluetooth and the like, IP multicast characteristics of a CoAP protocol are utilized, automatic discovery of terminals can be realized when service is needed, terminal information can be obtained through the CoAP protocol, interconnection channels are automatically selected according to the terminal information to establish interconnection, and users do not need to manually open Wi-Fi or Bluetooth of two terminals corresponding to each other when service is needed, necessary operations of the users are reduced, device interconnection is more quickly and conveniently realized, interconnection channels can be automatically selected, developers do not need to face heterogeneous networks, development cost is reduced, and expandability is better.

[0072] Further, the terminal information comprises current Wi-Fi information, Bluetooth information, USB port information and NFC information of the terminal.

[0073] The step S4 of selecting an interconnection channel according to the terminal information when the first processor executes the first computer program specifically comprises:

[0074] According to the preset priority sequence and the current Wi-Fi information, Bluetooth information, USB port information, Ethernet information and NFC information of the first terminal, the optimal interconnection channel is selected from the available interconnection channels.

[0075] The priority sequence is:

[0076] USB communication> Bluetooth networking> Wi-Fi P2P networking> Wi-Fi AP networking> NFC networking.

[0077] From the above description, when selecting an interconnection channel, the optimal interconnection channel is selected from the available interconnection channels according to the preset priority, thereby effectively improving the stability of data interconnection.

[0078] Further, if the first terminal is a Harmony terminal, the first processor executing the first computer program further comprises a step between the steps S1 and S2:

[0079] S11, the first terminal creates a session server of CoAP protocol;

[0080] The step S2 of establishing a session connection according to the IP and port in the broadcast information and the first terminal when the second processor executes the second computer program specifically comprises:

[0081] The second terminal as a client establishes a session connection of CoAP protocol with the session server created by the first terminal;

[0082] If the first terminal is an Android terminal, the first processor executing the first computer program further comprises a step between the steps S1 and S2:

[0083] S11, the first terminal creates a TCP Socket session server;

[0084] The step S2 of establishing a session connection according to the IP and port in the broadcast information and the first terminal when the second processor executes the second computer program specifically comprises:

[0085] The second terminal as a client establishes a session connection of TCP protocol with the session server created by the first terminal.

[0086] From the above description, after broadcasting the IP and port information through the CoAP protocol, the first terminal and the second terminal communicate data through the session server to obtain terminal information to select a suitable interconnection channel for interconnection.

[0087] Further, if the first terminal is a Harmony terminal, the terminal information includes user account system information and user login information, and the step S4 performed by the first processor when executing the first computer program specifically includes steps of:

[0088] S41, the first terminal receives the interconnection request, judges whether the user account information and the login user information of the second terminal are consistent with itself, if yes, establishes interconnection with the second terminal, otherwise generates and displays a PIN code;

[0089] S42, the second terminal initiates the interconnection request again according to the PIN code input by the user;

[0090] S43, the first terminal verifies the PIN code in the interconnection request with the PIN code generated by itself, if the verification is passed, selects an interconnection channel to establish interconnection with the second terminal;

[0091] If the first terminal is an Android terminal, the terminal information includes user account system information, user login information and owner information, and the step S4 performed by the first processor when executing the first computer program is specifically:

[0092] The first terminal receives the interconnection request, verifies the user account system information, the user login information and the owner information of the second terminal, if the user account system information and the user login information are consistent with itself or the owner information is consistent with itself, establishes interconnection with the second terminal, otherwise displays a connection authorization prompt, and after the user confirms the consent, selects an interconnection channel according to the terminal information to establish interconnection with the second terminal.

[0093] From the above description, according to the system type of the first terminal, the second terminal is authenticated through the corresponding authentication mechanism, and interconnection is performed after authentication.

[0094] Further, the terminal data is pre-set with security levels, the security levels include encryption types, specific types and general types, and the terminal information includes owner information, device ID or login user information;

[0095] When the first processor executes the first computer program and the second processor executes the second computer program, when data transmission is performed after interconnection is established in step S4, the steps further include steps of:

[0096] S51, judging the security level of the data to be transmitted, if the data to be transmitted is of an encryption type, executing step S52 and step S53, if it is of a specific type, executing step S54, and if it is of a general type, directly transmitting the data;

[0097] S52, generating and displaying an identification code, and communicating with a data receiver according to the identification code input by a user and a PAKE protocol, and generating a session key based on a preset algorithm;

[0098] S53, encrypting and transmitting the data to be transmitted according to the session key;

[0099] S54, comparing and verifying the IP, owner information, device ID or login user information of the data receiver with data in a preset transmissible list, and transmitting the data to be transmitted after the verification is passed.

[0100] As can be seen from the above description, when the data is transmitted, different processing is performed according to the security level of different data, so as to ensure the security of data transmission.

[0101] The method and the terminal for realizing fast interconnection of devices are suitable for a scenario in which two terminals need to be interconnected.

[0102] Please refer to Figure 1 , Figure 3 and Figure 4 , the first embodiment of the present application is:

[0103] A method for realizing fast interconnection of devices, comprising the steps of:

[0104] S1, a first terminal and a second terminal respectively acquire IP and port information of themselves, broadcast the IP and port information through a CoAP protocol, and continuously listen to surrounding broadcast information;

[0105] In this embodiment, please refer to Figure 4 , the relevant program resources in the terminal are divided into a user application layer, a self-organizing network adaptation layer and a system layer. The user application layer is a user of device discovery and interconnection function, decides when to call an interface to acquire a device list or establish device interconnection with a target terminal according to the business requirement of the application itself; the system layer is a module for realizing device system function, executes a corresponding connection request after the self-organizing network adaptation layer completes connection mode decision and connection initiation; the self-organizing network adaptation layer provides interfaces for discovering devices and establishing device connection, and provides a developer with a fast and convenient access to device interconnection; and completes main functions such as terminal discovery, connection networking and optimal connection mode decision. The main content of the scheme is realized by the self-organizing network adaptation layer, i.e., a self-organizing network service.

[0106] In this embodiment, the ad hoc network service of the first terminal and the second terminal is started by the user application binding service, or is started when the system is powered on, the IP and port information of the ad hoc network service is read, and the ad hoc network service broadcasts through the CoAP (Constrained Application Protocol, a web-like protocol in the Internet of Things world) service. At the same time, the ad hoc network service starts to listen to the broadcast information of other terminals around, that is, to discover the surrounding devices.

[0107] If the first terminal is a Harmony terminal, the steps S1 and S2 further include the following steps:

[0108] S11, the first terminal creates a session server of the CoAP protocol.

[0109] In this embodiment, the first terminal is a Harmony terminal, and broadcasts the IP and port information while acting as a session server of the CoAP protocol.

[0110] S2, after the second terminal listens to the broadcast information of the first terminal, the second terminal establishes a session connection with the first terminal according to the IP and port information in the broadcast information.

[0111] The step S2 of establishing a session connection with the first terminal according to the IP and port in the broadcast information is specifically:

[0112] The second terminal establishes a session connection with the session server of the first terminal created by the first terminal as a client.

[0113] In this embodiment, after the second terminal listens to the IP and port information sent by the first terminal, the second terminal establishes a connection with the session server of the first terminal as a client through the IP and port information, and obtains the terminal information of the first terminal.

[0114] S3, the second terminal receives an application service request, and sends an interconnection request and terminal information of the second terminal to the first terminal according to the application service request.

[0115] In this embodiment, the device interconnection interface of the ad hoc network service is called by the application of the user on the second terminal according to the needs, an interconnection channel is selected according to the terminal information of the first terminal, and an interconnection request is initiated to the first terminal.

[0116] S4, the first terminal receives the interconnection request, and establishes interconnection with the second terminal according to the terminal information to select an interconnection channel after the identity authentication mechanism is authenticated.

[0117] If the first terminal is a HongMeng terminal, the terminal information includes user account system information and user login information, and the step S4 specifically includes the following steps:

[0118] S41, the first terminal receives the interconnection request, judges whether the user account information and the login user information of the second terminal are consistent with itself, if yes, establishes interconnection with the second terminal, otherwise generates a PIN code and displays it;

[0119] S42, the second terminal initiates the interconnection request again according to the PIN code input by the user;

[0120] S43, the first terminal checks the PIN code in the interconnection request with the PIN code generated by itself, if the check is passed, selects an interconnection channel to establish interconnection with the second terminal;

[0121] In the embodiment, after the second terminal sends the interconnection request to the first terminal, the first terminal needs to be authenticated. The first terminal decides whether to establish interconnection with the second terminal according to the identity authentication mechanism of the HongMeng system. Specifically, if the account systems of the first terminal and the second terminal are the same, and the login account information is consistent, the HongMeng system considers that the first terminal and the second terminal belong to the terminals of the same user, does not pop up a connection prompt, allows the second terminal to establish interconnection with the first terminal, and establishes interconnection with the first terminal according to the terminal information of the second terminal. If the account systems of the first terminal and the second terminal are different, the first terminal generates a PIN code, the second terminal inputs the PIN code, and transmits it back to the first terminal, and the first terminal checks it, and only after the check is passed, the first terminal selects a suitable channel to establish interconnection with the second terminal.

[0122] Please refer to Figure 1 and Figure 3 , embodiment two of the present application is:

[0123] A method for realizing fast interconnection of devices, which is different from embodiment one in that the first terminal is an Android terminal, and the step S11 is specifically:

[0124] S11, the first terminal creates a TCP Socket server session server.

[0125] In the embodiment, after the first terminal broadcasts its IP and port information, the ad hoc service creates a TcpSocket session server and waits to be discovered and connected.

[0126] The step S2 of establishing a session connection with the first terminal according to the IP and port in the broadcast information is specifically:

[0127] The second terminal establishes a session connection with a TCP protocol session server created by the first terminal as a client.

[0128] In this embodiment, after the second terminal listens to the broadcast of the first terminal and discovers the first terminal, the second terminal establishes a session connection with a TCP Socketserver session server created by the first terminal as a client.

[0129] The step S4 specifically includes:

[0130] The first terminal receives the interconnection request, checks the user account system information, the user login information and the owner information of the second terminal, and if the user account system information and the user login information are consistent with itself or the owner information is consistent with itself, the first terminal establishes interconnection with the second terminal, otherwise, the first terminal displays a connection authorization prompt, and after the user confirms the consent, the first terminal selects an interconnection channel according to the terminal information and establishes interconnection with the second terminal.

[0131] In this embodiment, after the first terminal receives the interconnection request and the terminal information of the second terminal, the first terminal needs to be authenticated:

[0132] If the login accounts of the second terminal and the first terminal are consistent, the connection is allowed to be established, and the first terminal does not need to pop up a connection authorization prompt;

[0133] If the owner information of the second terminal and the first terminal is consistent, the connection is allowed to be established, and the first terminal does not need to pop up a connection authorization prompt;

[0134] If the login accounts and the owner information of the second terminal and the first terminal are inconsistent, but the connection has been established, the connection is allowed to be established, and the first terminal pops up a connection authorization prompt;

[0135] If the second terminal and the first terminal belong to stranger devices and have not been connected, the first terminal pops up a connection authorization prompt, and the user clicks to agree to allow the connection to be established.

[0136] The terminal information includes current Wi-Fi information, Bluetooth information, USB port information and NFC information of the terminal;

[0137] In the step S4, the interconnection channel is selected according to the terminal information, specifically including:

[0138] According to a preset priority sequence and the current Wi-Fi information, Bluetooth information, USB port information, Ethernet information and NFC information of the first terminal, the optimal interconnection channel is selected from the available interconnection channels;

[0139] The priority sequence is:

[0140] USB communication > Bluetooth networking > Wi-Fi P2P networking > Wi-Fi AP networking > NFC networking.

[0141] In this embodiment, the first terminal decides the optimal connection channel according to the terminal information sent by the second terminal, including Wi-Fi information, Bluetooth information, USB port information, Ethernet information and NFC information. The networking mode is selected according to the available networking mode between the current second terminal and the first terminal, and the priority is: USB communication > Bluetooth networking > Wi-Fi P2P networking > Wi-Fi AP networking > NFC networking. When the selected interconnection mode cannot complete the interconnection, i.e., the used networking mode is unreachable, the terminal information of the second terminal is reacquired, and the optimal connection channel is redecided.

[0142] After the first terminal and the second terminal successfully establish the device interconnection channel through networking, the required service interaction data can be transmitted through the established interconnection channel.

[0143] Preferably, the terminal data is further provided with a security level, including an encryption type, a specific type and a general type, and the terminal information includes owner information, device ID or login user information.

[0144] When data transmission is performed after the interconnection is established in step S4, the method further includes the following steps:

[0145] S51, the data sender judges the security level of the data to be transmitted, if the data to be transmitted is of the encryption type, steps S52 and S53 are performed, if the data to be transmitted is of the specific type, step S54 is performed, and if the data to be transmitted is of the general type, the transmission is directly performed;

[0146] S52, the data sender generates and displays an identification code, the data receiver communicates with the data sender according to the identification code input by the user and the PAKE protocol, and generates a session key based on a preset algorithm;

[0147] S53, the data sender transmits the data to be transmitted by encrypting the data to be transmitted through the session key;

[0148] S54, the data sender compares and verifies the IP, owner information, device ID or login user information of the data receiver with the data in the preset transmissible list, and transmits the data to be transmitted after the verification is passed.

[0149] In this embodiment, the security level of data is set in advance, and when the user performs data transmission, the data security level can be transmitted when calling the data transmission interface of the unified network interface. In this scheme, the data security level is divided into three types: encrypted data type, which needs to be encrypted during transmission; general data, which directly transmits data; and special data type, which needs to be authenticated by IP and device during transmission.

[0150] For encrypted data, a PIN code is generated by the first terminal, and after the PIN code is input by the second terminal, the first terminal and the second terminal perform handshake based on the PIN code and the PAKE protocol to negotiate a session key, and the encrypted data is transmitted by the key.

[0151] For special type data, such as IP authentication, device authentication, or both. For IP authentication, the first terminal is specified by the user application to be transmitted, and the IP of the second terminal is checked when the second terminal initiates a data transmission request. Device authentication can be authenticated by the user application through terminal owner information or specified terminal information authentication (such as specifying device ID, specifying login user, etc.).

[0152] For data that does not need to be encrypted, it can be transmitted directly after the interconnection channel is established.

[0153] Please refer to Figure 2 , the third embodiment of the present application is:

[0154] A system for realizing fast interconnection of devices 1, comprising a first terminal 2 and a second terminal 5, the first terminal comprising a first processor 3, a first memory 4, and a first computer program stored in the first memory 4 and executable on the first processor 3, the second terminal 5 comprising a second processor 6, a second memory 7, and a second computer program stored in the second memory 7 and executable on the second processor 6, the first processor 3 executing the first computer program and the second processor 6 executing the second computer program, respectively realizing the steps of the first terminal 2 and the second terminal 5 in the above embodiments one or two.

[0155] The method and system for realizing fast interconnection of devices of the present application mainly use the characteristics of CoAP protocol IP multicast to quickly discover terminals and transmit terminal information, so as to select an interconnection channel by using terminal information and establish interconnection.

[0156] In summary, the method and system for realizing fast interconnection of devices provided by the application are different from the terminal discovery protocol of the traditional Wi-Fi, Bluetooth and the like, utilize the IP multicast characteristics of the CoAP protocol, can realize automatic discovery of the terminal when the service is needed, and can obtain the terminal information through the CoAP protocol, automatically select an interconnection channel according to the terminal information to establish interconnection, and do not need the user to manually open the Wi-Fi or Bluetooth of the two terminals correspondingly when the service is needed, thereby reducing the necessary operation of the user, and more quickly and conveniently realizing the device interconnection; and since the interconnection channel can be automatically selected, the situation that the developer needs to face the heterogeneous network is avoided, the development cost is reduced, and the scalability is better.

[0157] The above description is only an embodiment of the application, and does not limit the patent range of the application, and any equivalent transformation or direct or indirect application in the related technical field by using the content of the specification and drawings of the application is also included in the patent protection range of the application.

Claims

1. A method for implementing fast interconnection of devices, characterized by, The method comprises the steps of: S1, the first terminal and the second terminal respectively acquire their own IP and port information, broadcast the IP and port information through a CoAP protocol, and continuously listen to the surrounding broadcast information; S2, after the second terminal listens to the broadcast information of the first terminal, a session connection is established with the first terminal according to the IP and port information in the broadcast information; S3, the second terminal receives an application service request, sends an interconnection request to the first terminal according to the application service request, and sends its own terminal information; S4, the first terminal receives the interconnection request, and after the identity authentication mechanism passes the authentication, an interconnection channel is selected according to the terminal information to establish the interconnection with the second terminal; The first terminal is an Android terminal or a Hongmeng terminal, and the second terminal is an Android terminal or a Hongmeng terminal; The terminal information comprises current Wi-Fi information, Bluetooth information, USB port information and NFC information of the terminal; In the step S4, the interconnection channel is selected according to the terminal information, specifically as follows: According to a preset priority sequence and the current Wi-Fi information, Bluetooth information, USB port information, Ethernet information and NFC information of the first terminal, the optimal interconnection channel is selected from the available interconnection channels; when the selected interconnection channel cannot complete the interconnection, the terminal information of the second terminal is re-acquired, and the optimal interconnection channel is re-decided to be created; The priority sequence is as follows: USB communication > Bluetooth networking > Wi-Fi P2P networking > Wi-Fi AP networking > NFC networking; If the first terminal is a Hongmeng terminal, the steps S1 and S2 further comprise the step of: S11, the first terminal creates a session server of a CoAP protocol; In the step S2, the session connection is established with the first terminal according to the IP and port in the broadcast information, specifically as follows: The second terminal establishes a session connection of a CoAP protocol with the session server created by the first terminal as a client; If the first terminal is an Android terminal, the steps S1 and S2 further comprise the step of: S11, the first terminal creates a TCP Socket session server; In the step S2, the session connection is established with the first terminal according to the IP and port in the broadcast information, specifically as follows: The second terminal establishes a session connection of a TCP protocol with the session server created by the first terminal as a client.

2. The method for achieving rapid interconnection of devices according to claim 1, characterized in that, If the first terminal is a Hongmeng terminal, the terminal information comprises user account system information and user login information, and the step S4 specifically comprises the steps of: S41, the first terminal receives the interconnection request, judges whether the user account system information and the user login information of the second terminal are consistent with itself, if yes, the interconnection is established with the second terminal, otherwise a PIN code is generated and displayed; S42, the second terminal initiates an interconnection request again according to the PIN code input by a user; S43, the first terminal checks the PIN code in the interconnection request with the PIN code generated by itself, and if the check is passed, the interconnection channel is selected and the interconnection with the second terminal is established; If the first terminal is an Android terminal, the terminal information includes user account system information, user login information and owner information, and the step S4 is specifically: The first terminal receives the interconnection request, checks the user account system information, the user login information and the owner information of the second terminal, and if the user account system information and the user login information are consistent with itself or the owner information is consistent with itself, the interconnection with the second terminal is established, otherwise, a connection authorization prompt is displayed, and after the user confirms the consent, the interconnection channel is selected according to the terminal information, and the interconnection with the second terminal is established.

3. The method of claim 1, wherein, The terminal data is pre-set with a security level, including encryption type, specific type and general type, and the terminal information includes owner information, device ID or login user information; When data transmission is performed after the interconnection is established in step S4, the step further includes: S51, the data sender judges the security level of the data to be transmitted, if the data to be transmitted is of encryption type, steps S52 and S53 are executed, if it is of specific type, step S54 is executed, and if it is of general type, the transmission is directly performed; S52, the data sender generates and displays an identification code, the data receiver communicates with the data sender according to the identification code input by the user and the PAKE protocol, and generates a session key based on a preset algorithm; S53, the data sender encrypts the data to be transmitted by the session key; S54, the data sender compares and checks the IP, owner information, device ID or login user information of the data receiver with the data in the preset transmissible list, and transmits the data to be transmitted after the check is passed.

4. A system for implementing fast interconnection of devices, comprising a first terminal and a second terminal, the first terminal comprising a first processor, a first memory, and a first computer program stored in the first memory and executable on the first processor, the second terminal comprising a second processor, a second memory, and a second computer program stored in the second memory and executable on the second processor, characterized in that, The first terminal is an Android terminal or a Hongmeng terminal, the second terminal is an Android terminal, and the first processor realizes the following steps when executing the first computer program: S1, obtain the IP and port information of itself, broadcast the IP and port information through the CoAP protocol, and continuously listen to the surrounding broadcast information; S4, receive the interconnection request from the second terminal, and after the identity authentication mechanism is authenticated, select the interconnection channel according to the terminal information and establish the interconnection with the second terminal; The second processor realizes the following steps when executing the second computer program: S1, obtain the IP and port information of itself, broadcast the IP and port information through the CoAP protocol, and continuously listen to the surrounding broadcast information; S2, after listening to the broadcast information of the first terminal, establish a session connection with the first terminal according to the IP and port information in the broadcast information; S3, receive an application service request, and send an interconnection request and terminal information of itself to the first terminal according to the application service request; The terminal information includes current Wi-Fi information, Bluetooth information, USB port information, and NFC information of the terminal; The step S4 of selecting an interconnection channel according to the terminal information when the first processor executes the first computer program is specifically: According to a preset priority sequence and the current Wi-Fi information, Bluetooth information, USB port information, Ethernet information, and NFC information of the first terminal, an optimal interconnection channel is selected from available interconnection channels; when the selected interconnection channel cannot complete interconnection, terminal information of the second terminal is reacquired, and the optimal interconnection channel is redecided; The priority sequence is: USB communication > Bluetooth networking > Wi-Fi P2P networking > Wi-Fi AP networking > NFC networking; If the first terminal is a Harmony terminal, the first processor executing the first computer program further includes the following step between the steps S1 and S2: S11, the first terminal creates a CoAP protocol session server; The step S2 of establishing a session connection with the first terminal according to the IP and port in the broadcast information when the second processor executes the second computer program is specifically: The second terminal establishes a CoAP protocol session connection with the session server created by the first terminal as a client; If the first terminal is an Android terminal, the first processor executing the first computer program further includes the following step between the steps S1 and S2: S11, the first terminal creates a TCP Socket session server; The step S2 of establishing a session connection with the first terminal according to the IP and port in the broadcast information when the second processor executes the second computer program is specifically: The second terminal establishes a TCP protocol session connection with the session server created by the first terminal as a client.

5. The system for implementing fast interconnection of devices according to claim 4, wherein, If the first terminal is a Harmony terminal, the terminal information includes user account information and user login information, and the step S4 when the first processor executes the first computer program specifically includes the following steps: S41, the first terminal receives the interconnection request, judges whether the user account system information and the user login information of the second terminal are consistent with itself, if yes, interconnection is established with the second terminal, otherwise a PIN code is generated and displayed; S42, the second terminal initiates an interconnection request again according to a user-input PIN code; S43, the first terminal verifies the PIN code in the interconnection request with the PIN code generated by itself, if the verification is passed, an interconnection channel is selected to establish interconnection with the second terminal; If the first terminal is an Android terminal, the terminal information includes user account system information, user login information, and owner information, and the step S4 when the first processor executes the first computer program is specifically: The first terminal receives the interconnection request, checks the user account system information, the user login information and the owner information of the second terminal, and if the user account system information and the user login information are consistent with itself or the owner information is consistent with itself, establishes interconnection with the second terminal, otherwise, displays a connection authorization prompt, and after the user confirms the consent, selects an interconnection channel according to the terminal information, and establishes interconnection with the second terminal.

6. The system for implementing fast interconnection of devices according to claim 4, wherein, The terminal data is pre-set with security levels, including encryption type, specific type and general type, and the terminal information includes owner information, device ID or login user information; When the first processor executes the first computer program and the second processor executes the second computer program, after the interconnection is established in step S4, the data transmission further includes the following steps: S51, judging the security level of the data to be transmitted, if the data to be transmitted is of the encryption type, executing step S52 and step S53, if it is of the specific type, executing step S54, and if it is of the general type, directly transmitting the data; S52, generating and displaying an identification code, and communicating with the data receiver according to the identification code input by the user and the PAKE protocol, and generating a session key based on a preset algorithm; S53, encrypting the data to be transmitted according to the session key; S54, comparing and checking the IP, owner information, device ID or login user information of the data receiver with the data in the preset transmissible list, and transmitting the data to be transmitted after the checking is passed.

Citation Information

Patent Citations

  • Interconnection method of vehicle-mounted terminal and smart phone

    CN104333844A