Remove variable parameters in shortcuts functions in RADIO

Plus some other small tweaks
This commit is contained in:
Grey-Echo 2017-03-20 21:38:33 +01:00
parent baa17a4cb7
commit 340c6d0820

View File

@ -79,7 +79,6 @@
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
RADIO = { RADIO = {
ClassName = "RADIO", ClassName = "RADIO",
Positionable,
FileName = "", FileName = "",
Frequency = 0, Frequency = 0,
Modulation = radio.modulation.AM, Modulation = radio.modulation.AM,
@ -205,22 +204,22 @@ end
--- Check validity of the subtitle and the subtitleDuration passed and sets RADIO.subtitle and RADIO.subtitleDuration --- Check validity of the subtitle and the subtitleDuration passed and sets RADIO.subtitle and RADIO.subtitleDuration
-- @param #RADIO self -- @param #RADIO self
-- @param #string SubTitle -- @param #string Subtitle
-- @param #number SubTitleDuration in s -- @param #number SubtitleDuration in s
-- @return #RADIO self -- @return #RADIO self
-- @usage -- @usage
-- -- Both parameters are mandatory, since it wouldn't make much sense to change the Subtitle and not its duration -- -- Both parameters are mandatory, since it wouldn't make much sense to change the Subtitle and not its duration
function RADIO:SetSubtitle(SubTitle, SubTitleDuration) function RADIO:SetSubtitle(Subtitle, SubtitleDuration)
self:F2({SubTitle, SubTitleDuration}) self:F2({Subtitle, SubtitleDuration})
if type(SubTitle) == "string" then if type(Subtitle) == "string" then
self.Subtitle = SubTitle self.Subtitle = Subtitle
else else
self.Subtitle = "" self.Subtitle = ""
self:E({"Subtitle is invalid. Subtitle reset.", self.Subtitle}) self:E({"Subtitle is invalid. Subtitle reset.", self.Subtitle})
end end
if type(SubTitleDuration) == "number" then if type(SubtitleDuration) == "number" then
if math.floor(math.abs(SubTitleDuration)) == SubTitleDuration then if math.floor(math.abs(SubtitleDuration)) == SubtitleDuration then
self.SubtitleDuration = SubTitleDuration self.SubtitleDuration = SubtitleDuration
return self return self
end end
end end
@ -230,7 +229,7 @@ end
--- Create a new transmission, that is to say, populate the RADIO with relevant data --- Create a new transmission, that is to say, populate the RADIO with relevant data
-- @param #RADIO self -- @param #RADIO self
-- @param #string Filename -- @param #string FileName
-- @param #number Frequency in MHz -- @param #number Frequency in MHz
-- @param #number Modulation either radio.modulation.AM or radio.modulation.FM -- @param #number Modulation either radio.modulation.AM or radio.modulation.FM
-- @param #number Power in W -- @param #number Power in W
@ -239,13 +238,13 @@ end
-- -- In this function the data is especially relevant if the broadcaster is anything but a UNIT or a GROUP, -- -- In this function the data is especially relevant if the broadcaster is anything but a UNIT or a GROUP,
-- but it will work with a UNIT or a GROUP anyway -- but it will work with a UNIT or a GROUP anyway
-- -- Only the RADIO and the Filename are mandatory -- -- Only the RADIO and the Filename are mandatory
function RADIO:NewGenericTransmission(...) function RADIO:NewGenericTransmission(FileName, Frequency, Modulation, Power)
self:F(arg) self:F({FileName, Frequency, Modulation, Power})
self:SetFileName(arg[1]) self:SetFileName(FileName)
if arg[2] then self:SetFrequency(arg[2]) end if Frequency then self:SetFrequency(Frequency) end
if arg[3] then self:SetModulation(arg[3]) end if Modulation then self:SetModulation(Modulation) end
if arg[4] then self:SetPower(arg[4]) end if Power then self:SetPower(Power) end
return self return self
end end
@ -253,7 +252,7 @@ end
--- Create a new transmission, that is to say, populate the RADIO with relevant data --- Create a new transmission, that is to say, populate the RADIO with relevant data
-- @param #RADIO self -- @param #RADIO self
-- @param #string Filename -- @param #string FileName
-- @param #string Subtitle -- @param #string Subtitle
-- @param #number SubtitleDuration in s -- @param #number SubtitleDuration in s
-- @param #number Frequency in MHz -- @param #number Frequency in MHz
@ -264,15 +263,15 @@ end
-- -- In this function the data is especially relevant if the broadcaster is a UNIT or a GROUP, -- -- In this function the data is especially relevant if the broadcaster is a UNIT or a GROUP,
-- but it will work for any POSITIONABLE -- but it will work for any POSITIONABLE
-- -- Only the RADIO and the Filename are mandatory -- -- Only the RADIO and the Filename are mandatory
function RADIO:NewUnitTransmission(...) function RADIO:NewUnitTransmission(FileName, Subtitle, SubtitleDuration, Frequency, Modulation, Loop)
self:F(arg) self:F({FileName, Subtitle, SubtitleDuration, Frequency, Modulation, Loop})
self:SetFileName(arg[1]) self:SetFileName(FileName)
if arg[2] then self:SetSubtitle(arg[2]) end if Subtitle then self:SetSubtitle(Subtitle) end
if arg[3] then self:SetSubtitleDuration(arg[3]) end if SubtitleDuration then self:SetSubtitleDuration(SubtitleDuration) end
if arg[4] then self:SetFrequency(arg[4]) end if Frequency then self:SetFrequency(Frequency) end
if arg[5] then self:SetModulation(arg[5]) end if Modulation then self:SetModulation(Modulation) end
if arg[6] then self:SetLoop(arg[6]) end if Loop then self:SetLoop(Loop) end
return self return self
end end