Author image Vladimir Ershov
and 1 contributors

NAME

Uniden::BC75XLT - module to program Uniden BC75XLT radio scanner over USB connection

SYNOPSIS

 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);

DESCRIPTION

Module implements all command described in UNIDEN BC75XLT Operation Specification (http://info.uniden.com/UnidenMan4/BC75XLT).

CONSTRUCTOR

PACKAGE->new(DEVICE_STR, OPTS_HASH)

Creates new Uniden::BC75XLT object. Where DEVICE_STR is port name and OPTS_HASH is a hash with following keys:

  • 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.

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";

METHODS

command(CMD_STR, ARGS_ARRAYREF)

Method send command CMD_STR to radio scanner with arguments ARGS_ARRAYREF. Arguments array may be undefined.

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:

  • 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.

getModelName

Method returns model name.

getFirmwareVersion

Method returns firmware version.

getVolume

Method returns volume level (0-15)

setVolume(VOL_INT)

Method set volume level value (VOL_INT). Reasonable values 0-15.

getSql

Method returns Sql value (0-15)

setSql(SQL_INT)

Method set Sql value (SQL_INT). Reasonable values 0-15.

setProgramMode

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.

quitProgramMode

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.

getBandPlan

Returns band plan code - 0:USA, 1:Canada.

getBandPlanName

Returns band plan name - USA/CANADA.

setBandPlan(BANDPLAN)

Set band plane. BANDPLAN can be integer - code or string - name.

Example:

 $radio->setBandPlan('CANADA');
 $radio->setBandPlan(1);

getKeyLockState

Returns key lock state code - 0:OFF, 1:ON.

getKeyLockStateName

Returns key lock state name - OFF/ON.

setKeyLockState(STATE)

Set key lock state. STATE can be integer - code or string - name.

Example:

 $radio->setKeyLockState('OFF');
 $radio->setKeyLockState(0);

getPriorityMode

Returns priority mode code - 0:OFF, 1:ON, 2:PLUS ON, 3:DND.

getPriorityModeName

Returns priority mode name - OFF/ON/PLUS ON/DND.

setPriorityMode(MODE)

Set priority mode. MODE can be integer - code or string - name.

Example:

 $radio->setPriorityMode('DND');
 $radio->setPriorityMode(3);

getScanChannelGroup

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.

setScanChannelGroup(GROUP_DATA)

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.

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.

Example:

 # 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');

setValidScanChannels(CHANNELS_ARRAYREF)

Set valid radio scanner groups in Scan mode. CHANNELS_ARRAYREF is ARRAYREF of radio scanner group indexes.

Example:

 # Set group 1,2,3,7,8,9 to ON state in Scan mode
 
 $radio->setValidScanChannels([1,2,3,7,8,9 ]);

getChannelInfo(N_INT)

Get stored channel information, N_INT is number of channel, integer between 1..300.

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'
 };

getChannelsInfo(OPTS_HASH)

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.

Example:

 # get information about channels 60..70 in ON state 
 
 $radio->getChannelsInfo(start => 60, stop => 70, status => 'ON');

 # get all channels information

 $radio->getChannelsInfo();

getBankChannelsInfo(N_INT)

Gets information about channel in a bank. N_INT is index of channels bank, 1..10.

Returns ARRAYREF each element is HASHREF with information about channel described in method getChannelInfo.

Example:

 $radio->getBankChannelsInfo(5);

setChannelInfo(IDX_INT, DATA_HASHREF)

Store frequency in to the channel. IDX_INT - integer, index of channel (1..300).

DATA_HASHREF is HASHREF, information about stored frequency with keys:

  • freq - frequency

  • delay - delay ON/OFF.

  • priority - priotity - ON/OFF.

  • lockout - lockout - UNLOCKED/LOCKOUT.

Example:

 $radio->setChannelInfo(61, { freq => '27.135' }); # set channel 
 $radio->setChannelInfo(61, { freq => '' }); # unset channel

eraseChannel(IDX_INT)

Erase information stored in channel. IDX_INT - integer, index of channel.

getSearchCloseCallSettings

Get Search Close Call Settings.

Returns HASHREF with keys:

  • 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.

setSearchCloseCallSettings(OPTS_HASHREF)

Set Search Close Call Settings.

OPTS_HASHREF is HASHREF with keys:

  • direction - search direction: 0, 1 or 'UP', 'DOWN'.

  • delay - delay: 0, 1 or 'OFF', 'ON'

getGlobalLockoutFreqs

Get list of global lockout frequencies. List returned as an ARRAYREF.

lockGlobalFrequency(FREQ)

Locks out frequency. FREQ is frequency value as string of float or integer.

Example:

 $radio->lockGlobalFrequency('27.000');
 $radio->lockGlobalFrequency(27);

unlockGlobalFrequency(FREQ)

Unlocks a lockout frequency. FREQ is frequency value as string of float or integer.

getCloseCallSettings

Get close call settings.

Returns HASHREF with keys:

  • 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.

setCloseCallSettings(OPTS_HASHREF)

Set close call settings.

OPTS_HASHREF is HASHREF with keys:

  • 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.

getServiceSearchSettings(BAND)

Returns information about Service Search settings. BAND_INT is index or name of one of 10 Service frequencies ranges.

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

  • delay - delay: ON/OFF.

  • delay_code - delay code: 1:ON/0:OFF.

  • direction - direction of search: UP/DOWN.

  • direction_code - direction of search code: 0:UP/1:DOWN.

setServiceSearchSettings(BAND, DLY, DIR)

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.

getCustomSearchGroup

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.

  • delay - delay: ON/OFF.

  • delay_code - delay code: 1:ON/0:OFF.

  • direction - direction of search: UP/DOWN.

  • direction_code - direction of search code: 0:UP/1:DOWN.

setCustomSearchGroup(GROUPS, DLY, DIR)

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.

DLY - delay code or name - 1:ON/0:OFF.

DIR - direction of search - 0:UP/1:DOWN.

getCustomSearchRange(RANGE_INT)

Radio scanner has 10 Custom Search frequency ranges. This method retrieve left and right bound of range.

RANGE_INT - integer, index of range.

Return value is an ARRAYREF of 2 elements. First is left bound, second is right.

getAllCustomSearchRanges

Returns all ten ranges bounds as ARRAYREF every element contains two elements ARRAYREF where first element is left bound and second is right.

setCustomSearchRange(RANGE_INT, LEFT, 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

Example:

 $radio->setCustomSearchRange(3, '144.0000', '147.9950');
 $radio->setCustomSearchRange(3, 144, 147.995);

clearMemory

Clear all radio memory. Not tested :)

SEE ALSO

Device::SerialPort