Realize the method for full-function remote control of short-wave radio station
One, technical field
The present invention relates to a kind of technology and implementation method of radio communication, the full-function remote-control of short-wave radio set after adopting the method, can be realized.
Two, background technology
To in the actual use of short-wave radio set, often need to use remote control equipment, requiring can global function ground remote control radio.Usual way is a set of Remoting Protocol of Functional Design that will realize according to radio station, realizes Remoting Protocol to complete distant control function in radio station and remote control equipment.If the function in radio station changes to some extent, Remoting Protocol will change, and the software in radio station and remote control equipment will change, and bring great inconvenience to designer.
Three, summary of the invention
The present invention seeks to: the technology and the implementation method that provide a kind of radio communication, the full-function remote-control of short-wave radio set after making to adopt the method, can be realized, and not by the impact that short-wave radio set function changes.
Technical scheme of the present invention is as follows:
Realize a method for full-function remote control of short-wave radio station, first, the guidance panel of remote control equipment is designed to identical with the guidance panel in radio station; Then, the key assignments that operator presses by remote control equipment issues radio station by serial ports, and radio station is then defined as operator and presses this key on the guidance panel in radio station after receiving this key assignments; Finally, issue remote control equipment by serial ports after the operation interface refreshing in radio station, remote control equipment receives rear refreshing display;
For remote control equipment end:
1) detect whether receive serial ports refresh command; If received, then refresh display, if do not received, then proceed to step 2);
2) judge whether actuation of keys to be detected; If actuation of keys do not detected, then return step 1), if actuation of keys detected, then proceed to step 3);
3) key assignments of corresponding for the actuation of keys detected button is sent to radio station;
The interface end corresponding with remote control equipment in radio station:
1) detect radio station operation interface whether to change; If changed, then current interface is sent to remote control equipment by serial ports, if do not changed, then proceed to step 2);
2) judge whether to receive the key assignments from serial ports; If do not received, then return step 1), if received, then proceed to step 3);
3) treatment step 2) in the key assignments that receives.
The interface end corresponding with remote control equipment in described radio station and the communication protocol of remote control equipment end as follows:
This communication protocol adopts character-oriented SLIP agreement, and it defines one group of character, by data assembling framing, is implemented as follows:
SLIP agreement defines 4 characters, that is:
End character: C0
ESC: DB
End alternatives: DC
Escape alternatives: DD
Respectively add an end character C0 at the head and the tail of each Frame, be packaged into SLIP frame;
At transmit leg, in the Frame of transmission, the data ESC DBDC identical with end character C0 adds alternatives and replaces, and the data ESC DBDD identical with ESC DB replaces;
Take over party, SLIP agreement does contrary alternative work to the data in frame, becomes C0, DBDD is become DB by DBDC;
It is as shown in table 1 by the data frame format of SLIP form definition,
Table 1: data frame format
CRC0 and CRC1 is check bit.
The production method of described check bit is: to the data acquisition after escape with by the simple exclusive or check of byte, obtain 1 byte, and get the low 4bit of high 4bit as the first character joint of verification of this byte, a high position fills out 0; Get the low 4bit of low 4bit as second byte of verification of this byte, a high position fills out 0.
Beneficial effect of the present invention is: the technology and the implementation method that provide a kind of radio communication, can realize the full-function remote-control of short-wave radio set after making to adopt the method, and not by the impact that short-wave radio set function changes.
Four, accompanying drawing explanation
Fig. 1 is the software flow schematic diagram of remote control equipment;
Fig. 2 is in radio station and the software flow schematic diagram of remote control equipment interface.
Five, embodiment
Realize a method for full-function remote control of short-wave radio station, first, the guidance panel of remote control equipment is designed to identical with the guidance panel in radio station; Then, the key assignments that operator presses by remote control equipment issues radio station by serial ports, and radio station is then defined as operator and presses this key on the guidance panel in radio station after receiving this key assignments; Finally, issue remote control equipment by serial ports after the operation interface refreshing in radio station, remote control equipment receives rear refreshing display;
For remote control equipment end:
1) detect whether receive serial ports refresh command; If received, then refresh display, if do not received, then proceed to step 2);
2) judge whether actuation of keys to be detected; If actuation of keys do not detected, then return step 1), if actuation of keys detected, then proceed to step 3);
3) key assignments of corresponding for the actuation of keys detected button is sent to radio station;
The interface end corresponding with remote control equipment in radio station:
1) detect radio station operation interface whether to change; If changed, then current interface is sent to remote control equipment by serial ports, if do not changed, then proceed to step 2);
2) judge whether to receive the key assignments from serial ports; If do not received, then return step 1), if received, then proceed to step 3);
3) treatment step 2) in the key assignments that receives.
Communication protocol
Communication protocol between injecting program and radio station adopts character-oriented SLIP agreement, and its major function is definition one group of character, by data assembling framing.Be implemented as follows:
SLIP agreement defines 4 characters, that is:
End character: C0
ESC: DB
End alternatives: DC
Escape alternatives: DD
Respectively add end character (C0) at the head and the tail of each Frame, be packaged into SLIP frame.
In the Frame sent, the data ESC (DBDC) identical with end character (C0) adds alternatives and replaces, and the data ESC (DBDD) identical with ESC (DB) replaces.
Take over party, SLIP agreement does contrary alternative work to the data in frame, is about to " DBDC " and becomes " C0 ", " DBDD " become " DB "
As shown in table 1 by the data frame format of SLIP form definition.
Table 1: data frame format
CRC0 and CRC1 is check bit, and check bit is produced by method below.
To the data acquisition after escape with by the simple exclusive or check of byte, obtain 1 byte, get the high 4bit of this byte, as the low 4bit of the first character joint 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 defining radio station is in the present invention ID
radio station, the ID of remote control equipment is ID
remote control.Frame control word is FrameCtrl, is designated IDkey, is designated IDdisp, passes key assignments order, and display refresh command is as follows.
Pass key assignments order: C0A0 frame length ID
radio station, ID
remote control, FrameCtrl IDkey key assignments CRC0CRC1C0
Display refresh command: C0A0 frame length, ID
remote controliD
radio station, FrameCtrl IDdisp shows data CRC0CRC1C0
After button on remote control equipment is pressed, transmit key assignments order to radio station from serial ports, key value is taken out in radio station after serial ports receives this order, performs keystroke handling program.Send display refresh command to remote control equipment from serial ports after the change of interface, radio station, remote control equipment refreshes display after serial ports receives this order, keeps consistent with the display in radio station.The full-function remote-control of short-wave radio set can be realized, as long as pass key assignments order and show refresh command constant, by the impact that short-wave radio set function changes after adopting the method.