Class: Verizon::DataFrame
- Defined in:
- lib/verizon/models/data_frame.rb
Overview
The data frame allows sending various advisory and road sign types of information to equipped devices.
Instance Attribute Summary collapse
-
#content ⇒ Object
Always set to 0 and carries no meaning.
-
#duration_time ⇒ Integer
The duration, in units of whole minutes, that a object persists for.
-
#frame_type ⇒ FrameType
The frameType data element provides the type of message to follow in the rest of the message frame structure.
-
#msg_id ⇒ Object
The frameType data element provides the type of message to follow in the rest of the message frame structure.
-
#not_used ⇒ Integer
Always set to 0 and carries no meaning.
-
#not_used1 ⇒ Integer
Always set to 0 and carries no meaning.
-
#not_used2 ⇒ Integer
Always set to 0 and carries no meaning.
-
#not_used3 ⇒ Integer
Always set to 0 and carries no meaning.
-
#priority ⇒ Integer
The relative importance of the sign, on a scale from zero (least important) to seven (most important).
-
#regions ⇒ Array[GeographicalPath]
The data frame is used to support the cross-cutting need in many V2X messages to describe arbitrary spatial areas (polygons, boundary lines, and other basic shapes) required by various message types in a small message size.
-
#start_time ⇒ Integer
Start time expresses the number of elapsed minutes of the current year in the time system being used (typically UTC time).
-
#start_year ⇒ Integer
The V2X year consists of integer values from zero to 4095 representing the year according to the Gregorian calendar date system.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(not_used:, frame_type:, msg_id:, start_time:, duration_time:, priority:, not_used1:, regions:, not_used2:, not_used3:, content:, start_year: SKIP) ⇒ DataFrame
constructor
A new instance of DataFrame.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(not_used:, frame_type:, msg_id:, start_time:, duration_time:, priority:, not_used1:, regions:, not_used2:, not_used3:, content:, start_year: SKIP) ⇒ DataFrame
Returns a new instance of DataFrame.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/verizon/models/data_frame.rb', line 120 def initialize(not_used:, frame_type:, msg_id:, start_time:, duration_time:, priority:, not_used1:, regions:, not_used2:, not_used3:, content:, start_year: SKIP) @not_used = not_used @frame_type = frame_type @msg_id = msg_id @start_year = start_year unless start_year == SKIP @start_time = start_time @duration_time = duration_time @priority = priority @not_used1 = not_used1 @regions = regions @not_used2 = not_used2 @not_used3 = not_used3 @content = content end |
Instance Attribute Details
#content ⇒ Object
Always set to 0 and carries no meaning. Legacy field maintained for backward compatibility.
88 89 90 |
# File 'lib/verizon/models/data_frame.rb', line 88 def content @content end |
#duration_time ⇒ Integer
The duration, in units of whole minutes, that a object persists for. A value of 32000 means that the object persists forever. The range 0..32000 provides for about 22.2 days of maximum duration.
54 55 56 |
# File 'lib/verizon/models/data_frame.rb', line 54 def duration_time @duration_time end |
#frame_type ⇒ FrameType
The frameType data element provides the type of message to follow in the rest of the message frame structure. The following frame types are supported:
- unknown
- advisory
- roadSignage
- commercialSignage
26 27 28 |
# File 'lib/verizon/models/data_frame.rb', line 26 def frame_type @frame_type end |
#msg_id ⇒ Object
The frameType data element provides the type of message to follow in the rest of the message frame structure. The following frame types are supported:
- unknown
- advisory
- roadSignage
- commercialSignage
36 37 38 |
# File 'lib/verizon/models/data_frame.rb', line 36 def msg_id @msg_id end |
#not_used ⇒ Integer
Always set to 0 and carries no meaning. Legacy field maintained for backward compatibility.
16 17 18 |
# File 'lib/verizon/models/data_frame.rb', line 16 def not_used @not_used end |
#not_used1 ⇒ Integer
Always set to 0 and carries no meaning. Legacy field maintained for backward compatibility.
64 65 66 |
# File 'lib/verizon/models/data_frame.rb', line 64 def not_used1 @not_used1 end |
#not_used2 ⇒ Integer
Always set to 0 and carries no meaning. Legacy field maintained for backward compatibility.
78 79 80 |
# File 'lib/verizon/models/data_frame.rb', line 78 def not_used2 @not_used2 end |
#not_used3 ⇒ Integer
Always set to 0 and carries no meaning. Legacy field maintained for backward compatibility.
83 84 85 |
# File 'lib/verizon/models/data_frame.rb', line 83 def not_used3 @not_used3 end |
#priority ⇒ Integer
The relative importance of the sign, on a scale from zero (least important) to seven (most important).
59 60 61 |
# File 'lib/verizon/models/data_frame.rb', line 59 def priority @priority end |
#regions ⇒ Array[GeographicalPath]
The data frame is used to support the cross-cutting need in many V2X messages to describe arbitrary spatial areas (polygons, boundary lines, and other basic shapes) required by various message types in a small message size. This data frame can describe a complex path or region of arbitrary size using either one of the two supported node offset methods (XY offsets or LL offsets) or using simple geometric projections.
73 74 75 |
# File 'lib/verizon/models/data_frame.rb', line 73 def regions @regions end |
#start_time ⇒ Integer
Start time expresses the number of elapsed minutes of the current year in the time system being used (typically UTC time). The value 527040 shall be used for invalid.
48 49 50 |
# File 'lib/verizon/models/data_frame.rb', line 48 def start_time @start_time end |
#start_year ⇒ Integer
The V2X year consists of integer values from zero to 4095 representing the year according to the Gregorian calendar date system. The value of zero shall represent an unknown value.
42 43 44 |
# File 'lib/verizon/models/data_frame.rb', line 42 def start_year @start_year end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/verizon/models/data_frame.rb', line 138 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. not_used = hash.key?('notUsed') ? hash['notUsed'] : nil frame_type = hash.key?('frameType') ? hash['frameType'] : nil msg_id = hash.key?('msgId') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:DataFrameMsgId), hash['msgId'] ) : nil start_time = hash.key?('startTime') ? hash['startTime'] : nil duration_time = hash.key?('durationTime') ? hash['durationTime'] : nil priority = hash.key?('priority') ? hash['priority'] : nil not_used1 = hash.key?('notUsed1') ? hash['notUsed1'] : nil # Parameter is an array, so we need to iterate through it regions = nil unless hash['regions'].nil? regions = [] hash['regions'].each do |structure| regions << (GeographicalPath.from_hash(structure) if structure) end end regions = nil unless hash.key?('regions') not_used2 = hash.key?('notUsed2') ? hash['notUsed2'] : nil not_used3 = hash.key?('notUsed3') ? hash['notUsed3'] : nil content = hash.key?('content') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:DataFrameContent), hash['content'] ) : nil start_year = hash.key?('startYear') ? hash['startYear'] : SKIP # Create object from extracted values. DataFrame.new(not_used: not_used, frame_type: frame_type, msg_id: msg_id, start_time: start_time, duration_time: duration_time, priority: priority, not_used1: not_used1, regions: regions, not_used2: not_used2, not_used3: not_used3, content: content, start_year: start_year) end |
.names ⇒ Object
A mapping from model property names to API property names.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/verizon/models/data_frame.rb', line 91 def self.names @_hash = {} if @_hash.nil? @_hash['not_used'] = 'notUsed' @_hash['frame_type'] = 'frameType' @_hash['msg_id'] = 'msgId' @_hash['start_year'] = 'startYear' @_hash['start_time'] = 'startTime' @_hash['duration_time'] = 'durationTime' @_hash['priority'] = 'priority' @_hash['not_used1'] = 'notUsed1' @_hash['regions'] = 'regions' @_hash['not_used2'] = 'notUsed2' @_hash['not_used3'] = 'notUsed3' @_hash['content'] = 'content' @_hash end |
.nullables ⇒ Object
An array for nullable fields
116 117 118 |
# File 'lib/verizon/models/data_frame.rb', line 116 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
109 110 111 112 113 |
# File 'lib/verizon/models/data_frame.rb', line 109 def self.optionals %w[ start_year ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/verizon/models/data_frame.rb', line 185 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.not_used, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.frame_type, ->(val) { FrameType.validate(val) }) and UnionTypeLookUp.get(:DataFrameMsgId) .validate(value.msg_id) and APIHelper.valid_type?(value.start_time, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.duration_time, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.priority, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.not_used1, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.regions, ->(val) { GeographicalPath.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.not_used2, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.not_used3, ->(val) { val.instance_of? Integer }) and UnionTypeLookUp.get(:DataFrameContent) .validate(value.content) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['notUsed'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['frameType'], ->(val) { FrameType.validate(val) }) and UnionTypeLookUp.get(:DataFrameMsgId) .validate(value['msgId']) and APIHelper.valid_type?(value['startTime'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['durationTime'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['priority'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['notUsed1'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['regions'], ->(val) { GeographicalPath.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['notUsed2'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['notUsed3'], ->(val) { val.instance_of? Integer }) and UnionTypeLookUp.get(:DataFrameContent) .validate(value['content']) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
255 256 257 258 259 260 261 262 263 |
# File 'lib/verizon/models/data_frame.rb', line 255 def inspect class_name = self.class.name.split('::').last "<#{class_name} not_used: #{@not_used.inspect}, frame_type: #{@frame_type.inspect}, msg_id:"\ " #{@msg_id.inspect}, start_year: #{@start_year.inspect}, start_time:"\ " #{@start_time.inspect}, duration_time: #{@duration_time.inspect}, priority:"\ " #{@priority.inspect}, not_used1: #{@not_used1.inspect}, regions: #{@regions.inspect},"\ " not_used2: #{@not_used2.inspect}, not_used3: #{@not_used3.inspect}, content:"\ " #{@content.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
246 247 248 249 250 251 252 |
# File 'lib/verizon/models/data_frame.rb', line 246 def to_s class_name = self.class.name.split('::').last "<#{class_name} not_used: #{@not_used}, frame_type: #{@frame_type}, msg_id: #{@msg_id},"\ " start_year: #{@start_year}, start_time: #{@start_time}, duration_time: #{@duration_time},"\ " priority: #{@priority}, not_used1: #{@not_used1}, regions: #{@regions}, not_used2:"\ " #{@not_used2}, not_used3: #{@not_used3}, content: #{@content}>" end |