Parse digital channels.

This commit is contained in:
Serge 2018-08-30 00:45:29 -07:00
parent dc9188c7a8
commit 23e87ef4da
14 changed files with 599 additions and 258 deletions

View File

@ -1,6 +1,6 @@
# #
# This configuration was generated 2018/08/29 by dmrconfig, # This configuration was generated 2018/08/30 by dmrconfig,
# Version 0.1.32, Copyright (C) 2018 Serge Vakulenko KK6ABQ # Version 0.1.37, Copyright (C) 2018 Serge Vakulenko KK6ABQ
# #
Radio: TYT MD-UV380 Radio: TYT MD-UV380
Name: - Name: -
@ -8,6 +8,10 @@ ID: 1234
Last Programmed Date: 2018-08-20 12:41:08 Last Programmed Date: 2018-08-20 12:41:08
CPS Software Version: V01.07 CPS Software Version: V01.07
# Text displayed when the radio powers up.
Welcome Line 1: -
Welcome Line 2: -
# Table of analog channels. # Table of analog channels.
# 1) Channel number: 1-3000 # 1) Channel number: 1-3000
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
@ -15,13 +19,14 @@ CPS Software Version: V01.07
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index # 6) Scan list: - or index
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Tone # 10) Receive only: -, +
# 11) Guard tone for receive, or '-' to disable # 11) Admit criteria: -, Free, Tone
# 12) Guard tone for transmit, or '-' to disable # 12) Guard tone for receive, or '-' to disable
# 13) Bandwidth in kHz: 12.5, 20, 25 # 13) Guard tone for transmit, or '-' to disable
# 14) Bandwidth in kHz: 12.5, 20, 25
# #
Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width
1 Channel1 400.000 +0 High - - 1 60 - - - - 12.5 1 Channel1 400.000 +0 High - - 1 60 - - - - 12.5

View File

@ -1,6 +1,6 @@
# #
# This configuration was generated 2018/08/29 by dmrconfig, # This configuration was generated 2018/08/30 by dmrconfig,
# Version 0.1.32, Copyright (C) 2018 Serge Vakulenko KK6ABQ # Version 0.1.37, Copyright (C) 2018 Serge Vakulenko KK6ABQ
# #
Radio: TYT MD-UV380 Radio: TYT MD-UV380
Name: - Name: -
@ -8,6 +8,10 @@ ID: 1234
Last Programmed Date: 2018-07-13 16:02:59 Last Programmed Date: 2018-07-13 16:02:59
CPS Software Version: V01.07 CPS Software Version: V01.07
# Text displayed when the radio powers up.
Welcome Line 1: -
Welcome Line 2: -
# Table of digital channels. # Table of digital channels.
# 1) Channel number: 1-3000 # 1) Channel number: 1-3000
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
@ -15,15 +19,16 @@ CPS Software Version: V01.07
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index in Scanlist table # 6) Scan list: - or index in Scanlist table
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Color # 10) Receive only: -, +
# 11) Color code: 1, 2, 3... 15 # 11) Admit criteria: -, Free, Color
# 12) Time slot: 1 or 2 # 12) Color code: 1, 2, 3... 15
# 13) In call criteria: -, Admit, TXInt # 13) Time slot: 1 or 2
# 14) Receive group list: - or index in Grouplist table # 14) In call criteria: -, Admit, TXInt
# 15) Contact for transmit: - or index in Contacts table # 15) Receive group list: - or index in Grouplist table
# 16) Contact for transmit: - or index in Contacts table
# #
Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact
1 Channel1 431.125 +0 Low - - 3 60 - - 1 1 - 1 1 1 Channel1 431.125 +0 Low - - 3 60 - - 1 1 - 1 1
@ -42,13 +47,14 @@ Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index # 6) Scan list: - or index
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Tone # 10) Receive only: -, +
# 11) Guard tone for receive, or '-' to disable # 11) Admit criteria: -, Free, Tone
# 12) Guard tone for transmit, or '-' to disable # 12) Guard tone for receive, or '-' to disable
# 13) Bandwidth in kHz: 12.5, 20, 25 # 13) Guard tone for transmit, or '-' to disable
# 14) Bandwidth in kHz: 12.5, 20, 25
# #
Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width
5 Channel5 435.525 +0 High - - 3 60 - - 82.5 82.5 12.5 5 Channel5 435.525 +0 High - - 3 60 - - 82.5 82.5 12.5

View File

@ -1,6 +1,6 @@
# #
# This configuration was generated 2018/08/29 by dmrconfig, # This configuration was generated 2018/08/30 by dmrconfig,
# Version 0.1.32, Copyright (C) 2018 Serge Vakulenko KK6ABQ # Version 0.1.37, Copyright (C) 2018 Serge Vakulenko KK6ABQ
# #
Radio: TYT MD-UV380 Radio: TYT MD-UV380
Name: Dit_Call Name: Dit_Call
@ -8,6 +8,10 @@ ID: 238
Last Programmed Date: 2018-08-05 17:54:47 Last Programmed Date: 2018-08-05 17:54:47
CPS Software Version: V01.32 CPS Software Version: V01.32
# Text displayed when the radio powers up.
Welcome Line 1: Husk_ID
Welcome Line 2: og_Call
# Table of digital channels. # Table of digital channels.
# 1) Channel number: 1-3000 # 1) Channel number: 1-3000
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
@ -15,15 +19,16 @@ CPS Software Version: V01.32
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index in Scanlist table # 6) Scan list: - or index in Scanlist table
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Color # 10) Receive only: -, +
# 11) Color code: 1, 2, 3... 15 # 11) Admit criteria: -, Free, Color
# 12) Time slot: 1 or 2 # 12) Color code: 1, 2, 3... 15
# 13) In call criteria: -, Admit, TXInt # 13) Time slot: 1 or 2
# 14) Receive group list: - or index in Grouplist table # 14) In call criteria: -, Admit, TXInt
# 15) Contact for transmit: - or index in Contacts table # 15) Receive group list: - or index in Grouplist table
# 16) Contact for transmit: - or index in Contacts table
# #
Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact
1 Bandholm_LK_238 434.650 -2 High 48 - 1 180 - Color 15 1 Admit 1 34 1 Bandholm_LK_238 434.650 -2 High 48 - 1 180 - Color 15 1 Admit 1 34
@ -806,13 +811,14 @@ Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index # 6) Scan list: - or index
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Tone # 10) Receive only: -, +
# 11) Guard tone for receive, or '-' to disable # 11) Admit criteria: -, Free, Tone
# 12) Guard tone for transmit, or '-' to disable # 12) Guard tone for receive, or '-' to disable
# 13) Bandwidth in kHz: 12.5, 20, 25 # 13) Guard tone for transmit, or '-' to disable
# 14) Bandwidth in kHz: 12.5, 20, 25
# #
Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width
15 Bandholm_FM 434.650 -2 High 54 - 1 180 - - 82.5 82.5 12.5 15 Bandholm_FM 434.650 -2 High 54 - 1 180 - - 82.5 82.5 12.5

View File

