codeplug

package module
v1.0.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2023 License: LGPL-3.0 Imports: 25 Imported by: 3

README

Codeplug library for MD-380 (and other) DMR Radios

This library provides a go API for reading/modifying/writing codeplug files for TYT MD-380 and other DMR radios.

Supported Models

The following models of radios are currently supported by this library:

  • Alinco DJ-MD40 handhelds
  • TYT MD-2017 / Retevis RT82 handhelds (GPS and non-GPS models)
  • TYT MD-380 / Retevis RT3 handhelds (GPS and non-GPS models; UHF and VHF models)
  • TYT MD-390 / Retevis RT8 handhelds (GPS and non-GPS models; UHF and VHF models)
  • TYT MD-9600 / Retevis RT90 mobiles (GPS and non-GPS models)
  • TYT MD-UV380 / Retevis RT3S handhelds (GPS and non-GPS models)
  • TYT MD-UV390 handhelds (GPS and non-GPS models)

Building It

The genCodeplugInfo and genFileData binaries will be needed when updating/modifying this library. Follow these links for details about building and installing them.

Type make.

Author

Dale Farnsworth dale@farnsworth.org

IRC: libera.chat channel: #md380, user: dfarnsworth

Documentation

Overview

Package codeplug implements access to MD380-style codeplug files. It can read/update/write both .rdt files and .bin files.

Package codeplug implements access to MD380-style codeplug files. It can read/update/write both .rdt files and .bin files.

Package codeplug implements access to MD380-style codeplug files. It can read/update/write both .rdt files and .bin files.

Package codeplug implements access to MD380-style codeplug files. It can read/update/write both .rdt files and .bin files.

Package codeplug implements access to MD380-style codeplug files. It can read/update/write both .rdt files and .bin files.

Package codeplug implements access to MD380-style codeplug files. It can read/update/write both .rdt files and .bin files.

Index

Constants

View Source
const (
	MinProgress = dfu.MinProgress
	MaxProgress = dfu.MaxProgress
)
View Source
const InvalidValueString = "=INVALID="

Variables

This section is empty.

Functions

func AddSuffix added in v0.15.10

func AddSuffix(f *Field, str string) string

func AllFrequencyRanges added in v0.11.9

func AllFrequencyRanges() map[string][]string

func DependentRecords added in v0.15.7

func DependentRecords(records []*Record) (newRecords []*Record, depRecords []*Record)

func ModelTypes added in v1.0.5

func ModelTypes(model string) string

func NameFieldChanged added in v0.16.0

func NameFieldChanged(change *Change)

func NewReader

func NewReader(ioReader io.Reader) *reader

func PrintDependentRecordWithIndex added in v0.15.2

func PrintDependentRecordWithIndex(w io.Writer, r *Record)

func PrintOneLineRecord added in v0.14.8

func PrintOneLineRecord(w io.Writer, r *Record)

func PrintRecord

func PrintRecord(w io.Writer, r *Record)

func PrintRecordWithIndex

func PrintRecordWithIndex(w io.Writer, r *Record)

func PrintRecordWithIndexDep added in v0.15.2

func PrintRecordWithIndexDep(w io.Writer, r *Record, dep bool)

func RadioExists added in v0.9.0

func RadioExists() error

func RandomString added in v0.15.10

func RandomString(n int) string

func RecordsRemoved added in v0.16.0

func RecordsRemoved(change *Change)

func RemoveSuffix added in v0.15.10

func RemoveSuffix(f *Field, str string) string

func RemoveSuffixes added in v0.15.10

func RemoveSuffixes(strs []string) []string

Types

type Change

type Change struct {
	// contains filtered or unexported fields
}

func (*Change) AddChange added in v0.15.2

func (change *Change) AddChange(newChange *Change)

func (*Change) Changes

func (change *Change) Changes() []*Change

func (*Change) Codeplug

func (change *Change) Codeplug() *Codeplug

func (*Change) Complete

func (change *Change) Complete()

func (*Change) Field

func (change *Change) Field() *Field

func (*Change) FieldType

func (change *Change) FieldType() FieldType

func (*Change) Record

func (change *Change) Record() *Record

func (*Change) RecordType

func (change *Change) RecordType() RecordType

func (*Change) Records

func (change *Change) Records() []*Record

func (*Change) Type

func (change *Change) Type() ChangeType

type ChangeType

type ChangeType string
const (
	FieldChange         ChangeType = "FieldChange"
	MoveRecordsChange   ChangeType = "MoveRecordsChange"
	InsertRecordsChange ChangeType = "InsertRecordsChange"
	RemoveRecordsChange ChangeType = "RemoveRecordsChange"
	MoveFieldsChange    ChangeType = "MoveFieldsChange"
	InsertFieldsChange  ChangeType = "InsertFieldsChange"
	RemoveFieldsChange  ChangeType = "RemoveFieldsChange"
	RecordsFieldChange  ChangeType = "RecordsFieldChange"
)

