Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@
<script src="js/ScanManager.js"></script>
<script src="js/script.js"></script>
<script src="js/ui.js"></script>
<!-- <script src="https://code.responsivevoice.org/responsivevoice.js?key=PekkZld1"></script> -->
<script src="https://code.responsivevoice.org/responsivevoice.js?key=PekkZld1"></script>
</body>
</html>
51 changes: 36 additions & 15 deletions client/ui/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,20 @@ function socketOpen() {
}

let beepVolumeReduction = 0.6; // default value
let isResponsiveVoiceApiKeySet = false; // default value
fetch('/configs/config.yml')
.then(response => response.text())
.then(yamlText => {
const lines = yamlText.split('\n');
for (const line of lines) {
const matchBeepVolume = line.match(/^\s*beepVolumeReduction\s*:\s*([0-9.]+)\s*$/i);
const matchApiKeyValue = line.match(/^\s*responsiveVoiceApiKey\s*:\s+\S*$/i);
if (matchBeepVolume) {
let parsed = parseFloat(matchBeepVolume[1]);
if (isNaN(parsed)) {
console.error('beepVolumeReduction in config.yml is not a number. Using default value.');
return;
}
if (parsed < 0.0) {
} if (parsed < 0.0) {
console.error('beepVolumeReduction in config.yml is less than 0. Clamping to 0.');
beepVolumeReduction = 0.0;
} else if (parsed > 1.0) {
Expand All @@ -124,12 +125,22 @@ fetch('/configs/config.yml')
beepVolumeReduction = parsed;
}
}
if (matchApiKeyValue) {
let apiKey = matchApiKeyValue.replace("responsiveVoiceApiKey: ", "");
if (apiKey !== null && apiKey !== "") {
isResponsiveVoiceApiKeySet = true
console.log('Responsive voice enabled')
} else {
console.log('Responsive voice API key not set, disabled')
}
}
}
})
.catch(err => {
console.warn('Could not load config.yml, using default config values:', err);
});


reconnectInterval = setInterval(() => {
if (isInSiteTrunking && radioOn) {
connectWebSocket();
Expand Down Expand Up @@ -409,6 +420,12 @@ window.addEventListener('message', async function (event) {
return;
}

if (currentCodeplug.zones[currentZoneIndex].channels[currentChannelIndex].isReceiveOnly === true) {
console.debug("Cannot tx, rx only");
bonk();
return;
}

if (isReceiving) {
console.debug("Receiving, not txing");
bonk();
Expand Down Expand Up @@ -643,18 +660,18 @@ async function powerOn(reReg) {
bootImage.style.display = 'none';
} else {
const bootScreenMessages = [
{text: "", duration: 0, line: "line1"},
{text: "", duration: 0, line: "line3"},
{text: HOST_VERSION, duration: 1500, line: "line2"},
{text: "", duration: 0, : "line1"},
{text: "", duration: 0, : "line3"},
{text: HOST_VERSION, duration: 1500, : "line2"},
{text: radioModel, duration: 1500, line: "line2"}
];

await displayBootScreen(bootScreenMessages);
}

if (!isScannerModel()) {
// responsiveVoice.speak(`${currentZone.name}`, `US English Female`, {rate: .8});
// responsiveVoice.speak(`${currentChannel.name}`, `US English Female`, {rate: .8});
if (!isScannerModel() && currentCodeplug.isAnnounceZoneChannelTalkgroups === true && isResponsiveVoiceApiKeySet === true) {
responsiveVoice.speak(`${currentZone.name_announce}`, `US English Female`, {rate: .8});
responsiveVoice.speak(`${currentChannel.name_announce}`, `US English Female`, {rate: .8});
}

updateDisplay();
Expand Down Expand Up @@ -911,9 +928,10 @@ function changeChannel(direction) {
setLine2("Fail 01/82");
}

const currentChannel = currentZone.channels[currentChannelIndex];

// responsiveVoice.speak(`${currentChannel.name}`, `US English Female`, {rate: .8});
if (currentCodeplug.isAnnounceZoneChannelTalkgroups === true && isResponsiveVoiceApiKeySet === true) {
const currentChannel = currentZone.channels[currentChannelIndex];
responsiveVoice.speak(`${currentChannel.name_announce}`, `US English Female`, {rate: .8});
}

SendGroupAffiliationRemoval(currentTg);

Expand Down Expand Up @@ -947,11 +965,14 @@ function changeZone(direction) {
}

currentChannelIndex = 0;
const currentZone = currentCodeplug.zones[currentZoneIndex];
const currentChannel = currentZone.channels[currentChannelIndex];

// responsiveVoice.speak(`${currentZone.name}`, `US English Female`, {rate: .8});
// responsiveVoice.speak(`${currentChannel.name}`, `US English Female`, {rate: .8});
if (currentCodeplug.isAnnounceZoneChannelTalkgroups === true && isResponsiveVoiceApiKeySet === true) {
const currentZone = currentCodeplug.zones[currentZoneIndex];
const currentChannel = currentZone.channels[currentChannelIndex];
responsiveVoice.speak(`${currentZone.name_announce}`, `US English Female`, {rate: .8});
responsiveVoice.speak(`${currentChannel.name_announce}`, `US English Female`, {rate: .8});
}

SendGroupAffiliationRemoval(currentTg);

updateDisplay();
Expand Down
31 changes: 23 additions & 8 deletions codeplugs/codeplug.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ radioWide:
serialNumber: "123ABC1234"
model: "APX6000"
inCarMode: "APX4500"
isAnnonceZoneChannelChanges: false

systems:
- name: "System 1"
Expand All @@ -22,30 +23,44 @@ qcList:
b: 500.9

zones:
- name: "Zone 1"
- name: "Z1" # Displayed on the radio UI
name_announce: "Zone 1" # Announced when switching to this zone
channels:
- name: "Channel 1"
- name: "Ch 1" # Displayed on the radio UI
name_announce: "Channel 1" # Announced when switching to this channel
system: "System 1"
tgid: "2001"
scanList: List 1
- name: "Channel 2"
isReceiveOnly: false
- name: "Ch 2" # Displayed on the radio UI
name_announce: "Channel 2" # Announced when switching to this channel
system: "System 1"
tgid: "15002"
- name: "Channel 3"
isReceiveOnly: false
- name: "Ch 3" # Displayed on the radio UI
name_announce: "Channel 3" # Announced when switching to this channel
system: "System 1"
tgid: "15003"
isReceiveOnly: false

- name: "Zone 2"
- name: "Z2" # Displayed on the radio UI
name_announce: "Zone 2" # Announced when switching to this zone
channels:
- name: "Channel A"
- name: "Ch A" # Displayed on the radio UI
name_announce: "Channel A" # Announced when switching to this channel
system: "System 1"
tgid: "16001"
- name: "Channel B"
isReceiveOnly: false
- name: "Ch B" # Displayed on the radio UI
name_announce: "Channel B" # Announced when switching to this channel
system: "System 1"
tgid: "16002"
- name: "Channel C"
isReceiveOnly: false
- name: "Ch C" # Displayed on the radio UI
name_announce: "Channel C" # Announced when switching to this channel
system: "System 1"
tgid: "16002"
isReceiveOnly: false

scanLists:
- name: List 1
Expand Down
3 changes: 2 additions & 1 deletion configs/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
siteBlips: true
disableAnimations: false
# Beep volume reduction factor. 0.0 is full volume, 1.0 is silent
beepVolumeReduction: 0.6
beepVolumeReduction: 0.6
responsiveVoiceApiKey: "add your api key"