CN116017762A - Equipment connection method, device, equipment and storage medium - Google Patents

Equipment connection method, device, equipment and storage medium Download PDF

Info

Publication number
CN116017762A
CN116017762A CN202111228301.6A CN202111228301A CN116017762A CN 116017762 A CN116017762 A CN 116017762A CN 202111228301 A CN202111228301 A CN 202111228301A CN 116017762 A CN116017762 A CN 116017762A
Authority
CN
China
Prior art keywords
communication
communication connection
connection
mode
equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111228301.6A
Other languages
Chinese (zh)
Inventor
吕翔杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Jimi Technology Co Ltd
Original Assignee
Chengdu Jimi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Jimi Technology Co Ltd filed Critical Chengdu Jimi Technology Co Ltd
Priority to CN202111228301.6A priority Critical patent/CN116017762A/en
Publication of CN116017762A publication Critical patent/CN116017762A/en
Pending legal-status Critical Current

Links

Images

Abstract

The application discloses a device connection method, which comprises the following steps: under the condition that the first communication connection of the second equipment fails to be established, the first equipment acquires first communication connection establishment information of the second equipment for establishing the first communication connection through the reference communication connection successfully established with the second equipment; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first device establishes the first communication connection with the second device through the first communication connection establishment information and the second communication connection establishment information, wherein the second communication connection establishment information is information of the first device for establishing the first communication connection. The application also discloses a device connecting device, a device and a storage medium.

Description