type Codeplug

type Codeplug struct {
	// contains filtered or unexported fields
}

A Codeplug represents a codeplug file.

func Codeplugs

func Codeplugs() []*Codeplug

Codeplugs returns a slice containing all currently open codeplugs.

func NewCodeplug

func NewCodeplug(fType FileType, filename string) (*Codeplug, error)

NewCodeplug returns a Codeplug, given a filename and codeplug type.

func (*Codeplug) AddMissingFields added in v0.14.4

func (cp *Codeplug) AddMissingFields()

func (*Codeplug) AllExts added in v0.8.0

func (cp *Codeplug) AllExts() []string

func (*Codeplug) AllFields added in v0.16.10

func (cp *Codeplug) AllFields() []*Field

func (*Codeplug) AppendRecord added in v0.15.2

func (cp *Codeplug) AppendRecord(r *Record) error

func (*Codeplug) Changed

func (cp *Codeplug) Changed() bool

Changed returns false if the codeplug state is the same as that at the most recent Open or Save/SaveAs operation.

func (*Codeplug) CodeplugInfo added in v0.14.0

func (cp *Codeplug) CodeplugInfo() *CodeplugInfo

func (*Codeplug) ConnectChange

func (cp *Codeplug) ConnectChange(fn func(*Change))

ConnectChange will cause the given function to be called passing the given change.

func (*Codeplug) CurrentHash

func (cp *Codeplug) CurrentHash() [sha256.Size]byte

CurrentHash returns a cryptographic hash of the current (modified) codeplug

func (*Codeplug) ExportJSON added in v0.9.2

func (cp *Codeplug) ExportJSON(filename string) error

func (*Codeplug) ExportText added in v0.9.2

func (cp *Codeplug) ExportText(filename string) (err error)

func (*Codeplug) ExportTextOneLineRecords added in v0.14.8

func (cp *Codeplug) ExportTextOneLineRecords(filename string) (err error)

func (*Codeplug) ExportXLSX added in v0.9.2

func (cp *Codeplug) ExportXLSX(filename string) error

func (*Codeplug) Ext added in v0.8.0

func (cp *Codeplug) Ext() string

func (*Codeplug) FileType

func (cp *Codeplug) FileType() FileType

FileType returns the type of codeplug file (rdt or bin).

func (*Codeplug) Filename

func (cp *Codeplug) Filename() string

Filename returns the path name of the file associated with the codeplug. This is the file named in the most recent Open or SaveAs function.

func (*Codeplug) FindRecordByName

func (cp *Codeplug) FindRecordByName(rType RecordType, name string) *Record

func (*Codeplug) Free

func (cp *Codeplug) Free()

Free frees a codeplug

func (*Codeplug) FrequencyRange added in v0.8.12

func (cp *Codeplug) FrequencyRange() string

func (*Codeplug) FrequencyValidA added in v0.14.0

func (cp *Codeplug) FrequencyValidA(freq float64) bool

func (*Codeplug) FrequencyValidB added in v0.14.0

func (cp *Codeplug) FrequencyValidB(freq float64) bool

func (*Codeplug) HasRecordType added in v0.14.0

func (cp *Codeplug) HasRecordType(rType RecordType) bool

func (*Codeplug) ID

func (cp *Codeplug) ID() string

ID returns a string unique to the codeplug.

func (*Codeplug) ImportText added in v0.14.0

func (cp *Codeplug) ImportText(reader io.Reader) error

func (*Codeplug) InsertRecord

func (cp *Codeplug) InsertRecord(r *Record) error

InsertRecord inserts the given record into the codeplug. The record's index determines the slice index at which it will be inserted. If the name of the record matches that of an existing record, the name is modified to make it unique. An error will be returned if the codeplug's maximum records of that type would be exceeded.

func (*Codeplug) InsertRecordsChange

func (cp *Codeplug) InsertRecordsChange(records []*Record) *Change

func (*Codeplug) Load added in v0.7.0

func (cp *Codeplug) Load(typ string, freqRange string) error

func (*Codeplug) Loaded added in v0.9.0

func (cp *Codeplug) Loaded() bool

func (*Codeplug) MaxRecords

func (cp *Codeplug) MaxRecords(rType RecordType) int

MaxRecords returns a codeplug's maximum number of records of the given Recordtype.

func (*Codeplug) Model added in v0.8.0

func (cp *Codeplug) Model() string

func (*Codeplug) Models added in v0.8.0

func (cp *Codeplug) Models() []string

func (*Codeplug) MoveRecord

func (cp *Codeplug) MoveRecord(dIndex int, r *Record)

MoveRecord moves a record from its current slice index to the given index.

func (*Codeplug) MoveRecordsChange

func (cp *Codeplug) MoveRecordsChange(records []*Record) *Change

func (*Codeplug) ParseRecords

func (cp *Codeplug) ParseRecords(rdr io.Reader, deferValues bool) (records []*Record, depRecords []*Record, err error)

