A kind of method enabling wifi module to be adapted to plurality of devices communications protocol
Technical field
The present invention relates to can only household field, refer in particular to a kind of enable wifi module to be adapted to plurality of devices communications protocol
Method.
Background technology
At present, with the popularization of smart home, increasing people is by terminals such as mobile phone plane plate computers come remotely control
Equipment in family, but because each electronic equipment is due to the difference of producer, product type, lead to the communications protocol of each equipment
All not quite alike, order is surveyed in distribution order, factory, data reporting schemes (cycle, triggering, actively), data report time interval, surpass
When re-transmission time, Retransmission timeout number of times, triggering report position, reported data length etc. to be also not quite similar, thus each equipment
Wifi module all different it is impossible to compatible it is difficult to shared.China Patent Publication No. cn104345661a, publication date
On 2 11st, 2015, disclose one kind in the patent of invention of entitled " intelligent appliance control system based on wifi " and be based on
The intelligent appliance control system of wifi, including power supply, central processing unit, infrared communication interface, described power supply, described infrared communication
Interface is connected with described central processing unit respectively it is characterised in that also including wifi interface, electric lines of force, embedded gateway, intelligence
Wiring board, described wifi interface, electric lines of force are connected with described central processing unit respectively, and described embedded gateway, described intelligence are inserted
Line plate is connected with described wifi interface respectively, and described Intelligent extension socket is connected with household electrical appliance, and described Intelligent extension socket includes continuing
Electrical equipment, single-chip microcomputer, cyberdog.Be disadvantageous in that, this invention still need in advance set communications protocol could be with multiple intelligence
Household electrical appliances are communicated, if there being new intelligent appliance, need to re-write communications protocol, using upper greatly inconvenience it is impossible to meet
The actually used demand of related personnel.
Content of the invention
The purpose of the present invention is to overcome each electronic equipment in prior art due to the difference of producer, product type, to lead to
The communications protocol of each equipment is different, controls the more difficult shortcoming of all devices using a wifi module, provides one kind to make
The method that wifi module can be adapted to plurality of devices communications protocol.
The purpose of the present invention is to be achieved by following technical proposals:
A kind of method enabling wifi module to be adapted to plurality of devices communications protocol, comprises the following steps:
Step 1, related personnel sends the request of control device to wifi module;
Step 2, wifi module sends querying command request to equipment;
Step 3, after equipment accepts querying command, generates integrated communication command;
Step 4, equipment returns integrated communication order to wifi module, and wifi module receives integrated communication order;
Step 5, integrated communication command is extracted and parsed to wifi module, obtains the characteristic information of equipment, then wifi module according to
Characteristic information completes to be adapted to equipment;
Step 6, related personnel sends, by wifi module, the various functions that instruction control device realizes equipment.
Integrated communication order comprises the various communication informations of equipment, and integrated communication order is extracted after parsing by wifi module,
Just it is obtained with the information of equipment, such that it is able to complete to be adapted to according to the information of equipment, related personnel just can pass through wifi
Module control device.Because wifi module can obtain the information of each equipment by obtaining integrated communication order, thus realizing
One wifi module controls the purpose of multiple equipment, and related personnel's operation is greatly simple, improves efficiency, reduces cost.
As a kind of preferred version, described integrated communication order includes frame head, reset command, resetting successfully returns life
Make, network state return command, factory survey order, data reporting schemes, trigger report position and postamble.
As a kind of preferred version, described integrated communication order also includes Retransmission timeout time and Retransmission timeout number of times.
The purpose of this design be that of avoiding communication smooth when, it is integrated logical that setting re-transmission guarantees that wifi module can be obtained by multiple communication
News order.
As a kind of preferred version, the described reset command of integrated communication order, reset successfully return command, network-like
State return command, factory's survey order, data reporting schemes, triggering report the every of position, Retransmission timeout time and Retransmission timeout number of times
It is equipped with the serial number for distinguishing command type before individual data.The effect of serial number is to enable wifi module clearly to distinguish each
The specific length of individual order, prevents misidentification from causing to extract parsing integrated communication command failure.
As a kind of preferred version, described integrated communication command checksum and judge whether correctly mode is crc to data
Verification.
As a kind of preferred version, the integrated communication order generating in described step 3 is added by encryption rule for equipment
Integrated communication order after close, in described step 5 wifi module extract and parse integrated communication command include wifi module to
Related personnel can obtain encryption rule, extract again and parse integrated communication life after the integrated communication order after encryption is decrypted
Order.This design is to prevent other wifi module that equipment is controlled, and only related personnel provides encryption rule just can crack and adds
Close integrated communication order, improves safety.
The invention has the beneficial effects as follows, enable the method that wifi module is adapted to plurality of devices communications protocol to achieve one
Wifi module controls the purpose of multiple equipment, and related personnel's operation is greatly simple, improves efficiency, reduces cost.And we
Method is practical, safe.
Brief description
Fig. 1 is a kind of flow chart of the present invention;
Fig. 2 is the integrated communication order schematic diagram of the present invention.
Specific embodiment
With reference to the accompanying drawings and examples the present invention is further described.
Embodiment: a kind of method enabling wifi module to be adapted to plurality of devices communications protocol, its flow chart as shown in figure 1,
Comprise the following steps:
Step 1, related personnel sends the request of control device to wifi module;
Step 2, wifi module sends querying command request to equipment;
Step 3, after equipment accepts querying command, generates integrated communication command;
Step 4, equipment returns integrated communication order to wifi module, and wifi module receives integrated communication order;
Step 5, integrated communication command is extracted and parsed to wifi module, obtains the characteristic information of equipment, then wifi module according to
Characteristic information completes to be adapted to equipment;
Step 6, related personnel sends, by wifi module, the various functions that instruction control device realizes equipment.
Described integrated communication order is as shown in Fig. 2 include frame head, reset command, reset successfully return command, network-like
State return command, factory's survey order, data reporting schemes, triggering report position, Retransmission timeout time, Retransmission timeout number of times and are used for
The postamble of verification.The described reset command of integrated communication order, reset successfully return command, network state return command, factory
Survey order, data reporting schemes, trigger report each data of position, Retransmission timeout time and Retransmission timeout number of times before be equipped with
For distinguishing the serial number of command type.Described integrated communication command checksum and judge whether correctly mode is crc to data
Verification.Integrated communication order comprises the various communication informations of equipment, and integrated communication order is extracted after parsing by wifi module, just
The information of equipment can be obtained, such that it is able to complete to be adapted to according to the information of equipment, related personnel just can pass through wifi module
Control device.Because wifi module can obtain the information of each equipment by obtaining integrated communication order, it is achieved thereby that one
Individual wifi module controls the purpose of multiple equipment, and related personnel's operation is greatly simple, improves efficiency, reduces cost.
Controlled as a example broadlink intelligence spcc equipment by wifi module, wifi module issues querying command:
A5a55a5a000b00000000, then equipment return integrated communication order
f55f01a5a55a5a98c1e8030000000002a5a55a5a99c1e9030000000003a5a55a5aa2c1ec03040
000000200000004a5a55a5aa3c1ec03040000000300000005a5a55a5aa4c1f403000000000690
010702000803000906000205080b0c0f64eb, wifi module starts to extract and parse integrated communication command, specifically
Process is:
1. equipment verifies first and judges whether integrated communication order is correct, and using crc verification, multinomial is 0x8408, initially
It is worth for 0xffff;
2. remove frame head f55f and command type sn: 01,02,03 ...;
3. extraction reset command: a5 a5 5a 5a 98 c1 e8 03 00 00 00 00;
4. extract the successfully return command that resets: a5 a5 5a 5a 99 c1 e9 03 00 00 00 00;
5. fill in network state return command: a5 a5 5a 5a a2 c1 ec 03 04 00 00 00 02 00 00 00,
Represent and have been coupled to ap, and a5 a5 5a 5a a3 c1 ec 03 04 00 00 00 03 00 00 00, represent
Through normally linking cloud service;
6. fill in factory and survey order: a5 a5 5a 5a a4 c1 f4 03 00 00 00 00;
7. fill in the Retransmission timeout time: 90 01, expression re-transmission time is 400ms;
8. fill in data reporting schemes: 02 00, represent that triggering reports;
9. fill in Retransmission timeout number of times: 03 00, represent that number of times is 3 times;
10. fill in triggering and report position: 06 00 02 05 08 0b 0c 0f, represent that trigger position is: 2,5,8,11,12,
15 .