Background technology
Gateway is a kind of computer system or equipment of changing important task that serves as, and is the bonded products that connects the software and hardware of heterogeneous networks.Using between different communication protocol, data format or the language even the diverse two kinds of systems of system, gateway is a translater; By sealing information again so that they can be read by another system, with the demand of adaptation to end system.
Bluetooth (Bluetooth) is a kind of short-distance wireless communication technology, and its agreement is followed open systems interconnection reference model (OSI/RM).It comprises following several agreement: baseband protocol, LMP Link Manager Protocol, logic link control and adapting protocol, service discovery protocol; Cable replacement agreement (RFCOMM); Phone transmits control protocol and some optional agreements etc.Except above-mentioned agreement, Bluetooth specification has also defined HCI (HCI).It is the software interface between bluetooth module and main frame, and it provides the instruction packet format of hardware capabilitys such as control base band, link manager, status register.Utilize Bluetooth technology, can at low cost various device be coupled together.
ZigBee be a kind of closely, low complex degree, low-power consumption, low data rate, two-way wireless communication technology cheaply, mainly be suitable for fields such as automatic control, sensing, monitoring and Long-distance Control, can embed in the various device, support geographic positioning functionality simultaneously.ZigBee alliance has adopted IEEE802.15.4 as its physical layer and medium Access Layer standard when formulating the ZigBee standard.On its basis, ZigBee alliance has formulated data link layer (DLL), network layer (NWK) and API (API) standard.
Because bluetooth is two kinds of different consensus standards with ZigBee, bluetooth equipment can not with the direct communication of ZigBee equipment.When these two kinds of equipment wish to set up communication, just need protocol conversion based on the equipment of these two kinds of technology.And in existing wireless communication protocol conversion equipment, also do not have blue Tooth ZigBee gateway, making at present also can't direct communication between these two kinds of equipment.
Summary of the invention
At the prior art above shortcomings, the object of the present invention is to provide a kind of blue Tooth ZigBee gateway technology, make and can realize the blue Tooth ZigBee gateway of communicating by letter between two kinds of equipment of bluetooth and ZigBee smoothly glibly.
The object of the present invention is achieved like this: blue Tooth ZigBee gateway is characterized in that hardware comprises bluetooth module and ZigBee module.Link to each other by serial ports between bluetooth module and the ZigBee module, be used for the data of bluetooth module are passed to the ZigBee module or the data of ZigBee module are passed to bluetooth module.Bluetooth transceiver in this module in the chip and bluetooth child node are by the wireless mode communication; The ZigBee transceiver is communicated by letter by wireless mode with the ZigBee child node;
The blue Tooth ZigBee gateway protocol model be divided into following which floor: the superiors are management level of gateway, lower floor be respectively Bluetooth RF, base band, LMP and L2CAP, RFCOMM and the SDP corresponding with Bluetooth protocol and with the corresponding ZigBee physical layer of ZigBee agreement, ZigBee MAC layer and ZigBee network layer; The blue Tooth ZigBee gateway management level are to use implementation during bluetooth and ZigBee initialization, configuration and the connection management, and the management entity of bluetooth and ZigBee coexistence management, and it is in charge of the encapsulation and the dismounting of message.
The processing method of blue Tooth ZigBee gateway is:
1) concerning the data that send to bluetooth host from ZigBee equipment, need pass through following processing: data that receive from ZigBee equipment → remove ZigBee physical layer packet head → remove ZigBee MAC layer packets headers → remove ZigBee network layer packet head → interpolation blue tooth RFCOMM layer packets headers (this step is optional) → interpolation bluetooth L2CAP layer packets headers → interpolation bluetooth physical layer packet head at blue Tooth ZigBee gateway.
2) concerning the data that send to ZigBee from bluetooth equipment, in gateway, it need pass through following processing: data that receive from bluetooth equipment → remove bluetooth physical layer packet head → remove bluetooth L2CAP layer packets headers → remove blue tooth RFCOMM layer packets headers (this step is optional) → interpolation ZigBee network layer packet head → interpolation ZigBee MAC layer packets headers → interpolation ZigBee physical layer packet head.
3) concerning the data that send to bluetooth equipment B from bluetooth equipment A, in gateway, it need pass through following processing: data that receive from bluetooth equipment A → remove bluetooth physical layer packet head → remove bluetooth L2CAP layer packets headers → remove blue tooth RFCOMM layer packets headers (this step is optional) → interpolation blue tooth RFCOMM layer packets headers (this step is optional) → interpolation bluetooth L2CAP layer packets headers → interpolation bluetooth physical layer packet head.
4) concerning the data that send to the ZigBee equipment B from the ZigBee device A, in gateway, it need pass through following processing: data that receive from the ZigBee device A → remove ZigBee physical layer packet head → remove ZigBee MAC layer packets headers → remove ZigBee network layer packet head → interpolation ZigBee network layer packet head → interpolation ZigBee MAC layer packets headers → interpolation ZigBee physical layer packet head.
Described blue Tooth ZigBee gateway main program is achieved as follows function:
1) registration process: when bluetooth equipment and ZigBee equipment entered in the middle of the blue Tooth ZigBee network, bluetooth and ZigBee equipment must be registered and authentication to blue Tooth ZigBee gateway;
2) service discovery: in the present invention, primary purpose is the bluetooth equipment and the ZigBee equipment that can find in the network, and knows the agreement that they use, and this is realized by the service discovery service that blue Tooth ZigBee gateway provided.In the service log of service discovery service, include relevant informations such as device name, address, protocol description, the bluetooth equipment and the ZigBee equipment that make bluetooth equipment can find that all are registered to gateway, ZigBee equipment also can find ZigBee equipment and bluetooth equipment conversely;
3) connection procedure: be meant between bluetooth equipment and the ZigBee equipment, perhaps between bluetooth equipment and the bluetooth equipment, the connection procedure between ZigBee equipment and the ZigBee equipment, being connected between ZigBee equipment and the bluetooth equipment must be passed through the gateway transfer, and can pass through the gateway transfer between the bluetooth equipment and between the ZigBee equipment, also can directly link to each other; In connection procedure, adopt ways of connecting successively;
4) data transmit-receive process: comprise the data transmit-receive process in ZigBee child node data transmit-receive process, bluetooth equipment data transmit-receive process and the blue Tooth ZigBee gateway;
5) disconnection process: be meant the inverse process of connection procedure, just refer between bluetooth equipment and the ZigBee equipment or the disconnection connection procedure between bluetooth equipment and the bluetooth equipment, between ZigBee equipment and the ZigBee equipment.The disconnection process must be passed through the gateway transfer; The process that disconnects without gateway is not within this invention.
6) log off procedure:, produce log off procedure when equipment requirements is left the blue Tooth ZigBee network.Log off procedure is divided into normal cancellation and improper cancellation.
Compared to existing technology, the present invention has following advantage:
1, blue Tooth ZigBee gateway of the present invention makes and can realize communication between bluetooth and two kinds of equipment of ZigBee smoothly glibly.
2, blue Tooth ZigBee gateway bluetooth part of the present invention can be used as the gateway use for bluetooth equipment, and the ZigBee part in the gateway can be used as the ZigBee telegon for ZigBee equipment and uses.
Embodiment
Below by describe specifying information of the present invention in detail by accompanying drawing, so that further understand the present invention.
1, the hardware designs of blue Tooth ZigBee gateway
As shown in Figure 1, blue Tooth ZigBee gateway mainly comprises: bluetooth module 1 and ZigBee module 2.Link to each other by serial ports between bluetooth module 1 and the ZigBee module 2, be used for the data of bluetooth module 1 are passed to ZigBee module 2 or the data of ZigBee module 2 are passed to bluetooth module 1.
Among the embodiment: bluetooth module 1 links to each other with the RS232 serial ports, and this module mainly realizes the agreement that bluetooth HCI layer is following, and the air interface that meets Bluetooth specification is provided.Bluetooth transceiver 4 in the module in the chip carries out communication with bluetooth child node 5.Bluetooth child node 5 can be the Bluetooth adapter in bluetooth cellular phone or the main frame.
ZigBee module 2 links to each other with the RS232 serial ports, in order to save the volume of cost and minimizing gateway, adopts the cc2430-F128 chip of Chipcon company, and chip internal has write the hypervisor of gateway.This module is used to receive the data that sent by ZigBee child node 6, and handles.ZigBee transceiver 3 in the module is used for communicating by letter by wireless mode with ZigBee child node 6.
The function of blue Tooth ZigBee gateway hardware is: run into emergency, can report to the police to administrative center by danger button; And can communicate with ZigBee child node 6 and bluetooth child node 5 respectively by wireless (ZigBee, the bluetooth) module on the gateway.
2, software design
2.1 protocol model:
The blue Tooth ZigBee gateway protocol model is primarily aimed at two kinds of different standards in the radio communication, i.e. intercommunication mutually between bluetooth and the ZigBee product.
As shown in Figure 2, blue Tooth ZigBee gateway 9 protocol models be divided into following which floor: the superiors are management level 8 of gateway, lower floor be respectively Bluetooth RF, base band, LMP and L2CAP, the RFCOMM corresponding and SDP with the agreement of bluetooth equipment 7 and with the corresponding ZigBee physical layer of the agreement of ZigBee equipment 10, ZigBee MAC layer and ZigBee network layer.Blue Tooth ZigBee gateway 9 is main equipments for bluetooth equipment 7, is telegons for ZigBee equipment 10.The physical layer of radio frequency in the agreement of bluetooth equipment 7, base band, LMP and L2CAP and ZigBee and MAC are first and second layers of OSI.Blue tooth RFCOMM is adaptive to the bluetooth of GSM TS 07.10; Bluetooth SDP is a bluetooth service discovery protocol.The management level 8 of blue Tooth ZigBee gateway are the implementations of using during bluetooth and ZigBee initialization, configuration and the connection management, and the management entity of bluetooth and ZigBee coexistence management.It is the protocol conversion function unit of whole gateway, and it is in charge of the encapsulation and the dismounting of message.
The process that connects between bluetooth and the ZigBee equipment: at first bluetooth equipment 7 and blue Tooth ZigBee gateway 9 connects respectively between every layer, then bluetooth equipment 7 sends a connection request to blue Tooth ZigBee gateway 9, comprise the relevant informations such as ZigBee equipment 10 addresses that will connect in the connection request packet, connect respectively between blue Tooth ZigBee gateway 9 and corresponding Z igBee equipment 10 each layers afterwards, send connection request to ZigBee equipment 10 after the success.ZigBee equipment 10 receives after the connection request order, and whether it is just made decision receives the connection request order, if ZigBee equipment 10 is accepted the connection request order, then just sets up between bluetooth equipment 7 and the ZigBee equipment 10 and has connected.
Send data procedures: bluetooth equipment 7 sends data to gateway 9, and gateway 9 receives after the data, all data is handled for every layer, and packet is when arriving management level 8, and its all head all is dropped.This moment, management level 8 were the relevant information taking-up that connects between previous bluetooth equipment 7 and the ZigBee equipment 10, such as information such as addresses.Management level 8 just join information such as address on the packet then, then continue the transmission to lower floor, continue to add relevant information.Last gateway 9 sends out packet, and ZigBee equipment 10 just receives corresponding packet.
The processing procedure of blue Tooth ZigBee gateway 9:
1) concerning the data that send to bluetooth host from ZigBee equipment 10, needs through following processing: data that receive from ZigBee equipment 10 → remove ZigBee physical layer packet head → remove ZigBee MAC layer packets headers → remove ZigBee network layer packet head → interpolation blue tooth RFCOMM layer packets headers (this step is optional) → interpolation bluetooth L2CAP layer packets headers → interpolation bluetooth physical layer packet head at blue Tooth ZigBee gateway 9;
2) concerning the data that send to ZigBee from bluetooth equipment 7, in gateway, it need pass through following processing: data that receive from bluetooth equipment 7 → remove bluetooth physical layer packet head → remove bluetooth L2CAP layer packets headers → remove blue tooth RFCOMM layer packets headers (this step is optional) → interpolation ZigBee network layer packet head → interpolation ZigBee MAC layer packets headers → interpolation ZigBee physical layer packet head.
3) concerning the data that send to bluetooth equipment B from bluetooth equipment A, in gateway, it need pass through following processing: data that receive from bluetooth equipment A → remove bluetooth physical layer packet head → remove bluetooth L2CAP layer packets headers → remove blue tooth RFCOMM layer packets headers (this step is optional) → interpolation blue tooth RFCOMM layer packets headers (this step is optional) → interpolation bluetooth L2CAP layer packets headers → interpolation bluetooth physical layer packet head.
4) concerning the data that send to the ZigBee equipment B from the ZigBee device A, in gateway, it need pass through following processing: data that receive from the ZigBee device A → remove ZigBee physical layer packet head → remove ZigBee MAC layer packets headers → remove ZigBee network layer packet head → interpolation ZigBee network layer packet head → interpolation ZigBee MAC layer packets headers → interpolation ZigBee physical layer packet head.
2.2 blue Tooth ZigBee gateway main program function:
Referring to Fig. 3, the main realization of blue Tooth ZigBee gateway main program registration 11, service discovery 12, connect 13, data transmit-receive 14, disconnect 15 and nullify 16 these several functions.
1) registration process 11: when bluetooth equipment and ZigBee equipment entered in the middle of the blue Tooth ZigBee network, bluetooth and ZigBee equipment must be registered and authentication to blue Tooth ZigBee gateway;
2) service discovery 12: in the present invention, primary purpose is the bluetooth equipment and the ZigBee equipment that can find in the network, and knows the agreement that they use, and this is realized by the service discovery service that blue Tooth ZigBee gateway provided.In the service log of service discovery service, include relevant informations such as device name, address, protocol description, the bluetooth equipment and the ZigBee equipment that make bluetooth equipment can find that all are registered to gateway, ZigBee equipment also can find ZigBee equipment and bluetooth equipment conversely;
3) connection procedure 13: be meant between bluetooth equipment and the ZigBee equipment, perhaps between bluetooth equipment and the bluetooth equipment, the connection procedure between ZigBee equipment and the ZigBee equipment, being connected between ZigBee equipment and the bluetooth equipment must be passed through the gateway transfer, and can pass through the gateway transfer between the bluetooth equipment and between the ZigBee equipment, also can directly link to each other; In connection procedure, adopt ways of connecting successively;
4) the data transmit-receive process 14: comprise the data transmit-receive process in ZigBee child node data transmit-receive process, bluetooth equipment data transmit-receive process and the blue Tooth ZigBee gateway;
5) disconnection process 15: be meant the inverse process of connection procedure, just refer between bluetooth equipment and the ZigBee equipment or the disconnection connection procedure between bluetooth equipment and the bluetooth equipment, between ZigBee equipment and the ZigBee equipment.The disconnection process must be passed through the gateway transfer.The process that disconnects without gateway is not within this invention.
6) log off procedure 16: when equipment requirements is left the blue Tooth ZigBee network, produce log off procedure.Log off procedure is divided into normal cancellation and improper cancellation.
By the discovery service that blue Tooth ZigBee gateway provides, the ZigBee equipment and the bluetooth equipment that are registered in the network can be inquired about near all ZigBee equipment and bluetooth equipments.
The normal process flow process is: bluetooth equipment or ZigBee equipment are at first registered 11 registration and authentications to blue Tooth ZigBee gateway.After bluetooth equipment and ZigBee equipment joined in the blue Tooth ZigBee network, they oneself were as client computer, and blue Tooth ZigBee gateway is as server.By service discovery protocol (SDP), they can search bluetooth equipment and the ZigBee equipment of registering in blue Tooth ZigBee gateway.In connection procedure 13, can between bluetooth equipment and ZigBee equipment or between the bluetooth equipment or between the ZigBee equipment, connect, after the connection, just can use data transmit-receive process 14 transceive data.After data transmit-receive is finished, the connection that can use disconnection process 15 to disconnect between the two.When equipment requirements is left the blue Tooth ZigBee network, just can use log off procedure 16 to nullify, other equipment just can not search this equipment more yet after nullifying.
The present invention is that the practical value from bluetooth and ZigBee technology goes out to send and is described, and under the situation of the spirit and scope of the present invention that do not break away from the appended claims and limited, can carry out the change of form and details separately.