func (*Codeplug) ReadRadio added in v0.9.0

func (cp *Codeplug) ReadRadio(progress func(cur int) error) error

func (*Codeplug) Record

func (cp *Codeplug) Record(rType RecordType) *Record

Record returns the first record of a codeplug's given RecordType.

func (*Codeplug) RecordTypeName added in v0.15.7

func (cp *Codeplug) RecordTypeName(rType RecordType) string

func (*Codeplug) RecordTypes

func (cp *Codeplug) RecordTypes() []RecordType

RecordTypes returns all of the record types of the codeplug except BasicInformation. The BasicInformation record is omitted.

func (*Codeplug) Records

func (cp *Codeplug) Records(rType RecordType) []*Record

Records returns all of a codeplug's records of the given RecordType.

func (*Codeplug) RecordsFieldChange added in v0.14.8

func (cp *Codeplug) RecordsFieldChange(recs []*Record) *Change

func (*Codeplug) RemoveAllRecords added in v0.14.4

func (cp *Codeplug) RemoveAllRecords()

func (*Codeplug) RemoveRecord

func (cp *Codeplug) RemoveRecord(r *Record)

RemoveRecord removes the given record from the codeplug.

func (*Codeplug) RemoveRecordsChange

func (cp *Codeplug) RemoveRecordsChange(records []*Record) *Change

func (*Codeplug) ResolveDeferredValueFields added in v0.15.2

func (cp *Codeplug) ResolveDeferredValueFields(progFunc func(int))

func (*Codeplug) Revert

func (cp *Codeplug) Revert() error

Revert reverts the codeplug to its state after the most recent open or save operation. An error is returned if the new codeplug state is invalid.

func (*Codeplug) Save

func (cp *Codeplug) Save() error

Save stores the state of the Codeplug into its file An error may be returned if the codeplug state is invalid.

func (*Codeplug) SaveAs

func (cp *Codeplug) SaveAs(filename string) error

SaveAs saves the state of the Codeplug into a named file. An error will be returned if the codeplug state is invalid. The named file becomes the current file associated with the codeplug.

func (*Codeplug) SaveToFile

func (cp *Codeplug) SaveToFile(filename string) (err error)

SaveToFile saves the state of the Codeplug into a named file. An error will be returned if the codeplug state is invalid. The state of the codeplug is not changed, so this is useful for use by an autosave function.

func (*Codeplug) SetChanged added in v0.9.0

func (cp *Codeplug) SetChanged()

func (*Codeplug) SetGPSEnabled added in v0.15.10

func (cp *Codeplug) SetGPSEnabled(b bool)

func (*Codeplug) SetRecordsField added in v0.14.8

func (cp *Codeplug) SetRecordsField(recs []*Record, fType FieldType, str string, progFunc func(int)) error

func (*Codeplug) SetUniqueContactNames added in v0.15.10

func (cp *Codeplug) SetUniqueContactNames(b bool)

func (*Codeplug) TextLines added in v0.14.0

func (cp *Codeplug) TextLines() []string

func (*Codeplug) Type added in v0.7.0

func (cp *Codeplug) Type() string

func (*Codeplug) TypesFrequencyRanges added in v0.14.4

func (cp *Codeplug) TypesFrequencyRanges() (types []string, freqRanges map[string][]string)

TypesFrequencyRanges returns the potential codeplug model and freqRange

func (*Codeplug) Valid added in v0.12.7

func (cp *Codeplug) Valid() bool

valid returns nil if all fields in the codeplug are valid.

func (*Codeplug) Warnings added in v0.12.7

func (cp *Codeplug) Warnings() []string

func (*Codeplug) WriteRadio added in v0.9.0

func (cp *Codeplug) WriteRadio(progress func(cur int) error) error

type CodeplugInfo added in v0.7.0

type CodeplugInfo struct {
	Type          string
	Models        []string
	Ext           string
	RdtSize       int
	HeaderSize    int
	TrailerOffset int
	TrailerSize   int
	RecordInfos   []*recordInfo
}

type Field

type Field struct {
	// contains filtered or unexported fields
}

A Field represents a field within a Record.

func (*Field) Change

func (f *Field) Change(previousValue string) *Change

func (*Field) Codeplug added in v0.14.0

func (f *Field) Codeplug() *Codeplug

func (*Field) DeferredString added in v0.15.2

func (f *Field) DeferredString() string

func (*Field) EnablerType added in v0.15.0

func (f *Field) EnablerType() FieldType

EnablerType returns the type of the field's enabling field.

func (*Field) Enables added in v0.16.8

func (f *Field) Enables() []FieldType

func (*Field) FullTypeName

func (f *Field) FullTypeName() string

FullTypeName returns a string containing the field's record's type name and index as well as the field's type name and index. The index is omitted if the MaxRecords or MaxFields is 1.

func (Field) GetString added in v1.0.22

func (f Field) GetString() string

GetString returns the fields value as a string, even if value is invalid.

