Uniden::BC75XLT - module to program Uniden BC75XLT radio scanner over USB connection
use Uniden::BC75XLT; use Data::Dumper; my $radio = Uniden::BC75XLT->new('/dev/ttyUSB0') || die "Cannot open radio: $!\n"; # get channels info in bank N1 my $channelsInfo = $radio->getBankChannelsInfo(1); print Dumper($channelsInfo); undef($radio);
Module implements all command described in UNIDEN BC75XLT Operation Specification (http://info.uniden.com/UnidenMan4/BC75XLT).
Creates new Uniden::BC75XLT object. Where DEVICE_STR is port name and OPTS_HASH is a hash with following keys:
DEVICE_STR
OPTS_HASH
baudrate - integer, port speed, default - 57600
databits - integer, number of data bits in each character, default - 8
parity - string, method of detecting errors in transmission, default - "none"
stopbits - integer, stop bits, default - 1
handshake - string, handshake method, default - "none"
read_cost_time - integer, const time for read (milliseconds), default - 1
timeout - integer, reading port timeout in milliseconds, default - 999
echo - boolean, if true all data sent to and received from port will be sent to STDERR
fatal - boolean, if set to true all errors are regarded as fatal and die will be called on them, otherwise error message invokes print to STDERR and undef will be returned after error.
die
undef
More accurate meaning and possible values of keys baudrate, databits, parity, stopbits, handshake and read_cost_time you can find in Device::SerialPort documentation.
Example:
my $radio = Uniden::BC75XLT->new('/dev/ttyUSB0', echo => 1) || die "Cannot open: $!\n";
Method send command CMD_STR to radio scanner with arguments ARGS_ARRAYREF. Arguments array may be undefined.
CMD_STR
ARGS_ARRAYREF
Normally you do not need to use this method 'cause other methods are frontends to this method and cover all described in operation manual commands.
Method returns HASHREF with following keys:
HASHREF
status - string, OK - if command executed successfully and ERROR if something was wrong
desc - string, if status has value ERROR this key contains description of error occurred
data - arrayref of strings, if status has value OK this key contains data returned by radio. Arrayref always defined even no data supposed to be returned.
Method returns model name.
Method returns firmware version.
Method returns volume level (0-15)
Method set volume level value (VOL_INT). Reasonable values 0-15.
Method returns Sql value (0-15)
Method set Sql value (SQL_INT). Reasonable values 0-15.
The scanner goes to Program Mode (PGM). The scanner displays "PC" and Key lock and PGM icons.
Some command (almost all) must be executed in PGM of scanner. If you use methods of this package you do not need enter to PGM manually. Each method "knows" how to communicate with scanner and if it needs PGM, it will enter to PGM before send command and exit after. But if you want to send sequence of commands you may start PGM manually and quit it after sequence is complete. It may save you some seconds.
The scanner exits from Program Mode. Then the scanner goes to Scan Hold Mode.
You need to call this method only if you call setProgramMode before.
setProgramMode
Returns band plan code - 0:USA, 1:Canada.
Returns band plan name - USA/CANADA.
Set band plane. BANDPLAN can be integer - code or string - name.
BANDPLAN
$radio->setBandPlan('CANADA'); $radio->setBandPlan(1);
Returns key lock state code - 0:OFF, 1:ON.
Returns key lock state name - OFF/ON.
Set key lock state. STATE can be integer - code or string - name.
STATE
$radio->setKeyLockState('OFF'); $radio->setKeyLockState(0);
Returns priority mode code - 0:OFF, 1:ON, 2:PLUS ON, 3:DND.
Returns priority mode name - OFF/ON/PLUS ON/DND.
Set priority mode. MODE can be integer - code or string - name.
MODE
$radio->setPriorityMode('DND'); $radio->setPriorityMode(3);
Get current status of the channel storage bank select.
Returns ARRAYREF of 10 elements. Each element contains ON/OFF string. Every array element describes group with the same index in radio. But index of radio scanner groups starts with 1. So element with index 0 means state of group with index 1.
ARRAYREF
Set current status of the channel storage bank select.
If GROUP_DATA is HASHREF then keys mean to be index of radio scanner group and values are states of group. States can be strings - ON/OFF or integer 1:OFF/0:ON.
GROUP_DATA
If GROUP_DATA is ARRAYREF then every element is state of group with index equals index of element plus 1. States can be strings - ON/OFF or integer 1:OFF/0:ON.
If GROUP_DATA is a string it will be passed as argument to command ASIS.
# Set group 1,2,3,7,8,9 to ON state in Scan mode # all three lines are equivalents $radio->setScanChannelGroup([ 'ON', 'ON', 'ON', 'OFF', 'OFF', 'OFF', 'ON', 'ON', 'ON', 'OFF' ]); $radio->setScanChannelGroup({ 1 => 'ON', 2 => 'ON', 3 => 'ON', 7 => 'ON', 8 => 'ON', 9 => 'ON' }); $radio->setScanChannelGroup('0001110001');
Set valid radio scanner groups in Scan mode. CHANNELS_ARRAYREF is ARRAYREF of radio scanner group indexes.
CHANNELS_ARRAYREF
# Set group 1,2,3,7,8,9 to ON state in Scan mode $radio->setValidScanChannels([1,2,3,7,8,9 ]);
Get stored channel information, N_INT is number of channel, integer between 1..300.
N_INT
Returns HASHREF with keys:
state - status of channel: SET or UNSET.
index - number of channel
freq - stored frequency in human readable form, e.g. 128.0000
freq_code - stored frequency as returned by radio scanner, e.g. '01280000'
delay - is delay turned on - ON/OFF
delay_code - is delay turned on code - 0:OFF/1:ON
lockout - lockout - UNLOCKED/LOCKOUT
lockout_code - lockout code - 0:UNLOCKED/1:LOCKOUT
priority - priority - ON/OFF
priority_code - priority code - 0:OFF/1:ON
Return example:
{ 'priority' => 'ON', 'delay_code' => '1', 'delay' => 'ON', 'freq_code' => '00271350', 'lockout' => 'UNLOCKED', 'state' => 'SET', 'index' => '61', 'lockout_code' => '0', 'freq' => '27.1350', 'priority_code' => '1' };
Retrieve information about stored channels.
OPTS_HASH has keys:
start - index of first channel
stop - index of last channels
state - status of channels to show. Possible values ON, OFF, 1, 0. If not set all channels will be selected.
Returns ARRAYREF each element is HASHREF with information about channel described in method getChannelInfo.
getChannelInfo
# get information about channels 60..70 in ON state $radio->getChannelsInfo(start => 60, stop => 70, status => 'ON'); # get all channels information $radio->getChannelsInfo();
Gets information about channel in a bank. N_INT is index of channels bank, 1..10.
$radio->getBankChannelsInfo(5);
Store frequency in to the channel. IDX_INT - integer, index of channel (1..300).
IDX_INT
DATA_HASHREF is HASHREF, information about stored frequency with keys:
DATA_HASHREF
freq - frequency
delay - delay ON/OFF.
priority - priotity - ON/OFF.
lockout - lockout - UNLOCKED/LOCKOUT.
$radio->setChannelInfo(61, { freq => '27.135' }); # set channel $radio->setChannelInfo(61, { freq => '' }); # unset channel
Erase information stored in channel. IDX_INT - integer, index of channel.
Get Search Close Call Settings.
direction - search direction: DOWN/UP.
direction_code search direction code: 1:DOWN/0:UP.
delay - delay: ON/OFF.
delay_code - delay code: 1:ON/0:OFF.
Set Search Close Call Settings.
OPTS_HASHREF is HASHREF with keys:
OPTS_HASHREF
direction - search direction: 0, 1 or 'UP', 'DOWN'.
delay - delay: 0, 1 or 'OFF', 'ON'
Get list of global lockout frequencies. List returned as an ARRAYREF.
Locks out frequency. FREQ is frequency value as string of float or integer.
FREQ
$radio->lockGlobalFrequency('27.000'); $radio->lockGlobalFrequency(27);
Unlocks a lockout frequency. FREQ is frequency value as string of float or integer.
Get close call settings.
mode - current CC mode: OFF/PRIORITY/DND
mode_code - current CC mode code: 0:OFF/1:PRIORITY/2:DND
alert_beep - beep alarm when CC is found: ON/OFF
alert_beep_code - beep alarm when CC is found code: 1:ON/0:OFF
alert_light - alarm with light when CC is found: ON/OFF
alert_light_code - alarm with light when CC is found code: 1:ON/0:OFF
bands - state of preset bands in Close Call RF mode. There are 4 bands: VHF_LOW, AIR, VHF_HIGH and UHF. They are keys in bands HASHREF, possible values: ON/OFF.
Set close call settings.
mode - Close Call RF mode - 0,1,3 or OFF, PRIORITY, DND
alert_beep - alert with beep settings: 0, 1 or OFF, ON
alert_light - alert with light settings: 0, 1 or OFF, ON
bands - list of available bands in Close Call RF mode. ARRAYREF each element is band name to be set to ON state.
All keys are optional. By default mode is set in DND, all alerts are OFF, all bands are ON.
Returns information about Service Search settings. BAND_INT is index or name of one of 10 Service frequencies ranges.
BAND_INT
Ranges: 1:WX -Weather, 2:POLICE - Police, 3:FIRE - Fire/Emergency, 4:MARINE - Marine, 5:RACE - Racing, 6:AIR - Civil Air, 7:HAM - HAM Radio, 8:RAIL - Railroad, 9:CB - CB Radio, 10:OTHER - FRS/GMRS/MRUS.
Return value is HASHREF with keys:
index - index of freq range (1..10)
band - name for freq range
direction - direction of search: UP/DOWN.
direction_code - direction of search code: 0:UP/1:DOWN.
Set Service search freq range settings. BAND index or name of search range. DLY - delay code or name - 1:ON/0:OFF. DIR - direction of search - 0:UP/1:DOWN.
BAND
DLY
DIR
Returns state of Custom Search frequencies groups and Custom Search settings. Return value is HASHREF with keys:
group - ARRAYREF of 10 elements. Each element contains ON/OFF string. Every array element describes group with the same index in radio. But index of radio scanner groups starts with 1. So element with index 0 means state of group with index 1.
Set state of frequencies groups in Custom Search mode.
GROUPS - HASHREF or ARRAYREF - describes states of freq group. If you use ARRAYREF you should set 10 elements array every element must contain string ON or OFF. In HASHREF representation keys are index of groups, values are state. If group state was not present in HASH its state would be set to OFF.
GROUPS
HASH
DLY - delay code or name - 1:ON/0:OFF.
DIR - direction of search - 0:UP/1:DOWN.
Radio scanner has 10 Custom Search frequency ranges. This method retrieve left and right bound of range.
RANGE_INT - integer, index of range.
RANGE_INT
Return value is an ARRAYREF of 2 elements. First is left bound, second is right.
Returns all ten ranges bounds as ARRAYREF every element contains two elements ARRAYREF where first element is left bound and second is right.
Set bounds of frequency range.
RANGE_INT - index of range. 1..10
LEFT - frequency value - left bound of range
RIGHT - frequency value - right bound of range
$radio->setCustomSearchRange(3, '144.0000', '147.9950'); $radio->setCustomSearchRange(3, 144, 147.995);
Clear all radio memory. Not tested :)
Device::SerialPort
To install Uniden::BC75XLT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Uniden::BC75XLT
CPAN shell
perl -MCPAN -e shell install Uniden::BC75XLT
For more information on module installation, please visit the detailed CPAN module installation guide.