The content of the invention
An embodiment of the present invention provides a kind of smart machine to find method, apparatus, control terminal and system, can preferably keep away
Exempt from upper application software and frequently receive notice.
In a first aspect, an embodiment of the present invention provides a kind of smart machine to find method, at least two communication protocols are realized
Registration;Further include:
When the smart machine that any communication protocol for receiving registration returns reach the standard grade notice when, it is determined whether exist
Other any described communication protocols have found that the smart machine is reached the standard grade;
If it is not, then the smart machine is notified to reach the standard grade to corresponding upper application software;
If it is, the smart machine is not notified to reach the standard grade to the upper application software;
When the offline notice for the smart machine that any communication protocol for receiving registration returns, it is determined whether
There are any communication protocol to have found that the smart machine is reached the standard grade;
If it is not, then notify that the smart machine is offline to the upper application software;
If it is, do not notify that the smart machine is offline to the upper application software.
Preferably,
The smart machine returned when any communication protocol for receiving registration reach the standard grade notice when, it is determined whether
There are other any described communication protocols to have found that the smart machine is reached the standard grade, including:
When the smart machine that any communication protocol for receiving registration returns reach the standard grade notice when, will be corresponding described
The product ID SN of the title of communication protocol and the smart machine is corresponded to and is stored in default Hash table;Determine described
With the presence or absence of the title of other any communication protocols and the SN of corresponding storage in Hash table;
During the offline notice of the smart machine returned when any communication protocol for receiving registration, determine
Have found that the smart machine is reached the standard grade with the presence or absence of any communication protocol, including:
When the offline notice for the smart machine that any communication protocol for receiving registration returns, in the Kazakhstan
The title of the corresponding communication protocol and the SN of corresponding storage are searched in uncommon table, and is deleted;After determining delete processing
The Hash table in the presence or absence of the title of any communication protocol and the SN of corresponding storage.
Preferably,
It is described to notify the smart machine to reach the standard grade to corresponding upper application software, including:
The smart machine is notified to reach the standard grade to the upper application software using default unified call back function;
It is described to notify that the smart machine is offline to the upper application software, including:
Notify that the smart machine is offline to the upper application software using the unified call back function.
Preferably,
Further comprise:
When the offline notice for the smart machine that any communication protocol for receiving registration returns, and determine exist
It is any described logical from have found that the smart machine is reached the standard grade when any communication protocol has found that the smart machine is reached the standard grade
Believe and a destinations traffic agreement is selected in agreement;
Utilize the communication described in the destinations traffic protocol realization between upper application software and the smart machine.
Second aspect, an embodiment of the present invention provides a kind of smart machine to find device, including:Registering unit, reach the standard grade it is logical
Know determination unit and offline notice determination unit, wherein,
The registering unit, is used for realization the registration of at least two communication protocols;
The notice determination unit of reaching the standard grade, for the smart machine returned when any communication protocol for receiving registration
Reach the standard grade notice when, it is determined whether there are other any described communication protocols to have found that the smart machine is reached the standard grade;If it is not, then
The smart machine is notified to reach the standard grade to corresponding upper application software;If it is, institute is not notified to the upper application software
Smart machine is stated to reach the standard grade;
The offline notice determination unit, for the intelligence returned when any communication protocol for receiving registration
During the offline notice of equipment, it is determined whether there are any communication protocol to have found that the smart machine is reached the standard grade;If it is not, then
Notify that the smart machine is offline to the upper application software;If it is, not to described in upper application software notice
Smart machine is offline.
Preferably,
The notice determination unit of reaching the standard grade, for the smart machine returned when any communication protocol for receiving registration
Reach the standard grade notice when, the product ID SN of the title of the corresponding communication protocol and the smart machine is corresponded into storage
In default Hash table;Determine that title and correspondence in the Hash table with the presence or absence of other any communication protocols are deposited
The SN of storage;
The offline notice determination unit, for the intelligence returned when any communication protocol for receiving registration
During the offline notice of equipment, searched in the Hash table described in title and the corresponding storage of the corresponding communication protocol
SN, and delete;Determine in the Hash table after delete processing with the presence or absence of the title and correspondence of any communication protocol
The SN of storage.
Preferably,
The notice determination unit of reaching the standard grade, for being notified using default unified call back function to the upper application software
The smart machine is reached the standard grade;
The offline notice determination unit, for notifying institute to the upper application software using the unified call back function
It is offline to state smart machine.
Preferably,
Further comprise:Communication control unit;
The communication control unit, for receiving any communication protocols of registration when the offline notice determination unit
The offline notice of the smart machine returned is discussed, and determines that there are any communication protocol to have found on the smart machine
During line, a destinations traffic agreement is selected in any communication protocol that the smart machine is reached the standard grade from having found;Using institute
State the communication between upper application software and the smart machine described in destinations traffic protocol realization.
The third aspect, an embodiment of the present invention provides a kind of control terminal, including:Intelligence described in any of the above-described embodiment
Equipment finds device and upper application software.
Fourth aspect, an embodiment of the present invention provides a kind of smart machine to find system, including:Described in above-described embodiment
Control terminal, and at least one smart machine.
An embodiment of the present invention provides a kind of smart machine to find method, apparatus, control terminal and system, be first realize to
The registration of few two kinds of communication protocol, if in this way, reaching the standard grade for the smart machine that any communication protocol for receiving registration returns is logical
No longer it is that direct notice upper application software smart machine is reached the standard grade, but be necessary to determine whether any logical there are other when knowing
Letter agreement has found that the smart machine is reached the standard grade, if it is present illustrating that current communication protocol is not to be originally found the intelligence
What equipment was reached the standard grade, therefore without notifying upper application software, if it does not exist, then illustrating that current communication protocol is most initial
What existing smart machine was reached the standard grade, therefore need to notify that the equipment has been reached the standard grade to upper application software at this time, in this way, ensureing upper layer application
Software receives only once the notice that the smart machine is reached the standard grade, similarly, when receiving the offline notice of the smart machine, also not
It is to directly notify upper application software again, but it needs to be determined that currently whether also find that the equipment is reached the standard grade there are communication protocol,
If it is present upper application software is not longer notified about, if it does not exist, then illustrating that the smart machine is offline, then to upper layer application
The software notification smart machine is offline, this way it is ensured that upper application software receives only once, the smart machine is offline to be led to
Know.Therefore, this programme preferably avoids upper application software from frequently receiving notice.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, the technical solution in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, instead of all the embodiments, based on the embodiments of the present invention, those of ordinary skill in the art
The all other embodiments obtained on the premise of creative work is not made, belong to the scope of protection of the invention.
As shown in Figure 1, an embodiment of the present invention provides a kind of smart machine to find method, this method can include following step
Suddenly:
Step 101:Realize the registration of at least two communication protocols, and perform step 102 and step 105 respectively.
Step 102:When the smart machine that any communication protocol for receiving registration returns reach the standard grade notice when, determine
Have found that the smart machine is reached the standard grade with the presence or absence of other any described communication protocols, if it is not, then step 103 is performed, if
It is then to perform step 104.
Step 103:The smart machine is notified to reach the standard grade to corresponding upper application software.
Step 104:The smart machine is not notified to reach the standard grade to the upper application software.
Step 105:When the offline notice for the smart machine that any communication protocol for receiving registration returns,
Determine whether there is any communication protocol and have found that the smart machine is reached the standard grade, if it is not, then step 106 is performed, if
It is then to perform step 107.
Step 106:Notify that the smart machine is offline to the upper application software.
Step 107:Do not notify that the smart machine is offline to the upper application software.
An embodiment of the present invention provides a kind of smart machine to find method, is the note for realizing at least two communication protocols first
Volume, if in this way, receive registration any communication protocol return smart machine reach the standard grade notice when, be no longer directly to notify
The upper application software smart machine is reached the standard grade, but is necessary to determine whether to have found that the intelligence is set there are other any communication protocols
It is standby to reach the standard grade, if it is present the current communication protocol of explanation is not to be originally found the smart machine to reach the standard grade, therefore without
Upper application software is notified, if it does not exist, then illustrating that current communication protocol is originally found smart machine and reaches the standard grade, therefore
Needing notice at this time, the equipment has been reached the standard grade to upper application software, in this way, ensureing that upper application software receives only once the intelligence
The notice that energy equipment is reached the standard grade, is also no longer to directly notify upper strata to answer when receiving the offline notice of the smart machine similarly
With software, but it needs to be determined that currently whether also find that the equipment is reached the standard grade there are communication protocol, if it is present being not longer notified about
Layer application software, if it does not exist, then illustrating that the smart machine is offline, then notifies under the smart machine to upper application software
Line, this way it is ensured that upper application software receives only once the offline notice of the smart machine.Therefore, this programme is preferable
Upper application software is avoided frequently to receive notice.
In an embodiment of the invention, the embodiment of the step 102, including:As times for receiving registration
The smart machine that one communication protocol returns reach the standard grade notice when, by the title of the corresponding communication protocol and the intelligence
The product ID SN of energy equipment, which is corresponded to, to be stored in default Hash table;Determine any with the presence or absence of other in the Hash table
The title of the communication protocol and the SN of corresponding storage;The embodiment of the step 105, including:Work as reception
During the offline notice of the smart machine returned to any communication protocol of registration, searched in the Hash table corresponding
The title of the communication protocol and the SN of corresponding storage, and delete;Determine in the Hash table after delete processing
The SN of title and corresponding storage with the presence or absence of any communication protocol.
In above-described embodiment, Hash table is primarily used to the record information of reaching the standard grade of storage smart machine, wherein, the note of reaching the standard grade
Record information may include:It was found that the title for the communication protocol that smart machine is reached the standard grade and No. SN of smart machine, then once work as certain
Communication protocol broken string is when causing smart machine offline, then by No. SN of the title of the communication protocol and the smart machine from Hash
Carry out corresponding to deletion in table, in this way, for this No. SN, or this No. SN is not present in Hash table, or there are it is at least one not
The title of same communication protocol and corresponding this No. SN stored, so, for this No. SN, as long as there are this No. SN in Hash table
And the title of any one other communication protocol of corresponding storage, then illustrate that the smart machine is in the state of reaching the standard grade at this time.
Clearly to illustrate above-described embodiment, below by by taking table 1 as follows as an example.
Table 1
Communication protocol title |
Smart machine SN |
IPP |
F31***WTD |
XMPP |
F31***WTD |
IPP |
CNX7***11 |
It is assumed that after a period of time has passed, receive the smart machine F31***WTD that the communication protocol IPP of registration is returned
Offline notice, then delete title IPP and the SN F31***WTD of communication protocol are corresponding from table 1, table 1 will become at this time
For such as table 2 below.
Table 2
Communication protocol title |
Smart machine SN |
XMPP |
F31***WTD |
IPP |
CNX7***11 |
As can be seen from Table 2, it is also corresponding in table to be stored with MXPP and F31***WTD, namely also XMPP has found intelligence
Equipment F31***WTD is in state of reaching the standard grade, therefore, even if the offline notice of the smart machine of IPP returns is received, but due to
Also other communication protocols make it that the smart machine is online (namely state of reaching the standard grade), therefore, are not notified that corresponding upper strata should
With software, the smart machine is offline, so as to avoid the situation of notice is frequently sent to upper application software.
It is assumed that in the case of above-mentioned table 1, what the communication protocol MQTT through after a period of time, receiving registration was returned
The notice of reaching the standard grade of smart machine F31***WTD, then correspond to title MQTT and SN F31***WTD and store into table 1, at this time
Table 1 is changed into such as table 3 below.
Table 3
Communication protocol title |
Smart machine SN |
IPP |
F31***WTD |
XMPP |
F31***WTD |
IPP |
CNX7***11 |
MQTT |
F31***WTD |
As can be seen from Table 3, in addition to the just MQTT and F31***WTD of corresponding storage, also correspondence is stored with table 3
IPP and F31***WTD, and XMPP and F31***WTD, it is seen then that receive IPP return notice of reaching the standard grade before, IPP and
XMPP has found that smart machine F31***WTD reaches the standard grade, therefore, even if the notice of reaching the standard grade of IPP returns is received, but due to also having
Other communication protocols make it that the smart machine is online, so no longer sending notice of reaching the standard grade to corresponding upper application software.
What deserves to be explained is No. SN of the mainly title of storage communication protocol and smart machine of the embodiment of the present invention,
But other much informations such as notice receiving time are may also include, specifically, can be set according to the actual requirements.
In an embodiment of the invention, the embodiment of the step 103, including:Returned using default unification
Letter of transfer number notifies the smart machine to reach the standard grade to the upper application software;The embodiment of the step 106, including:
Notify that the smart machine is offline to the upper application software using the unified call back function.
In embodiments of the present invention, by pre-setting unified call back function onDeviceAdd (), then receiving often
During the notice that a kind of corresponding call back function of communication protocol returns, for example, receiving the corresponding call back functions of MQTT
The notice of reaching the standard grade for the smart machine that onMQTTDeviceAdd is returned, and receive the corresponding call back functions of XMPP
The notice of reaching the standard grade for the smart machine that onXMPPDeviceAdd () is returned, then by unified call back function onDeviceAdd ()
To corresponding upper application software notice, once the smart machine is reached the standard grade.
In an embodiment of the invention, further comprise:Returned when any communication protocol for receiving registration
The offline notice of the smart machine, and when determining to have found that the smart machine is reached the standard grade there are any communication protocol, from
Have found one destinations traffic agreement of selection in any communication protocol that the smart machine is reached the standard grade;Led to using the target
Believe the communication between upper application software and the smart machine described in protocol realization.
, can also be from it if communication protocol currently in use breaks and causes smart machine offline in above-described embodiment
He has found that selecting the higher communication protocol of a priority to realize in the communication protocol that the smart machine is reached the standard grade communicates, can with this
Control instruction is found to corresponding smart machine by upper application software.
A kind of smart machine provided in an embodiment of the present invention is described more detail below and finds method, as shown in Fig. 2, this method
It may comprise steps of:
Step 201:The registration of at least two communication protocols is realized, when the intelligence that any communication protocol for receiving registration returns
Can equipment reach the standard grade notice when, perform step 202, when receive registration any communication protocol return smart machine it is offline
During notice, step 206 is performed.
In embodiments of the present invention, in order to stable discovering device, when avoiding a kind of communication protocol broken string, this is caused
The situation that equipment will not be found, therefore can realize the registration of various communications protocols, to pass through each communication protocol of registration
Go to find smart machine, wherein, at least one local communication protocol is may include in the communication protocol of registration, and it is at least one
Long-range communication protocol (mainly meeting the local communication after distribution, and distribution and telecommunication).
Step 202:The SN of the title of corresponding communication protocol and smart machine is corresponded to and is stored in default Hash table
In.
For example, the entitled IPP of communication protocol, No. SN of smart machine is CNX7***11.
Step 203:Determine the title with the presence or absence of other any communication protocols and the corresponding SN stored in Hash table, such as
Fruit is no, then performs step 204, if it is, performing step 205.
Due to being used only in Hash table, storage is current still to find that smart machine is in the title for the communication protocol reached the standard grade
And No. SN of the smart machine, therefore, receiving reaching the standard grade for No. SN corresponding smart machine CNX7***11 of IPP returns
During notice, then also the title there are other any communication protocols and corresponding storage need to be only searched whether from the Hash table
CNX7***11, if it is present explanation also has other communication protocols still to find what the smart machine was reached the standard grade at present, therefore, no
Upper application software is reinformed, if it does not exist, then explanation currently only has the IPP to find that the smart machine is reached the standard grade, it is therefore desirable to
Upper application software is notified, so that upper application software sends corresponding control instruction to the smart machine.
Step 204:Reached the standard grade using default unified call back function to corresponding upper application software notice smart machine, and
Terminate current process.
In embodiments of the present invention, the notice that the corresponding call back function of all log-in protocols is sent mainly is received,
Corresponding upper application software is being notified after unified management, then by default unified call back function.
Step 205:Do not reach the standard grade to upper application software notice smart machine, and terminate current process.
Step 206:The title of corresponding communication protocol and the SN of corresponding storage are searched in Hash table, and is deleted.
In embodiments of the present invention, then, will be stored before upper after offline notice is received in order to improve efficiency
Line Notification Record is deleted, so that each time by checking Hash table, can quickly know that corresponding smart machine is being worked as
It is preceding whether also in the state of reaching the standard grade.
Step 207:Determine that title and correspondence in the Hash table after delete processing with the presence or absence of any communication protocol are deposited
The SN of storage, if it is not, then step 208 is performed, if it is, performing step 209.
Step 208:It is offline to upper application software notice smart machine using unified call back function, and terminate current stream
Journey.
Step 209:It is not offline to upper application software notice smart machine.
Step 210:A destinations traffic agreement is selected in any communication protocol that smart machine is reached the standard grade from having found.
Smart machine caused by breaking in order to avoid certain communication protocol is offline, then one can be selected from other communication protocols
Communication protocol, to maintain the communication between corresponding upper application software and smart machine.
Step 211:Utilize the communication between the destinations traffic protocol realization upper application software and smart machine of selection.
As shown in figure 3, an embodiment of the present invention provides a kind of smart machine to find device, including:Registering unit 301, on
Line notifies determination unit 302 and offline notice determination unit 303, wherein,
The registering unit 301, is used for realization the registration of at least two communication protocols;
The notice determination unit 302 of reaching the standard grade, for the intelligence returned when any communication protocol for receiving registration
Equipment reach the standard grade notice when, it is determined whether there are other any described communication protocols to have found that the smart machine is reached the standard grade;If
It is no, then notify the smart machine to reach the standard grade to corresponding upper application software;If it is, do not lead to the upper application software
Know that the smart machine is reached the standard grade;
The offline notice determination unit 303, described in being returned when any communication protocol for receiving registration
During the offline notice of smart machine, it is determined whether there are any communication protocol to have found that the smart machine is reached the standard grade;If
It is no, then notify that the smart machine is offline to the upper application software;If it is, do not notified to the upper application software
The smart machine is offline.
In an embodiment of the invention, the notice determination unit of reaching the standard grade, any described of registration is received for working as
The smart machine that communication protocol returns reach the standard grade notice when, by the title of the corresponding communication protocol and the smart machine
Product ID SN correspond to be stored in default Hash table;Determine any described logical with the presence or absence of other in the Hash table
Believe the title of agreement and the SN of corresponding storage;
The offline notice determination unit, for the intelligence returned when any communication protocol for receiving registration
During the offline notice of equipment, searched in the Hash table described in title and the corresponding storage of the corresponding communication protocol
SN, and delete;Determine in the Hash table after delete processing with the presence or absence of the title and correspondence of any communication protocol
The SN of storage.
In an embodiment of the invention, the notice determination unit of reaching the standard grade, for utilizing default unified call back function
The smart machine is notified to reach the standard grade to the upper application software;
The offline notice determination unit, for notifying institute to the upper application software using the unified call back function
It is offline to state smart machine.
As shown in figure 4, in an embodiment of the invention, further comprise:Communication control unit 401;
The communication control unit 401, for receiving any described logical of registration when the offline notice determination unit
Believe the offline notice for the smart machine that agreement returns, and determine that there are any communication protocol to have found that the intelligence is set
It is standby when reaching the standard grade, select a destinations traffic agreement from having found in any communication protocol that the smart machine is reached the standard grade;Profit
Communication described in the destinations traffic protocol realization between upper application software and the smart machine.
The contents such as the information exchange between each unit, implementation procedure in above device, due to implementing with the method for the present invention
Example is based on same design, and particular content can be found in the narration in the method for the present invention embodiment, and details are not described herein again.
As shown in figure 5, an embodiment of the present invention provides a kind of control terminal, including:Intelligence described in any of the above-described embodiment
Equipment finds device 501 and upper application software 502.
As shown in fig. 6, an embodiment of the present invention provides a kind of smart machine to find system, including:Any of the above-described embodiment
The control terminal 601, and at least one smart machine 602.
An embodiment of the present invention provides a kind of computer-readable medium, including computer executed instructions, work as storage control
Processor when performing the computer executed instructions, the intelligence that the storage control performs described in any of the above-described embodiment is set
Preparation shows method.
An embodiment of the present invention provides a kind of storage control, including:Processor, memory and bus;The memory
For storing computer executed instructions, the processor is connected with the memory by the bus, when the storage control
When device is run, the processor performs the computer executed instructions of the memory storage, so that the storage control
Perform the smart machine described in any of the above-described embodiment and find method.
To sum up, each embodiment of the present invention at least has the advantages that:
1st, in embodiments of the present invention, first it is the registration of realizing at least two communication protocols, if in this way, receiving note
The smart machine that any communication protocol of volume returns reach the standard grade notice when, be no longer that direct notice upper application software intelligence is set
It is standby to reach the standard grade, but be necessary to determine whether to have found that the smart machine is reached the standard grade there are other any communication protocols, if it is present saying
Bright current communication protocol is not to be originally found the smart machine to reach the standard grade, therefore without notifying upper application software, such as
Fruit is not present, then illustrates that current communication protocol is originally found smart machine and reaches the standard grade, therefore needs notice at this time to upper strata
The application software equipment has been reached the standard grade, in this way, ensureing that upper application software receives only once the notice that the smart machine is reached the standard grade, together
Reason, is also no longer to directly notify upper application software when receiving the offline notice of the smart machine, but it needs to be determined that
Currently whether also find that the equipment is reached the standard grade there are communication protocol, if it is present upper application software is not longer notified about, if do not deposited
Then illustrating that the smart machine is offline, then notifying that the smart machine is offline to upper application software, this way it is ensured that upper strata should
The offline notice of the smart machine is received only once with software.Therefore, this programme preferably avoids upper application software frequent
Receive notice.
2nd, in embodiments of the present invention, the record information of reaching the standard grade of smart machine is stored by Hash table, in, the record of reaching the standard grade
Information may include:It was found that the title for the communication protocol that smart machine is reached the standard grade and No. SN of smart machine, and receiving this
During the offline notice of smart machine, corresponding record information of reaching the standard grade is deleted from the Hash table, in this way, by checking
Hash table, can quickly know corresponding smart machine currently whether also in the state of reaching the standard grade, so as to quickly really
It is fixed that notice either offline notice of reaching the standard grade whether is sent to corresponding upper application software.
3rd, in embodiments of the present invention, corresponding upper application software is notified by using unified call back function, can
Simplify the workload of developer, improve development efficiency, improve user experience.
4th, in present example, the offline notice of smart machine is being received, and determine that also there are communication protocol discovery
, can also be from can be from finding that selection one maintains and intelligence in these communication protocols for reaching the standard grade of smart machine when smart machine is reached the standard grade
The communication of equipment room, meanwhile, by registering various communications protocols, also it can not find that smart machine is reached the standard grade in a certain communication protocol
When, find that smart machine is reached the standard grade using other communication protocols, thereby it is ensured that stability that smart machine is found and reliable
Property.
It should be noted that herein, such as first and second etc relational terms are used merely to an entity
Or operation is distinguished with another entity or operation, is existed without necessarily requiring or implying between these entities or operation
Any actual relationship or order.Moreover, term " comprising ", "comprising" or its any other variant be intended to it is non-
It is exclusive to include, so that process, method, article or equipment including a series of elements not only include those key elements,
But also including other elements that are not explicitly listed, or further include solid by this process, method, article or equipment
Some key elements.In the absence of more restrictions, the key element limited by sentence " including one ", is not arranged
Except in the process, method, article or apparatus that includes the element also in the presence of other identical factor.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above method embodiment can pass through
The relevant hardware of programmed instruction is completed, and foregoing program can be stored in computer-readable storage medium, the program
Upon execution, the step of execution includes above method embodiment;And foregoing storage medium includes:ROM, RAM, magnetic disc or light
Disk etc. is various can be with the medium of store program codes.
It is last it should be noted that:The foregoing is merely presently preferred embodiments of the present invention, is merely to illustrate skill of the invention
Art scheme, is not intended to limit the scope of the present invention.Any modification for being made within the spirit and principles of the invention,
Equivalent substitution, improvement etc., are all contained in protection scope of the present invention.