@ -1,6 +1,6 @@
# #
# This configuration was generated 2018/08/29 by dmrconfig, # This configuration was generated 2018/08/30 by dmrconfig,
# Version 0.1.32, Copyright (C) 2018 Serge Vakulenko KK6ABQ # Version 0.1.37, Copyright (C) 2018 Serge Vakulenko KK6ABQ
# #
Radio: TYT MD-UV380 Radio: TYT MD-UV380
Name: - Name: -
@ -8,6 +8,10 @@ ID: 1234
Last Programmed Date: 2017-07-23 19:19:23 Last Programmed Date: 2017-07-23 19:19:23
CPS Software Version: V01.17 CPS Software Version: V01.17
# Text displayed when the radio powers up.
Welcome Line 1: -
Welcome Line 2: -
# Table of digital channels. # Table of digital channels.
# 1) Channel number: 1-3000 # 1) Channel number: 1-3000
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
@ -15,15 +19,16 @@ CPS Software Version: V01.17
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index in Scanlist table # 6) Scan list: - or index in Scanlist table
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Color # 10) Receive only: -, +
# 11) Color code: 1, 2, 3... 15 # 11) Admit criteria: -, Free, Color
# 12) Time slot: 1 or 2 # 12) Color code: 1, 2, 3... 15
# 13) In call criteria: -, Admit, TXInt # 13) Time slot: 1 or 2
# 14) Receive group list: - or index in Grouplist table # 14) In call criteria: -, Admit, TXInt
# 15) Contact for transmit: - or index in Contacts table # 15) Receive group list: - or index in Grouplist table
# 16) Contact for transmit: - or index in Contacts table
# #
Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact
1 MB-Local 442.2875 +5 High 1 - 1 180 - - 1 2 - - 1 1 MB-Local 442.2875 +5 High 1 - 1 180 - - 1 2 - - 1
@ -497,13 +502,14 @@ Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index # 6) Scan list: - or index
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Tone # 10) Receive only: -, +
# 11) Guard tone for receive, or '-' to disable # 11) Admit criteria: -, Free, Tone
# 12) Guard tone for transmit, or '-' to disable # 12) Guard tone for receive, or '-' to disable
# 13) Bandwidth in kHz: 12.5, 20, 25 # 13) Guard tone for transmit, or '-' to disable
# 14) Bandwidth in kHz: 12.5, 20, 25
# #
Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width
464 N6DL_147.33 147.330 +0.6 High - - 1 180 - - - 100.0 25 464 N6DL_147.33 147.330 +0.6 High - - 1 180 - - - 100.0 25

View File

@ -1,6 +1,6 @@
# #
# This configuration was generated 2018/08/29 by dmrconfig, # This configuration was generated 2018/08/30 by dmrconfig,
# Version 0.1.32, Copyright (C) 2018 Serge Vakulenko KK6ABQ # Version 0.1.37, Copyright (C) 2018 Serge Vakulenko KK6ABQ
# #
Radio: TYT MD-UV380 Radio: TYT MD-UV380
Name: YourCall-Here Name: YourCall-Here
@ -8,6 +8,10 @@ ID: 12345678
Last Programmed Date: 2017-07-19 07:09:13 Last Programmed Date: 2017-07-19 07:09:13
CPS Software Version: V01.16 CPS Software Version: V01.16
# Text displayed when the radio powers up.
Welcome Line 1: YourName
Welcome Line 2: YourCall
# Table of digital channels. # Table of digital channels.
# 1) Channel number: 1-3000 # 1) Channel number: 1-3000
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
@ -15,15 +19,16 @@ CPS Software Version: V01.16
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index in Scanlist table # 6) Scan list: - or index in Scanlist table
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Color # 10) Receive only: -, +
# 11) Color code: 1, 2, 3... 15 # 11) Admit criteria: -, Free, Color
# 12) Time slot: 1 or 2 # 12) Color code: 1, 2, 3... 15
# 13) In call criteria: -, Admit, TXInt # 13) Time slot: 1 or 2
# 14) Receive group list: - or index in Grouplist table # 14) In call criteria: -, Admit, TXInt
# 15) Contact for transmit: - or index in Contacts table # 15) Receive group list: - or index in Grouplist table
# 16) Contact for transmit: - or index in Contacts table
# #
Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact
171 dSmplx1_441.000 441.000 +0 High - - 1 180 - Color 1 1 Admit - 10 171 dSmplx1_441.000 441.000 +0 High - - 1 180 - Color 1 1 Admit - 10
@ -874,13 +879,14 @@ Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Mid, Low
# 6) Scan list: - or index # 6) Scan list: - or index
# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Tone # 10) Receive only: -, +
# 11) Guard tone for receive, or '-' to disable # 11) Admit criteria: -, Free, Tone
# 12) Guard tone for transmit, or '-' to disable # 12) Guard tone for receive, or '-' to disable
# 13) Bandwidth in kHz: 12.5, 20, 25 # 13) Guard tone for transmit, or '-' to disable
# 14) Bandwidth in kHz: 12.5, 20, 25
# #
Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width
1 01_PRMARY_145.37 145.370 -0.6 High - - 1 180 - - - 136.5 25 1 01_PRMARY_145.37 145.370 -0.6 High - - 1 180 - - - 136.5 25

View File

@ -1,6 +1,6 @@
# #
# This configuration was generated 2018/08/29 by dmrconfig, # This configuration was generated 2018/08/30 by dmrconfig,
# Version 0.1.32, Copyright (C) 2018 Serge Vakulenko KK6ABQ # Version 0.1.37, Copyright (C) 2018 Serge Vakulenko KK6ABQ
# #
Radio: TYT MD-380 Radio: TYT MD-380
Name: YOURCALL Name: YOURCALL
@ -8,22 +8,27 @@ ID: 1234567
Last Programmed Date: 2018-03-29 10:33:50 Last Programmed Date: 2018-03-29 10:33:50
CPS Software Version: V01.34 CPS Software Version: V01.34
# Text displayed when the radio powers up.
Welcome Line 1: WELCOME
Welcome Line 2: YOURCALL
# Table of digital channels. # Table of digital channels.
# 1) Channel number: 1-1000 # 1) Channel number: 1-1000
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
# 3) Receive frequency in MHz # 3) Receive frequency in MHz
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Low
# 6) Scan list: - or index in Scanlist table # 6) Scan list: - or index in Scanlist table
# 7) Squelch level: Normal, Tight # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: Normal, Tight
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Color # 10) Receive only: -, +
# 11) Color code: 1, 2, 3... 15 # 11) Admit criteria: -, Free, Color
# 12) Time slot: 1 or 2 # 12) Color code: 1, 2, 3... 15
# 13) In call criteria: -, Admit, TXInt # 13) Time slot: 1 or 2
# 14) Receive group list: - or index in Grouplist table # 14) In call criteria: -, Admit, TXInt
# 15) Contact for transmit: - or index in Contacts table # 15) Receive group list: - or index in Grouplist table
# 16) Contact for transmit: - or index in Contacts table
# #
Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit Color Slot InCall RxGL TxContact Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit Color Slot InCall RxGL TxContact
1 Black_DMR 444.350 +5 High - - Normal 60 - - 1 2 - - 15 1 Black_DMR 444.350 +5 High - - Normal 60 - - 1 2 - - 15
@ -37,15 +42,16 @@ Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
# 3) Receive frequency in MHz # 3) Receive frequency in MHz
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Low
# 6) Scan list: - or index # 6) Scan list: - or index
# 7) Squelch level: Normal, Tight # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: Normal, Tight
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Tone # 10) Receive only: -, +
# 11) Guard tone for receive, or '-' to disable # 11) Admit criteria: -, Free, Tone
# 12) Guard tone for transmit, or '-' to disable # 12) Guard tone for receive, or '-' to disable
# 13) Bandwidth in kHz: 12.5, 20, 25 # 13) Guard tone for transmit, or '-' to disable
# 14) Bandwidth in kHz: 12.5, 20, 25
# #
Analog Name Receive Transmit Power Scan AS Squelch TOT RO Admit RxTone TxTone Width Analog Name Receive Transmit Power Scan AS Squelch TOT RO Admit RxTone TxTone Width
3 Black_FM 443.225 +5 High - - Normal - - - 100.0 100.0 25 3 Black_FM 443.225 +5 High - - Normal - - - 100.0 100.0 25

