Summary of the invention
Based on the deficiencies in the prior art, the invention provides a kind of system that carries out Communication Control at terminal room, comprise control terminal and controlled terminal, it is characterized in that:
Described control terminal comprises as lower module:
Control module is used for realizing that the communication for terminal room provides WebSocket to serve and generates and transmit control signal based on the WebSocket agreement;
Control supplementary module, be used for judging whether control terminal can access public internet, in the situation that can access public internet by the signal receiving module on the described control module of public internet bridge joint and controlled terminal;
Described controlled terminal comprises:
Signal receiving module is used for keeping the long control signal that is connected and receives the control module transmission to supply the application program to be converted to its required signal by WebSocket client and control module.
Further, according to the system that carries out Communication Control at terminal room of the present invention, it is characterized in that can be by in the interconnective situation of public internet at described control terminal and controlled terminal, described control supplementary module receives the log-on message of control module, and available control module information is returned to signal receiving module at signal receiving module during by the list of public internet access request control module, set up WebSocket between assist signal receiver module and control module and be connected.
Further, according to the system that carries out Communication Control at terminal room of the present invention, described log-on message is LAN IP address information or the public internet net IP address information of described control module current device.
Further, according to the system that carries out Communication Control at terminal room of the present invention, it is characterized in that to access public internet at described control supplementary module judgement control terminal, and when control terminal and controlled terminal are in same local area network (LAN), the described control module LAN IP address that it is corresponding is converted to shorter character code by reversible algorithm, and be shown on the control terminal interface, set up WebSocket with described control module be connected after the described character code of input on the signal receiving module of controlled terminal by the user is manual.
Further, according to the system that carries out Communication Control at terminal room of the present invention, it is characterized in that described control module comprises:
Control interface module, be used for providing and control the interface, and the touch information at interface is converted into control signal;
Service module function is used for monitoring and the data interaction service for the communication of terminal room provides based on the WebSocket agreement;
The IP modular converter is used in the situation that current terminal equipment can't be converted to shorter character string display to controlling the interface by the reversible algorithm LAN IP information that current terminal equipment is corresponding by public internet.
Further, according to the system that carries out Communication Control at terminal room of the present invention, but it is characterized in that described control interface module is touch-control interface module or the interface module that can control according to gravity sensing.
Further, according to the system that carries out Communication Control at terminal room of the present invention, but the control interface that it is characterized in that described touch-control interface module is game paddle interface or TV remote controller interface.
In addition, the present invention also provides a kind of method of carrying out Communication Control at terminal room, is applied in control terminal and is connected with controlled terminal and connects under the environment of public internet, it is characterized in that comprising the steps:
The control module of step 1, startup control terminal is obtained public internet IP address information or the LAN IP address information of current control terminal, and this information registering is arrived control supplementary module by control module;
The controlled application at step 2, enabling signal receiver module place, by signal receiving module by public internet access control supplementary module and obtain available control module information list;
Step 3, signal receiving module output to controlled interface with the control module information list that second step gets, and select required control module by the user;
The WebSocket address of service of step 4, the signal receiving module control module that selective extraction is arrived according to step 3, and control module is set up the WebSocket connection;
Step 5, signal receiving module receive the control signal that control module sends over, and according to the setting of controlled application, control signal are converted to required signal with the form control controlled application of event.
In addition, the present invention also provides a kind of method of carrying out Communication Control at terminal room, is applied under the environment that control terminal and controlled terminal be in same local area network (LAN), it is characterized in that comprising the steps:
Step 1, the control module of control terminal of starting are obtained the LAN IP address information of current control terminal and this information exchange are crossed reversible algorithm by control module and be encoded on the control interface that identifying code is presented at control module;
The controlled application at step 2, enabling signal receiver module place, the prompting user inputs the identifying code that described control module produces;
Step 3, signal receiving module are decoded as the WebSocket address of service of control module with the identifying code of input, and set up WebSocket with control module and be connected;
Step 4, signal receiving module receive the control signal that control module sends over, and according to the setting of controlled application, control signal are converted to required signal with the form control controlled application of event.
Of the present invention based on the system and method for WebSocket standard agreement in the terminal room Communication Control, realized need not the cross-terminal Communication Control of data wire, make application developer can develop fast based on the mutual application in multiple terminals; Simultaneously, user's (cross-terminal use end user) can in the situation that do not buy new extras, utilize existing equipment and general interaction protocol to use the cross-terminal class to use.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage are become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
Fig. 1 is that the present invention is at the structural representation of terminal room communication control system; As shown in Figure 1, the system that carries out Communication Control at terminal room of the present invention comprises control terminal and controlled terminal, it is characterized in that:
Described control terminal comprises as lower module:
Control module is used for realizing that the communication for terminal room provides WebSocket to serve and generates and transmit control signal based on the WebSocket agreement; This control module comprises the control interface module, is used for providing controlling the interface, and the touch information at interface is converted into control signal; Service module function is used for monitoring and the data interaction service for the communication of terminal room provides based on the WebSocket agreement; The IP modular converter is used for being converted to shorter character string display to controlling the interface in the situation that current terminal equipment can't be accessed public internet by the reversible algorithm LAN IP information that current terminal equipment is corresponding.Described control interface module is the interface module (as touch-control, gravity sensing, accelerometer, light sensation, temperature sense etc.) that depends on the terminal equipment input form.But the control interface of described touch-control interface module is for example game paddle interface or TV remote controller interface.
Control supplementary module, be used for judging whether control terminal can access public internet, in the situation that can access public internet by the signal receiving module on the described control module of public internet bridge joint and controlled terminal; This module is the service module that can access at any time that is deployed in public internet.Play the effect of a bridge joint, be responsible for preserving spendable control terminal information and these information are offered corresponding signal receiving module.This module is in the situation that can connect public internet available (can simplify the connection procedure between control module and signal receiving module), in the situation that disconnected public internet can use manual mode to substitute.
Described controlled terminal comprises:
Signal receiving module is used for keeping the long control signal that is connected and receives the control module transmission to supply the application program to be converted to its required signal by WebSocket client and control module.
Described control terminal and controlled terminal can be by in the interconnective situations of public internet, described control supplementary module receives the log-on message of control module, described log-on message is LAN IP address information or the public internet net IP address information of described control module current device, and available control module information is returned to signal receiving module at signal receiving module during by the list of public internet access request control module, set up WebSocket between assist signal receiver module and control module and be connected.
Can not access public internet at described control supplementary module judgement control terminal, and when being in same local area network (LAN), control terminal and controlled terminal (only have Intranet WIFI to use), the described control module LAN IP address that it is corresponding is converted to shorter character code by reversible algorithm, and be shown on the control terminal interface, set up WebSocket with described control module be connected after the described character code of input on the signal receiving module of controlled terminal by the user is manual.
Be connected with controlled terminal at control terminal and connect under the environment of public internet, method implementation of carrying out Communication Control at terminal room of the present invention is as shown in Fig. 2 sequential chart, and its handling process comprises the steps:
The control module of step 1, startup control terminal is obtained public internet IP address information or the LAN IP address information of current control terminal, and this information registering is arrived control supplementary module by control module;
The controlled application at step 2, enabling signal receiver module place, by signal receiving module by public internet access control supplementary module and obtain available control module information list;
According to controlling connections of shaking hands of the defined interaction flow of interaction protocol, the prompting control module is carried out " confirming to move " to corresponding all controller terminals of control module information list that step 3, signal receiving module get second step on application interface simultaneously one by one.(this step can in the situation that have a plurality of control modules all to start accurately connect with application);
Confirming currently to be connected to effective connection, and other is connected to invalid connection, all disconnects, and so far formally connects with control module according to the information input signal specific of step 3 for step 4, control module;
Step 5, signal receiving module receive the control signal that control module sends over, and after filtering through signal, according to the setting of controlled application, control signal are converted to required signal with the form control controlled application of event.
Be under the environment of same local area network (LAN) (only having Intranet WIFI to use) at control terminal and controlled terminal, method implementation of carrying out Communication Control at terminal room of the present invention is as shown in Fig. 3 sequential chart, and its handling process comprises the steps:
Step 1, the control module of control terminal of starting are obtained the LAN IP address information of current control terminal and this information exchange are crossed reversible algorithm by control module and be encoded on the control interface that shorter identifying code (character string) is presented at control module;
The controlled application at step 2, enabling signal receiver module place, the prompting user inputs the identifying code that described control module produces;
Step 3, signal receiving module are decoded as the WebSocket address of service of control module with the identifying code of input, and set up WebSocket with control module and be connected;
Step 4, signal receiving module receive the control signal that control module sends over, and after filtering through signal, according to the setting of controlled application, control signal are converted to required signal with the form control controlled application of event.
Of the present invention based on the system and method for WebSocket standard agreement in the terminal room Communication Control, realized need not the cross-terminal Communication Control of data wire, make application developer can develop fast based on the mutual application in multiple terminals; Simultaneously, user's (cross-terminal use end user) can in the situation that do not buy new extras, utilize existing equipment and general interaction protocol to use the cross-terminal class to use.
After the operation under above-mentioned two kinds of networking patterns and non-networking pattern is completed, namely set up being connected between control module and signal receiving module, the signal of all control modules all can send to signal receiving module with the situation of appointing.After signal receiving module receives signal, can be according to the needs of concrete application, any mode by receiver module place environment support is converted into the required signal of application module with signal.Be exemplified below, play an application of PPT demonstration by webpage, under normal circumstances, can control (as upper and lower, left and right, carriage return etc.) by some buttons of keyboard when it is play; And in the situation that controller module of the present invention is arranged, after its receiver module receives the signal that control module sends over, can be the button such as upper and lower, left and right, carriage return of KeyEvent with its corresponding conversion.Namely do not completed in the situation that do not revise original logic of " PPT demonstration " this application the docking of controlling like this.In addition, the signal that the signal that signal receiving module receives and controller send is consistent, and application program can according to the needs of oneself, be selected be converted to corresponding KeyEvent or directly dock with application logic.Completing the related main api interface function of terminal room Communication Control of the present invention illustrates as follows:
One: add () interface,
Interface specification: terminal control unit information registering
URL:ws://192.168.0.137:4128/remote/nodeService
The false code form is as follows: function void add () { }
Field information:
Example is as follows:
Register machine is abnormal: show current terminal i p.
Two: find () interface
Interface specification: receiver retrieval register list
URL:ws://192.168.0.137:4128/remote/nodeService
Support form: JSON,
Field information:
Return results: [{ " name ": " 192.168.0.137/ ", " uri ": " ws: // 192.168.0.137/ " }]
Explanation of field
Return value field field type explanation of field
Name String node title
uri String node URL
Two: request connects
Illustrate: the receiver request connects controller, new WwbSocket (url);
Receiver is monitored the onmessage event, obtains message:MessageEvent.data
Example:
{″enable″:1,″code″:1}
Explanation of field
Return value field explanation of field
Enable allows to connect
The disable rejection connects
The code identifying code
Three: receiver is confirmed the controller of matching connection:
Receiver sends message: message
Return value field field type explanation of field
Message String " connection ": successful connection, normal communication, " close ": disconnect unsuccessful other connections of checking,
Four: disconnect
Receiver is monitored the onclose event, and prompting user websocket disconnects
Receiver is monitored the onclose event, changes user ui interface,
The present invention carries out the system of Communication Control at terminal room, applicable to controlling interconnected plurality of application scenes between various terminals and terminal.So just make the characteristic structure of each Terminal Type of performance become possibility based on the application that the multiple terminals cooperates, now be exemplified below:
Mobile device is controlled the PC class and is used
Under the HTML5 standard, browser provides the WebSocket function, so the method for the invention can be implemented based on the browser of supporting HTML5.This class is used can bring into play the mobile phone conveniently moving, and the PC device screen is large and the strong characteristic of operational capability, sets up the cooperation class and uses.For example: mobile phone or dull and stereotyped use as control terminal, and be arranged on web game on PC as the controlled application of controlled terminal, by with mobile phone or dull and stereotypedly control based on the Keyboard Control class web game on browser as game paddle.
PC controls the mobile device class and uses
By means of the Web technology, can realize a Web-based application, the management function to cell phone apparatus is provided.For example, open a Web page and use, can provide interface management cell phone address book easily, the mobile phone file; Can be in webpage input and editing short message and send by mobile phone; Can be at the multi-medium data (as picture, music etc.) of opening in webpage on mobile phone.In the case, PC is as control terminal, and mobile phone can be used as controlled terminal, carries out Communication Control by the WebSocket agreement between the two.
Between many mobile devices, the cooperation class is used
Can based on the method, build based on (need not to connect public internet) of local area network (LAN) interconnected multiple terminals cooperation class and use.As, based on many people chess/card game of local area network (LAN).At this moment, between mobile device mutually as control terminal and controlled terminal.
Mobile device is controlled internet television
Can based on the method, build the remote controller of controlling internet television.Also can be used as simultaneously the game paddle of the game on line that internet television provides.At this moment, mobile device, as control terminal, and television set is as controlled terminal.
Mobile device is controlled the traditional game machine
Can be based on the method, gravity sensing device by mobile device, game machine is being done in certain improved situation, be used as a gravity sensing handle and control game (the WII joystick that is equivalent to a Nintendo Co.), at this moment, mobile device is as control terminal, and game machine is as controlled terminal.
Should be noted that at last: above embodiment is only in order to illustrate that technical scheme of the present invention is not intended to limit; Although with reference to preferred embodiment, the present invention is had been described in detail, those of ordinary skill in the field are to be understood that: still can modify or the part technical characterictic is equal to replacement the specific embodiment of the present invention; And not breaking away from the spirit of technical solution of the present invention, it all should be encompassed in the middle of the technical scheme scope that the present invention asks for protection.