Equipment connection method, device, equipment and storage medium
Technical Field
The present disclosure relates to wireless communication technologies, and in particular, to a device connection method, apparatus, device, and storage medium.
Background
At present, mobile terminals such as smart phones are adopted to control household appliances, and the traditional remote controllers are gradually replaced to control the household appliances. When the intelligent household appliance is controlled through the mobile terminal, the intelligent household appliance is usually communicated with the intelligent household appliance in a fixed communication mode according to the current connection state, so that the intelligent household appliance is controlled.
In the process of implementing the embodiments of the present disclosure, it is found that at least the following problems exist in the related art: when the mobile terminal and the household electrical appliance can communicate through the local area network, the local area network has the characteristics of high transmission rate, long communication distance, large transmission data volume, high real-time performance and the like, but the household electrical appliance and the mobile phone are required to be in the same local area network and the same network segment, or the mobile phone cannot find the household electrical appliance and cannot establish connection with the household electrical appliance.
Disclosure of Invention
In view of this, embodiments of the present application provide a device connection method, apparatus, device, and storage medium, which can obtain, based on other communication modes outside a local area network, a communication connection corresponding to the local area network, so as to implement connection between a first device and a second device in a network expansion segment based on the local area network.
The technical scheme of the embodiment of the application is realized as follows:
In a first aspect, an embodiment of the present application provides a device connection method, applied to a first device, including:
under the condition that the first communication connection with the second equipment fails to be established, the first equipment acquires first communication connection establishment information of the second equipment for establishing the first communication connection through the reference communication connection successfully established with the second equipment; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network;
the first device establishes the first communication connection with the second device through the first communication connection establishment information and the second communication connection establishment information, wherein the second communication connection establishment information is information of the first device for establishing the first communication connection.
In a second aspect, an embodiment of the present application provides a device connection method, applied to a second device, including:
the method comprises the steps that under the condition that a first communication connection with first equipment fails to be established, second equipment sends first communication connection establishment information for establishing the first communication connection to the first equipment through a reference communication connection which is successfully established with the first equipment; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first communication connection establishment information is used for the first equipment to combine with second communication connection establishment information, the first communication connection is established with the second equipment, and the second communication connection establishment information is information of the first equipment for establishing the first communication connection.
In a third aspect, an embodiment of the present application provides a device connection apparatus, applied to a first device, where the apparatus includes:
an obtaining unit, configured to obtain, when a first communication connection with a second device fails to be established, first communication connection establishment information of the second device for establishing the first communication connection through a reference communication connection with the second device, where the establishment of the first communication connection is successful; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network;
the compensation connection unit is configured to establish the first communication connection with the second device through the first communication connection establishment information and second communication connection establishment information, where the second communication connection establishment information is information of the first device for establishing the first communication connection.
In a fourth aspect, an embodiment of the present application provides a device connection apparatus, applied to a second device, where the apparatus includes:
a transmitting unit configured to transmit first communication connection establishment information for establishing a first communication connection to a first device through a reference communication connection with the first device, the reference communication connection being established successfully, in a case where establishment of the first communication connection with the first device fails; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first communication connection establishment information is used for the first equipment to combine with second communication connection establishment information, the first communication connection is established with the second equipment, and the second communication connection establishment information is information of the first equipment for establishing the first communication connection.
In a fifth aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and capable of running on the processor, where the processor implements steps in a device connection method of the first device or steps in a device connection method of the second device when the processor executes the computer program.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium, i.e., a storage medium, on which a computer program is stored, which when executed by a processor, implements the device connection method of the first device or the device connection method of the second device.
According to the device connection method, device, equipment and storage medium, under the condition that the first communication connection is failed to be established, the first device acquires first communication connection establishment information of the second device for establishing the first communication connection through establishing successful reference communication connection; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first device establishes the first communication connection with the second device through the first communication connection establishment information and the second communication connection establishment information, wherein the second communication connection establishment information is information of the first device for establishing the first communication connection; and the communication connection corresponding to the local area network is acquired and established based on other communication modes outside the local area network, so that the communication defects of the local area network are compensated through other communication modes, and the connection based on the local area network between the first equipment and the second equipment of the expanded network section is realized.
Drawings
Fig. 1 is a schematic diagram of an alternative architecture of a wireless communication system provided in an embodiment of the present application;
FIG. 2A is an alternative flow diagram of a device connection method provided by an embodiment of the present application;
FIG. 2B is a schematic flow chart of an alternative method for connecting devices according to an embodiment of the present application
FIG. 3 is an alternative schematic illustration of a connection between a first device and a second device provided by an embodiment of the present application;
FIG. 4 is an alternative flow diagram of a method for device connection provided in an embodiment of the present application;
FIG. 5 is an alternative flow diagram of a method for device connection provided in an embodiment of the present application;
FIG. 6 is an alternative flow diagram of a device connection method provided by an embodiment of the present application;
FIG. 7 is an alternative flow chart of a method for connecting devices according to an embodiment of the present application;
FIG. 8 is an alternative flow chart of a device connection method provided in an embodiment of the present application;
FIG. 9 is an alternative flow chart of a method for connecting devices according to an embodiment of the present application;
FIG. 10 is an alternative flow chart of a method for connecting devices according to an embodiment of the present application;
FIG. 11 is a schematic view of an alternative construction of a device connection apparatus provided in an embodiment of the present application;
FIG. 12 is a schematic view of an alternative construction of a device connection apparatus provided in an embodiment of the present application;
fig. 13 is an alternative structural schematic diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the present application will be described in further detail with reference to the accompanying drawings, and the described embodiments should not be construed as limiting the present application, and all other embodiments obtained by those skilled in the art without making any inventive effort are within the scope of the present application.
The embodiment of the application can provide a device connection method and device, a device and a storage medium. In practical applications, the device connection method may be implemented by an information processing apparatus, and each functional entity in the information processing apparatus may be cooperatively implemented by a hardware resource of a computer device (such as an earphone and a terminal device), a computing resource such as a processor, and a communication resource (such as for supporting communications in various manners such as implementing an optical cable and a cellular).
Of course, the embodiments of the present application are not limited to being provided as methods and hardware, but may be implemented in various manners, such as being provided as a storage medium (storing instructions for performing the device connection methods provided by the embodiments of the present application).
The device connection method provided in the embodiment of the present application may be applied to a wireless communication system shown in fig. 1, where, as shown in fig. 1, the wireless communication system includes: the first device 10 and the second device 20 may establish a plurality of communication connections, and communicate based on one of a plurality of communication modes corresponding to the plurality of communication connections. The communication modes corresponding to the communication connection between the first equipment and the second equipment comprise various of the following communication modes: local area network, direct communication, internet communication. The local area network may include a wireless local area network and a wired local area network, where the wireless local area network includes: wireless fidelity (Wireless Fidelity, wiFi), zigbee (zigbee), and the like; the direct communication includes: bluetooth, acoustic communication, mobile network-based Device-to-Device (D2D), etc., and Internet communication may be data communication using protocols such as message queue telemetry transport (Message Queuing Telemetry Transport, MQTT), hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP), etc. When the Internet communication adopts the MQTT protocol, the wireless communication system also comprises an MQTT server, the first equipment establishes connection with the MQTT server through the Internet communication, and the second equipment establishes connection with the MQTT server through the Internet communication, so that the first equipment and the second equipment establish communication connection through the MQTT server under the condition of accessing the Internet communication.
One of the first device and the second device is a control device, and the other is a controlled device. In an example, the first device is a control device capable of controlling the second device, which is a controlled device capable of being controlled by the first device. In an example, the first device is a controlled device that is controllable by the second device, which is a control device that is capable of controlling the first device.
In this embodiment, when the first communication connection is failed to be established, the first device 10 obtains, through the reference communication connection that is successfully established, first communication connection establishment information for establishing the first communication connection of the second device 20; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first device 10 establishes the first communication connection with the second device 20 through the first communication connection establishment information and second communication connection establishment information, which is information of the first device 10 for establishing the first communication connection.
In this embodiment of the present application, the control device may be a terminal device, which may refer to an access terminal, a User Equipment (UE), a subscriber unit, a subscriber station, a mobile station, a remote terminal, a mobile device, a User terminal, a wireless communication device, a User agent, or a User apparatus. An access terminal may be a cellular telephone, a cordless telephone, a session initiation protocol (Session Initiation Protocol, SIP) phone, a wireless local loop (Wireless Local Loop, WLL) station, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device with wireless communication capabilities, a computing device or other processing device connected to a wireless modem, an in-vehicle device, a wearable device, a terminal device in a 5th generation (5th generation,5G) network or a terminal device in a future evolved public land mobile network (Public Land Mobile Network, PLMN), etc. The controlled device may include: household equipment such as mobile phones, intelligent washing machines, air conditioners, refrigerators, projectors, air purifiers, electronic locks and the like.
Embodiments of a device connection method, apparatus, device, and storage medium provided in the embodiments of the present application are described below with reference to a schematic diagram of a wireless communication system shown in fig. 1.
An embodiment of the present application provides a device connection method, where the method is applied to a first device, and fig. 2A is a schematic implementation flow diagram of the device connection method of the first device in the embodiment of the present application, as shown in fig. 2A, where the method may include the following steps:
S201A, under the condition that the first communication connection is failed to be established, the first device acquires first communication connection establishment information of the second device for establishing the first communication connection through successful reference communication connection establishment.
The first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network. Here, the reference communication connection includes one or more communication connections, and the second communication means includes one or more communication means other than the local area network.
In the embodiment of the present application, the local area network may include a wireless local area network and a wired local area network, where the wireless local area network includes: wiFi, zigbee, and the like; the second communication mode includes: communication modes outside local area networks such as direct communication, internet communication and the like, wherein the direct communication comprises: bluetooth, acoustic communication, D2D based on a mobile network and the like, and Internet communication can be realized by adopting MQTT, HTTP and other protocols.
In one example, the first communication mode is WiFi and the second communication mode includes bluetooth and a data network. At this time, the reference communication connection includes: bluetooth communication connection and data network connection.
In one example, the first communication mode is WiFi and the second communication mode is bluetooth. At this time, the reference communication connection includes: bluetooth communication connection.
In one example, the first communication mode is WiFi and the second communication mode is a data network. At this time, the reference communication connection includes: and (5) connecting a data network.
The first device may have a control program disposed therein, and the user may trigger a connection with the second device by an operation of the control program, where the control program receives a search device operation of the user and triggers a search device instruction based on the search device operation of the user.
After receiving the search device instruction, the first device tries to establish the following communication connection with the second device: the communication mode is a first communication connection of the local area network, namely a local area network communication connection, and the communication mode is a reference communication connection of a second communication mode.
When the first device establishes reference communication connection with the second device and does not establish first communication connection with the second device, a connection information acquisition request is sent to the second device through the established reference communication connection to acquire first communication connection establishment information of the second device, and when the second device receives the connection information acquisition request, the first communication connection establishment information is sent to the first device through the reference communication connection.
The first communication connection establishment information is information required for the second device to establish a first connection with the first device. In an example, the first communication connection is a WiFi connection corresponding to WiFi, and the first communication connection establishment information includes at least one of: information such as a service set identification (Service Set Identifier, SSID) of a local area network to which the second device is connected, an internet protocol (Internet Protocol, IP) address of the local area network to which the second device is connected, a subnet mask of the local area network to which the second device is connected, and the like.
In the embodiment of the application, the first device acquires the first communication connection establishment information through one or more communication connections in the reference communication connection established with the second device. In the case where the reference communication connection includes a direct communication connection and an internet communication connection, the first device may obtain the first communication connection establishment information from the second device through one or both of the direct communication connection and the internet communication connection. The reference communication connection comprises: under the condition of direct communication connection, the first equipment acquires first communication connection establishment information from the second equipment through the direct communication connection. The reference communication connection comprises: in the case of an internet communication connection, the first device obtains first communication connection establishment information from the second device via the internet communication connection.
S202A, the first device establishes the first communication connection with the second device through the first communication connection establishment information and the second communication connection establishment information.
The second communication connection establishment information is information of the first device for establishing the first communication connection.
After the first device obtains the first communication connection establishment information through the reference communication connection, the second communication connection establishment information of the first device is compared with the obtained first communication connection establishment information. The first device establishes a first communication connection with the second device if it is determined that the first device and the second device are located in the same local area network. The first device, if it is determined that the first device and the second device are located in different local area networks, relinquishes establishing the first communication connection with the second device, at which point the first device may communicate with the second device via the reference communication connection to control the second device.
The second communication connection establishment information is necessary information required for the first device to establish the first communication connection with the second device; in an example, the first communication connection is a WiFi connection corresponding to WiFi, and the second communication connection establishment information includes: the SSID of the local area network accessed by the first device, the IP address of the local area network accessed by the first device, the subnet mask of the local area network accessed by the first device and the like.
Here, after acquiring the first communication connection establishment information, the first device sends a connection establishment request carrying second communication connection establishment information to the second device based on the first communication connection information to establish a connection with the second device. The connection establishment request may employ a transport protocol such as user datagram protocol (User Datagram Protocol, UDP) or transmission control protocol (Transmission Control Protocol, TCP). And under the condition that the connection establishment request adopts TCP, the second equipment sends a confirmation message to the first equipment, and if the first equipment receives the confirmation message sent by the second equipment, the second equipment returns a confirmation message to the second equipment, so that the establishment of the first communication connection between the first equipment and the second equipment is completed.
Here, in the case where the first device and the second device are located in the same lan, they may be located in different network segments, and the subnet masks are different.
It should be noted that, when the first device and the second device are located in the same network segment of the same lan, the first device and the second device can discover each other through the lan, and establish a first communication connection; when the first device and the second device are located in different network segments of the same local area network, the first device and the second device cannot find each other through the local area network, and then the first communication connection cannot be established.
According to the device connection method provided by the embodiment of the application, under the condition that the first communication connection is failed to be established, the first device acquires first communication connection establishment information of the second device for establishing the first communication connection through successful establishment of the reference communication connection; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first device establishes the first communication connection with the second device through the first communication connection establishment information and the second communication connection establishment information, wherein the second communication connection establishment information is information of the first device for establishing the first communication connection; and the second equipment is connected with the first equipment by the second communication mode, so that connection establishment information required by the second equipment for establishing the first communication connection is acquired based on other communication modes outside the local area network, the first communication connection is established, the communication defects of the local area network are compensated through other communication modes, and the connection based on the local area network is realized between the first equipment and the second equipment of the expanded network section.
An embodiment of the present application provides a device connection method, where the method is applied to a second device, and fig. 2B is a schematic implementation flow diagram of the device connection method of the second device in the embodiment of the present application, as shown in fig. 2B, where the method may include the following steps:
S201B, when the first communication connection with the first device fails to be established, the second device sends first communication connection establishment information for establishing the first communication connection to the first device through the reference communication connection successfully established with the first device.
The first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first communication connection establishment information is used for the first equipment to combine with the second communication connection establishment information, the first communication connection is established with the second equipment, the first communication connection establishment information is information of the second equipment for establishing the first communication connection, and the second communication connection establishment information is information of the first equipment for establishing the first communication connection.
The first device attempts to establish the following communication connection with the second device: the communication mode is a first communication connection of the local area network, namely a local area network communication connection, and the communication mode is a reference communication connection of a second communication mode. Wherein the second communication means comprises one or more communication means other than a local area network.
In the embodiment of the present application, the local area network may include a wireless local area network and a wired local area network, where the wireless local area network includes: WIFI, zigbee, etc.; the second communication mode includes: communication modes outside local area networks such as direct communication, internet communication and the like, wherein the direct communication comprises: bluetooth, acoustic communication, D2D based on a mobile network and the like, and Internet communication can be realized by adopting MQTT, HTTP and other protocols.
In one example, the first communication mode is WiFi and the second communication mode includes bluetooth and a data network. At this time, the reference communication connection includes: bluetooth communication connection and data network connection.
In one example, the first communication mode is WiFi and the second communication mode is bluetooth. At this time, the reference communication connection includes: bluetooth communication connection.
In one example, the first communication mode is WiFi and the second communication mode is a data network. At this time, the reference communication connection includes: and (5) connecting a data network.
When the first device establishes reference communication connection with the second device and does not establish first communication connection with the second device, a connection information acquisition request is sent to the second device through the established reference communication connection to acquire first communication connection establishment information of the second device, and when the second device receives the connection information acquisition request, the first communication connection establishment information is sent to the first device through the reference communication connection.
The first communication connection establishment information is information required for the second device to establish a first communication connection with the first device. In an example, the first communication connection is a WiFi connection corresponding to WiFi, and the first communication connection establishment information includes at least one of: the SSID of the local area network accessed by the second device, the IP address of the local area network accessed by the second device, the subnet mask of the local area network accessed by the second device, and the like.
In the embodiment of the application, the second device sends the first communication connection establishment information to the first device through one or more communication connections in the reference communication connection established with the first device. In the case where the reference communication connection comprises a direct communication connection and an internet communication connection, the second device may send the first communication connection establishment information from the second device to the first device via one or both of the direct communication connection and the internet communication connection. The reference communication connection comprises: and under the condition of direct communication connection, the second equipment sends the first communication connection establishment information to the first equipment through the direct communication connection. The reference communication connection comprises: in the case of an internet communication connection, the second device sends the first communication connection establishment information to the first device via the internet communication connection.
After receiving the first communication connection establishment information, the first device compares the second communication connection establishment information with the acquired first communication connection establishment information. The first device establishes a first communication connection with the second device if it is determined that the first device and the second device are located in the same local area network. The first device, if it is determined that the first device and the second device are located in different local area networks, relinquishes establishing the first communication connection with the second device, at which point the first device may communicate with the second device via the reference communication connection to control the second device.
The second communication connection establishment information is information required by the first equipment to establish local area network connection with the second equipment; in an example, the first communication connection is a WiFi connection corresponding to WiFi, and the second communication connection establishment information includes at least one of: the SSID of the local area network accessed by the first device, the IP address of the local area network accessed by the first device, the subnet mask of the local area network accessed by the first device and the like.
Here, in the case where the first device and the second device are located in the same lan, they may be located in different network segments, and the subnet masks are different.
It should be noted that, when the first device and the second device are located in the same network segment of the same lan, the first device and the second device can discover each other through the lan, and establish a first communication connection; when the first device and the second device are located in different network segments of the same local area network, the first device and the second device cannot find each other through the local area network, and then the first communication connection cannot be established.
According to the device connection method, when the first communication connection with the first device fails to be established, the second device sends first communication connection establishment information for establishing the first communication connection to the first device through the reference communication connection successfully established with the first device; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first communication connection establishment information is used for the first equipment to combine with second communication connection establishment information, the first communication connection is established with the second equipment, and the second communication connection establishment information is information of the first equipment for establishing the first communication connection; and the communication connection corresponding to the local area network is acquired and established based on other communication modes outside the local area network, so that the communication defects of the local area network are compensated through other communication modes, and the connection based on the local area network between the first equipment and the second equipment of the expanded network section is realized.
In some embodiments, the method further comprises: the first device discovering the second device from a first channel and a reference channel, respectively; the communication mode corresponding to the first channel is the first communication mode, and the communication mode corresponding to the reference channel is the second communication mode; in the case that the first device does not find the second device from the first channel, the first device determines that the first communication connection establishment fails; the first device establishes the reference communication connection with the second device in the event that the first device discovers the second device from the reference channel.
Here, the communication mode of the first channel is a local area network, which may be called a local area network channel; the communication manner of the reference channel is a second communication manner, and the reference channel may include one or more of the second channel and the third channel. The communication mode of the second channel is direct communication, and can be called as a direct communication channel; the communication mode of the third channel is internet communication, which can be called an internet communication channel, that is, the second communication mode comprises one or more of direct communication and internet communication.
And the first device performs device discovery when receiving the device search instruction so as to determine whether the connectable device comprises the second device. Here, the first device detects whether the connectable device corresponding to each communication mode includes the second device based on the first channel and the reference channel in the case of receiving the device search instruction, so as to determine whether the first device can establish a corresponding communication connection with the second device.
When the first device does not find the connectable device based on the first channel or the found connectable device does not include the second device, it is determined that the second device does not belong to the connectable device based on the local area network, and the first device cannot establish the first communication connection with the second device.
And when the first device discovers that the second device belongs to the connectable device based on the reference channel, determining that the second device belongs to the connectable device based on the second communication mode, and establishing reference communication connection between the first device and the second device.
In some embodiments, the reference channel comprises: the communication mode is a second channel of direct communication and the communication mode is a third channel of internet communication, and when the first device discovers the second device from the reference channel, the first device establishes the reference communication connection with the second device, including:
the first device establishes a second communication connection with the second device; the communication mode of the second communication connection is direct communication; the first device establishes a third communication connection with the second device; the communication mode of the third communication connection is internet communication.
Under the condition that the first device receives the device search instruction, the first channel, the second channel and the third channel are triggered to discover the second device, so that whether the second device belongs to connectable devices in a plurality of communication modes based on local area network, direct communication and internet communication is judged.
When the first device finds that the second device belongs to the connectable device based on the direct communication channel, the first device establishes direct communication connection with the second device. When the first device discovers that the second device belongs to the connectable device based on the internet communication channel, the first device establishes the internet communication connection with the second device.
In the embodiment of the present application, the communication manner supported by the second device may include: local area network, direct communication, and internet communication. In an example, as shown in fig. 3, taking a local area network as WiFi, direct communication as bluetooth, and MQTT as an example for internet communication, the second device 300 includes a WiFi service 301, a bluetooth service 302, and an MQTT service 303, where the communication mode supported by the local area network service is WiFi, the communication mode supported by the bluetooth service is bluetooth, and the communication mode supported by the MQTT service is MQTT.
In an example, when the first device obtains the first communication connection establishment information through the direct communication connection, the first communication connection establishment information may be obtained from the direct communication service; at this time, the direct communication service acquires the first connection establishment information from the lan service. When the first device obtains the first communication connection establishment information through the internet communication connection, the first communication connection establishment information can be obtained from the internet communication service, and at this time, the internet communication service obtains the first connection establishment information from the local area network service.
In some embodiments, the method further comprises:
the first device establishes the first communication connection with the second device in the case where the first device discovers the second device from the first channel.
In this embodiment of the present application, when the first device discovers that the second device belongs to the connectable device based on the lan channel, the first communication connection is established with the second device.
In this embodiment, for a channel in which the second device is detected to belong to a connectable device, the first device establishes a corresponding communication connection with the second device based on a communication manner corresponding to the channel.
In this embodiment, as shown in fig. 4, the connection established between the first device 41 and the second device 42 includes: local area network communication connection 401, direct communication connection 402, internet communication connection 403.
In the embodiment of the application, under the condition that multiple communication connections are established between the first device and the second device, the first device and the second device communicate based on one communication connection in the multiple communication connections. Wherein the connection over which the communication is made may be selected based on:
mode 1: randomly selecting;
mode 2 is based on the communication connection corresponding to the highest priority communication mode.
In this embodiment of the present application, in the case where a plurality of communication connections are established between the first device and the second device, a selection manner of the communication connection for performing communication between the first device and the second device is not limited in any way.
In some embodiments, the second communication means includes: the reference communication connection includes a second communication connection with a communication mode of direct communication and a third communication connection with a communication mode of internet communication, and the step of obtaining, by establishing a successful reference communication connection in S202A implemented by the electronic device, first communication connection establishment information of the second device for establishing the first communication connection may be implemented as: determining the priority of direct communication and internet communication; selecting a target communication connection from the second communication connection and the third communication connection according to the acquired priority; the communication mode of the target communication connection is a communication mode with high priority in the direct communication and the internet communication; and the first equipment acquires the first communication connection establishment information through the target communication connection.
Here, the second communication method includes: in the case of direct communication and internet communication, the reference communication connection includes a second communication connection and a third communication connection, the first device selects a communication connection with a higher priority of a communication scheme from among the reference communication connections as a target communication connection according to the priority of the direct communication and the priority of the internet communication, and acquires first communication connection establishment information from the second device based on the target communication connection. At this time, the second device transmits first communication connection establishment information to the first device based on the target communication connection.
In an example, taking direct communication as bluetooth and internet communication as MQTT, where bluetooth has a priority higher than that of MQTT, the first device obtains the first communication connection establishment information from the second device using the bluetooth communication connection, and the second device sends the first communication connection establishment information to the first device through the second communication connection.
In an example, taking direct communication as bluetooth and internet communication as MQTT, where the priority of bluetooth is lower than that of MQTT, the first device acquires the first communication connection establishment information from the second device using the MQTT communication connection, and the second device sends the first communication connection establishment information to the first device through the third communication connection.
In some embodiments, before the first device establishes the first communication connection with the second device through the first communication connection establishment information and the second communication connection establishment information, the method further comprises:
the first device detecting whether the first device has established the first communication connection with the second device;
and under the condition that the first communication connection with the second equipment is not established as a detection result, the first equipment determines to establish the first communication connection with the second equipment through the first communication connection establishment information and the second communication connection establishment information.
Here, after the first device acquires the first communication connection establishment information and before the first communication connection is established based on the first communication connection information, it is determined whether the first device has currently established the first communication connection with the second device. In this embodiment of the present invention, when there is a possibility that information of the first device or the second device accessing the local area network changes, the first device and the second device may be located in the same network segment, and the first device and the second device may discover each other and establish a first communication connection based on the changed information, where the first device does not need to establish a first communication connection with the second device based on the obtained first communication connection establishment information, and when the first device and the second device do not establish the first communication connection, the first device establishes the first communication connection with the second device through the obtained first communication connection establishment information.
In some embodiments, the second communication means includes: direct communication and internet communication, the method further comprising:
when a first device adopts a communication connection corresponding to a third communication mode to communicate with a second device, detecting whether the communication connection corresponding to the third communication mode meets a corresponding communication connection interruption condition or not; the third communication mode is any one of the local area network, the direct communication and the internet communication;
And under the condition that the communication connection corresponding to the third communication mode meets the corresponding communication connection interruption condition, the first equipment adopts the communication connection corresponding to a fourth communication mode to communicate with the second equipment, wherein the fourth communication mode is one of the local area network, the direct communication and the internet communication except the third communication mode, and the priority of the third communication mode is higher than that of the fourth communication mode.
The third communication mode is any one of the local area network, the direct communication and the internet communication, and the fourth communication mode is a communication mode which is lower in priority than the third communication mode except the third communication mode in the local area network, the direct communication and the internet communication.
In this embodiment, when the first device and the second device communicate by using a communication connection corresponding to a high-priority communication manner, the current communication connection satisfies a corresponding communication connection interruption condition, and then the first device and the second device cannot continue to communicate by using the current communication connection.
Here, the communication connection interruption conditions corresponding to different communication connections are the same or different.
In one example, for different communication connections, the communication connection disruption conditions include: and not receiving the heartbeat packet within the set time threshold. The time threshold may be 5 milliseconds (ms), 10ms, 15ms, etc. The time thresholds corresponding to different communication connections may be the same or different.
In an example, the communication connection interruption condition corresponding to the first communication connection includes: the local area network signal is less than a first signal threshold, the data transmission rate is less than a first rate threshold, etc.; the communication connection interruption condition corresponding to the second communication connection includes: the distance between the first device and the second device is larger than a distance threshold, the data transmission rate is smaller than a second rate threshold, etc.; the communication connection interruption condition corresponding to the third communication connection includes: disconnecting the first device from internet communication, disconnecting the second device from internet communication, the data transfer rate being less than a third rate threshold, etc. In the embodiment of the present application, the communication connection interruption condition corresponding to each communication connection is not limited.
The first signal threshold, the first rate threshold, the distance threshold, the second rate threshold, the third rate threshold, and the like referred to in the embodiments of the present application may be data set according to actual experience or data obtained based on experimental tests. The size of each threshold is not limited in this embodiment. In an example, the second rate threshold is less than the third rate threshold, and the third rate threshold is less than the first rate threshold, such as: the first transmission rate is 50 kilobits per second (kbps), the second rate threshold is 5kbps, and the third rate threshold is 10kbps.
When the first equipment and the second equipment cannot continue to communicate based on the current communication connection, communication is performed by adopting a communication mode with relatively lower priority, namely, a communication connection corresponding to a fourth communication mode, so that communication degradation is realized. The priorities of the local area network, the direct communication and the Internet communication are respectively different.
In this embodiment of the present application, the priority of the communication connection corresponds to the priority of the corresponding communication mode. For a communication connection, if the priority of the corresponding communication mode is high, the priority of the communication connection is high, and if the priority of the corresponding communication connection is low, the priority of the communication connection is low.
In one example, the priority of local area network, direct communication, and internet communication is ordered from high to low: the local area network, the direct communication and the internet communication, when the third communication mode is the local area network, the fourth communication mode is: when the third communication mode is local area network, the fourth communication mode is: internet communication; when the third communication mode is direct communication, the fourth communication mode is: and (5) Internet communication.
In some embodiments, the method further comprises:
the first device detects whether the communication connection corresponding to the sixth communication mode meets the corresponding communication connection recovery condition when the communication connection corresponding to the fifth communication mode is adopted to communicate with the second device; the fifth communication mode is any one of the local area network, the direct communication and the internet communication, the sixth communication mode is one of the local area network, the direct communication and the internet communication except the fifth communication mode, and the priority of the fifth communication mode is lower than that of the sixth communication mode; and when the communication connection corresponding to the sixth communication mode meets the corresponding communication connection recovery condition, the first device communicates with the second device by adopting the communication connection corresponding to the sixth communication mode.
In this embodiment of the present application, when the high-priority communication connection meets the corresponding connection interruption condition, when the first device and the second device communicate by adopting the communication connection corresponding to the low-priority communication mode, at this time, the first device detects whether the high-priority communication connection meets the corresponding communication connection restoration condition, and when the high-priority communication connection meets the corresponding communication connection restoration condition, the high-priority communication connection is characterized as being available.
Here, the communication connection restoration conditions corresponding to the different communication connections are the same or different.
In an example, the communication restoration conditions corresponding to the different communication connections include: a heartbeat packet is received based on the corresponding communication connection.
In an example, the communication connection restoration condition corresponding to the first communication connection includes: the local area network signal is greater than the second signal threshold, the data transmission rate is greater than the fourth rate threshold, etc.; the communication connection recovery condition corresponding to the second communication connection includes: the distance between the first device and the second device is smaller than a distance threshold, the data transmission rate is larger than a fifth rate threshold, and the like; the communication connection recovery condition corresponding to the third communication connection includes: the first device establishes a connection with internet communications, the second device establishes a connection with internet communications, the data transfer rate is greater than a sixth rate threshold, and so on. In the embodiment of the present application, the communication connection recovery conditions corresponding to the respective communication connections are not limited at all.
The second signal threshold, the fourth rate threshold, the distance threshold, the fifth rate threshold, the sixth rate threshold, and the like referred to in the embodiments of the present application may be data set according to actual experience or data obtained based on experimental tests. The size of each threshold is not limited in this embodiment. In an example, the fifth rate threshold is less than the sixth rate threshold, and the sixth rate threshold is less than the fourth rate threshold, such as: the fourth transmission rate is 50 kilobits per second (kbps), the fifth rate threshold is 5kbps, and the sixth rate threshold is 10kbps.
When the first device detects that communication can be performed based on the communication connection with high priority, the adopted communication connection is switched from the current communication connection to the communication connection with high priority, and communication is performed by adopting a communication mode with relatively higher priority, namely, a communication connection corresponding to a sixth communication mode, so that communication upgrading is realized. The priorities of the local area network, the direct communication and the internet communication are respectively different.
In one example, the priority of local area network, direct communication, and internet communication is ordered from high to low: the local area network, the direct communication and the internet communication, and when the fifth communication mode is direct communication, the sixth communication mode is: when the fifth communication mode is internet communication, the third communication mode is: direct communication; when the third communication mode is internet communication, the fourth communication mode is: a local area network.
In some embodiments, the second communication means includes: direct communication and internet communication, the method further comprising:
when the first device cannot be connected to the second device through a seventh communication connection, positioning fault information of the seventh communication connection through an eighth communication connection, wherein the seventh communication connection is one of the first communication connection, the second communication connection and the third communication connection, the eighth communication connection is one of the first communication connection, the second communication connection and the third communication connection except for the seventh communication connection, a communication mode of the second communication connection is direct communication, and a communication mode of the third communication connection is internet communication; the first device outputs the fault information.
In this embodiment of the present invention, when there are a seventh communication connection that is successfully established and an eighth communication connection that is not successfully established in three communication connections supported by the first device and the second device, connection information for the eighth communication connection may be acquired from the second device by means of the seventh communication connection, fault information reflecting that the eighth communication connection is not successfully established may be determined based on the acquired connection information, and the fault information may be output, so that a user may be able to learn a cause of the failure of the seventh communication connection. Wherein the failure information can characterize a cause of the eighth communication connection not being established successfully.
In the embodiment of the present application, the fault information corresponding to different communication connections may be different. In an example, the fault information corresponding to the first communication connection includes: the second device does not turn on the local area network, the second device does not access the local area network, the first device and the second device are not in one local area network, the first device and the second device access the same local area network but are not in the same network segment, etc. In an example, the fault information corresponding to the second communication connection includes: the second device does not open direct communication, the first device is far from the second device, etc. In an example, the fault information corresponding to the third communication connection includes: the second device does not turn on internet communications, MQTT service, etc.
In the embodiment of the application, the first device determines a communication mode of the eighth communication connection, and acquires the connection information from the second device based on the communication mode of the eighth communication connection.
In an example, if the eighth communication connection is a lan communication connection, the first device obtains connection information of the second device for establishing the lan communication connection through direct communication or internet communication, and determines failure information that the lan communication connection is not established successfully based on the obtained connection information. The acquired connection information may include: the information of a first identifier representing the local area network opening state of the second device, a second identifier of whether the second device is connected to the local area network, a local area network identifier (such as SSID) of the local area network to which the second device is connected, IP of the second device in the connected local area network, a subnet mask of the second device in the connected local area network and the like is represented. At this time, the failure information determined by the first device based on the acquired connection information includes one of: the second device does not open the local area network, the second device does not access the local area network, the first device and the second device access different local area networks, the first device and the second device access the same local area network but are in different network segments, and the like.
In an example, if the eighth communication connection is a direct communication connection, the first device acquires connection information for establishing the direct communication connection of the second device through local area network or internet communication, and determines failure information that the direct communication connection is not established successfully based on the acquired connection information. The acquired connection information may include: the third identifier representing the direct communication opening state of the second device, the fourth identifier whether the second device establishes direct communication connection, the position information of the second device, the signal strength of the wireless local area network accessed by the second device and the like. At this time, the failure information determined by the first device based on the acquired connection information includes one of: the second device does not open direct communication, the first device is far from the second device, etc.
In an example, if the eighth communication connection is an internet communication connection, the first device obtains connection information for establishing the internet communication connection of the second device through a local area network or direct communication, and determines failure information that the internet communication connection is not successfully established based on the obtained connection information. The acquired connection information comprises: the internet communication on condition of the second device, the MQTT service on condition of the second device, and the like, at which time the failure information determined based on the connection information includes one of: the second device does not turn on internet communications, MQTT service, etc.
In the embodiment of the invention, the connection information of the communication connection which is not established successfully is obtained through the communication connection which is established successfully, and the fault information which characterizes the failure of the communication connection which is not established successfully is determined based on the obtained connection information, so that a user can intuitively locate the reason of the failure of the communication connection.
In the embodiment of the present application, the fault information corresponding to each communication connection is not limited.
Next, the mobile phone using the first device as the control device, the projection device using the second device as the controlled device, the first communication mode being WiFi, the second communication mode including: bluetooth and MQTT-based Internet communication are taken as examples, and the device connection method provided by the embodiment of the application is described.
Under the condition that the mobile phone and the projection equipment are connected only through a local area network, namely a wireless local area network, the following technical problems exist:
1. the connection establishment speed is low;
2. poor network condition connection is unstable;
3. the mobile phone and the projection equipment cross network segments under the same local area network, and the mobile phone cannot find the projection equipment;
4. under the condition that the mobile phone cannot be connected with the projection equipment, the mobile phone cannot know the specific reason of the failure to connect;
5. the projection device cannot be remotely controlled in a non-identical local area network.
In the embodiment of the application, the mobile phone and the projection equipment can be connected by adopting a multi-mode connection scheme. In the multi-mode connection scheme, the mobile phone is simultaneously connected through a local area network, an MQTT and Bluetooth (BLE), and the most suitable communication mode is automatically selected according to the current network condition. Under the condition that the current communication mode is unstable, the communication mode of the mobile phone and the projection equipment is switched to other communication modes, so that the optimal experience of the mobile phone and the projection equipment is ensured.
The device connection method provided by the embodiment of the application comprises the following aspects:
in the first aspect, three communication modes of the mobile phone and the projection equipment are provided simultaneously: communication scheme 1, wireless lan, communication scheme 2, MQTT, communication scheme 3, BLE.
For a wireless local area network, the method has the advantages of high transmission rate, long communication distance, large transmission data volume and high instantaneity, and the defects that the projection equipment and the mobile phone are required to be in the same local area network and the same network segment, and communication is unstable if the bandwidth of the network is occupied by other services, and applicable advantageous scenes comprise: screen throwing, picture transmission, file transmission and game.
For the MQTT, the method has the advantages that the mobile phone and the projection equipment can be used after being accessed to the Internet (data network), the communication distance is not limited, and the method has the advantages that the mobile phone and the projection equipment are not in direct communication, depend on the MQTT service and have low instantaneity, and the applicable advantage scenes include: and (5) remote operation.
For BLE, the method has the advantages of high connection speed, no dependence on network conditions and third party services, high instantaneity, short communication distance and small transmission data volume, and the applicable advantage scenes comprise: nearby device discovery, quick connect, simple instruction.
In the embodiment of the application, the connection is established by combining the advantages of the three communication modes, and the respective disadvantages are compensated.
The process of connecting the mobile phone with the projection equipment comprises the following steps:
s11, the mobile phone discovers connectable equipment;
the mobile phone runs a control program for controlling the projection equipment, and after the control program in the mobile phone is started, the mobile phone searches connectable equipment from the wireless local area network channel, the MQTT channel and the BLE channel at the same time.
The process of searching the connectable device from the wireless lan channel by the mobile phone is shown in fig. 5, and includes:
s501, the mobile phone receives a search instruction.
The search instruction is to instruct searching for connectable devices.
S502, the mobile phone judges whether to turn on the hot spot or connect to WiFi.
If the handset turns on the hotspot or connects to WiFi, S5031 is executed, otherwise S5032 is executed and the search is terminated.
S5031, the mobile phone transmits a broadcast.
The broadcast sent by the mobile phone is only detected by the equipment of the same network segment under the same wireless local area network. Wherein the broadcast herein may comprise a UDP broadcast.
For the projection device 51 in the same route and under a different network segment as the mobile phone, the broadcast sent by the mobile phone cannot reach the projection device 51.
For the projection device 52 that is the same network segment as the cell phone, the projection device 52 performs the following steps:
s521, receiving a broadcast;
s522, replying to the UDP message.
The projection device 52 returns a UDP message to the handset as a reply to the broadcast, at which point the handset will receive the UDP message replied to by the projection device 52.
S504, is the mobile phone determining that a reply of the broadcast is received?
If the mobile phone receives the broadcast response, i.e., the UDP message, S505 is executed, otherwise S5031 is continued.
S505, the mobile phone adds the projection equipment into the equipment list.
Here, the devices in the device list are connectable devices found by the handset.
S506, returning to the device list.
S507, the mobile phone shows connectable equipment in the equipment list.
Among them, the implementation of S5031 to S506 may be integrated in a software development kit (gmSDK) 50 of the cellular phone.
The flow of the mobile phone searching the connectable equipment from the MQTT channel is shown in fig. 6, and the flow comprises the following steps:
s601, the mobile phone receives a search instruction.
S602, the mobile phone judges whether to connect to the Internet.
In the case where the mobile phone is connected to the internet, S6031 is performed, otherwise S6032 is performed, and the search is terminated.
S6031, the mobile phone acquires the online condition of the projection equipment.
Here, in the case where the mobile phone acquires the projection device 62 from the MQTT server 61, the MQTT server 61 includes: a device presence service 611 and an MQTT proxy (brooker) 612, the device presence service 611 includes a list of presence devices 6111.
The projection device 62 includes an MQTT service 621 that interacts with the MQTT server 61. When the MQTT service 621 issues an up/down message to the MQTT browser 612, in the case where the device presence service 611 subscribes to the MQTT browser 612 for presence information of the projection device, the MQTT browser 612 notifies the device presence service 611 of the up or down of the projection device 62 based on the MQTT service 621, and records the presence condition of the projection device 62 in the presence device list 6111.
The mobile phone acquires the online condition of the projection device 62 from the online device list 6111, and the online device list 6111 returns the online condition of the projection device 62 to the mobile phone, so that the mobile phone obtains the online condition of the projection device.
S604, device is online?
The mobile phone judges whether the projection equipment is on-line or not, and the mobile phone judges whether the projection equipment is on-line or not based on the on-line condition of the projection equipment returned by the MQTT server. If online, S6051 is performed, determining that the device is connectable. If not, S6052 is performed, determining that the device is not connectable.
If the projection equipment is on-line, the mobile phone determines that the projection equipment is connectable, namely the connectable equipment comprises the projection equipment; if the projection device is not online, the handset determines that it is not connectable at the projection device, i.e., the connection device does not include the projection device.
For the projection equipment, namely, the local MQTT service is used for issuing the online and offline information to the MQTT proxy in the MQTT server, the MQTT proxy is used for sending the online and offline information of the projection equipment to the equipment online service in the MQTT server, and the equipment online service is used for synchronizing the online information of the projection equipment to an online equipment list. The equipment online service receives a mobile phone online state acquisition request to acquire the online state of the projection equipment, inquires the online state of the projection equipment in an online equipment list, and returns the inquired online state to the mobile phone.
The process of searching for connectable devices from the BLE channel by the mobile phone is shown in fig. 7, and includes:
s701, the mobile phone receives a search instruction.
S702, the mobile phone starts Bluetooth peripheral service.
When the mobile phone turns on the bluetooth peripheral service, the projector apparatus 71 performs S703, transmitting BLE broadcast based on the bluetooth service 711. At this time, the handset performs S704.
S704, the mobile phone receives BLE broadcasting.
S705, determining, by the mobile phone, that the data packet is the data packet of the projection device?
The mobile phone judges whether the received BLE broadcast is a data packet of the projection device, and if the received BLE broadcast is a data packet of the projection device, S7061 is executed to determine that the device is connectable, i.e. the connectable device includes the projection device, otherwise S7062 is executed to determine that the projection device is a non-connectable device, and the connectable device does not include the projection device.
S12, the mobile phone establishes connection with the connectable equipment.
For any channel to which the projection device can be connected, the mobile phone establishes a corresponding communication connection with the projection device.
When the mobile phone determines that the projection equipment can be connected based on the wireless local area network channel, the mobile phone acquires the IP address of the projection equipment, carries out UDP direct broadcasting based on the IP address, and receives a response to the UDP broadcasting returned by the projection equipment, and the communication connection establishment based on the wireless local area network is successful.
When the mobile phone determines that the projection equipment can be connected based on the MQTT channel, the projection equipment in the equipment online service is in an online state, the mobile phone is connected to the MQTT server as a client of the MQTT server, and completes message subscription, and then the communication connection between the mobile phone and the projection equipment based on the MQTT is considered to be successfully established.
When the mobile phone determines that the projection equipment can be connected based on the Bluetooth channel, after the mobile phone discovers the projection equipment which can be connected with BLE, the mobile phone directly connects with the projection equipment, namely, establishes Bluetooth-based communication connection with the projection equipment.
For the non-connectable channels of the projection device, the mobile phone compensates the necessary information for the establishment of the corresponding communication connection through the established communication connection.
On the premise that communication connection of three communication modes is successfully established, the local area network can obtain optimal experience. For wireless local area networks, the handset needs to acquire the IP of the projection device in the local area network. The mobile phone and the projection equipment are in a cross-network section even under the same local area network, and the mobile phone cannot find and acquire the IP of the projection equipment through the equipment. The IP of the projection device may be acquired at this time using the MQTT-based communication connection or BLE-based communication connection that has been successfully connected.
The process of the handset obtaining the IP of the projection device using the successfully connected MQTT-based communication connection or BLE-based communication connection is shown in fig. 8, and includes:
s801, searching local area network equipment by the mobile phone.
S802, the mobile phone judges whether to cross the network segment with the projection equipment or not.
And under the condition that the mobile phone judges that the mobile phone and the projection equipment cross the network segment, executing S8031 and S8032, otherwise, executing S8033.
S8031, the mobile phone judges whether the MQTT connection is established.
In the case where the MQTT connection has been established, S8041 is performed, otherwise S8043, search termination is performed.
S8032, the mobile phone judges whether BLE connection is established.
In case a BLE connection has been established S8042 is performed, otherwise S8043, search termination is performed.
Here, in the case where the MQTT connection is not established and the BLE connection is not established, the search is terminated and the connection compensation is ended.
S8033, discovering a local area network connectable device.
S8041, the mobile phone acquires the IP of the projection equipment through the MQTT.
The mobile phone acquires the IP of the projection device from the MQTT service in the projection device through the MQTT connection with the projection device.
S8042, the mobile phone acquires the IP of the projection equipment through BLE.
The mobile phone obtains the IP of the projection device from the BLE service in the projection device through the BLE connection between the mobile phone and the projection device.
In the embodiment of the present application, the projection device 81 includes: MQTT service 811, lan connectivity service 812, and BLE service 813.
The MQTT service 811 is configured to send the IP address of the projection device to the mobile phone through the MQTT, so that the mobile phone obtains the IP of the projection device through the MQTT. The BLE service 813 is configured to send the IP address of the projection device to the mobile phone through BLE, so that the mobile phone obtains the IP of the projection device through BLE.
If the mobile phone acquires the IP of the projection device, S805 is executed.
S805, the mobile phone judges whether the wireless local area network connection is established.
If the wireless lan connection has been established, it ends, otherwise S806 is performed.
S806, the mobile phone establishes wireless local area network connection with the projection equipment.
After the wireless local area network connection is established between the mobile phone and the projection equipment, the UDP message sent by the projection equipment is received, and the UDP message is sent to the projection equipment.
In the embodiment of the application, the projection equipment is respectively provided with a wireless local area network service, an MQTT service and a BLE service, the mobile phone establishes wireless local area network connection with the wireless local area network service in the projection equipment, the mobile phone establishes MQTT connection with the MQTT service in the projection equipment, and the mobile phone establishes BLE connection with the BLE service in the shadow equipment.
S13, the mobile phone selects a main communication mode for communication with the projection equipment according to the current communication scene.
(1) Under the condition that the wireless local area network connection, the MQTT connection and the BLE connection are successfully established, the mobile phone selects a main communication mode according to the priority of the wireless local area network, the MQTT and the BLE. The three communication modes of the wireless local area network, the MQTT and the BLE are ordered according to the priority level: high priority: local area network, medium priority: BLE, low priority: MQTT.
The mobile phone selects a wireless local area network with high priority as a main communication mode according to the priority of the three communication modes.
(2) Automatic switching of communication modes
Degradation of communication modes: in the process of controlling the projection device by a high-priority communication mode, the mobile phone may have a situation that the communication connection is disconnected or unstable due to the following reasons: router failure, internet connection interruption, leaving BLE bluetooth communicable range, network jitter. At this time, the mobile phone can switch the communication mode from high priority to low priority, so as to ensure that the projection equipment can be controlled continuously.
As shown in fig. 9, when the mobile phone performs S901 and performs control based on the lan system, and detects S902 that the wireless lan communication connection is disconnected, and when the mobile phone cannot communicate with the wireless lan service 911 in the projection device 92, the mobile phone performs S903 and switches the communication system to the BLE system, and performs 904 and performs control based on the BLE system.
When the mobile phone performs S904 to control the projection device based on the BLE method, that is, the bluetooth communication connection is used, it is detected that the mobile phone has disconnected the BLE communication connection in S905, and at this time, the mobile phone cannot communicate with the bluetooth service 912 of the projection device 91, the mobile phone performs S906 to switch the communication method to the MQTT method, and performs S907 to control based on the MQTT method.
Here, the mobile phone communicates with the MQTT service 913 in the projection device 91 through the MQTT cloud service (MQTT cloud server) 92 to control the projection device when executing S907.
Upgrading the communication mode: in the process of controlling the projection equipment through the communication mode with low priority, under the condition that communication connection corresponding to the communication mode with high priority is recovered, at this time, the communication mode can be switched from low priority to high priority by the mobile phone, and control experience is improved.
As shown in fig. 10, when the mobile phone performs S1001 and performs control based on the MQTT system, that is, when the mobile phone performs control on the projection device based on the MQTT communication connection, it detects that S1002 and BLE connection is restored to the mobile phone, S1003 is performed to switch the communication system to the BLE system, and S1004 is performed to perform control based on the BLE system, that is, performs communication with the bluetooth service based on the BLE communication connection, so as to control the projection device.
In the step S1004, when the mobile phone detects that the mobile phone has recovered the lan connection, the mobile phone performs step S1006, switches the communication mode to the lan mode, and performs step S1007, and performs control based on the lan mode, that is, performs communication with the wireless local service in the projection device based on the wireless local communication connection, so as to control the projection device.
In the control based on the lan method, the mobile phone performs interaction of UDP messages with the lan connection service 911 in the projection device 91.
In the second aspect, the mobile phone locates the reason that the mobile phone cannot communicate with the projection device according to the characteristics of the three communication modes.
1. Analysis of wireless local area network failure to connect
When the local area network cannot be connected (including the situation that the local area network cannot be connected after compensation), the current SSID, the IP address and the subnet mask of the projection equipment are obtained from other communication modes, and compared with the SSID, the IP address and the subnet mask of the mobile phone, whether the mobile phone and the projection equipment are in the same local area network and the same network segment or not can be obtained, and therefore the reason that the local area network cannot be connected is obtained.
2. Bluetooth connectionless analysis
When the Bluetooth cannot be connected, the mobile phone acquires the current Bluetooth starting condition, wiFi signal intensity and the like of the projection equipment from other communication modes, and analyzes the current Bluetooth starting condition, wiFi signal intensity and position information of the mobile phone. Therefore, whether Bluetooth is not started or not is obtained, and the reason that the mobile phone cannot be connected is obtained due to the fact that the distance between the mobile phone and the projection equipment is too far.
3. MQTT is unable to connect
When the MQTT cannot be connected, the mobile phone acquires whether the projection equipment is in a connection state with the MQTT on-line service or not from other communication modes, and the reason of the failure to connect can be obtained.
In order to implement the above device connection method, an embodiment of the present application provides a device connection apparatus 1100, which is applied to a first device, as shown in fig. 11, the apparatus 1100 includes:
an obtaining unit 1101, configured to obtain, in a case where establishment of a first communication connection with a second device fails, first communication connection establishment information for establishing the first communication connection of the second device through a reference communication connection with which establishment of the second device is successful; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network;
and the compensation connection unit 1102 is configured to establish the first communication connection with the second device through the first communication connection establishment information and second communication connection establishment information, where the second communication connection establishment information is information of the first device for establishing the first communication connection.
In some embodiments, the apparatus 1100 further comprises:
a discovery unit configured to discover the second device from a first channel and a reference channel, respectively; the communication mode corresponding to the first channel is the first communication mode, and the communication mode corresponding to the reference channel is the second communication mode;
A determining unit, configured to determine that the first communication connection establishment fails, in a case where the first device does not find the second device from the first channel;
a first establishing unit, configured to establish the reference communication connection with the second device when the first device discovers the second device from the reference channel.
In some embodiments, the first setup unit is further configured to: the reference channel comprises: the communication mode is a second channel of direct communication and the communication mode is a third channel of internet communication,
establishing a second communication connection with the second device; the communication mode of the second communication connection is direct communication, and the communication mode of the second channel included in the reference channel is direct communication;
establishing a third communication connection with the second device; the communication mode of the third communication connection is internet communication, and the communication mode of the third channel included in the reference channel is data connection.
In some embodiments, the apparatus 1100 further comprises: a second establishing unit, configured to establish the first communication connection with the second device if the first device discovers the second device from the first channel.
In some embodiments, the obtaining unit 1101 is further configured to:
the second communication mode includes: under the condition of direct communication and internet communication, determining the priority of the direct communication and the internet communication; the reference communication connection comprises a second communication connection with a direct communication mode and a third communication connection with an internet communication mode;
selecting a target communication connection from the second communication connection and the third communication connection according to the acquired priority; the communication mode of the target communication connection is a communication mode with high priority in the direct communication and the internet communication;
and acquiring the first communication connection establishment information through the target communication connection.
In some embodiments, the apparatus 1100 further comprises:
a judging unit configured to detect whether the first device has established the first communication connection with the second device before the first device establishes the first communication connection with the second device through the first communication connection establishment information and the second communication connection establishment information;
and if the detection result is that the first communication connection with the second equipment is not established, determining to establish the first communication connection with the second equipment through the first communication connection establishment information and the second communication connection establishment information.
In some embodiments, the apparatus 1100 further comprises: a first switching unit for:
the second communication mode includes: under the condition that direct communication and internet communication are carried out and communication connection corresponding to a third communication mode is adopted to communicate with second equipment, whether the communication connection corresponding to the third communication mode meets corresponding communication connection interruption conditions or not is detected; the third communication mode is any one of the local area network, the direct communication and the internet communication;
when the communication connection corresponding to the third communication mode meets the corresponding communication connection interruption condition, adopting a communication connection corresponding to a fourth communication mode to communicate with the second device, wherein the fourth communication mode is one of the local area network, the direct communication and the internet communication except the third communication mode, and when the communication connection corresponding to the third communication mode meets the communication connection interruption condition, adopting the communication connection corresponding to the fourth communication mode to communicate with the second device, wherein the priority of the third communication mode is higher than that of the fourth communication mode; the local area network, the direct communication and the internet communication have different priorities, and the third communication mode has a higher priority than the fourth communication mode.
In some embodiments, the apparatus 1100 further comprises: a second switching unit configured to:
the second communication mode includes: the method comprises the steps of detecting whether communication connection corresponding to a sixth communication mode meets corresponding communication connection recovery conditions or not under the condition that direct communication and internet communication are carried out and communication connection corresponding to a fifth communication mode is adopted to communicate with the second equipment; the fifth communication mode is any one of the local area network, the direct communication and the internet communication, the sixth communication mode is one of the local area network, the direct communication and the internet communication except the fifth communication mode, and the priority of the fifth communication mode is lower than that of the sixth communication mode;
and when the communication connection corresponding to the sixth communication mode meets the corresponding communication connection recovery condition, adopting the communication connection corresponding to the sixth communication mode to communicate with the second equipment.
In some embodiments, the apparatus 1100 further comprises:
the positioning unit is configured to, in the second communication manner, include: in the case that the second device cannot be connected to the first device through a third communication connection, positioning fault information of the third communication connection through a fourth communication connection, wherein the third communication connection is one of the first communication connection, the second communication connection and the third communication connection, the fourth communication connection is one of the first communication connection, the second communication connection and the third communication connection except the fourth communication connection, the second communication connection is in direct communication, and the third communication connection is in internet communication;
And the output unit is used for outputting the fault information.
In order to implement the above device connection method, an embodiment of the present application provides a device connection apparatus 1200, which is applied to a second device, as shown in fig. 12, the apparatus 1200 includes:
a transmitting unit 1201 configured to, in a case where establishment of a first communication connection with a first device fails, transmit first communication connection establishment information for establishing the first communication connection to the first device through a reference communication connection with the first device, the establishment of which is successful; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first communication connection establishment information is used for the first equipment to combine with second communication connection establishment information, the first communication connection is established with the second equipment, and the second communication connection establishment information is information of the first equipment for establishing the first communication connection.
It should be noted that, each logic unit included in the device connection apparatus provided in the embodiment of the present application may be implemented by a processor in an electronic device; of course, the method can also be realized by a specific logic circuit; in practice, the processor may be a central processing unit (CPU, central Processing Unit), a microprocessor (MPU, micro Processor Unit), a digital signal processor (DSP, digital Signal Processor) or a Field programmable gate array (FPGA, field-Programmable Gate Array), or the like.
The description of the system embodiments above is similar to that of the method embodiments above, with similar benefits as the method embodiments. For technical details not disclosed in the system embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
It should be noted that, in the embodiment of the present application, if the above-mentioned page display method is implemented in the form of a software function module, and sold or used as a separate product, the page display method may also be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributing to the related art, and the computer software product may be stored in a storage medium, and include several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read Only Memory (ROM), a magnetic disk, an optical disk, or other various media capable of storing program codes. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
The embodiment of the application also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the steps in the device connection method implemented by the first device or the steps in the device connection method implemented by the second device when executing the computer program.
Accordingly, the present embodiments provide a storage medium, that is, a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements the first device-implemented device connection method provided in the above embodiments, or implements the second device-implemented device connection method provided in the above embodiments.
It should be noted here that: the description of the storage medium embodiments above is similar to that of the method embodiments described above, with similar advantageous effects as the method embodiments. For technical details not disclosed in the storage medium embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
It should be noted that, fig. 13 is a schematic diagram of a hardware entity of an electronic device (a first device or a second device) according to an embodiment of the present application, as shown in fig. 13, the electronic device 1300 includes: a processor 1301, at least one communication bus 1302, at least one external communication interface 1304, and memory 1305. Wherein the communication bus 1302 is configured to enable connected communication between these components. In an example, the electronic device 1300 further includes: the user interface 1303, wherein the user interface 1303 may comprise a display screen, and the external communication interface 1304 may comprise a standard wired interface and a wireless interface.
The memory 1305 is configured to store instructions and applications executable by the processor 1301, and may also cache data (e.g., image data, audio data, voice communication data, and video communication data) to be processed or processed by various modules in the processor 1301 as well as the electronic device, may be implemented by a FLASH memory (FLASH) or a random access memory (Random Access Memory, RAM).
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in some embodiments" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present application, the sequence numbers of the foregoing processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic thereof, and should not constitute any limitation on the implementation process of the embodiments of the present application. The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation 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 may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above described device embodiments are only illustrative, e.g. the division of the units is only one logical function division, and there may be other divisions in practice, such as: multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the various components shown or discussed may be coupled or directly coupled or communicatively coupled to each other via some interface, whether indirectly coupled or communicatively coupled to devices or units, whether electrically, mechanically, or otherwise.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units; can be located in one place or distributed to a plurality of network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may be separately used as one unit, or two or more units may be integrated in one unit; the integrated units may be implemented in hardware or in hardware plus software functional units.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, where the program, when executed, performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read Only Memory (ROM), a magnetic disk or an optical disk, or the like, which can store program codes.
Alternatively, the integrated units described above may be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributing to the related art, and the computer software product may be stored in a storage medium, and include several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a removable storage device, a ROM, a magnetic disk, or an optical disk.
The foregoing is merely an embodiment of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (12)

