Realize the method for short-wave radio set full-function remote-control
One, technical field
The present invention relates to a kind of technology and implementation method of radio communication, can realize the full-function remote-control of short-wave radio set after employing the method.
Two, background technology
In the actual use to short-wave radio set, often need to use remote control equipment, remote control radio with requiring the energy global function.Usual way is the Functional Design one cover remote control agreement that will realize according to the radio station, realizes that in radio station and remote control equipment the remote control agreement completes distant control function.If the function in radio station changes to some extent, the remote control agreement will change, and the software in radio station and remote control equipment will change, and bring great inconvenience to the designer.
Three, summary of the invention
The present invention seeks to: provide a kind of technology and implementation method of radio communication, make and to realize the full-function remote-control of short-wave radio set after adopting the method, and be not subjected to the impact of short-wave radio set Functional change.
Technical scheme of the present invention is as follows:
At first a kind of method that realizes the short-wave radio set full-function remote-control, is designed to the guidance panel of remote control equipment and the guidance panel in radio station identical; Then, remote control equipment is issued the radio station with the key assignments that the operator presses by serial ports, and the radio station receives that being defined as the operator after this key assignments presses this key on the guidance panel in radio station; At last, issue remote control equipment by serial ports after the operation interface in radio station refreshes, refresh demonstration after remote control equipment is received;
For the remote control equipment end:
1) detect whether receive the serial ports refresh command; If receive, refresh demonstration, if do not receive, change step 2 over to);
2) judge whether to detect actuation of keys; If actuation of keys do not detected, return to step 1), if actuation of keys detected, change step 3) over to;
3) key assignments with the corresponding button of the actuation of keys that detects sends to the radio station;
For the interface end corresponding with remote control equipment in the radio station:
Whether 1) detect the radio station operation interface changes; If change, current interface is sent to remote control equipment by serial ports, if do not change, change step 2 over to);
2) judge whether to receive key assignments from serial ports; If do not receive, return to step 1), if receive, change step 3) over to;
3) treatment step 2) in the key assignments received.
The interface end corresponding with remote control equipment in described radio station and the communication protocol of remote control equipment end are as follows:
This communication protocol adopts character-oriented SLIP agreement, and it defines one group of character, with the data assembling framing, is implemented as follows:
The SLIP protocol definition 4 characters, that is:
End character: C0
ESC: DB
End alternatives: DC
Escape alternatives: DD
Head and the tail at each Frame respectively add an end character C0, are packaged into the SLIP frame;
At transmit leg, in the Frame of transmission, the data identical with end character C0 add alternatives with ESC DBDC and replace, and the data identical with ESC DB replace with ESC DBDD;
The take over party, the SLIP agreement is done opposite alternative work to the data in frame, is about to DBDC and becomes C0, and DBDD is become DB;
The data frame format of pressing the SLIP formal definition is as shown in table 1,
Table 1: data frame format
CRC0 and CRC1 are check bit.
The production method of described check bit is: the data after escape by the simple exclusive or check of byte, is obtained 1 byte, get the high 4bit of this byte as the low 4bit of first byte of verification, a high position fills out 0; Get the low 4bit of this byte as the low 4bit of second byte of verification, a high position fills out 0.
Beneficial effect of the present invention is: provide a kind of technology and implementation method of radio communication, make and can realize the full-function remote-control of short-wave radio set after adopting the method, and be not subjected to the impact of short-wave radio set Functional change.
Four, description of drawings
Fig. 1 is the software flow schematic diagram of remote control equipment;
Fig. 2 is in the radio station and the software flow schematic diagram of remote control equipment interface.
Five, embodiment
At first a kind of method that realizes the short-wave radio set full-function remote-control, is designed to the guidance panel of remote control equipment and the guidance panel in radio station identical; Then, remote control equipment is issued the radio station with the key assignments that the operator presses by serial ports, and the radio station receives that being defined as the operator after this key assignments presses this key on the guidance panel in radio station; At last, issue remote control equipment by serial ports after the operation interface in radio station refreshes, refresh demonstration after remote control equipment is received;
For the remote control equipment end:
1) detect whether receive the serial ports refresh command; If receive, refresh demonstration, if do not receive, change step 2 over to);
2) judge whether to detect actuation of keys; If actuation of keys do not detected, return to step 1), if actuation of keys detected, change step 3) over to;
3) key assignments with the corresponding button of the actuation of keys that detects sends to the radio station;
For the interface end corresponding with remote control equipment in the radio station:
Whether 1) detect the radio station operation interface changes; If change, current interface is sent to remote control equipment by serial ports, if do not change, change step 2 over to);
2) judge whether to receive key assignments from serial ports; If do not receive, return to step 1), if receive, change step 3) over to;
3) treatment step 2) in the key assignments received.
Communication protocol
Communication protocol between injecting program and radio station adopts character-oriented SLIP agreement, and its major function is one group of character of definition, with the data assembling framing.Be implemented as follows:
The SLIP protocol definition 4 characters, that is:
End character: C0
ESC: DB
End alternatives: DC
Escape alternatives: DD
Head and the tail at each Frame respectively add an end character (C0), are packaged into the SLIP frame.
In the Frame that sends, the data identical with end character (C0) add alternatives with ESC (DBDC) and replace, and the data identical with ESC (DB) replace with ESC (DBDD).
The take over party, the SLIP agreement is done opposite alternative work to the data in frame, is about to " DBDC " and becomes " C0 ", and " DBDD " become " DB "
The data frame format of pressing the SLIP formal definition is as shown in table 1.
Table 1: data frame format
CRC0 and CRC1 are check bit, and check bit is produced by following method.
The data after escape by the simple exclusive or check of byte, is obtained 1 byte, get the high 4bit of this byte, as the low 4bit of first byte of verification, a high position fills out 0; Get the low 4bit of this byte, as the low 4bit of second byte of verification, a high position fills out 0.
Concrete methods of realizing
The ID that defines in the present invention the radio station is ID
The radio station, the ID of remote control equipment is ID
Remote controlThe frame control word is that FrameCtrl passes the key assignments order, is designated IDkey, is designated IDdisp, shows that refresh command is as follows.
Pass the key assignments order: C0 A0 frame length ID
The radio station, ID
Remote control, FrameCtrl IDkey key assignments CRC0 CRC1 C0
Show refresh command: C0 A0 frame length, ID
Remote controlID
The radio station, FrameCtrl IDdisp shows data CRC0 CRC1 C0
After button on remote control equipment is pressed, transmit the key assignments order to the radio station from serial ports, key value is taken out in the radio station after serial ports is received this order, carry out the keystroke handling program.Send from serial ports after the interface, radio station changes to show refresh command to remote control equipment, remote control equipment refreshes demonstration after serial ports is received this order, keep consistent with the demonstration in radio station.Can realize the full-function remote-control of short-wave radio set after adopting the method, as long as pass the key assignments order and show that refresh command is constant, not be subjected to the impact of short-wave radio set Functional change.