View File

@ -1,6 +1,6 @@
# #
# This configuration was generated 2018/08/29 by dmrconfig, # This configuration was generated 2018/08/30 by dmrconfig,
# Version 0.1.32, Copyright (C) 2018 Serge Vakulenko KK6ABQ # Version 0.1.37, Copyright (C) 2018 Serge Vakulenko KK6ABQ
# #
Radio: TYT MD-380 Radio: TYT MD-380
Name: noname Name: noname
@ -8,22 +8,27 @@ ID: 1234
Last Programmed Date: 2016-09-11 21:46:59 Last Programmed Date: 2016-09-11 21:46:59
CPS Software Version: V01.32 CPS Software Version: V01.32
# Text displayed when the radio powers up.
Welcome Line 1: noname
Welcome Line 2: noDMRid
# Table of digital channels. # Table of digital channels.
# 1) Channel number: 1-1000 # 1) Channel number: 1-1000
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
# 3) Receive frequency in MHz # 3) Receive frequency in MHz
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Low
# 6) Scan list: - or index in Scanlist table # 6) Scan list: - or index in Scanlist table
# 7) Squelch level: Normal, Tight # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: Normal, Tight
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Color # 10) Receive only: -, +
# 11) Color code: 1, 2, 3... 15 # 11) Admit criteria: -, Free, Color
# 12) Time slot: 1 or 2 # 12) Color code: 1, 2, 3... 15
# 13) In call criteria: -, Admit, TXInt # 13) Time slot: 1 or 2
# 14) Receive group list: - or index in Grouplist table # 14) In call criteria: -, Admit, TXInt
# 15) Contact for transmit: - or index in Contacts table # 15) Receive group list: - or index in Grouplist table
# 16) Contact for transmit: - or index in Contacts table
# #
Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit Color Slot InCall RxGL TxContact Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit Color Slot InCall RxGL TxContact
1 PAARA_(SJ)_w6otx 444.475 +5 High 1 + Normal 90 - Color 1 2 - 2 1 1 PAARA_(SJ)_w6otx 444.475 +5 High 1 + Normal 90 - Color 1 2 - 2 1
@ -954,15 +959,16 @@ Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
# 3) Receive frequency in MHz # 3) Receive frequency in MHz
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Low
# 6) Scan list: - or index # 6) Scan list: - or index
# 7) Squelch level: Normal, Tight # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: Normal, Tight
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Tone # 10) Receive only: -, +
# 11) Guard tone for receive, or '-' to disable # 11) Admit criteria: -, Free, Tone
# 12) Guard tone for transmit, or '-' to disable # 12) Guard tone for receive, or '-' to disable
# 13) Bandwidth in kHz: 12.5, 20, 25 # 13) Guard tone for transmit, or '-' to disable
# 14) Bandwidth in kHz: 12.5, 20, 25
# #
Analog Name Receive Transmit Power Scan AS Squelch TOT RO Admit RxTone TxTone Width Analog Name Receive Transmit Power Scan AS Squelch TOT RO Admit RxTone TxTone Width
323 NatlSmplx_446.0 446.000 +0 High 14 - Normal 90 - - - - 25 323 NatlSmplx_446.0 446.000 +0 High 14 - Normal 90 - - - - 25

View File

@ -1,6 +1,6 @@
# #
# This configuration was generated 2018/08/29 by dmrconfig, # This configuration was generated 2018/08/30 by dmrconfig,
# Version 0.1.32, Copyright (C) 2018 Serge Vakulenko KK6ABQ # Version 0.1.37, Copyright (C) 2018 Serge Vakulenko KK6ABQ
# #
Radio: TYT MD-380 Radio: TYT MD-380
Name: MYCALL Name: MYCALL
@ -8,22 +8,27 @@ ID: 1234
Last Programmed Date: 2016-10-20 17:49:09 Last Programmed Date: 2016-10-20 17:49:09
CPS Software Version: V01.32 CPS Software Version: V01.32
# Text displayed when the radio powers up.
Welcome Line 1: MYCALL
Welcome Line 2: MYNAME
# Table of digital channels. # Table of digital channels.
# 1) Channel number: 1-1000 # 1) Channel number: 1-1000
# 2) Name: up to 16 characters, use '_' instead of space # 2) Name: up to 16 characters, use '_' instead of space
# 3) Receive frequency in MHz # 3) Receive frequency in MHz
# 4) Transmit frequency or +/- offset in MHz # 4) Transmit frequency or +/- offset in MHz
# 5) Transmit power: High, Mid, Low # 5) Transmit power: High, Low
# 6) Scan list: - or index in Scanlist table # 6) Scan list: - or index in Scanlist table
# 7) Squelch level: Normal, Tight # 7) Autoscan flag: -, +
# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555 # 8) Squelch level: Normal, Tight
# 9) Receive only: -, + # 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555
# 10) Admit criteria: -, Free, Color # 10) Receive only: -, +
# 11) Color code: 1, 2, 3... 15 # 11) Admit criteria: -, Free, Color
# 12) Time slot: 1 or 2 # 12) Color code: 1, 2, 3... 15
# 13) In call criteria: -, Admit, TXInt # 13) Time slot: 1 or 2
# 14) Receive group list: - or index in Grouplist table # 14) In call criteria: -, Admit, TXInt
# 15) Contact for transmit: - or index in Contacts table # 15) Receive group list: - or index in Grouplist table
# 16) Contact for transmit: - or index in Contacts table
# #
Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit Color Slot InCall RxGL TxContact Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit Color Slot InCall RxGL TxContact
1 K6ACR_MB_CA 444.7875 +5 High 14 + Normal 60 - Color 1 1 - 1 9 1 K6ACR_MB_CA 444.7875 +5 High 14 + Normal 60 - Color 1 1 - 1 9

2
main.c
View File

@ -140,7 +140,6 @@ int main(int argc, char **argv)
// Print configuration from image file. // Print configuration from image file.
// Load image from file. // Load image from file.
radio_read_image(argv[0]); radio_read_image(argv[0]);
radio_print_version(stdout);
radio_print_config(stdout, ! isatty(1)); radio_print_config(stdout, ! isatty(1));
} else { } else {
@ -159,7 +158,6 @@ int main(int argc, char **argv)
perror(filename); perror(filename);
exit(-1); exit(-1);
} }
radio_print_version(conf);
radio_print_config(conf, 1); radio_print_config(conf, 1);
fclose(conf); fclose(conf);
} }

266
md380.c
View File

@ -113,6 +113,7 @@ typedef struct {
#define ADMIT_ALWAYS 0 #define ADMIT_ALWAYS 0
#define ADMIT_CH_FREE 1 #define ADMIT_CH_FREE 1
#define ADMIT_TONE 2 #define ADMIT_TONE 2
#define ADMIT_COLOR 3
// Byte 5 // Byte 5
uint8_t _unused5 : 4, // 0 uint8_t _unused5 : 4, // 0
@ -324,7 +325,20 @@ static const char *SIGNALING_SYSTEM[] = { "-", "DTMF-1", "DTMF-2", "DTMF-3", "DT
// //
static void md380_print_version(radio_device_t *radio, FILE *out) static void md380_print_version(radio_device_t *radio, FILE *out)
{ {
// Nothing to print. unsigned char *timestamp = &radio_mem[OFFSET_TIMESTMP];
static const char charmap[16] = "0123456789:;<=>?";
if (*timestamp != 0xff) {
fprintf(out, "Last Programmed Date: %d%d%d%d-%d%d-%d%d",
timestamp[0] >> 4, timestamp[0] & 15, timestamp[1] >> 4, timestamp[1] & 15,
timestamp[2] >> 4, timestamp[2] & 15, timestamp[3] >> 4, timestamp[3] & 15);
fprintf(out, " %d%d:%d%d:%d%d\n",
timestamp[4] >> 4, timestamp[4] & 15, timestamp[5] >> 4, timestamp[5] & 15,
timestamp[6] >> 4, timestamp[6] & 15);
fprintf(out, "CPS Software Version: V%c%c.%c%c\n",
charmap[timestamp[7] & 15], charmap[timestamp[8] & 15],
charmap[timestamp[9] & 15], charmap[timestamp[10] & 15]);
}
} }
// //
@ -407,15 +421,14 @@ static void print_freq(FILE *out, unsigned data)
} }
} }
#if 0
// //
// Check that the radio does support this frequency. // Check that the radio does support this frequency.
// //
static int is_valid_frequency(int mhz) static int is_valid_frequency(int mhz)
{ {
if (mhz >= 108 && mhz <= 520) if (mhz >= 136 && mhz <= 174)
return 1; return 1;
if (mhz >= 700 && mhz <= 999) if (mhz >= 400 && mhz <= 480)
return 1; return 1;
return 0; return 0;
} }
@ -423,11 +436,13 @@ static int is_valid_frequency(int mhz)
// //
// Set the parameters for a given memory channel. // Set the parameters for a given memory channel.
// //
static void setup_channel(int i, char *name, double rx_mhz, double tx_mhz, static void setup_channel(int i, int mode, char *name, double rx_mhz, double tx_mhz,
int tmode, int power, int wide, int scan, int isam) int power, int scanlist, int autoscan, int squelch, int tot, int rxonly,
int admit, int colorcode, int timeslot, int incall, int grouplist, int contact)
{ {
//TODO: always set Data Call Confirmed=1 (wait for SMS acknowledge) //TODO: always set Data Call Confirmed=1 (wait for SMS acknowledge)
//TODO: always set talkaround=0 //TODO: always set talkaround=0
#if 0
memory_channel_t *ch = i + (memory_channel_t*) &radio_mem[OFFSET_CHANNELS]; memory_channel_t *ch = i + (memory_channel_t*) &radio_mem[OFFSET_CHANNELS];
hz_to_freq((int) (rx_mhz * 1000000.0), ch->rxfreq); hz_to_freq((int) (rx_mhz * 1000000.0), ch->rxfreq);
@ -467,8 +482,8 @@ static void setup_channel(int i, char *name, double rx_mhz, double tx_mhz,
*scan_data |= scan << scan_shift; *scan_data |= scan << scan_shift;
encode_name(i, name); encode_name(i, name);
}
#endif #endif
}
// //
// Convert a 4-byte frequency value from binary coded decimal // Convert a 4-byte frequency value from binary coded decimal
@ -583,8 +598,6 @@ static void print_id(FILE *out)
{ {
general_settings_t *gs = (general_settings_t*) &radio_mem[OFFSET_SETTINGS]; general_settings_t *gs = (general_settings_t*) &radio_mem[OFFSET_SETTINGS];
unsigned id = gs->radio_id[0] | (gs->radio_id[1] << 8) | (gs->radio_id[2] << 16); unsigned id = gs->radio_id[0] | (gs->radio_id[1] << 8) | (gs->radio_id[2] << 16);
unsigned char *timestamp = &radio_mem[OFFSET_TIMESTMP];
static const char charmap[16] = "0123456789:;<=>?";
fprintf(out, "Name: "); fprintf(out, "Name: ");
if (gs->radio_name[0] != 0 && gs->radio_name[0] != 0xffff) { if (gs->radio_name[0] != 0 && gs->radio_name[0] != 0xffff) {
@ -593,18 +606,6 @@ static void print_id(FILE *out)
fprintf(out, "-"); fprintf(out, "-");
} }
fprintf(out, "\nID: %u\n", id); fprintf(out, "\nID: %u\n", id);
if (*timestamp != 0xff) {
fprintf(out, "Last Programmed Date: %d%d%d%d-%d%d-%d%d",
timestamp[0] >> 4, timestamp[0] & 15, timestamp[1] >> 4, timestamp[1] & 15,
timestamp[2] >> 4, timestamp[2] & 15, timestamp[3] >> 4, timestamp[3] & 15);
fprintf(out, " %d%d:%d%d:%d%d\n",
timestamp[4] >> 4, timestamp[4] & 15, timestamp[5] >> 4, timestamp[5] & 15,
timestamp[6] >> 4, timestamp[6] & 15);
fprintf(out, "CPS Software Version: V%c%c.%c%c\n",
charmap[timestamp[7] & 15], charmap[timestamp[8] & 15],
charmap[timestamp[9] & 15], charmap[timestamp[10] & 15]);
}
} }
static void print_intro(FILE *out) static void print_intro(FILE *out)
@ -751,17 +752,18 @@ static void print_digital_channels(FILE *out, int verbose)
fprintf(out, "# 2) Name: up to 16 characters, use '_' instead of space\n"); fprintf(out, "# 2) Name: up to 16 characters, use '_' instead of space\n");
fprintf(out, "# 3) Receive frequency in MHz\n"); fprintf(out, "# 3) Receive frequency in MHz\n");
fprintf(out, "# 4) Transmit frequency or +/- offset in MHz\n"); fprintf(out, "# 4) Transmit frequency or +/- offset in MHz\n");
fprintf(out, "# 5) Transmit power: High, Mid, Low\n"); fprintf(out, "# 5) Transmit power: High, Low\n");
fprintf(out, "# 6) Scan list: - or index in Scanlist table\n"); fprintf(out, "# 6) Scan list: - or index in Scanlist table\n");
fprintf(out, "# 7) Squelch level: Normal, Tight\n"); fprintf(out, "# 7) Autoscan flag: -, +\n");
fprintf(out, "# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555\n"); fprintf(out, "# 8) Squelch level: Normal, Tight\n");
fprintf(out, "# 9) Receive only: -, +\n"); fprintf(out, "# 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555\n");
fprintf(out, "# 10) Admit criteria: -, Free, Color\n"); fprintf(out, "# 10) Receive only: -, +\n");
fprintf(out, "# 11) Color code: 1, 2, 3... 15\n"); fprintf(out, "# 11) Admit criteria: -, Free, Color\n");
fprintf(out, "# 12) Time slot: 1 or 2\n"); fprintf(out, "# 12) Color code: 1, 2, 3... 15\n");
fprintf(out, "# 13) In call criteria: -, Admit, TXInt\n"); fprintf(out, "# 13) Time slot: 1 or 2\n");
fprintf(out, "# 14) Receive group list: - or index in Grouplist table\n"); fprintf(out, "# 14) In call criteria: -, Admit, TXInt\n");
fprintf(out, "# 15) Contact for transmit: - or index in Contacts table\n"); fprintf(out, "# 15) Receive group list: - or index in Grouplist table\n");
fprintf(out, "# 16) Contact for transmit: - or index in Contacts table\n");
fprintf(out, "#\n"); fprintf(out, "#\n");
} }
fprintf(out, "Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit Color Slot InCall RxGL TxContact"); fprintf(out, "Digital Name Receive Transmit Power Scan AS Squelch TOT RO Admit Color Slot InCall RxGL TxContact");
@ -841,15 +843,16 @@ static void print_analog_channels(FILE *out, int verbose)
fprintf(out, "# 2) Name: up to 16 characters, use '_' instead of space\n"); fprintf(out, "# 2) Name: up to 16 characters, use '_' instead of space\n");
fprintf(out, "# 3) Receive frequency in MHz\n"); fprintf(out, "# 3) Receive frequency in MHz\n");
fprintf(out, "# 4) Transmit frequency or +/- offset in MHz\n"); fprintf(out, "# 4) Transmit frequency or +/- offset in MHz\n");
fprintf(out, "# 5) Transmit power: High, Mid, Low\n"); fprintf(out, "# 5) Transmit power: High, Low\n");
fprintf(out, "# 6) Scan list: - or index\n"); fprintf(out, "# 6) Scan list: - or index\n");
fprintf(out, "# 7) Squelch level: Normal, Tight\n"); fprintf(out, "# 7) Autoscan flag: -, +\n");
fprintf(out, "# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555\n"); fprintf(out, "# 8) Squelch level: Normal, Tight\n");
fprintf(out, "# 9) Receive only: -, +\n"); fprintf(out, "# 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555\n");
fprintf(out, "# 10) Admit criteria: -, Free, Tone\n"); fprintf(out, "# 10) Receive only: -, +\n");
fprintf(out, "# 11) Guard tone for receive, or '-' to disable\n"); fprintf(out, "# 11) Admit criteria: -, Free, Tone\n");
fprintf(out, "# 12) Guard tone for transmit, or '-' to disable\n"); fprintf(out, "# 12) Guard tone for receive, or '-' to disable\n");
fprintf(out, "# 13) Bandwidth in kHz: 12.5, 20, 25\n"); fprintf(out, "# 13) Guard tone for transmit, or '-' to disable\n");
fprintf(out, "# 14) Bandwidth in kHz: 12.5, 20, 25\n");
fprintf(out, "#\n"); fprintf(out, "#\n");
} }
fprintf(out, "Analog Name Receive Transmit Power Scan AS Squelch TOT RO Admit RxTone TxTone Width"); fprintf(out, "Analog Name Receive Transmit Power Scan AS Squelch TOT RO Admit RxTone TxTone Width");
@ -936,6 +939,8 @@ static void md380_print_config(radio_device_t *radio, FILE *out, int verbose)
fprintf(out, "Radio: %s\n", radio->name); fprintf(out, "Radio: %s\n", radio->name);
print_id(out); print_id(out);
if (verbose)
md380_print_version(radio, out);
print_intro(out); print_intro(out);
// //
@ -1227,24 +1232,160 @@ static void md380_parse_parameter(radio_device_t *radio, char *param, char *valu
// Start_flag is 1 for the first table row. // Start_flag is 1 for the first table row.
// Return 0 on failure. // Return 0 on failure.
// //
static int parse_digital_channel(int first_row, char *line) static int parse_digital_channel(radio_device_t *radio, int first_row, char *line)
{ {
//TODO: parse digital channel Name char num_str[256], name_str[256], rxfreq_str[256], offset_str[256];
//TODO: parse digital channel Receive char power_str[256], scanlist_str[256], autoscan_str[256], squelch_str[256];
//TODO: parse digital channel Transmit char tot_str[256], rxonly_str[256], admit_str[256], colorcode_str[256];
//TODO: parse digital channel Power char slot_str[256], incall_str[256], grouplist_str[256], contact_str[256];
//TODO: parse digital channel Scan int num, power, scanlist, autoscan, squelch, tot, rxonly, admit;
//TODO: parse digital channel AS int colorcode, timeslot, incall, grouplist, contact;
//TODO: parse digital channel Sq double rx_mhz, tx_mhz;
//TODO: parse digital channel TOT
//TODO: parse digital channel RO if (sscanf(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
//TODO: parse digital channel Admit num_str, name_str, rxfreq_str, offset_str,
//TODO: parse digital channel Color power_str, scanlist_str, autoscan_str, squelch_str,
//TODO: parse digital channel Slot tot_str, rxonly_str, admit_str, colorcode_str,
//TODO: parse digital channel InCall slot_str, incall_str, grouplist_str, contact_str) != 16)
//TODO: parse digital channel RxGL return 0;
//TODO: parse digital channel TxContact
return 0; num = atoi(num_str);
if (num < 1 || num > NCHAN) {
fprintf(stderr, "Bad channel number.\n");
return 0;
}
if (sscanf(rxfreq_str, "%lf", &rx_mhz) != 1 ||
!is_valid_frequency(rx_mhz)) {
fprintf(stderr, "Bad receive frequency.\n");
return 0;
}
if (sscanf(offset_str, "%lf", &tx_mhz) != 1) {
badtx: fprintf(stderr, "Bad transmit frequency.\n");
return 0;
}
if (offset_str[0] == '-' || offset_str[0] == '+')
tx_mhz += rx_mhz;
if (! is_valid_frequency(tx_mhz))
goto badtx;
if (strcasecmp("High", power_str) == 0) {
power = POWER_HIGH;
} else if (strcasecmp("Low", power_str) == 0) {
power = POWER_LOW;
} else {
fprintf(stderr, "Bad power level.\n");
return 0;
}
if (*scanlist_str == '-') {
scanlist = 0;
} else {
scanlist = atoi(scanlist_str);
if (scanlist == 0 || scanlist > NSCANL) {
fprintf(stderr, "Bad scanlist.\n");
return 0;
}
}
if (*autoscan_str == '-') {
autoscan = 0;
} else if (*autoscan_str == '+') {
autoscan = 1;
} else {
fprintf(stderr, "Bad autoscan flag.\n");
return 0;
}
squelch = atoi(squelch_str);
if (squelch > 9) {
fprintf(stderr, "Bad squelch level.\n");
return 0;
}
tot = atoi(tot_str);
if (tot > 37) {
fprintf(stderr, "Bad timeout timer.\n");
return 0;
}
tot *= 15;
if (*rxonly_str == '-') {
rxonly = 0;
} else if (*rxonly_str == '+') {
rxonly = 1;
} else {
fprintf(stderr, "Bad receive only flag.\n");
return 0;
}
if (*admit_str == '-' || strcasecmp("Always", admit_str) == 0) {
admit = ADMIT_ALWAYS;
} else if (strcasecmp("Free", admit_str) == 0) {
admit = ADMIT_CH_FREE;
} else if (strcasecmp("Color", admit_str) == 0) {
admit = ADMIT_COLOR;
} else {
fprintf(stderr, "Bad admit criteria.\n");
return 0;
}
colorcode = atoi(colorcode_str);
if (colorcode < 1 || colorcode > 15) {
fprintf(stderr, "Bad color code.\n");
return 0;
}
timeslot = atoi(slot_str);
if (timeslot < 1 || timeslot > 2) {
fprintf(stderr, "Bad timeslot.\n");
return 0;
}
if (*incall_str == '-' || strcasecmp("Always", incall_str) == 0) {
incall = INCALL_ALWAYS;
} else if (strcasecmp("Admit", incall_str) == 0) {
incall = INCALL_ADMIT;
} else {
fprintf(stderr, "Bad incall criteria.\n");
return 0;
}
if (*grouplist_str == '-') {
grouplist = 0;
} else {
grouplist = atoi(grouplist_str);
if (grouplist == 0 || grouplist > NGLISTS) {
fprintf(stderr, "Bad receive grouplist.\n");
return 0;
}
}
if (*contact_str == '-') {
contact = 0;
} else {
contact = atoi(contact_str);
if (contact == 0 || contact > NCONTACTS) {
fprintf(stderr, "Bad transmit contact.\n");
return 0;
}
}
if (first_row && radio->channel_count == 0) {
// On first entry, erase the channel table.
int i;
for (i=0; i<NCHAN; i++) {
setup_channel(i, MODE_ANALOG, 0, 0, 0, POWER_HIGH, 0, 0, 0,
4, 0, 0, 1, 1, 0, 0, 0);
}
}
setup_channel(num-1, MODE_DIGITAL, name_str, rx_mhz, tx_mhz,
power, scanlist, autoscan, squelch, tot, rxonly, admit,
colorcode, timeslot, incall, grouplist, contact);
radio->channel_count++;
return 1;
} }
// //
@ -1252,7 +1393,7 @@ static int parse_digital_channel(int first_row, char *line)
// Start_flag is 1 for the first table row. // Start_flag is 1 for the first table row.
// Return 0 on failure. // Return 0 on failure.
// //
static int parse_analog_channel(int first_row, char *line) static int parse_analog_channel(radio_device_t *radio, int first_row, char *line)
{ {
#if 1 #if 1
//TODO: parse analog channel Name //TODO: parse analog channel Name
@ -1339,16 +1480,17 @@ badtx: fprintf(stderr, "Bad transmit frequency.\n");
return 0; return 0;
} }
if (first_row) { if (first_row && radio->channel_count == 0) {
// On first entry, erase the channel table. // On first entry, erase the channel table.
int i; int i;
for (i=0; i<NCHAN; i++) { for (i=0; i<NCHAN; i++) {
setup_channel(i, 0, 0, 0, 0, 12, 1, 0, 0); setup_channel(i, MODE_ANALOG, 0, 0, 0, 0, 12, 1, 0, 0);
} }
} }
setup_channel(num-1, name_str, rx_mhz, tx_mhz, setup_channel(num-1, MODE_ANALOG, name_str, rx_mhz, tx_mhz,
tmode, power, wide, scan, isam); tmode, power, wide, scan, isam);
radio->channel_count++;
return 1; return 1;
#endif #endif
} }
@ -1490,8 +1632,8 @@ static int md380_parse_header(radio_device_t *radio, char *line)
static int md380_parse_row(radio_device_t *radio, int table_id, int first_row, char *line) static int md380_parse_row(radio_device_t *radio, int table_id, int first_row, char *line)
{ {
switch (table_id) { switch (table_id) {
case 'D': return parse_digital_channel(first_row, line); case 'D': return parse_digital_channel(radio, first_row, line);
case 'A': return parse_analog_channel(first_row, line); case 'A': return parse_analog_channel(radio, first_row, line);
case 'Z': return parse_zones(first_row, line); case 'Z': return parse_zones(first_row, line);
case 'S': return parse_scanlist(first_row, line); case 'S': return parse_scanlist(first_row, line);
case 'C': return parse_contact(first_row, line); case 'C': return parse_contact(first_row, line);

View File

@ -194,6 +194,7 @@ void radio_parse_config(char *filename)
exit(-1); exit(-1);
} }
device->channel_count = 0;
while (fgets(line, sizeof(line), conf)) { while (fgets(line, sizeof(line), conf)) {
line[sizeof(line)-1] = 0; line[sizeof(line)-1] = 0;

View File

@ -89,6 +89,7 @@ struct _radio_device_t {
int (*parse_header)(radio_device_t *radio, char *line); int (*parse_header)(radio_device_t *radio, char *line);
int (*parse_row)(radio_device_t *radio, int table_id, int first_row, char *line); int (*parse_row)(radio_device_t *radio, int table_id, int first_row, char *line);
void (*update_timestamp)(radio_device_t *radio); void (*update_timestamp)(radio_device_t *radio);
int channel_count;
}; };
extern radio_device_t radio_md380; // TYT MD-380 extern radio_device_t radio_md380; // TYT MD-380

9
util.c
View File

@ -271,11 +271,18 @@ int utf8_to_unicode(const char **p)
// //
// Decode UTF-8 string into UCS-2 string, at most nsym characters. // Decode UTF-8 string into UCS-2 string, at most nsym characters.
// Replace underscore by space.
// //
void utf8_decode(unsigned short *dst, const char *src, unsigned nsym) void utf8_decode(unsigned short *dst, const char *src, unsigned nsym)
{ {
for (; nsym > 0; nsym--) { for (; nsym > 0; nsym--) {
if ((*dst++ = utf8_to_unicode(&src)) == 0) { int ch = utf8_to_unicode(&src);
if (ch == '_')
ch = ' ';
*dst++ = ch;
if (ch == 0) {
// Clear the remaining bytes. // Clear the remaining bytes.
while (--nsym > 0) while (--nsym > 0)
*dst++ = 0; *dst++ = 0;

266
uv380.c
View File

@ -106,6 +106,7 @@ typedef struct {
#define ADMIT_ALWAYS 0 #define ADMIT_ALWAYS 0
#define ADMIT_CH_FREE 1 #define ADMIT_CH_FREE 1
#define ADMIT_TONE 2 #define ADMIT_TONE 2
#define ADMIT_COLOR 3
// Byte 5 // Byte 5
uint8_t _unused7 : 4, // 0 uint8_t _unused7 : 4, // 0
@ -342,7 +343,20 @@ static const char *TURNOFF_FREQ[] = { "259.2", "55.2", "???", "-" };
// //
static void uv380_print_version(radio_device_t *radio, FILE *out) static void uv380_print_version(radio_device_t *radio, FILE *out)
{ {
// Nothing to print. unsigned char *timestamp = &radio_mem[OFFSET_TIMESTMP];
static const char charmap[16] = "0123456789:;<=>?";
if (*timestamp != 0xff) {
fprintf(out, "Last Programmed Date: %d%d%d%d-%d%d-%d%d",
timestamp[0] >> 4, timestamp[0] & 15, timestamp[1] >> 4, timestamp[1] & 15,
timestamp[2] >> 4, timestamp[2] & 15, timestamp[3] >> 4, timestamp[3] & 15);
fprintf(out, " %d%d:%d%d:%d%d\n",
timestamp[4] >> 4, timestamp[4] & 15, timestamp[5] >> 4, timestamp[5] & 15,
timestamp[6] >> 4, timestamp[6] & 15);
fprintf(out, "CPS Software Version: V%c%c.%c%c\n",
charmap[timestamp[7] & 15], charmap[timestamp[8] & 15],
charmap[timestamp[9] & 15], charmap[timestamp[10] & 15]);
}
} }
// //
@ -423,15 +437,14 @@ static void print_freq(FILE *out, unsigned data)
} }
} }
#if 0
// //
// Check that the radio does support this frequency. // Check that the radio does support this frequency.
// //
static int is_valid_frequency(int mhz) static int is_valid_frequency(int mhz)
{ {
if (mhz >= 108 && mhz <= 520) if (mhz >= 136 && mhz <= 174)
return 1; return 1;
if (mhz >= 700 && mhz <= 999) if (mhz >= 400 && mhz <= 480)
return 1; return 1;
return 0; return 0;
} }
@ -439,11 +452,13 @@ static int is_valid_frequency(int mhz)
// //
// Set the parameters for a given memory channel. // Set the parameters for a given memory channel.
// //
static void setup_channel(int i, char *name, double rx_mhz, double tx_mhz, static void setup_channel(int i, int mode, char *name, double rx_mhz, double tx_mhz,
int tmode, int power, int wide, int scan, int isam) int power, int scanlist, int autoscan, int squelch, int tot, int rxonly,
int admit, int colorcode, int timeslot, int incall, int grouplist, int contact)
{ {
//TODO: always set Data Call Confirmed=1 (wait for SMS acknowledge) //TODO: always set Data Call Confirmed=1 (wait for SMS acknowledge)
//TODO: always set talkaround=0 //TODO: always set talkaround=0
#if 0
memory_channel_t *ch = i + (memory_channel_t*) &radio_mem[OFFSET_CHANNELS]; memory_channel_t *ch = i + (memory_channel_t*) &radio_mem[OFFSET_CHANNELS];
hz_to_freq((int) (rx_mhz * 1000000.0), ch->rxfreq); hz_to_freq((int) (rx_mhz * 1000000.0), ch->rxfreq);
@ -483,8 +498,8 @@ static void setup_channel(int i, char *name, double rx_mhz, double tx_mhz,
*scan_data |= scan << scan_shift; *scan_data |= scan << scan_shift;
encode_name(i, name); encode_name(i, name);
}
#endif #endif
}
// //
// Convert a 4-byte frequency value from binary coded decimal // Convert a 4-byte frequency value from binary coded decimal
@ -599,8 +614,6 @@ static void print_id(FILE *out)
{ {
general_settings_t *gs = (general_settings_t*) &radio_mem[OFFSET_SETTINGS]; general_settings_t *gs = (general_settings_t*) &radio_mem[OFFSET_SETTINGS];
unsigned id = gs->radio_id[0] | (gs->radio_id[1] << 8) | (gs->radio_id[2] << 16); unsigned id = gs->radio_id[0] | (gs->radio_id[1] << 8) | (gs->radio_id[2] << 16);
unsigned char *timestamp = &radio_mem[OFFSET_TIMESTMP];
static const char charmap[16] = "0123456789:;<=>?";
fprintf(out, "Name: "); fprintf(out, "Name: ");
if (gs->radio_name[0] != 0 && gs->radio_name[0] != 0xffff) { if (gs->radio_name[0] != 0 && gs->radio_name[0] != 0xffff) {
@ -609,18 +622,6 @@ static void print_id(FILE *out)
fprintf(out, "-"); fprintf(out, "-");
} }
fprintf(out, "\nID: %u\n", id); fprintf(out, "\nID: %u\n", id);
if (*timestamp != 0xff) {
fprintf(out, "Last Programmed Date: %d%d%d%d-%d%d-%d%d",
timestamp[0] >> 4, timestamp[0] & 15, timestamp[1] >> 4, timestamp[1] & 15,
timestamp[2] >> 4, timestamp[2] & 15, timestamp[3] >> 4, timestamp[3] & 15);
fprintf(out, " %d%d:%d%d:%d%d\n",
timestamp[4] >> 4, timestamp[4] & 15, timestamp[5] >> 4, timestamp[5] & 15,
timestamp[6] >> 4, timestamp[6] & 15);
fprintf(out, "CPS Software Version: V%c%c.%c%c\n",
charmap[timestamp[7] & 15], charmap[timestamp[8] & 15],
charmap[timestamp[9] & 15], charmap[timestamp[10] & 15]);
}
} }
static void print_intro(FILE *out) static void print_intro(FILE *out)
@ -771,15 +772,16 @@ static void print_digital_channels(FILE *out, int verbose)
fprintf(out, "# 4) Transmit frequency or +/- offset in MHz\n"); fprintf(out, "# 4) Transmit frequency or +/- offset in MHz\n");
fprintf(out, "# 5) Transmit power: High, Mid, Low\n"); fprintf(out, "# 5) Transmit power: High, Mid, Low\n");
fprintf(out, "# 6) Scan list: - or index in Scanlist table\n"); fprintf(out, "# 6) Scan list: - or index in Scanlist table\n");
fprintf(out, "# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n"); fprintf(out, "# 7) Autoscan flag: -, +\n");
fprintf(out, "# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555\n"); fprintf(out, "# 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n");
fprintf(out, "# 9) Receive only: -, +\n"); fprintf(out, "# 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555\n");
fprintf(out, "# 10) Admit criteria: -, Free, Color\n"); fprintf(out, "# 10) Receive only: -, +\n");
fprintf(out, "# 11) Color code: 1, 2, 3... 15\n"); fprintf(out, "# 11) Admit criteria: -, Free, Color\n");
fprintf(out, "# 12) Time slot: 1 or 2\n"); fprintf(out, "# 12) Color code: 1, 2, 3... 15\n");
fprintf(out, "# 13) In call criteria: -, Admit, TXInt\n"); fprintf(out, "# 13) Time slot: 1 or 2\n");
fprintf(out, "# 14) Receive group list: - or index in Grouplist table\n"); fprintf(out, "# 14) In call criteria: -, Admit, TXInt\n");
fprintf(out, "# 15) Contact for transmit: - or index in Contacts table\n"); fprintf(out, "# 15) Receive group list: - or index in Grouplist table\n");
fprintf(out, "# 16) Contact for transmit: - or index in Contacts table\n");
fprintf(out, "#\n"); fprintf(out, "#\n");
} }
fprintf(out, "Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact"); fprintf(out, "Digital Name Receive Transmit Power Scan AS Sq TOT RO Admit Color Slot InCall RxGL TxContact");
@ -865,13 +867,14 @@ static void print_analog_channels(FILE *out, int verbose)
fprintf(out, "# 4) Transmit frequency or +/- offset in MHz\n"); fprintf(out, "# 4) Transmit frequency or +/- offset in MHz\n");
fprintf(out, "# 5) Transmit power: High, Mid, Low\n"); fprintf(out, "# 5) Transmit power: High, Mid, Low\n");
fprintf(out, "# 6) Scan list: - or index\n"); fprintf(out, "# 6) Scan list: - or index\n");
fprintf(out, "# 7) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n"); fprintf(out, "# 7) Autoscan flag: -, +\n");
fprintf(out, "# 8) Transmit timeout timer in seconds: 0, 15, 30, 45... 555\n"); fprintf(out, "# 8) Squelch level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n");
fprintf(out, "# 9) Receive only: -, +\n"); fprintf(out, "# 9) Transmit timeout timer in seconds: 0, 15, 30, 45... 555\n");
fprintf(out, "# 10) Admit criteria: -, Free, Tone\n"); fprintf(out, "# 10) Receive only: -, +\n");
fprintf(out, "# 11) Guard tone for receive, or '-' to disable\n"); fprintf(out, "# 11) Admit criteria: -, Free, Tone\n");
fprintf(out, "# 12) Guard tone for transmit, or '-' to disable\n"); fprintf(out, "# 12) Guard tone for receive, or '-' to disable\n");
fprintf(out, "# 13) Bandwidth in kHz: 12.5, 20, 25\n"); fprintf(out, "# 13) Guard tone for transmit, or '-' to disable\n");
fprintf(out, "# 14) Bandwidth in kHz: 12.5, 20, 25\n");
fprintf(out, "#\n"); fprintf(out, "#\n");
} }
fprintf(out, "Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width"); fprintf(out, "Analog Name Receive Transmit Power Scan AS Sq TOT RO Admit RxTone TxTone Width");
@ -959,6 +962,8 @@ static void uv380_print_config(radio_device_t *radio, FILE *out, int verbose)
fprintf(out, "Radio: %s\n", radio->name); fprintf(out, "Radio: %s\n", radio->name);
print_id(out); print_id(out);
if (verbose)
uv380_print_version(radio, out);
print_intro(out); print_intro(out);
// //
@ -1270,24 +1275,164 @@ static void uv380_parse_parameter(radio_device_t *radio, char *param, char *valu
// Start_flag is 1 for the first table row. // Start_flag is 1 for the first table row.
// Return 0 on failure. // Return 0 on failure.
// //
static int parse_digital_channel(int first_row, char *line) static int parse_digital_channel(radio_device_t *radio, int first_row, char *line)
{ {
//TODO: parse digital channel Name char num_str[256], name_str[256], rxfreq_str[256], offset_str[256];
//TODO: parse digital channel Receive char power_str[256], scanlist_str[256], autoscan_str[256], squelch_str[256];
//TODO: parse digital channel Transmit char tot_str[256], rxonly_str[256], admit_str[256], colorcode_str[256];
//TODO: parse digital channel Power char slot_str[256], incall_str[256], grouplist_str[256], contact_str[256];
//TODO: parse digital channel Scan int num, power, scanlist, autoscan, squelch, tot, rxonly, admit;
//TODO: parse digital channel AS int colorcode, timeslot, incall, grouplist, contact;
//TODO: parse digital channel Sq double rx_mhz, tx_mhz;
//TODO: parse digital channel TOT
//TODO: parse digital channel RO if (sscanf(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
//TODO: parse digital channel Admit num_str, name_str, rxfreq_str, offset_str,
//TODO: parse digital channel Color power_str, scanlist_str, autoscan_str, squelch_str,
//TODO: parse digital channel Slot tot_str, rxonly_str, admit_str, colorcode_str,
//TODO: parse digital channel InCall slot_str, incall_str, grouplist_str, contact_str) != 16)
//TODO: parse digital channel RxGL return 0;
//TODO: parse digital channel TxContact
return 0; num = atoi(num_str);
if (num < 1 || num > NCHAN) {
fprintf(stderr, "Bad channel number.\n");
return 0;
}
if (sscanf(rxfreq_str, "%lf", &rx_mhz) != 1 ||
!is_valid_frequency(rx_mhz)) {
fprintf(stderr, "Bad receive frequency.\n");
return 0;
}
if (sscanf(offset_str, "%lf", &tx_mhz) != 1) {
badtx: fprintf(stderr, "Bad transmit frequency.\n");
return 0;
}
if (offset_str[0] == '-' || offset_str[0] == '+')
tx_mhz += rx_mhz;
if (! is_valid_frequency(tx_mhz))
goto badtx;
if (strcasecmp("High", power_str) == 0) {
power = POWER_HIGH;
} else if (strcasecmp("Mid", power_str) == 0) {
power = POWER_MIDDLE;
} else if (strcasecmp("Low", power_str) == 0) {
power = POWER_LOW;
} else {
fprintf(stderr, "Bad power level.\n");
return 0;
}
if (*scanlist_str == '-') {
scanlist = 0;
} else {
scanlist = atoi(scanlist_str);
if (scanlist == 0 || scanlist > NSCANL) {
fprintf(stderr, "Bad scanlist.\n");
return 0;
}
}
if (*autoscan_str == '-') {
autoscan = 0;
} else if (*autoscan_str == '+') {
autoscan = 1;
} else {
fprintf(stderr, "Bad autoscan flag.\n");
return 0;
}
squelch = atoi(squelch_str);
if (squelch > 9) {
fprintf(stderr, "Bad squelch level.\n");
return 0;
}
tot = atoi(tot_str);
if (tot > 37) {
fprintf(stderr, "Bad timeout timer.\n");
return 0;
}
tot *= 15;
if (*rxonly_str == '-') {
rxonly = 0;
} else if (*rxonly_str == '+') {
rxonly = 1;
} else {
fprintf(stderr, "Bad receive only flag.\n");
return 0;
}
if (*admit_str == '-' || strcasecmp("Always", admit_str) == 0) {
admit = ADMIT_ALWAYS;
} else if (strcasecmp("Free", admit_str) == 0) {
admit = ADMIT_CH_FREE;
} else if (strcasecmp("Color", admit_str) == 0) {
admit = ADMIT_COLOR;
} else {
fprintf(stderr, "Bad admit criteria.\n");
return 0;
}
colorcode = atoi(colorcode_str);
if (colorcode < 1 || colorcode > 15) {
fprintf(stderr, "Bad color code.\n");
return 0;
}
timeslot = atoi(slot_str);
if (timeslot < 1 || timeslot > 2) {
fprintf(stderr, "Bad timeslot.\n");
return 0;
}
if (*incall_str == '-' || strcasecmp("Always", incall_str) == 0) {
incall = INCALL_ALWAYS;
} else if (strcasecmp("Admit", incall_str) == 0) {
incall = INCALL_ADMIT;
} else if (strcasecmp("TXInt", incall_str) == 0) {
incall = INCALL_TXINT;
} else {
fprintf(stderr, "Bad incall criteria.\n");
return 0;
}
if (*grouplist_str == '-') {
grouplist = 0;
} else {
grouplist = atoi(grouplist_str);
if (grouplist == 0 || grouplist > NGLISTS) {
fprintf(stderr, "Bad receive grouplist.\n");
return 0;
}
}
if (*contact_str == '-') {
contact = 0;
} else {
contact = atoi(contact_str);
if (contact == 0 || contact > NCONTACTS) {
fprintf(stderr, "Bad transmit contact.\n");
return 0;
}
}
if (first_row && radio->channel_count == 0) {
// On first entry, erase the channel table.
int i;
for (i=0; i<NCHAN; i++) {
setup_channel(i, MODE_ANALOG, 0, 0, 0, POWER_HIGH, 0, 0, 0,
4, 0, 0, 1, 1, 0, 0, 0);
}
}
setup_channel(num-1, MODE_DIGITAL, name_str, rx_mhz, tx_mhz,
power, scanlist, autoscan, squelch, tot, rxonly, admit,
colorcode, timeslot, incall, grouplist, contact);
radio->channel_count++;
return 1;
} }
// //
@ -1295,7 +1440,7 @@ static int parse_digital_channel(int first_row, char *line)
// Start_flag is 1 for the first table row. // Start_flag is 1 for the first table row.
// Return 0 on failure. // Return 0 on failure.
// //
static int parse_analog_channel(int first_row, char *line) static int parse_analog_channel(radio_device_t *radio, int first_row, char *line)
{ {
#if 1 #if 1
//TODO: parse analog channel Name //TODO: parse analog channel Name
@ -1382,16 +1527,17 @@ badtx: fprintf(stderr, "Bad transmit frequency.\n");
return 0; return 0;
} }
if (first_row) { if (first_row && radio->channel_count == 0) {
// On first entry, erase the channel table. // On first entry, erase the channel table.
int i; int i;
for (i=0; i<NCHAN; i++) { for (i=0; i<NCHAN; i++) {
setup_channel(i, 0, 0, 0, 0, 12, 1, 0, 0); setup_channel(i, MODE_ANALOG, 0, 0, 0, 0, 12, 1, 0, 0);
} }
} }
setup_channel(num-1, name_str, rx_mhz, tx_mhz, setup_channel(num-1, MODE_ANALOG, name_str, rx_mhz, tx_mhz,
tmode, power, wide, scan, isam); tmode, power, wide, scan, isam);
radio->channel_count++;
return 1; return 1;
#endif #endif
} }
@ -1533,8 +1679,8 @@ static int uv380_parse_header(radio_device_t *radio, char *line)
static int uv380_parse_row(radio_device_t *radio, int table_id, int first_row, char *line) static int uv380_parse_row(radio_device_t *radio, int table_id, int first_row, char *line)
{ {
switch (table_id) { switch (table_id) {
case 'D': return parse_digital_channel(first_row, line); case 'D': return parse_digital_channel(radio, first_row, line);
case 'A': return parse_analog_channel(first_row, line); case 'A': return parse_analog_channel(radio, first_row, line);
case 'Z': return parse_zones(first_row, line); case 'Z': return parse_zones(first_row, line);
case 'S': return parse_scanlist(first_row, line); case 'S': return parse_scanlist(first_row, line);
case 'C': return parse_contact(first_row, line); case 'C': return parse_contact(first_row, line);