Class: AIXM::Component::Frequency
- Inherits:
-
Object
- Object
- AIXM::Component::Frequency
- Defined in:
- lib/aixm/component/frequency.rb
Overview
Frequencies used by a service.
By default, #reception_f is set to the same value as #transmission_f since most services rely on simplex (aka: non-duplex) two-way communication. For services with one-way communication only such as ATIS, the #reception_f has to be set to nil explicitly!
Cheat Sheet in Pseudo Code:
frequency = AIXM.frequency(
transmission_f: AIXM.f
callsigns: Hash
)
frequency.reception_f = AIXM.f or nil
frequency.type = TYPES or nil
frequency. = AIXM. or nil
frequency.remarks = String or nil
Constant Summary collapse
- TYPES =
{ STD: :standard, ALT: :alternative, EMRG: :emergency, GUARD: :guard, MIL: :military, CIV: :civilian, OTHER: :other # specify in remarks }.freeze
Instance Attribute Summary collapse
-
#callsigns ⇒ Hash
Map from languages (ISO 639-1) to callsigns.
-
#reception_f ⇒ AIXM::F?
Frequency for reception (incoming).
-
#remarks ⇒ String?
Free text remarks.
-
#service ⇒ AIXM::Feature::Service
readonly
Service the frequency belongs to.
-
#timetable ⇒ AIXM::Component::Timetable?
Operating hours.
-
#transmission_f ⇒ AIXM::F
Frequency for transmission (outgoing).
-
#type ⇒ Symbol?
Type of frequency (see TYPES).
Instance Method Summary collapse
-
#initialize(transmission_f:, callsigns:) ⇒ Frequency
constructor
A new instance of Frequency.
- #inspect ⇒ String
-
#to_uid ⇒ String
UID markup.
-
#to_xml ⇒ String
AIXM or OFMX markup.
Constructor Details
#initialize(transmission_f:, callsigns:) ⇒ Frequency
61 62 63 64 |
# File 'lib/aixm/component/frequency.rb', line 61 def initialize(transmission_f:, callsigns:) self.transmission_f, self.callsigns = transmission_f, callsigns self.reception_f = transmission_f end |
Instance Attribute Details
#callsigns ⇒ Hash
Returns map from languages (ISO 639-1) to callsigns.
45 46 47 |
# File 'lib/aixm/component/frequency.rb', line 45 def callsigns @callsigns end |
#reception_f ⇒ AIXM::F?
One-way services such as ATIS should set this to nil and simplex (aka: non-duplex) communication should set this to #transmission_f.
Returns frequency for reception (incoming).
50 51 52 |
# File 'lib/aixm/component/frequency.rb', line 50 def reception_f @reception_f end |
#remarks ⇒ String?
59 60 61 |
# File 'lib/aixm/component/frequency.rb', line 59 def remarks @remarks end |
#service ⇒ AIXM::Feature::Service
36 37 38 |
# File 'lib/aixm/component/frequency.rb', line 36 def service @service end |
#timetable ⇒ AIXM::Component::Timetable?
56 57 58 |
# File 'lib/aixm/component/frequency.rb', line 56 def end |
#transmission_f ⇒ AIXM::F
39 40 41 |
# File 'lib/aixm/component/frequency.rb', line 39 def transmission_f @transmission_f end |
#type ⇒ Symbol?
53 54 55 |
# File 'lib/aixm/component/frequency.rb', line 53 def type @type end |
Instance Method Details
#inspect ⇒ String
67 68 69 |
# File 'lib/aixm/component/frequency.rb', line 67 def inspect %Q(#<#{self.class} transmission_f=#{transmission_f.inspect} callsigns=#{callsigns.inspect}>) end |
#to_uid ⇒ String
106 107 108 109 110 111 112 |
# File 'lib/aixm/component/frequency.rb', line 106 def to_uid builder = Builder::XmlMarkup.new(indent: 2) builder.FqyUid do |fqy_uid| fqy_uid << service.to_uid.indent(2) fqy_uid.valFreqTrans(transmission_f.freq) end end |
#to_xml ⇒ String
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/aixm/component/frequency.rb', line 115 def to_xml builder = Builder::XmlMarkup.new(indent: 2) builder.Fqy do |fqy| fqy << to_uid.indent(2) fqy.valFreqRec(reception_f.freq) if reception_f fqy.uomFreq(transmission_f.unit.upcase.to_s) fqy << .to_xml(as: :Ftt).indent(2) if fqy.txtRmk(remarks) if remarks callsigns.each do |language, callsign| fqy.Cdl do |cdl| cdl.txtCallSign(callsign) cdl.codeLang(language.upcase.to_s) end end fqy.target! end end |