Summary of the invention
The invention provides the method for Long-distance Control lan device and client, service end, to realize Long-distance Control lan device.
Technical scheme of the present invention is achieved in that
A method for Long-distance Control lan device, the communication protocol of having made an appointment of the service end in client and remote lan, or, being pre-definedly used on the communication protocol that client is communicated by letter with service end, the method comprises:
In the time that client is wanted Long-distance Control one lan device, according to predefined communication protocol, control command is packaged into and controls message or control documents, send and control message or control documents to remote service end by network;
Service end receives this control message or control documents, resolves this message or file according to predefined communication protocol, parses lan device mark and the Control the content that will control from message or file;
Service end sends control command by interconnected agreement to the lan device that will control.
Described service end further comprises after the lan device that will control sends control command by interconnected agreement:
Service end is returned to control response message to client.
Described control message is Short Message Service SMS information or voice, and described control documents is Email or instant communication file.
Described client is mobile terminal or personal computer PC, and described service end is mobile terminal, PC or TV.
After described service end is resolved this message or file according to predefined communication protocol, parse the lan device mark that will control and Control the content from message or file before, further comprise: service end is according to predefined communication protocol, judge that whether this message or file be legal, if so, carry out and described from message or file, parse that the lan device that will control identifies and the action of Control the content; Otherwise, directly abandon this message or file;
Or, further comprise: service end is carried out authentication according to default authentication information to this message or file, if authentication is passed through, carry out described from message or file, parsing that the lan device that will control identifies and the action of Control the content; Otherwise, directly abandon this message or file.
A kind of client, comprising:
Package module: in the time wanting Long-distance Control one lan device, according to predefined communication protocol, control command is packaged into and controls message or control documents, control message or control documents are sent to transceiver module;
Transceiver module: send and control message or control documents to remote service end by network.
Described client is mobile terminal, or personal computer PC.
A kind of service end, comprising:
Transceiver module: receive control message or control documents that client is sent, this message or file are sent to parsing module;
Parsing module: receive control message or control documents that transceiver module is sent, resolve this message or file according to predefined communication protocol, from message or file, parse lan device mark and the Control the content that will control, this lan device mark and Control the content are sent to control module;
Control module: receive lan device mark and Control the content that parsing module is sent, according to interconnected agreement, send control command to corresponding lan device.
Described parsing module is further used for, in the time receiving control message that transceiver module sends or control documents, according to predefined communication protocol judge this message or file whether legal, if legal, carry out and described from message or file, parse that the lan device that will control identifies and the action of Control the content, otherwise, directly abandon this message or file; Or, according to default authentication information, this message or file are carried out to authentication, if authentication is passed through, carry out described from message or file, parsing that the lan device that will control identifies and the action of Control the content, otherwise, directly abandon this message or file.
Described service end is mobile terminal, personal computer PC or TV.
Compared with prior art, the present invention has realized the Long-distance Control of local area network equipment.
Embodiment
Below in conjunction with drawings and the specific embodiments, the present invention is further described in more detail.
The method flow diagram of the Long-distance Control lan device that Fig. 1 provides for the embodiment of the present invention, as shown in Figure 1, its concrete steps are as follows:
Step 100: the communication protocol of having made an appointment of the service end in client and remote lan, or, be pre-definedly used on the communication protocol that client is communicated by letter with service end.
Fig. 2 has provided the networking diagram of the remote control of domestic equipment that the embodiment of the present invention provides, as shown in Figure 2, between client and remote service end, be connected by communication network or internet etc., service end and each household equipment are in same local area network (LAN), and household equipment is as TV, refrigerator, washing machine, microwave oven, electric heater etc.
Step 101: definite Long-distance Control one lan device of wanting of client, according to predefined communication protocol, control command is packaged into and controls message or control documents, send this control message or control documents by network to remote service end.
Controlling message can be the forms such as Short Message Service (SMS, Short Message Service) information or voice, and control documents can be Email, instant communication file etc.
The message type field of controlling in message can represent that this message is the message of Long-distance Control lan device, and for example, message type field value is 0 to be expressed as common message, and value is 1 to be expressed as the message of Long-distance Control lan device.
The object terminal iidentification of controlling in message is: service end mark, and control object is: the lan device mark that control, carry Control the content simultaneously.
Control the content can be: open, close, by temperature adjust to a degree, under temperature b, move n minute, inform this lan device current running status, inform the normal range of operation of a certain parameter of this lan device etc., a, b, n are integer.
For control documents, can adopt: by whole the content of the above-mentioned control message file of putting into.
Client can be mobile terminal as: mobile phone, panel computer etc. can be also personal computers (PC, Personal Computer) etc., and service end can be mobile terminal, PC or TV etc.
For example: the form of controlling message can be as follows:
MsgType?ActionID?ObjectID?CtrlPara1?CtrlPara2…CtrlParaN?Retcode
Wherein, MsgType represents type of message, as: value is 0 expression common message, and value is the message of 1 expression Long-distance Control lan device;
ActionID represents control command, as: open, close etc.;
ObjectID represents the lan device ID controlling;
CtrlPara1 ... CtrlParaN represents the control parameter of attaching, as: temperature parameter, humidity parameter etc.
Step 102: service end receives this control message or control documents, resolves this message or file, finds that this message or file are message or the file of Long-distance Control lan device, obtains lan device mark and the Control the content that will control from message or file.
Service end, receiving after control message, can learn that message is the message of common message or Long-distance Control lan device according to the value of the message type field of message.
After service end finds that message or file are the message or file of Long-distance Control lan device, can first judge that whether this message or file be legal, for example: whether the form that judges this message or file meets predetermined communications protocol format, if, it is legal to determine, continues subsequent action; Otherwise, determine illegally, directly abandon this message or file.
Service end also can first be carried out authentication to this message or file after finding that message or file are the message or file of Long-distance Control lan device, for example: judge the whether safety of source of this message or file, if so, determine that authentication passes through, continue subsequent action; Otherwise, determine failed authentication, directly abandon this message or file.Wherein, service end can be preserved client-side information in advance, controls after message or control documents when receiving, and the client-side information in message or file is mated with the client-side information of preservation, if match, definite authentication is passed through.
Step 103: service end sends control command by interconnected agreement to the lan device that will control.
Between service end and lan device, can realize interconnected by UPNP, DLNA agreement etc.
Service end can also be returned to control response message or control response file to client, to inform client control result: the normal range of operation of success or failure, running status, parameter etc.
Below provide an application example of the present invention:
Running client software in mobile terminal A, in the time wanting Remote Open water heater, according to default format editing formation control order: open water heater, and send with the form of SMS message, SMS message arrives mobile terminal C through carrier network B, and C analyzes after receiving short message, and discovery is the control command to household equipment: open water heater, send and open order to water heater by DLNA agreement, and return to response message with the form of short message to A.
The composition schematic diagram of the client that Fig. 3 provides for the embodiment of the present invention, as shown in Figure 3, it mainly comprises: package module 31 and transceiver module 32, wherein:
Package module 31: in the time wanting Long-distance Control one lan device, according to predefined communication protocol, control command is packaged into and controls message or control documents, control message or control documents are sent to transceiver module 32.
Transceiver module 32: receive control message or control documents that package module 31 is sent, send this control message or control documents by network to remote service end.
In actual applications, client also can further comprise: parsing module, receive control response message or control response file that transceiver module 32 is sent, and resolve this message or file according to predefined communication protocol, message content or file content are shown to user.And transceiver module 32 is further used for, receive control response message or control response file that service end is returned, this message or file are sent to parsing module.
Parsing module also can be further used for, in the time receiving control response message that transceiver module 32 sends or control response file, according to predefined communication protocol judge this message or file whether legal, if legal, carry out the action that message content or file content is shown to user, otherwise, directly abandon this message or file; Or, according to default authentication information, this message or file are carried out to authentication, if authentication is passed through, carry out the action that message content or file content is shown to user, otherwise, directly abandon this message or file.
The composition schematic diagram of the service end that Fig. 4 provides for the embodiment of the present invention, as shown in Figure 4, it mainly comprises: transceiver module 41, parsing module 42 and control module 43, wherein:
Transceiver module 41: receive control message or control documents that client is sent, this message or file are sent to parsing module 42.
Parsing module 42: receive control message or control documents that transceiver module 41 is sent, resolve this message or file according to predefined communication protocol, from message or file, parse lan device mark and the Control the content that will control, this lan device mark and Control the content are sent to control module 43.
Parsing module 42 is further used for, in the time receiving control message that transceiver module sends or control documents, according to predefined communication protocol judge this message or file whether legal, if legal, carry out and described from message or file, parse that the lan device that will control identifies and the action of Control the content, otherwise, directly abandon this message or file; Or, according to default authentication information, this message or file are carried out to authentication, if authentication is passed through, carry out described from message or file, parsing that the lan device that will control identifies and the action of Control the content, otherwise, directly abandon this message or file.
Control module 43: receive lan device mark and Control the content that parsing module 42 is sent, according to interconnected agreement, send control command to corresponding lan device.
In actual applications, service end also can further comprise: package module, for the control result that control module 43 is sent, be packaged into control response message or control response file according to default communication protocol, and this message or file are sent to client.And control module 43 is further used for, control result is sent to package module.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, be equal to replacement, improvement etc., within all should being included in the scope of protection of the invention.