1. A method of device connection, the method comprising:
under the condition that the first communication connection with the second equipment fails to be established, the first equipment acquires first communication connection establishment information of the second equipment for establishing the first communication connection through the reference communication connection successfully established with the second equipment; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network;
the first device establishes the first communication connection with the second device through the first communication connection establishment information and the second communication connection establishment information, wherein the second communication connection establishment information is information of the first device for establishing the first communication connection.
2. The method according to claim 1, wherein the method further comprises:
the first device discovering the second device from a first channel and a reference channel, respectively; the first channel corresponds to the first communication mode, and the reference channel corresponds to the second communication mode;
in the case that the first device does not find the second device from the first channel, the first device determines that the first communication connection establishment fails;
The first device establishes the reference communication connection with the second device in the event that the first device discovers the second device from the reference channel.
3. The method of claim 2, wherein the reference channel comprises: the communication mode is a second channel of direct communication and the communication mode is a third channel of Internet communication; said establishing, by said first device, said reference communication connection with said second device in case said first device discovers said second device from said reference channel, comprising:
the first device establishes a second communication connection with the second device; the communication mode of the second communication connection is direct communication;
the first device establishes a third communication connection with the second device; the communication mode of the third communication connection is internet communication.
4. The method according to claim 2, wherein the method further comprises:
the first device establishes the first communication connection with the second device in the case where the first device discovers the second device from the first channel.
5. The method of claim 1, wherein the second communication means comprises: the method comprises the steps of directly connecting communication and internet communication, wherein the reference communication connection comprises a second communication connection with a communication mode of directly connecting communication and a third communication connection with a communication mode of internet communication, and the method comprises the steps of obtaining first communication connection establishment information of the second device for establishing the first communication connection by establishing successful reference communication connection, and comprises the following steps:
Determining the priority of direct communication and internet communication;
selecting a target communication connection from the second communication connection and the third communication connection according to the acquired priority; the communication mode of the target communication connection is a communication mode with high priority in the direct communication and the internet communication;
and acquiring the first communication connection establishment information through the target communication connection.
6. The method of claim 1, wherein prior to the first device establishing the first communication connection with the second device via the first communication connection establishment information and second communication connection establishment information, the method further comprises:
the first device detecting whether the first device has established the first communication connection with the second device;
and under the condition that the first communication connection with the second equipment is not established as a detection result, the first equipment determines to establish the first communication connection with the second equipment through the first communication connection establishment information and the second communication connection establishment information.
7. The method of claim 1, wherein the second communication means comprises: direct communication and internet communication, the method further comprising:
When a first device adopts a communication connection corresponding to a third communication mode to communicate with a second device, the first device detects whether the communication connection corresponding to the third communication mode meets a corresponding communication connection interruption condition; the third communication mode is any one of the local area network, the direct communication and the internet communication;
and under the condition that the communication connection corresponding to the third communication mode meets the corresponding communication connection interruption condition, the first equipment adopts the communication connection corresponding to a fourth communication mode to communicate with the second equipment, wherein the fourth communication mode is one of the local area network, the direct communication and the internet communication except the third communication mode, and the priority of the third communication mode is higher than that of the fourth communication mode.
8. The method of claim 1, wherein the second communication means comprises: direct communication and internet communication, the method further comprising:
the first device detects whether the communication connection corresponding to the sixth communication mode meets the corresponding communication connection recovery condition when the communication connection corresponding to the fifth communication mode is adopted to communicate with the second device; the fifth communication mode is any one of the local area network, the direct communication and the internet communication, the sixth communication mode is one of the local area network, the direct communication and the internet communication except the fifth communication mode, and the priority of the fifth communication mode is lower than that of the sixth communication mode;
And when the communication connection corresponding to the sixth communication mode meets the corresponding communication connection recovery condition, the first device communicates with the second device by adopting the communication connection corresponding to the sixth communication mode.
9. The method of claim 1, wherein the second communication means comprises: direct communication and internet communication, the method further comprising:
when the first device cannot be connected to the second device through a seventh communication connection, positioning fault information of the seventh communication connection through an eighth communication connection, wherein the seventh communication connection is one of the first communication connection, the second communication connection and the third communication connection, the eighth communication connection is one of the first communication connection, the second communication connection and the third communication connection except for the seventh communication connection, a communication mode of the second communication connection is direct communication, and a communication mode of the third communication connection is internet communication;
the first device outputs the fault information.
10. A method of device connection, the method comprising:
the method comprises the steps that under the condition that a first communication connection with first equipment fails to be established, second equipment sends first communication connection establishment information for establishing the first communication connection to the first equipment through a reference communication connection successfully established with the first equipment; the first communication mode of the first communication connection is a local area network, and the communication mode of the reference communication connection is a second communication mode except the local area network; the first communication connection establishment information is used for the first equipment to combine with second communication connection establishment information, the first communication connection is established with the second equipment, and the second communication connection establishment information is information of the first equipment for establishing the first communication connection.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the steps of the device connection method of any one of claims 1 to 9 or the steps of the device connection method of claim 10.
12. A storage medium storing an executable program, wherein the executable program, when executed by a processor, implements the device connection method of any one of claims 1 to 9, or the device connection method of claim 10.
CN202111228301.6A 2021-10-21 2021-10-21 Equipment connection method, device, equipment and storage medium Pending CN116017762A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111228301.6A CN116017762A (en) 2021-10-21 2021-10-21 Equipment connection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111228301.6A CN116017762A (en) 2021-10-21 2021-10-21 Equipment connection method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116017762A true CN116017762A (en) 2023-04-25

Family

ID=86021589

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111228301.6A Pending CN116017762A (en) 2021-10-21 2021-10-21 Equipment connection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116017762A (en)

Similar Documents

Publication Publication Date Title
JP2023520478A (en) Configuration information transmission method and device, communication device and storage medium
EP2082545B1 (en) Methods, systems, and devices for establishing a registrationless data communication connection between electronic devices
US9781579B2 (en) Method and device for realizing terminal WIFI talkback
CN104283976B (en) Switching method of network interface and access equipment
CN101730188B (en) Method for transmitting access network policy and home access network discovery and selection functional unit
CN102860094A (en) Mobile device for selectively suppressing a video function of a packet-based video call
CN110290570A (en) Wireless network access method and relevant device, storage device
JP2023519730A (en) Information transmission method, device, communication device and storage medium
WO2014008806A1 (en) Method and device for determining wireless local area network neighboring user equipment
CN114401537B (en) Network redirection method, device and user equipment
US10070289B1 (en) Client association for provisioning devices in a communication network
CN111226463A (en) Processing method and device for link establishment failure and computer storage medium
US9560583B2 (en) Gateway selection based on geographical location
EP3863330B1 (en) Network switching to a target wireless access network capable of establishing a connection with an ims network
JP7335452B2 (en) COMMUNICATION PROCESSING METHOD, APPARATUS AND COMPUTER STORAGE MEDIUM
US20230224690A1 (en) Communication apparatus, control method, and computer-readable storage medium
EP3869863A1 (en) Communication service transmission method and apparatus, storage medium and electronic apparatus
JP2007306511A (en) Wireless communication terminal and wireless communication method
CN109921993B (en) Data transmission method of communication system and communication system
JP7143071B2 (en) Communication device, communication system, communication method, and program
CN116017762A (en) Equipment connection method, device, equipment and storage medium
US20230104162A1 (en) Using dnai to identify a smf supporting connection to a local dn
WO2022120735A1 (en) Wireless communication method and apparatus, and communication device and storage medium
CN111727653A (en) Method, device, communication equipment and storage medium for transferring service
CN115843434A (en) Network element discovery method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination