Summary of the invention
Based on this, it is necessary to for network equipment principle is unfamiliar with, in face of the login and professional parameter of the router pageSetting, it appears the problem of having no way of doing it provides a kind of router long-range control method and system based on MQTT agreement.
A kind of router long-range control method based on MQTT agreement, the method can make distal end control routerSystem, the distal end connect database, the device parameter information of router are prestored in the database, which comprises
Network connection is established between the router and the distal end, is established between the router and the distal endMQTT interface channel keeps long connection by the MQTT interface channel between the router and the distal end;
The router sends MQTT connection request to the distal end;
The distal end receives the MQTT connection request and verifies the legitimacy of the router;
If the router is legal, MQTT connection request described in the far end response;
Its daily record data is sent to the distal end by the MQTT interface channel by the router;
The distal end receives the daily record data of the router, analyzes the daily record data, raw according to the daily record dataAt corresponding configuration-direct, the configuration-direct is sent to the router by the MQTT interface channel;
The router completes corresponding configuration operation according to the configuration-direct.
In one of the embodiments, the method also includes:
The distal end is connected with personal terminal, according to the configuring request that personal terminal issues, sends configuration-direct to roadBy device.
The distal end receives the MQTT connection request and verifies the legal of the router in one of the embodiments,The step of property further include:
Binding state of the router in distal end is examined, router legitimacy is verified according to the MQTT connection request;
When consistent in the router device parameter and remote database in the MQTT connection request, the router conjunctionMethod;
When in the MQTT connection request router device parameter with it is inconsistent in remote database, the router is notIt is legal.
In one of the embodiments, the router device parameter include vendor id, model ID and MAC Address extremelyFew one kind.
In one of the embodiments, the distal end and the router at least one be provided with MQTT client, it is describedMQTT client is to establish MQTT interface channel.
The configuration-direct includes long-range change setting, firmware upgrade and self detects extremely in one of the embodiments,Few one kind.
The daily record data includes the router process state, processor service condition in one of the embodiments,It is at least one that record is changed with setting.
One kind being based on MQTT protocol router tele-control system, comprising:
Router and distal end, the distal end connect database, and the device parameter letter of router is prestored in the databaseBreath, the distal end and the router at least one be provided with MQTT interface channel module;
Information authentication module, for router legitimacy described in the remote authentication;
MQTT channel module, for establishing MQTT interface channel between the router and the distal end and keeping long companyIt connects;
Daily record data module is sent to the distal end by the MQTT interface channel for generating daily record data, describedDistal end receives the daily record data of the router, analyzes the daily record data, produces corresponding configuration according to the daily record dataInstruction sends the configuration-direct to the router by the MQTT interface channel;
Remote configuration module carries out corresponding configuration operation for receiving the distal end configuration-direct.
A kind of computer equipment, including processor and memory, the memory are stored with computer program, the calculatingWhen machine program is executed by the processor, so that the processor executes a kind of call method or a kind of communicating data processing sideMethod.
A kind of computer readable storage medium is stored with computer program, when the computer program is executed by processor,So that the processor executes a kind of call method or a kind of communicating data processing method.
Above-mentioned router long-range control method and system based on MQTT agreement, provide it is a kind of it is simple low cost it is long-rangeAllocation plan is able to solve the problem of Intranet NAT is penetrated, and allows router manufacturer that can sell product to oneself at any time and matchesIt sets and manages and maintains.It can also be used family by mobile phone barcode scanning, establish the long-range control to router, allow user to use more convenient.The present invention improves volume production efficiency: 1.) client can be reused with modularization, 2.) test process can be with machine and machine pairWords, speed faster, 3.) improve the degree of automation, 4.) improve platform security.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, rightThe present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, andIt is not used in the restriction present invention.
As shown in Figure 1, in one embodiment, providing a kind of based on MQTT protocol router tele-control system, packetInclude information authentication module 110, MQTT channel module 120, daily record data module 130 and remote configuration module 140.
Information authentication module 110 is used for remote authentication router legitimacy.Distal end record router sequence number, MAC AddressEtc. information, whether the device parameter information by router in garbled data library consistent with router, and verifying the router isIt is no to be bound with distal end.
When consistent in the router device parameter and remote database in the MQTT connection request, the router conjunctionMethod;
When in the MQTT connection request router device parameter with it is inconsistent in remote database, the router is notIt is legal.
MQTT channel module 120, for establishing MQTT interface channel between the router and the distal end and keeping longConnection, router and distal end pass through MQTT interface channel interaction data.
Daily record data module 130 is sent to the distal end, institute by the MQTT interface channel for generating daily record dataThe daily record data that distal end receives the router is stated, the daily record data is analyzed, is matched accordingly according to daily record data generationInstruction is set, the configuration-direct is sent to the router by the MQTT interface channel.
Remote configuration module 140 carries out corresponding configuration operation for receiving the distal end configuration-direct.
In one embodiment, the daily record data of the distal end receiving router, the daily record data include router intoJourney state, processor service condition and setting change record are at least one.
In one embodiment, the router device parameter includes at least the one of vendor id, model ID and MAC AddressKind.
In one embodiment, the configuration-direct include state acquisition, configuration distributing, push upgrading etc. far calls andOperation.
As shown in Fig. 2, in one embodiment it is proposed that a kind of router long-range control method based on MQTT agreement,This method be applied to router side the following steps are included:
Step 201, start MQTT client, and distally establish MQTT interface channel.
Step 202, MQTT connection request is sent.
Step 203, router legitimacy, after determining that router is legal, far end response MQTT connection request are verified.
Step 204, daily record data is sent.
Step 205, daily record data is analyzed, configuration-direct is generated.
Step 206, the configuration-direct that distal end is sent is received, corresponding configuration operation, feedback configuration are completed according to configuration-directAs a result.
The above method establishes MQTT interface channel between router startup MQTT client and distal end, when the distal end withLegitimate verification is completed between the router, the router uploads daily record data, and the distal end is analyzed on the routerThe daily record data of biography sends configuration-direct to the router.The router completes corresponding configuration operation according to configuration-direct,Feedback configuration result is to the distal end.
As shown in figure 3, in one embodiment it is proposed that a kind of router long-range control method based on MQTT agreement,This method be applied to distal end the following steps are included:
Step 301, MQTT interface channel is established in router and distal end, and is protected by the MQTT interface channel and routerHold long connection.
Step 302, the MQTT connection request that receiving router is sent, verifies the legitimacy of router.
Step 303, if router is legal, MQTT connection request described in the far end response, sending instruction makes routerStart built-in MQTT client.
Step 304, the daily record data of distal end receiving router analyzes the daily record data and generates configuration-direct.
Step 305, distal end sends configuration-direct to router.
The router device parameter includes at least one of vendor id, model ID and router mac address.
The step of verifying router legitimacy further include:
Binding state of the router in distal end is examined, router legitimacy is verified according to the subscription information.
When consistent in the router device parameter and remote database in the MQTT connection request, the router conjunctionMethod;
When in the MQTT connection request router device parameter with it is inconsistent in remote database, the router is notIt is legal.
Router device parameter is prestored in the distal end reading database generates release information, after verifying router is legal,MQTT interface channel, which is established, with router keeps long connection.The daily record data that the distal end receiving router is sent, to the dayWill data are analyzed, and are generated configuration-direct and are sent to router.
As shown in figure 4, in one embodiment it is proposed that a kind of router long-range control method based on MQTT agreement,Method includes the following steps:
Step 401, start built-in MQTT client connection distal end and establish MQTT interface channel, and connected by the MQTTChannel and distal end keep long connection.
Step 402, router sends MQTT connection request to distal end.
Step 403, after determining that router is legal, far end response MQTT connection request.
Step 404, daily record data is sent to distal end, is analyzed the daily record data, is produced according to the daily record data correspondingConfiguration-direct, pass through the MQTT interface channel and send the configuration-direct to the router.
Step 405, configuration-direct is received, router is completed corresponding configuration according to the configuration-direct and operated.
The above method starts and establishes MQTT interface channel between built-in MQTT client connection distal end, and keeps with distal endLong connection sends daily record data to distal end after the success of router legitimate verification.The router sends log number by MQTTAccording to distal end, the configuration-direct of far-end feedback is received, completes to configure according to the configuration-direct.
In conjunction with Fig. 3, Fig. 4, family can be used not need to the router side carry out the router for the methodConfiguration, can by distally carry out it is described remotely connect the router, by being established between the distal end and the routerThe MQTT interface channel carries out Remote configuration.The daily record data that the router uploads is analyzed, configuration-direct is generated and is sent toThe router.The present invention configures router by network remote, saves manpower and time.
As shown in figure 5, in one embodiment it is proposed that a kind of router long-range control method based on MQTT agreement,Method includes the following steps:
Step 501, connection distal end.
Step 502, successful connection.
Step 503, to router configuration management.
Step 504, configuration-direct is sent.
Step 505, according to configuration-direct, corresponding configuration operation is completed.
Step 506, feedback configuration result.
The above method provides personal terminal and remotely connects configuration management of the distal end to the router.It is described remoteEnd receives the information of configuration management, and sending configuration-direct makes the router according to configuration-direct, completes corresponding configuration operation.It is logicalThe method is crossed, user the personal terminal such as mobile phone, plate, computer can be used to carry out Remote configuration router, make configuration of routers moreAdd simple and conveniently.
In another embodiment, the personal terminal can also connect distal end by related platform, be turned by related platformConfiguration of routers management is sent out, and then completes the configuration to router.As long as the related platform can connect distal end, forward personal wholeThe information at end is to distal end.
Fig. 6 is the schematic diagram of internal structure of computer equipment in one embodiment, can be used as distal end and router.Such as Fig. 6Shown, this distally includes processor, memory and the network interface connected by system bus.Wherein, memory may include non-Volatile storage medium and built-in storage.The memory of the computer equipment is stored with operating system, database and computer journeySequence can be stored with corresponding password of sequence number, MAC Address, user name and user name of router etc. in database.The calculatingWhen the execution processed of machine program, processor may make to realize a kind of router long-range control method based on MQTT agreement.The meterThe processor of machine equipment is calculated for providing calculating and control ability, supports the operation of entire computer equipment.The computer equipmentNetwork interface for communicate accordingly with external terminal through internet, such as reception configuration-direct or feedback configuration resultDeng.Computer equipment can be realized with the distant clusters of the either multiple distal end compositions in independent distal end.
Fig. 7 is the schematic diagram of internal structure of computer equipment in another embodiment, be can be used as using personal terminal.Such as figureShown in 7, which includes the processor connected by system bus, memory, network interface, display screen and input dressIt sets.Wherein, memory may include non-volatile memory medium and built-in storage.It can be stored with operating system in memory, also depositA kind of computer program is contained, which is used for the router long-range control method based on MQTT agreement.The processorFor providing calculating and control ability, the operation of entire computer equipment is supported.Built-in storage is in non-volatile memory mediumComputer program operation provide environment.Network interface is attached for accessing internet with distal end, is such as received configuration and is referred toOrder and feedback configuration result etc.;It is also used to connect internet.The display screen of computer equipment can be liquid crystal display or electricitySub- ink display screen etc., input unit can be the touch layer covered on display screen, be also possible to set on computer equipment shellKey, trace ball or the Trackpad set, are also possible to external keyboard, Trackpad or mouse etc..The computer equipment can beMobile phone, notebook, tablet computer or wearable device etc..
It will be understood by those skilled in the art that structure shown in Fig. 6 and Fig. 7, only relevant to application schemeThe block diagram of part-structure does not constitute the restriction for the computer equipment being applied thereon to application scheme, specific to calculateMachine equipment may include perhaps combining certain components or with different components than more or fewer components as shown in the figureArrangement.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be withRelevant hardware is instructed to complete by computer program, which can be stored in a computer-readable storage and be situated betweenIn matter, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, storage medium above-mentioned can beThe non-volatile memory mediums such as magnetic disk, CD, read-only memory (Read-Only Memory, ROM) or random storage noteRecall body (Random Access Memory, RAM) etc..
Above-mentioned router long-range control method and system based on MQTT agreement, provide it is a kind of it is simple low cost it is long-rangeAllocation plan is able to solve the problem of Intranet NAT is penetrated, and allows router manufacturer that can sell product to oneself at any time and matchesIt sets and manages and maintains.It can also be used family by mobile phone barcode scanning, establish the long-range control to router, allow user to use more convenient.The present invention improves volume production efficiency: 1.) client can be reused with modularization, 2.) test process can be with machine and machine pairWords, speed faster, 3.) improve the degree of automation, 4.) improve platform security.
Each technical characteristic of embodiment described above can be combined arbitrarily, for simplicity of description, not to above-mentioned realityIt applies all possible combination of each technical characteristic in example to be all described, as long as however, the combination of these technical characteristics is not depositedIn contradiction, all should be considered as described in this specification.
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneouslyIt cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the artIt says, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to protection of the inventionRange.Therefore, the scope of protection of the patent of the invention shall be subject to the appended claims.