diff --git a/openrtx/include/core/voicePromptUtils.h b/openrtx/include/core/voicePromptUtils.h index aaab8a59..0acc6a71 100644 --- a/openrtx/include/core/voicePromptUtils.h +++ b/openrtx/include/core/voicePromptUtils.h @@ -60,5 +60,9 @@ void announceCTCSS(bool rxToneEnabled, uint8_t rxTone, bool txToneEnabled, uint8 void anouncePower(float power, VoicePromptQueueFlags_T flags); void announceBrightness(uint8_t brightness, VoicePromptQueueFlags_T flags); void announceSquelch(uint8_t squelch, VoicePromptQueueFlags_T flags); +void announceContact(contact_t* contact, VoicePromptQueueFlags_T flags); +void announceContactWithIndex(uint16_t index, VoicePromptQueueFlags_T flags); +void announceTimeslot(uint8_t timeslot, VoicePromptQueueFlags_T flags); +void announceColorCode(uint8_t rxColorCode, uint8_t txColorCode, VoicePromptQueueFlags_T flags); #endif //VOICE_PROMPT_UTILS_H_INCLUDED \ No newline at end of file diff --git a/openrtx/include/core/voicePrompts.h b/openrtx/include/core/voicePrompts.h index b6fb6b64..ec07ae41 100644 --- a/openrtx/include/core/voicePrompts.h +++ b/openrtx/include/core/voicePrompts.h @@ -120,7 +120,10 @@ PROMPT_SOURCE_ID, // Source ID PROMPT_DEST_ID, // Destination ID PROMPT_DMR_ID, // DMR ID PROMPT_TALKGROUP, // Talk group +PROMPT_TIMESLOT, // timeslot +PROMPT_COLORCODE, // color code PROMPT_TONE, // tone +PROMPT_CONTACT, // contact PROMPT_CHARACTER, // character PROMPT_SPACE, // space PROMPT_PERCENT, // Percent diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 365748c7..7cbdc8e0 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -197,7 +197,18 @@ VoicePromptQueueFlags_T flags) localFlags); } } - // Todo M17 and DMR info. + else if (channel->mode == OPMODE_M17) + { + announceContactWithIndex(channel->m17.contact_index, localFlags); + } + else if (channel->mode == OPMODE_DMR) + { + announceContactWithIndex(channel->dmr.contact_index, localFlags); + // Force announcement of the words timeslot and colorcode to avoid ambiguity. + announceTimeslot(channel->dmr.dmr_timeslot, (localFlags | vpqIncludeDescriptions)); + announceColorCode(channel->dmr.rxColorCode, channel->dmr.txColorCode, (localFlags | vpqIncludeDescriptions)); + } + anouncePower(channel->power, localFlags); vpPlayIfNeeded(flags); @@ -330,4 +341,67 @@ void announceSquelch(uint8_t squelch, VoicePromptQueueFlags_T flags) vpQueueInteger(squelch); vpPlayIfNeeded(flags); -} \ No newline at end of file +} + +void announceContact(contact_t* contact, VoicePromptQueueFlags_T flags) +{ + if (!contact) + return; + + vpInitIfNeeded(flags); + + if (flags & vpqIncludeDescriptions) + vpQueuePrompt(PROMPT_CONTACT); + + if (contact->name[0]) + vpQueueString(contact->name, vpAnnounceCommonSymbols); + + vpPlayIfNeeded(flags); +} + +void announceContactWithIndex(uint16_t index, VoicePromptQueueFlags_T flags) +{ + if (index == 0) + return; + + contact_t contact; + + if (cps_readContact(&contact, index) == -1) + return; + + announceContact(&contact, flags); +} + +void announceTimeslot(uint8_t timeslot, VoicePromptQueueFlags_T flags) +{ + vpInitIfNeeded(flags); + + if (flags & vpqIncludeDescriptions) + vpQueuePrompt(PROMPT_TIMESLOT); + + vpQueueInteger(timeslot); + + vpPlayIfNeeded(flags); +} + +void announceColorCode(uint8_t rxColorCode, uint8_t txColorCode, VoicePromptQueueFlags_T flags) +{ + vpInitIfNeeded(flags); + + if (flags & vpqIncludeDescriptions) + vpQueuePrompt(PROMPT_COLORCODE); + + if (rxColorCode == txColorCode) + { + vpQueueInteger(rxColorCode); + } + else + { + vpQueuePrompt(PROMPT_RECEIVE); + vpQueueInteger(rxColorCode); + vpQueuePrompt(PROMPT_TRANSMIT); + vpQueueInteger(txColorCode); + } + + vpPlayIfNeeded(flags); +}