func (*Field) Index

func (f *Field) Index() int

Index returns the field's slice index.

func (*Field) IndexedStrings

func (f *Field) IndexedStrings() []IndexedString

IndexedStrings returns the IndexedString struct for the field, if any.

func (*Field) IsEnabled

func (f *Field) IsEnabled() bool

IsEnabled returns true if the field is enabled

func (*Field) IsInvalidValue added in v0.15.7

func (f *Field) IsInvalidValue() bool

IsInvalidValue returns true if the field has previously been determined to be invalid. The field can only be invalid if the value read from the codeplug file was invalid.

func (*Field) ListRecordType

func (f *Field) ListRecordType() RecordType

ListRecordType returns the field's list's record type.

func (*Field) MaxFields added in v0.9.5

func (f *Field) MaxFields() int

MaxFields returns the maximum number of fields of the fields type

func (*Field) Record

func (f *Field) Record() *Record

Record returns the record that the field is part of.

func (*Field) SetDefault added in v0.14.4

func (f *Field) SetDefault()

func (*Field) SetIndex

func (f *Field) SetIndex(index int)

SetIndex sets the field's slice index.

func (*Field) SetInvalidValue added in v1.0.1

func (f *Field) SetInvalidValue()

func (*Field) SetStore added in v0.15.0

func (f *Field) SetStore(store bool)

func (*Field) SetString

func (f *Field) SetString(str string) error

SetString set the string's value from the given string, recording a change.

func (*Field) Span

func (f *Field) Span() *Span

Span returns the fields Span struct, if any

func (*Field) SpanStrings added in v0.14.8

func (f *Field) SpanStrings() []string

func (Field) String

func (f Field) String() string

String returns the fields value as a string.

func (*Field) Strings

func (f *Field) Strings() []string

Strings returns a slice of valid string values for the field.

func (*Field) TestSetString added in v0.14.8

func (f *Field) TestSetString(str string) error

func (*Field) Type

func (f *Field) Type() FieldType

Type returns the field's type.

func (*Field) TypeName

func (f *Field) TypeName() string

TypeName returns the field's type's name.

func (*Field) ValueType

func (f *Field) ValueType() ValueType

ValueType returns the field's value's type.

type FieldType

type FieldType string

A FieldType represents a field's type

const (
	FtBdLongPressDuration         FieldType = "LongPressDuration"
	FtBiCpsVersion                FieldType = "CpsVersion"
	FtBiFrequencyRangeA           FieldType = "FrequencyRangeA"
	FtBiFrequencyRangeB           FieldType = "FrequencyRangeB"
	FtBiFrequencyRange_md380      FieldType = "FrequencyRange"
	FtBiFrequencyRange_md390      FieldType = "FrequencyRange"
	FtBiFrequencyRange_md40       FieldType = "FrequencyRange"
	FtBiHighFrequency             FieldType = "HighFrequency"
	FtBiHighFrequencyA            FieldType = "HighFrequencyA"
	FtBiHighFrequencyB            FieldType = "HighFrequencyB"
	FtBiLastProgrammedTime        FieldType = "LastProgrammedTime"
	FtBiLowFrequency              FieldType = "LowFrequency"
	FtBiLowFrequencyA             FieldType = "LowFrequencyA"
	FtBiLowFrequencyB             FieldType = "LowFrequencyB"
	FtBiModel                     FieldType = "Model"
	FtCiAdmitCriteria             FieldType = "AdmitCriteria"
	FtCiAllowInterrupt            FieldType = "AllowInterrupt"
	FtCiAllowTalkaround           FieldType = "AllowTalkaround"
	FtCiAutoscan                  FieldType = "Autoscan"
	FtCiBandwidth                 FieldType = "Bandwidth"
	FtCiChannelMode               FieldType = "ChannelMode"
	FtCiColorCode                 FieldType = "ColorCode"
	FtCiCompressedUdpDataHeader   FieldType = "CompressedUdpDataHeader"
	FtCiContactName               FieldType = "ContactName"
	FtCiCtcssDecode               FieldType = "CtcssDecode"
	FtCiCtcssEncode               FieldType = "CtcssEncode"
	FtCiDCDMSwitch                FieldType = "DCDMSwitch"
	FtCiDQTTurnoffFreq            FieldType = "DQTTurnoffFreq"
	FtCiDataCallConfirmed         FieldType = "DataCallConfirmed"
	FtCiDecode1                   FieldType = "Decode1"
	FtCiDecode2                   FieldType = "Decode2"
	FtCiDecode3                   FieldType = "Decode3"
	FtCiDecode4                   FieldType = "Decode4"
	FtCiDecode5                   FieldType = "Decode5"
	FtCiDecode6                   FieldType = "Decode6"
	FtCiDecode7                   FieldType = "Decode7"
	FtCiDecode8                   FieldType = "Decode8"
	FtCiDisplayPTTID              FieldType = "DisplayPTTID"
	FtCiEmergencyAlarmAck         FieldType = "EmergencyAlarmAck"
	FtCiEmergencySystem           FieldType = "EmergencySystem"
	FtCiGPSSystem                 FieldType = "GPSSystem"
	FtCiGroupList                 FieldType = "GroupList"
	FtCiInCallCriteria            FieldType = "InCallCriteria"
	FtCiLeaderMS                  FieldType = "LeaderMS"
	FtCiLoneWorker                FieldType = "LoneWorker"
	FtCiName                      FieldType = "Name"
	FtCiPower                     FieldType = "Power"
	FtCiPower_uv380               FieldType = "Power"
	FtCiPrivacy                   FieldType = "Privacy"
	FtCiPrivacyNumber             FieldType = "PrivacyNumber"
	FtCiPrivateCallConfirmed      FieldType = "PrivateCallConfirmed"
	FtCiQtReverse                 FieldType = "QtReverse"
	FtCiReceiveGPSInfo            FieldType = "ReceiveGPSInfo"
	FtCiRepeaterSlot              FieldType = "RepeaterSlot"
	FtCiReverseBurst              FieldType = "ReverseBurst"
	FtCiRxFrequency               FieldType = "RxFrequency"
	FtCiRxOnly                    FieldType = "RxOnly"
	FtCiRxRefFrequency            FieldType = "RxRefFrequency"
	FtCiRxSignallingSystem        FieldType = "RxSignallingSystem"
	FtCiScanList_md380            FieldType = "ScanList"
	FtCiScanList_md40             FieldType = "ScanList"
	FtCiSendGPSInfo               FieldType = "SendGPSInfo"
	FtCiSquelch                   FieldType = "Squelch"
	FtCiSquelch_uv380             FieldType = "Squelch"
	FtCiTalkaround                FieldType = "Talkaround"
	FtCiTot                       FieldType = "Tot"
	FtCiTotRekeyDelay             FieldType = "TotRekeyDelay"
	FtCiTxFrequencyOffset         FieldType = "TxFrequencyOffset"
	FtCiTxRefFrequency            FieldType = "TxRefFrequency"
	FtCiTxSignallingSystem        FieldType = "TxSignallingSystem"
	FtCiVox                       FieldType = "Vox"
	FtDcCallID                    FieldType = "CallID"
	FtDcCallReceiveTone           FieldType = "CallReceiveTone"
	FtDcCallType                  FieldType = "CallType"
	FtDcName                      FieldType = "Name"
	FtGlContact                   FieldType = "Contact"
	FtGlName                      FieldType = "Name"
	FtGpDestinationID             FieldType = "DestinationID"
	FtGpGPSDefaultReportInterval  FieldType = "GPSDefaultReportInterval"
	FtGpGPSRevertChannel          FieldType = "GPSRevertChannel"
	FtGsBacklightColor            FieldType = "BacklightColor"
	FtGsBacklightTime             FieldType = "BacklightTime"
	FtGsCHVoiceAnnouncement       FieldType = "CHVoiceAnnouncement"
	FtGsCallAlertToneDuration     FieldType = "CallAlertToneDuration"
	FtGsChFreeIndicationTone      FieldType = "ChFreeIndicationTone"
	FtGsChannelsHangTime          FieldType = "ChannelsHangTime"
	FtGsDisableAllLeds            FieldType = "DisableAllLeds"
	FtGsDisableAllTones           FieldType = "DisableAllTones"
	FtGsEditRadioID               FieldType = "EditRadioID"
	FtGsEnableContactsCSV         FieldType = "EnableContactsCSV"
	FtGsFreqChannelMode           FieldType = "FreqChannelMode"
	FtGsFreqChannelMode_uv380     FieldType = "FreqChannelMode"
	FtGsGroupCallHangTime         FieldType = "GroupCallHangTime"
	FtGsGroupCallMatch            FieldType = "GroupCallMatch"
	FtGsIntroScreen               FieldType = "IntroScreen"
	FtGsIntroScreenLine1          FieldType = "IntroScreenLine1"
	FtGsIntroScreenLine2          FieldType = "IntroScreenLine2"
	FtGsKeypadTones               FieldType = "KeypadTones"
	FtGsLockUnlock                FieldType = "LockUnlock"
	FtGsLoneWorkerReminderTime    FieldType = "LoneWorkerReminderTime"
	FtGsLoneWorkerResponseTime    FieldType = "LoneWorkerResponseTime"
	FtGsMenuControl               FieldType = "MenuControl"
	FtGsMicLevel                  FieldType = "MicLevel"
	FtGsModeSelect                FieldType = "ModeSelect"
	FtGsModeSelectA               FieldType = "ModeSelectA"
	FtGsModeSelectB               FieldType = "ModeSelectB"
	FtGsMonitorType               FieldType = "MonitorType"
	FtGsPcProgPassword            FieldType = "PcProgPassword"
	FtGsPowerOnPassword           FieldType = "PowerOnPassword"
	FtGsPrivateCallHangTime       FieldType = "PrivateCallHangTime"
	FtGsPrivateCallMatch          FieldType = "PrivateCallMatch"
	FtGsPublicZone                FieldType = "PublicZone"
	FtGsPwAndLockEnable           FieldType = "PwAndLockEnable"
	FtGsRadioID                   FieldType = "RadioID"
	FtGsRadioID1                  FieldType = "RadioID1"
	FtGsRadioID2                  FieldType = "RadioID2"
	FtGsRadioID3                  FieldType = "RadioID3"
	FtGsRadioName                 FieldType = "RadioName"
	FtGsRadioProgPassword         FieldType = "RadioProgPassword"
	FtGsRxLowBatteryInterval      FieldType = "RxLowBatteryInterval"
	FtGsSaveModeReceive           FieldType = "SaveModeReceive"
	FtGsSavePreamble              FieldType = "SavePreamble"
	FtGsScanAnalogHangTime        FieldType = "ScanAnalogHangTime"
	FtGsScanDigitalHangTime       FieldType = "ScanDigitalHangTime"
	FtGsSetKeypadLockTime         FieldType = "SetKeypadLockTime"
	FtGsTalkPermitTone            FieldType = "TalkPermitTone"
	FtGsTimeZone                  FieldType = "TimeZone"
	FtGsTwoChannel                FieldType = "TwoChannel"
	FtGsTxMode                    FieldType = "TxMode"
	FtGsTxPreambleDuration        FieldType = "TxPreambleDuration"
	FtGsVoxSensitivity            FieldType = "VoxSensitivity"
	FtMiAnswered                  FieldType = "Answered"
	FtMiBacklight                 FieldType = "Backlight"
	FtMiCallAlert                 FieldType = "CallAlert"
	FtMiDisplayMode               FieldType = "DisplayMode"
	FtMiEdit                      FieldType = "Edit"
	FtMiEditList                  FieldType = "EditList"
	FtMiGps                       FieldType = "Gps"
	FtMiHangTime                  FieldType = "HangTime"
	FtMiIntroScreen               FieldType = "IntroScreen"
	FtMiKeyboardLock              FieldType = "KeyboardLock"
	FtMiLedIndicator              FieldType = "LedIndicator"
	FtMiManualDial                FieldType = "ManualDial"
	FtMiMissed                    FieldType = "Missed"
	FtMiOutgoingRadio             FieldType = "OutgoingRadio"
	FtMiPasswordAndLock           FieldType = "PasswordAndLock"
	FtMiPower                     FieldType = "Power"
	FtMiProgramKey                FieldType = "ProgramKey"
	FtMiProgramRadio              FieldType = "ProgramRadio"
	FtMiRadioCheck                FieldType = "RadioCheck"
	FtMiRadioDisable              FieldType = "RadioDisable"
	FtMiRadioEnable               FieldType = "RadioEnable"
	FtMiRemoteMonitor             FieldType = "RemoteMonitor"
	FtMiScan                      FieldType = "Scan"
	FtMiSquelch                   FieldType = "Squelch"
	FtMiTalkaround                FieldType = "Talkaround"
	FtMiTextMessage               FieldType = "TextMessage"
	FtMiToneOrAlert               FieldType = "ToneOrAlert"
	FtMiVox                       FieldType = "Vox"
	FtNkContact                   FieldType = "Contact"
	FtOtCall                      FieldType = "Call"
	FtOtCallType                  FieldType = "CallType"
	FtOtDTMF                      FieldType = "DTMF"
	FtOtEncode                    FieldType = "Encode"
	FtOtMode                      FieldType = "Mode"
	FtOtTextMessage               FieldType = "TextMessage"
	FtPsBasicKey                  FieldType = "BasicKey"
	FtPsEnhancedKey               FieldType = "EnhancedKey"
	FtRbButton                    FieldType = "Button"
	FtRbButton_md40               FieldType = "Button"
	FtRbButton_rt84               FieldType = "Button"
	FtRbButton_uv380              FieldType = "Button"
	FtSlChannel_md380             FieldType = "Channel"
	FtSlChannel_md40              FieldType = "Channel"
	FtSlName                      FieldType = "Name"
	FtSlPriorityChannel1_md380    FieldType = "PriorityChannel1"
	FtSlPriorityChannel1_md40     FieldType = "PriorityChannel1"
	FtSlPriorityChannel2_md380    FieldType = "PriorityChannel2"
	FtSlPriorityChannel2_md40     FieldType = "PriorityChannel2"
	FtSlPrioritySampleTime        FieldType = "PrioritySampleTime"
	FtSlSignallingHoldTime        FieldType = "SignallingHoldTime"
	FtSlTxDesignatedChannel_md380 FieldType = "TxDesignatedChannel"
	FtSlTxDesignatedChannel_md40  FieldType = "TxDesignatedChannel"
	FtTmTextMessage               FieldType = "TextMessage"
	FtZiChannelA_uv380            FieldType = "ChannelA"
	FtZiChannelB_uv380            FieldType = "ChannelB"
	FtZiChannel_md380             FieldType = "Channel"
	FtZiChannel_md40              FieldType = "Channel"
	FtZiName                      FieldType = "Name"
)

Field types

type FileType

type FileType int

FileType tells whether the codeplug is an rdt file or a bin file.

const (
	FileTypeNone FileType = iota
	FileTypeRdt
	FileTypeBin
	FileTypeNew
	FileTypeText
	FileTypeJSON
	FileTypeXLSX
)

type IndexedString

type IndexedString struct {
	Index  uint16
	String string
}

An IndexedString represents a string corresponding to a field's integer value.

type PositionError added in v0.8.4

type PositionError struct {
	// contains filtered or unexported fields
}

func (*PositionError) Column added in v0.8.4

func (e *PositionError) Column() int

func (*PositionError) Line added in v0.8.4

func (e *PositionError) Line() int

type Record

type Record struct {
	// contains filtered or unexported fields
}

A Record represents a record within a Codeplug.

func (*Record) AllFieldTypes added in v0.14.4

func (r *Record) AllFieldTypes() []FieldType

func (*Record) AllFields added in v0.15.2

func (r *Record) AllFields() []*Field

func (*Record) Codeplug

func (r *Record) Codeplug() *Codeplug

Codeplug returns the codeplug for the record.

func (*Record) Copy

func (or *Record) Copy() *Record

func (*Record) Field

func (r *Record) Field(fType FieldType) *Field

Field returns the first field of the given type in the record.

func (*Record) FieldTypes

func (r *Record) FieldTypes() []FieldType

FieldTypes return all valid FieldTypes for the record.

func (*Record) Fields

func (r *Record) Fields(fType FieldType) []*Field

Fields returns a slice of all fields of the given type in the record.

func (*Record) FindFieldByName

func (r *Record) FindFieldByName(fType FieldType, name string) *Field

func (*Record) FindFieldsByName added in v1.0.22

func (r *Record) FindFieldsByName(fType FieldType, name string) []*Field

func (*Record) FullTypeName added in v0.15.2

func (r *Record) FullTypeName() string

func (*Record) HasFieldType added in v0.14.0

func (r *Record) HasFieldType(fType FieldType) bool

func (*Record) InCodeplug added in v0.15.2

func (r *Record) InCodeplug() bool

func (*Record) Index

func (r *Record) Index() int

Index returns the slice index of the record.

func (*Record) InsertField

func (r *Record) InsertField(f *Field) error

func (*Record) InsertFieldsChange

func (r *Record) InsertFieldsChange(fields []*Field) *Change

func (Record) ListNames

func (rd Record) ListNames() *[]string

ListNames returns a slice of the names of all records in the rDesc.

func (*Record) MaxFields

func (r *Record) MaxFields(fType FieldType) int

MaxFields returns the maximum number of fields of the given type for record.

func (*Record) MaxRecords added in v0.9.5

func (r *Record) MaxRecords() int

func (Record) MemberListNames added in v0.7.2

func (rd Record) MemberListNames(filter func(r *Record) bool) *[]string

MemberListNames returns a slice of possible member list names

func (*Record) MoveField

func (r *Record) MoveField(dIndex int, f *Field)

func (*Record) MoveFieldsChange

func (r *Record) MoveFieldsChange(fields []*Field) *Change

func (*Record) Name

func (r *Record) Name() string

Name returns the record's name.

func (*Record) NameExists added in v0.15.2

func (r *Record) NameExists() bool

func (*Record) NameField

func (r *Record) NameField() *Field

NameField returns the field containing the record's name.

func (*Record) NameFieldType

func (r *Record) NameFieldType() FieldType

NameType returns the fieldtype containing the record's name field.

func (*Record) NamePrefix added in v0.9.5

func (r *Record) NamePrefix() string

func (*Record) Names added in v0.15.0

func (r *Record) Names() []string

func (*Record) NewField

func (r *Record) NewField(fType FieldType) *Field

newField creates and returns the address of a new field of the given type.

func (*Record) NewFieldWithValue

func (r *Record) NewFieldWithValue(fType FieldType, index int, str string) (*Field, error)

func (*Record) RemoveField

func (r *Record) RemoveField(f *Field)

func (*Record) RemoveFieldsChange

func (r *Record) RemoveFieldsChange(fields []*Field) *Change

func (*Record) SetIndex

func (r *Record) SetIndex(index int)

Index set the index of the record.

func (*Record) Type

func (r *Record) Type() RecordType

Type returns the record's type.

func (*Record) TypeName

func (r *Record) TypeName() string

TypeName returns the name of the record's type.

type RecordType

type RecordType string

A RecordType represents a record's type

const (
	RtBasicInformation_md380 RecordType = "BasicInformation"
	RtBasicInformation_md390 RecordType = "BasicInformation"
	RtBasicInformation_md40  RecordType = "BasicInformation"
	RtBasicInformation_uv380 RecordType = "BasicInformation"
	RtButtonDefinitions      RecordType = "ButtonDefinitions"
	RtChannels_md380         RecordType = "Channels"
	RtChannels_md40          RecordType = "Channels"
	RtChannels_rt84          RecordType = "Channels"
	RtChannels_uv380         RecordType = "Channels"
	RtContacts               RecordType = "Contacts"
	RtContacts_uv380         RecordType = "Contacts"
	RtGPSSystems             RecordType = "GPSSystems"
	RtGeneralSettings_md2017 RecordType = "GeneralSettings"
	RtGeneralSettings_md380  RecordType = "GeneralSettings"
	RtGeneralSettings_md40   RecordType = "GeneralSettings"
	RtGeneralSettings_rt84   RecordType = "GeneralSettings"
	RtGeneralSettings_uv380  RecordType = "GeneralSettings"
	RtGroupLists             RecordType = "GroupLists"
	RtMenuItems              RecordType = "MenuItems"
	RtMenuItems_noGPS        RecordType = "MenuItems"
	RtNumberKey              RecordType = "NumberKey"
	RtOneTouch               RecordType = "OneTouch"
	RtPrivacySettings        RecordType = "PrivacySettings"
	RtRadioButtons           RecordType = "RadioButtons"
	RtRadioButtons2          RecordType = "RadioButtons2"
	RtRadioButtons_md2017    RecordType = "RadioButtons"
	RtRadioButtons_md40      RecordType = "RadioButtons"
	RtRadioButtons_rt84      RecordType = "RadioButtons"
	RtRadioButtons_uv380     RecordType = "RadioButtons"
	RtScanLists_md380        RecordType = "ScanLists"
	RtScanLists_md40         RecordType = "ScanLists"
	RtScanLists_uv380        RecordType = "ScanLists"
	RtTextMessages           RecordType = "TextMessages"
	RtZones_md380            RecordType = "Zones"
	RtZones_md40             RecordType = "Zones"
	RtZones_uv380            RecordType = "Zones"
)

Record types

type Span

type Span struct {
	// contains filtered or unexported fields
}

A Span represents a range of values.

func (*Span) Interval added in v0.14.8

func (span *Span) Interval() int

func (*Span) Maximum

func (span *Span) Maximum() int

Maximum returns the maximum value of a Span.

func (*Span) MinString

func (span *Span) MinString() string

MinString return a special string represented by the span's minimum value. If the span doesn't have such a special value, the empty string is returned.

func (*Span) Minimum

func (span *Span) Minimum() int

Minimum returns the minimum value of a Span.

func (*Span) Scale added in v0.14.8

func (span *Span) Scale() int

func (*Span) Step

func (span *Span) Step() int

Step returns the step (minimal increment) for a Span.

type ValueType

type ValueType string

A ValueType represents the type of a field's value

const (
	VtAscii              ValueType = "ascii"
	VtBandwidth          ValueType = "bandwidth"
	VtBiFrequency        ValueType = "biFrequency"
	VtCallID             ValueType = "callID"
	VtCallType           ValueType = "callType"
	VtContactListIndex   ValueType = "contactListIndex"
	VtContactName        ValueType = "contactName"
	VtCpsVersion         ValueType = "cpsVersion"
	VtCtcssDcs           ValueType = "ctcssDcs"
	VtDerefListIndex     ValueType = "derefListIndex"
	VtFrequency          ValueType = "frequency"
	VtFrequencyOffset    ValueType = "frequencyOffset"
	VtGpsListIndex       ValueType = "gpsListIndex"
	VtGpsReportInterval  ValueType = "gpsReportInterval"
	VtHexadecimal32      ValueType = "hexadecimal32"
	VtHexadecimal4       ValueType = "hexadecimal4"
	VtIStrings           ValueType = "iStrings"
	VtIndexedStrings     ValueType = "indexedStrings"
	VtIntroLine          ValueType = "introLine"
	VtListIndex          ValueType = "listIndex"
	VtMemberListIndex    ValueType = "memberListIndex"
	VtName               ValueType = "name"
	VtNkContactListIndex ValueType = "nkContactListIndex"
	VtOffOn              ValueType = "offOn"
	VtOnOff              ValueType = "onOff"
	VtPcPassword         ValueType = "pcPassword"
	VtPrivacyNumber      ValueType = "privacyNumber"
	VtRadioButton        ValueType = "radioButton"
	VtRadioName          ValueType = "radioName"
	VtRadioPassword      ValueType = "radioPassword"
	VtRadioProgPassword  ValueType = "radioProgPassword"
	VtSpan               ValueType = "span"
	VtSpanList           ValueType = "spanList"
	VtTextMessage        ValueType = "textMessage"
	VtTimeStamp          ValueType = "timeStamp"
)

The value types a field may contain

type Warning added in v0.8.10

type Warning struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL