CN113329359B - Communication method, communication device, electronic equipment and readable storage medium - Google Patents

Communication method, communication device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN113329359B
CN113329359B CN202110633149.3A CN202110633149A CN113329359B CN 113329359 B CN113329359 B CN 113329359B CN 202110633149 A CN202110633149 A CN 202110633149A CN 113329359 B CN113329359 B CN 113329359B
Authority
CN
China
Prior art keywords
data
zigbee
bluetooth
protocol
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.)
Active
Application number
CN202110633149.3A
Other languages
Chinese (zh)
Other versions
CN113329359A (en
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.)
Hangzhou Tuya Information Technology Co Ltd
Original Assignee
Hangzhou Tuya Information 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 Hangzhou Tuya Information Technology Co Ltd filed Critical Hangzhou Tuya Information Technology Co Ltd
Priority to CN202110633149.3A priority Critical patent/CN113329359B/en
Publication of CN113329359A publication Critical patent/CN113329359A/en
Application granted granted Critical
Publication of CN113329359B publication Critical patent/CN113329359B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/30Services specially adapted for particular environments, situations or purposes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/06Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • H04W48/16Discovering, processing access restriction or access information
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Multimedia (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application discloses a communication method, a communication device, electronic equipment and a computer readable storage medium, wherein the method comprises the following steps: acquiring first data sent by first equipment; the first device is a Bluetooth device or a Zigbee device, and the data type of the first data corresponds to the first device; carrying out format conversion on the first data based on a target protocol to obtain second data; the target protocol is a Bluetooth communication protocol which takes target data used for forming standard zigbee protocol data as a payload field; sending the second data to the second device; the second equipment is Bluetooth equipment or Zigbee equipment, and the equipment type of the second equipment is different from that of the first equipment; the method can realize the communication between the Bluetooth network and the equipment in the ZigBee network, realize the interconnection between the Bluetooth network and the ZigBee network, and enlarge the communication range of the equipment of the Internet of things.

Description

Communication method, communication device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a communication method, a communication apparatus, an electronic device, and a computer-readable storage medium.
Background
With the popularization of technologies and devices such as the internet of things and smart homes, network communication is required to be carried out among more devices. Among them, bluetooth, especially Bluetooth Low Energy (BLE), and ZigBee (ZigBee) are widely used communication protocols, all of which have a characteristic of Low power consumption, and are suitable for the application field of the internet of things. However, since the two standard communication protocols cannot be interconnected, and the communication protocols adopted by different devices may be different, each electronic device in the related art can only communicate with devices adopting the same communication protocol, and the communication range is limited.
Disclosure of Invention
In view of this, an object of the present application is to provide a communication method, a communication apparatus, an electronic device, and a computer-readable storage medium, which implement interconnection between a bluetooth network and a ZigBee network, and enlarge a communication range of an internet of things device.
In order to solve the above technical problem, the present application provides a communication method, including:
acquiring first data sent by first equipment; the first device is a Bluetooth device or a Zigbee device;
carrying out format conversion on the first data based on a target protocol to obtain second data; the target protocol is a Bluetooth communication protocol which takes target data used for forming standard Zigbee protocol data as a payload field;
sending the second data to a second device; the second device is the Bluetooth device or the Zigbee device, and the type of the second device is different from that of the first device.
Optionally, if the first device is the bluetooth device, performing format conversion on the first data based on the target protocol to obtain second data, including:
analyzing the first data based on the target protocol to obtain a plurality of target data;
and generating the standard zigbee protocol data by using the target data, and determining the standard zigbee protocol data as the second data.
Optionally, if the first device is the zigbee device, the performing format conversion on the first data based on the target protocol to obtain second data includes:
analyzing the first data based on a standard zigbee protocol to obtain a plurality of target data;
and generating data based on the target protocol by using the target data to obtain the second data.
Optionally, the method further comprises:
if the Bluetooth broadcast data sent by the initial equipment is detected, establishing Bluetooth connection with the initial equipment;
generating a zigbee network address corresponding to the initial equipment, and establishing an identity corresponding relation between the zigbee network address and the initial equipment;
and feeding back the zigbee network address to the initial equipment, and sending a network access notification to the zigbee network gateway.
Optionally, the generating a zigbee network address corresponding to the initial device includes:
executing random address generation operation to obtain an initial network address;
judging whether the initial network address is repeated with the existing network address;
if not, determining the initial network address as the zigbee network address;
and if so, determining to re-execute the random address generation operation.
Optionally, the sending the second data to the second device includes:
if the second data is standard zigbee protocol data, the second data is sent to the zigbee equipment corresponding to the destination address in the second data;
and if the second data is Bluetooth protocol data, determining target Bluetooth equipment by using the identity corresponding relation, and sending the second data to the target Bluetooth equipment.
Optionally, the method further comprises:
if the search broadcast signal sent by the third equipment is detected, converting the search broadcast signal into a zigbee search broadcast signal;
broadcasting and sending the zigbee search broadcast signal, and acquiring a response signal responding to the zigbee search broadcast signal;
extracting a response address from the response signal and transmitting the response address to the third device.
The present application further provides a communication apparatus, comprising:
the acquisition module is used for acquiring first data sent by first equipment; the first device is a Bluetooth device or a Zigbee device;
the conversion module is used for carrying out format conversion on the first data based on a target protocol to obtain second data; the target protocol is a Bluetooth communication protocol which takes target data used for forming a standard Zigbee protocol as a payload field;
the sending module is used for sending the second data to second equipment; the second device is the Bluetooth device or the Zigbee device, and the type of the second device is different from that of the first device.
The present application further provides an electronic device comprising a memory and a processor, wherein:
the memory is used for storing a computer program;
the processor is configured to execute the computer program to implement the communication method.
The present application also provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the communication method described above.
According to the communication method, first data sent by first equipment are obtained; the first device is a Bluetooth device or a Zigbee device, and the data type of the first data corresponds to the first device; carrying out format conversion on the first data based on a target protocol to obtain second data; the target protocol is a Bluetooth communication protocol which takes target data used for forming standard zigbee protocol data as a payload field; sending the second data to the second device; the second device is a Bluetooth device or a Zigbee device, and the type of the second device is different from that of the first device.
Therefore, the method is provided with a target protocol for carrying out format conversion on the Bluetooth communication data or the ZigBee communication data to obtain the communication data conforming to another communication protocol. Specifically, the target protocol is a special bluetooth communication protocol, which is designed based on a standard bluetooth communication protocol and has a special payload field, i.e., payload field. In the target protocol, the payload field is target data for constituting data of a standard ZigBee protocol, and thus target data necessary for generating ZigBee communication data can be transmitted using bluetooth communication data. After the first data sent by the bluetooth device is acquired, the required target data can be extracted based on the target protocol, the corresponding standard ZigBee communication data is generated, and the standard ZigBee communication data is sent to the corresponding second device (i.e. the ZigBee device). After the first data sent by the ZigBee protocol device is obtained, the target data can be extracted from the first data, special Bluetooth communication data are formed according to the target protocol, and the special Bluetooth communication data are sent to the corresponding second device (namely the Bluetooth device). By the mode, communication between the Bluetooth network and the equipment in the ZigBee network can be realized, interconnection and intercommunication between the Bluetooth network and the ZigBee network are realized, and the communication range of the equipment of the Internet of things is expanded.
In addition, the application also provides a communication device, an electronic device and a computer readable storage medium, which also have the beneficial effects.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments or related technologies of the present application, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a communication method according to an embodiment of the present application;
fig. 2 is a specific structure diagram of a dual mode device according to an embodiment of the present application;
fig. 3 is a specific network topology diagram provided in the embodiment of the present application;
fig. 4 is a schematic diagram of a specific protocol format of a target protocol according to an embodiment of the present application;
fig. 5 is a flowchart of a specific communication method provided in an embodiment of the present application;
fig. 6 is a schematic structural diagram of a communication device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a flowchart of a communication method according to an embodiment of the present disclosure. The method comprises the following steps:
s101: first data sent by first equipment is obtained.
It should be noted that the ZigBee mentioned in the embodiment of the present application is a low power consumption lan protocol based on the ieee802.15.4 standard. All or part of the steps in the application can be executed by a ZigBee-bluetooth dual-mode device, the dual-mode device is a device supporting two operation modes, and the ZigBee-bluetooth dual-mode device is a dual-mode device supporting a ZigBee communication mode and a bluetooth communication mode. According to different bluetooth types, the specific types of the ZigBee-bluetooth dual mode device may be different, for example, when bluetooth is low power consumption bluetooth, the dual mode device is a ZigBee BLE dual mode device.
It can be understood that the dual-mode device may communicate with a bluetooth device and a ZigBee device (or referred to as a ZigBee device, that is, a device that uses ZigBee communication protocol for data transmission), so that a wireless communication component, such as a wireless radio frequency chip, that can communicate with the bluetooth device and the ZigBee device necessarily exists in the dual-mode device. In one embodiment, a dual mode device may be configured with two different data transceiving components. Referring to fig. 2, fig. 2 is a structural diagram of a specific dual-mode device provided in an embodiment of the present application, where the structure includes a ZigBee RF (i.e., a ZigBee communication data transceiver component) and a BLE RF (i.e., a BLE communication data transceiver component). The two data receiving and transmitting components are controlled by an MCU (Micro Control Unit) and are respectively used for communicating with the ZigBee device and the BLE device. In another embodiment, the dual-mode device may only have one data transceiver component, and communicate with the ZigBee device and the bluetooth device in different time slots according to a time division multiplexing rule by integrating a time division multiplexing technology, so as to achieve an effect of communicating with the two devices. It can be understood that, since the encoding and decoding modes corresponding to the two protocols are different from the applicable channel, the channel and the encoding and decoding modes need to be switched according to the time division multiplexing rule. In addition, for some data transceiver components that cannot perform data reception and data transmission simultaneously, it is necessary to switch the operating state, that is, switch between the transmission state and the reception state, between two times of switching of the channel and the encoding and decoding method.
After the ZigBee-bluetooth dual mode device is configured, the ZigBee-bluetooth dual mode device can be used as a bridge for communication between each bluetooth device in the bluetooth network and each ZigBee device in the ZigBee network. Referring to fig. 3, fig. 3 is a specific network topology diagram according to an embodiment of the present disclosure. The ZigBee BLE dual-mode device is communicated with the BLE device, the ZigBee device and the ZigBee gateway respectively, and interconnection and intercommunication of the BLE network and the ZigBee network are achieved. Specifically, after the dual-mode device is set in the network, it may acquire data sent by other devices.
In this embodiment, the first device may be any one of a bluetooth device and a ZigBee device, and it can be understood that the data type of the first data necessarily corresponds to the first device, that is, the bluetooth device necessarily sends bluetooth communication data (or referred to as bluetooth data), and the ZigBee device necessarily sends ZigBee communication data (or referred to as ZigBee data).
The present embodiment does not limit the specific manner of acquiring the first data, and as can be seen from the above description of the dual mode device, when the number of data transceiving components in the dual mode device is different, the manner of acquiring the first data may also be different. When the device is provided with two data transceiving components respectively corresponding to different communication protocols, in one embodiment, two types of data can be acquired by using the two data transceiving components at the same time, namely, the Bluetooth data and the ZigBee data are acquired by using the BLE RF and the ZigBee RF at the same time; in another embodiment, the two data transceiver components may take turns to acquire data, i.e. when the BLE RF acquires bluetooth data, the ZigBee RF may be in a data transmission state or an idle state, and when the ZigBee RF acquires bluetooth data, the BLE RF may be in a data transmission state or an idle state. When the dual-mode device only has one data transceiving component, the bluetooth data and the ZigBee data cannot be acquired simultaneously, but the two data are acquired in different time slots respectively.
It can be understood that, before the dual-mode device communicates with the bluetooth device or the ZigBee device, the dual-mode device needs to establish a connection with the bluetooth device or the ZigBee device. In the communication process, a data sending party needs to specify the identity of a data receiving party to accurately send data to the specified data receiving party. Since the addresses of the devices are unique data and the addresses of each device are different, the way of specifying the identity is usually to specify the address of the data receiver. In order to enable the bluetooth device and the ZigBee device to communicate, in one embodiment, a corresponding ZigBee address may be assigned to the bluetooth device during the connection establishment with the bluetooth device, so that the bluetooth device can use the ZigBee address to indicate its own identity to the ZigBee device. Specifically, the process of establishing the connection between the bluetooth device and the dual mode device may include the following steps:
step 11: and if the Bluetooth broadcast data sent by the initial equipment is detected, establishing Bluetooth connection with the initial equipment.
Step 12: and generating a zigbee network address corresponding to the initial equipment, and establishing an identity corresponding relation between the zigbee network address and the initial equipment.
Step 13: and feeding back the network address of the zigbee to the initial equipment, and sending a network access notification to the zigbee network gateway.
The initiating device is a bluetooth device which has not established a connection with the dual-mode device, and because the connection has not been established yet, when the initiating device wants to access the network (i.e. join the network formed by the bluetooth network and the ZigBee network), the initiating device needs to transmit bluetooth broadcast data in the bluetooth network by using a broadcast mode, so as to declare that the dual-mode device wants to join the network. After detecting the bluetooth broadcast data sent by the initial device, the dual-mode device establishes a bluetooth network with the initial device to complete the initial establishment of network connection, and the specific establishment process may refer to related technologies.
In addition, different from a common bluetooth connection establishment mode, in order to enable a bluetooth device to communicate with a ZigBee device, a corresponding ZigBee network address, that is, a ZigBee network address needs to be generated for the bluetooth device. The embodiment does not limit a specific generation manner, and since the length of the ZigBee network address is 2 bytes, a 2-byte address can be randomly generated as the ZigBee network address. The binding between the equipment and the address is realized by establishing the identity corresponding relation between the ZigBee network address and the initial equipment, so that the information sent to the ZigBee network address is monitored and forwarded in the subsequent process. One party in the identity corresponding relation is the ZigBee network address, and the other party is the identity information of the initial equipment, such as the equipment number, the Bluetooth address and the like. Meanwhile, the corresponding ZigBee network address is fed back to the initial equipment, so that the initial equipment can generate Bluetooth data which accords with the target protocol by using the initial equipment when the initial equipment subsequently sends the first data.
In addition, the ZigBee gateway can know that a new device is accessed to the network by sending the network access notification to the ZigBee network gateway, namely the ZigBee gateway, so that the ZigBee gateway can conveniently execute the operation of authenticating, registering and the like on the cloud end of the related information of the newly accessed device. Specifically, the network access notification is a ZigBee device announce instruction (ZigBee device announcement instruction).
It can be understood that, the network access process is different from the network access process of the traditional ZigBee device, and only the last step of network access of the traditional ZigBee device, that is, sending the network access notification, is adopted. The traditional ZigBee equipment needs to be subjected to network access, namely 'discovery network' for requesting association 'for obtaining the distributed ZigBee network address', network key obtaining 'for informing network access', and the like. In the method, the initial equipment allocates the ZigBee address to the dual-mode equipment when the dual-mode equipment accesses the network, and the dual-mode equipment informs the ZigBee gateway of accessing the network.
Further, in a possible case, when the ZigBee network address is generated, the randomly generated ZigBee network address may be an existing address. In order to avoid the situation that the ZigBee network addresses of the two bluetooth devices are the same, which causes communication abnormality, the process of generating the ZigBee network address corresponding to the initial device may specifically include the following steps:
step 21: and executing random address generation operation to obtain an initial network address.
Step 22: and judging whether the initial network address and the existing network address are repeated.
Step 23: and if not, determining the initial network address as the zigbee network address.
Step 24: and if so, determining to execute the random address generation operation again.
The existing network address refers to a ZigBee network address which is generated and allocated to the Bluetooth device before the ZigBee network address is generated. In this embodiment, the result obtained after the random address generation operation is directly performed is the initial network address, and is not directly determined to be the ZigBee network address. The specific generation manner and process of the random address generation operation are not limited. Judging whether the initial network address is the existing network address or not, judging whether the address repetition occurs or not, if the initial network address is different from all the existing network addresses, determining that the address repetition does not occur, determining the initial network address as the ZigBee network address, and otherwise, executing the random address generation operation again until the unrepeated initial network address is generated.
Further, in order to enable a bluetooth device to communicate with a device (ZigBee gateway or a general ZigBee device) in the ZigBee network, it is necessary to provide the bluetooth device with an address of the device in the ZigBee network. For example, when the ZigBee network address is fed back to the initial device, the gateway address of the ZigBee gateway is provided for the bluetooth device, so that the information such as the status is reported to the cloud through the ZigBee gateway. In another embodiment, the bluetooth device may also be provided with an address of a common ZigBee device, so that it communicates with the common ZigBee device, for example, transmits a control instruction and the like through the first data. The process of providing the address of the ZigBee device to the bluetooth device may include the steps of:
step 31: and if the search broadcast signal transmitted by the third equipment is detected, converting the search broadcast signal into a zigbee search broadcast signal.
Step 32: the broadcast transmission zigbee search broadcast signal and acquires a response signal in response to the zigbee search broadcast signal.
Step 33: the response address is extracted from the response signal and sent to the third device.
The third device is a bluetooth device, which specifically refers to a bluetooth device that transmits a search broadcast signal. The ZigBee search broadcast signal (i.e., zigBee search broadcast signal) refers to a signal for searching for a ZigBee device meeting a certain condition (for example, a condition that can be controlled by a third device) in the ZigBee network, and a specific form and a corresponding condition thereof are not limited. The search broadcast signal is a zigbee search broadcast signal under the requirement of a target protocol format, and is specifically bluetooth data, which can also be regarded as special first data.
After acquiring the search broadcast signal sent by the third device, the dual-mode device may perform format conversion on the search broadcast signal based on the target protocol to obtain a corresponding ZigBee search broadcast signal, where a specific conversion process will be described in the subsequent step S102, and the obtained ZigBee search broadcast signal may be regarded as special second data. After the ZigBee search broadcast signal is obtained, the ZigBee search broadcast signal is broadcasted in the ZigBee network, and the ZigBee device meeting the requirement of the ZigBee search broadcast signal responds to the broadcast, specifically, sends a response signal to the dual-mode device. By receiving and interpreting the response signal, an address of the ZigBee device that meets the condition, which is referred to as a response address in this embodiment, can be extracted therefrom. The response address is sent to the third device, so that the third device can obtain addresses of the ZigBee devices meeting the conditions, the third device can conveniently and directly communicate with the ZigBee devices in the subsequent process, and the first data are sent to the dual-mode device through the dual-mode device in the same communication process.
It should be noted that, the ZigBee device may also send the broadcast signal in the bluetooth network in a similar manner, and a specific sending process is similar to the above process, which is not described herein again.
S102: and carrying out format conversion on the first data based on the target protocol to obtain second data.
Wherein the target protocol is a bluetooth communication protocol using target data for constituting standard zigbee protocol data as a payload field. It should be noted that the target protocol still belongs to the bluetooth communication protocol, and is designed based on the standard bluetooth communication protocol, and is characterized in that the target protocol uses the payload field to transmit the target data required for forming the standard zigbee protocol data.
The bluetooth device can put some data into the payload field and transmit the data by using the bluetooth data according to the own needs. To enable bluetooth devices to communicate with ZigBee devices, the payload field of the target protocol is used to record the target data needed to generate standard ZigBee protocol data. The specific content of the target data is not limited, and the content required by any standard ZigBee protocol data (i.e., standard ZigBee data) is the target data, such as a source address, a destination address, a cluster, a command, and the like. Referring to fig. 4, fig. 4 is a schematic diagram of a specific protocol format of a target protocol provided in this embodiment of the present application, and it can be seen that a data packet specified by the target protocol includes a BLE packet header (i.e., a BLE header) of a BLE packet and CRC (Cyclic Redundancy Check code) data for checking, and in a payload portion, the data packet includes a source address (source dev) having a length of 2 bytes, a destination address (dst dev) having a length of 2 bytes, a cluster (cluster) having a length of 2 bytes, a command (cmd) having a length of 1 byte, data length information (len) having a length of 2 bytes, and a data value (data) having an arbitrary length. It should be noted that the protocol format of the target protocol in fig. 4 is only one possible protocol format, and in other embodiments, the target protocol may be designed into other formats as needed.
The target protocol is bluetooth protocol, but the transmitted content can be used to form standard ZigBee data, or corresponding bluetooth data can be generated based on the target protocol using the standard ZigBee data. It can be understood that, because the target protocol is still the bluetooth communication protocol, in the converged network of ZigBee and bluetooth, the first data sent by the bluetooth device to the dual-mode device necessarily conforms to the target protocol, and the first data sent by the ZigBee device to the dual-mode device necessarily conforms to the standard ZigBee protocol. In this case, the dual mode device can convert data of one communication protocol (i.e., the first data) into data of a corresponding other communication protocol (i.e., the second data) using the target protocol, and the actual meaning of the two data is the same, except that the applicable network protocols are different.
It is understood that the data type of the first data corresponds to the device type of the first device, and the conversion manner for different types of first data is different. In an embodiment, when the first device is a bluetooth device, performing format conversion on the first data based on a target protocol to obtain the second data may include the following steps:
step 41: and analyzing the first data based on the target protocol to obtain a plurality of target data.
Step 42: and generating standard zigbee protocol data by using the target data, and determining the standard zigbee protocol data as second data.
When the first device is a bluetooth device, the first data is bluetooth data, and based on the above description, in this case, the structure of the first data conforms to the specification of the target protocol. Therefore, the first data can be analyzed based on the target protocol, and the target data can be extracted. The standard ZigBee protocol is a standard ZigBee protocol, has strict standards for data formats of standard ZigBee data, and can be used for splicing target data according to the labeled ZigBee protocol to obtain the standard ZigBee data, namely the standard ZigBee protocol data, and determining the standard ZigBee data as second data.
In another embodiment, when the first device is a ZigBee device, the format conversion of the first data based on the target protocol to obtain the second data may include the following steps:
step 51: and analyzing the first data based on a standard zigbee protocol to obtain a plurality of target data.
Step 52: and generating and processing data based on the target protocol by using the target data to obtain second data.
When the first device is a ZigBee device, the first data is ZigBee data, and based on the above description, in this case, the structure of the first data conforms to the specification of the standard ZigBee protocol. Therefore, the first data can be analyzed based on the standard ZigBee protocol, and the target data in the first data can be extracted. After the target data is obtained, the target data can be processed according to the target protocol, the generated data is the second data, and the second data is generated based on the target protocol, so that the second data belongs to the Bluetooth data and can be used for being sent to the Bluetooth device.
S103: the second data is transmitted to the second device,
the second device is a bluetooth device or a ZigBee device, and the second device is different from the first device in device type, that is, the first device and the second device are a bluetooth device and a ZigBee device, respectively. By converting the first data into the second data, the process of converting the bluetooth data into the ZigBee data or converting the ZigBee data into the bluetooth data is completed. The second data are sent to the second equipment, so that the communication between the Bluetooth equipment and the ZigBee equipment can be completed, and the interconnection and intercommunication between the Bluetooth network and the ZigBee network are realized.
Specifically, the manner of sending the second data may also be different according to the specific content and data type of the second data. Specifically, the sending process of the second data may include the following steps:
step 61: and if the second data is standard zigbee protocol data, sending the second data to zigbee equipment corresponding to a destination address in the second data.
Step 62: and if the second data is Bluetooth protocol data, determining the target Bluetooth equipment by using the identity corresponding relation, and sending the second data to the target Bluetooth equipment.
If the second data is standard ZigBee data, the second data needs to be sent to the corresponding ZigBee device, specifically, the second data is sent to the ZigBee device specified by the destination address, and the ZigBee device specified by the destination address is the second device. For the special second data such as the broadcast signal searched by the ZigBee, since it needs to be broadcast, its destination address may be null, in which case it may be sent to all ZigBee devices, in which case all ZigBee devices are the second devices.
If the second data is bluetooth protocol data (i.e., bluetooth data), the target bluetooth device may be determined by using an identity correspondence relationship generated when the bluetooth device accesses the network and determined as the second device. Specifically, the destination address in the payload field in the bluetooth data may be used to traverse the corresponding relationship between the identities, determine the target bluetooth device, and send the second data using the bluetooth address of the target bluetooth device in the bluetooth network. In this case, the target bluetooth device is the second device.
By applying the communication method provided by the embodiment of the application, the target protocol is set and used for carrying out format conversion on the Bluetooth communication data or the ZigBee communication data to obtain the communication data conforming to another communication protocol. Specifically, the target protocol is a special bluetooth communication protocol, which is designed based on a standard bluetooth communication protocol and has a special payload field, i.e., payload field. In the target protocol, the payload field is target data for constituting data of a standard ZigBee protocol, and thus target data necessary for generating ZigBee communication data can be transmitted using bluetooth communication data. After the first data sent by the bluetooth device is acquired, the required target data can be extracted based on the target protocol, and the corresponding standard ZigBee communication data is generated and sent to the corresponding second device (i.e. ZigBee device). After the first data sent by the ZigBee protocol device is obtained, the target data can be extracted from the first data, special Bluetooth communication data is formed according to the target protocol, and the special Bluetooth communication data is sent to the corresponding second device (namely the Bluetooth device). By the mode, communication between the Bluetooth network and the equipment in the ZigBee network can be realized, interconnection and intercommunication between the Bluetooth network and the ZigBee network are realized, and the communication range of the equipment of the Internet of things is expanded.
Based on the above embodiments, the present embodiment describes a specific communication procedure. Referring to fig. 5, fig. 5 is a flowchart illustrating a specific communication method according to an embodiment of the present disclosure. The Z-BLE device is the dual-mode device in the above embodiment, and specifically, the Z-BLE device is a ZigBee BLE dual-mode device. Before communication, the Bluetooth broadcast data is used as a special ZigBee device to be distributed, namely, the Bluetooth broadcast data is added into a ZigBee network, BLE scanning is started, and in the BLE scanning process, if Bluetooth broadcast data sent by BLE devices (namely initial devices) which do not enter the network exist, connection between the BLE devices and Z-BLE devices can be established. After the connection is established, the dual mode device further needs to generate a random 2-byte address as the ZigBee device address for the initial device, that is, use the random 2-byte address as the ZigBee network address for identifying the BLE sub device (i.e., BLE device). And meanwhile, the address is issued to the initial equipment by utilizing a BLE instruction. In addition, in order to enable the BLE device to communicate with the ZigBee gateway and report the data of the BLE device through the ZigBee gateway, the ZigBee address of the ZigBee gateway can be issued to the BLE device, and meanwhile, the ZigBee gateway is informed that new devices are accessed into the network.
The dual-mode device establishes a corresponding relation between the BLE device and the corresponding ZigBee network addresses, and monitors the ZigBee messages sent to the ZigBee network addresses. Meanwhile, the Bluetooth message sent by any BLE equipment can be acquired. When the ZigBee gateway sends an instruction to the BLE device, the dual-mode device may monitor and obtain the ZigBee data packet whose destination address is the ZigBee address of the BLE device. And processing the ZigBee data packet according to a target protocol to obtain a corresponding BLE data packet, and forwarding the BLE data packet to corresponding BLE equipment by using a BLE protocol. In addition, when a certain BLE device generates a BLE data packet according to a target protocol by using self data, the BLE data packet is sent to the dual-mode device. The dual-mode device analyzes the BLE data packet according to the target protocol to obtain target data, generates a ZigBee standard instruction according to the standard ZigBee protocol by using the target data, and sends the ZigBee standard instruction to the ZigBee gateway.
The following describes a communication device provided in an embodiment of the present application, and the communication device described below and the communication method described above may be referred to correspondingly.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a communication device according to an embodiment of the present application, including:
an obtaining module 110, configured to obtain first data sent by a first device; the first device is a Bluetooth device or a Zigbee device;
a conversion module 120, configured to perform format conversion on the first data based on the target protocol to obtain second data; the target protocol is a Bluetooth communication protocol which takes target data for forming a standard Zigbee protocol as a payload field;
a sending module 130, configured to send the second data to the second device; the second device is a Bluetooth device or a Zigbee device, and the type of the second device is different from that of the first device.
Optionally, the conversion module 120 includes:
the first analysis unit is used for analyzing the first data based on a target protocol to obtain a plurality of target data if the first device is a Bluetooth device;
and the first generating unit is used for generating the standard zigbee protocol data by using the target data and determining the standard zigbee protocol data as the second data.
Optionally, the conversion module 120 includes:
the second analysis unit is used for analyzing the first data based on a standard zigbee protocol to obtain a plurality of target data if the first device is a zigbee device;
and the second generation unit is used for performing data generation processing on the basis of the target protocol by using the target data to obtain second data.
Optionally, the method further comprises:
the connection establishing module is used for establishing Bluetooth connection with the initial equipment if Bluetooth broadcast data sent by the initial equipment is detected;
the address generating module is used for generating a zigbee network address corresponding to the initial equipment and establishing an identity corresponding relation between the zigbee network address and the initial equipment;
and the notification network access module is used for feeding back the zigbee network address to the initial equipment and sending a network access notification to the zigbee network gateway.
Optionally, the address generation module includes:
the initial generation unit is used for executing random address generation operation to obtain an initial network address;
a duplication judgment unit for judging whether the initial network address is duplicated with the existing network address;
an address determining unit, configured to determine the initial network address as a zigbee network address if the network address is not duplicated;
and the repeated execution unit is used for determining to execute the random address generation operation again if the random address generation operation is repeated.
Optionally, the sending module 130 includes:
the first sending unit is used for sending the second data to the zigbee equipment corresponding to the destination address in the second data if the second data is standard zigbee protocol data;
and the second sending unit is used for determining the target Bluetooth equipment by using the identity corresponding relation and sending the second data to the target Bluetooth equipment if the second data is Bluetooth protocol data.
Optionally, the method further comprises:
the broadcast signal conversion module is used for converting the search broadcast signal into a zigbee search broadcast signal if the search broadcast signal sent by the third equipment is detected;
the response signal acquisition module is used for broadcasting and sending the zigbee search broadcast signal and acquiring a response signal responding to the zigbee search broadcast signal;
and the response address issuing module is used for extracting the response address from the response signal and sending the response address to the third equipment.
In the following, the electronic device provided by the embodiment of the present application is introduced, and the electronic device described below and the communication method described above may be referred to correspondingly.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. Wherein the electronic device 100 may include a processor 101 and a memory 102, and may further include one or more of a multimedia component 103, an information input/information output (I/O) interface 104, and a communication component 105.
The processor 101 is configured to control the overall operation of the electronic device 100, so as to complete all or part of the steps in the communication method; the memory 102 is used to store various types of data to support operation at the electronic device 100, such data may include, for example, instructions for any application or method operating on the electronic device 100, as well as application-related data. The Memory 102 may be implemented by any type or combination of volatile and non-volatile Memory devices, such as one or more of Static Random Access Memory (SRAM), electrically Erasable Programmable Read-Only Memory (EEPROM), erasable Programmable Read-Only Memory (EPROM), programmable Read-Only Memory (PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic or optical disk.
The multimedia component 103 may include a screen and an audio component. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 102 or transmitted through the communication component 105. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 104 provides an interface between the processor 101 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 105 is used for wired or wireless communication between the electronic device 100 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, near Field Communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them, so that the corresponding Communication component 105 may include: wi-Fi part, bluetooth part, NFC part.
The electronic Device 100 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components, and is configured to perform the communication method according to the above embodiments.
The following describes a computer-readable storage medium provided in an embodiment of the present application, and the computer-readable storage medium described below and the communication method described above may be referred to correspondingly.
The present application further provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above-described communication method.
The computer-readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be noted that, herein, relationships such as first and second, etc., are intended only to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms include, or any other variation is intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that includes 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.
The principle and the implementation of the present application are explained herein by applying specific examples, and the above description of the embodiments is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (9)

1. A method of communication, comprising:
acquiring first data sent by first equipment; the first device is a Bluetooth device or a Zigbee device;
carrying out format conversion on the first data based on a target protocol to obtain second data; the target protocol is a Bluetooth communication protocol which takes target data used for forming standard zigbee protocol data as a payload field;
sending the second data to a second device; the second device is the Bluetooth device or the Zigbee device, and the type of the second device is different from that of the first device;
if the Bluetooth broadcast data sent by the initial equipment is detected, establishing Bluetooth connection with the initial equipment;
generating a zigbee network address corresponding to the initial equipment, and establishing an identity corresponding relation between the zigbee network address and the initial equipment;
and feeding back the zigbee network address to the initial equipment, and sending a network access notification to the zigbee network gateway.
2. The communication method according to claim 1, wherein if the first device is the bluetooth device, the format converting the first data based on the target protocol to obtain second data includes:
analyzing the first data based on the target protocol to obtain a plurality of target data;
and generating the standard zigbee protocol data by using the target data, and determining the standard zigbee protocol data as the second data.
3. The communication method according to claim 1, wherein if the first device is the zigbee device, the format conversion of the first data based on the target protocol to obtain the second data includes:
analyzing the first data based on a standard zigbee protocol to obtain a plurality of target data;
and generating data based on the target protocol by using the target data to obtain the second data.
4. The communication method according to claim 1, wherein the generating the zigbee network address corresponding to the initial device comprises:
executing random address generation operation to obtain an initial network address;
judging whether the initial network address is repeated with the existing network address;
if not, determining the initial network address as the zigbee network address;
and if so, determining to re-execute the random address generation operation.
5. The communication method according to claim 1, wherein the sending the second data to a second device comprises:
if the second data is standard zigbee protocol data, the second data is sent to the zigbee device corresponding to the destination address in the second data;
and if the second data is Bluetooth protocol data, determining target Bluetooth equipment by using the identity corresponding relation, and sending the second data to the target Bluetooth equipment.
6. The communication method according to claim 1, further comprising:
if a search broadcast signal sent by a third device is detected, converting the search broadcast signal into a zigbee search broadcast signal;
broadcasting and sending the zigbee search broadcast signal, and acquiring a response signal responding to the zigbee search broadcast signal;
extracting a response address from the response signal and transmitting the response address to the third device.
7. A communications apparatus, comprising:
the acquisition module is used for acquiring first data sent by first equipment; the first device is a Bluetooth device or a Zigbee device;
the conversion module is used for carrying out format conversion on the first data based on a target protocol to obtain second data; the target protocol is a Bluetooth communication protocol which takes target data used for forming a standard Zigbee protocol as a payload field;
the sending module is used for sending the second data to second equipment; the second device is the Bluetooth device or the Zigbee device, and the type of the second device is different from that of the first device;
further comprising: the connection establishing module is used for establishing Bluetooth connection with the initial equipment if Bluetooth broadcast data sent by the initial equipment is detected; the address generating module is used for generating a zigbee network address corresponding to the initial equipment and establishing an identity corresponding relation between the zigbee network address and the initial equipment; and the notification network access module is used for feeding back the zigbee network address to the initial equipment and sending a network access notification to the zigbee network gateway.
8. An electronic device comprising a memory and a processor, wherein:
the memory is used for storing a computer program;
the processor for executing the computer program to implement the communication method according to any one of claims 1 to 6.
9. A computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the communication method according to any one of claims 1 to 6.
CN202110633149.3A 2021-06-07 2021-06-07 Communication method, communication device, electronic equipment and readable storage medium Active CN113329359B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110633149.3A CN113329359B (en) 2021-06-07 2021-06-07 Communication method, communication device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110633149.3A CN113329359B (en) 2021-06-07 2021-06-07 Communication method, communication device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN113329359A CN113329359A (en) 2021-08-31
CN113329359B true CN113329359B (en) 2023-03-24

Family

ID=77419845

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110633149.3A Active CN113329359B (en) 2021-06-07 2021-06-07 Communication method, communication device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113329359B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101815041A (en) * 2010-02-05 2010-08-25 中国电子科技集团公司第五十八研究所 Multiple play gateway

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100479443C (en) * 2006-09-22 2009-04-15 金纯� Blue Tooth ZigBee gateway
CN202143065U (en) * 2011-07-26 2012-02-08 内蒙古大学 Heterogeneous wireless network transmission system based on Bluetooth and ZigBee
KR20130088567A (en) * 2012-01-31 2013-08-08 강원대학교산학협력단 Handheld terminal-based multi-control system for patients with limited mobility and method for thereof
CN105451165B (en) * 2015-12-01 2019-12-06 中国通信建设集团设计院有限公司 near field communication method and device based on multiple protocols
MA44914A1 (en) * 2019-02-15 2020-08-31 Ecole Marocaine Des Sciences De L’Ingenieur Multi-interface and multi-protocol intelligent communication device for industrial wireless communication based on modbus
CN112087441B (en) * 2020-09-03 2022-08-16 郑州信大先进技术研究院 Multi-protocol communication method, intelligent home gateway and multi-protocol communication system
CN112671638B (en) * 2021-01-13 2022-10-04 北京方正数码有限公司 Gateway structure for multi-protocol conversion

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101815041A (en) * 2010-02-05 2010-08-25 中国电子科技集团公司第五十八研究所 Multiple play gateway

Also Published As

Publication number Publication date
CN113329359A (en) 2021-08-31

Similar Documents

Publication Publication Date Title
JP6367501B1 (en) Method, apparatus and smart watch for interaction between smart watch and we chat platform
US9173161B2 (en) Peer-to-peer pre-association discovery operations
CN112217831A (en) Information interaction method, device and equipment about Internet of things equipment
CN110740460A (en) device network access method, device, network device and storage medium
KR102060434B1 (en) Apparatus and method for providing a wireless communication in a portable terminal
EP2858326B1 (en) Service information discovery method and device
CN105072665A (en) Networking control and access method and corresponding terminal and equipment
JP2008219482A (en) Information distribution system in radio packet communication system, information distribution method and information distribution device
CN110958593A (en) Bluetooth networking method, device, system and computer readable medium
KR20140135080A (en) METHOD FOR COMMUNICATING BETWEEN UEs IN WIRELESS COMMUNICATIN SYSTEMS
US10149134B2 (en) Near field discovery method, user equipment, and storage medium
WO2017143743A1 (en) Heterogeneous protocol communication method and controller
KR20150018302A (en) Group Owner Centric Service Discovery method and apparatus
US20160316395A1 (en) Service query method, apparatus and system, and station
CN108684021B (en) Bluetooth low-power-consumption communication method and device
CN105120454A (en) Information transmission method, network access method and corresponding terminals
CN113329359B (en) Communication method, communication device, electronic equipment and readable storage medium
EP3107231B1 (en) Data processing method and device
CN111147582B (en) Voice interaction method and device, computer equipment and storage medium
KR20210068464A (en) Apparatus and method for performing group communication
CN111263338B (en) Network distribution method of Bluetooth Mesh network, related network distribution equipment and system
CN109361682B (en) Communication method, device, equipment and storage medium
CN117880372B (en) FTTR system equipment access control method, gateway equipment and gateway distributed system
KR102543726B1 (en) Wireless handheld microphone system
CN113271305B (en) Attack detection method and device and web application level intrusion prevention system WAF

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
GR01 Patent grant
GR01 Patent grant