Class: Verizon::EtxClientType

Inherits:
Object
  • Object
show all
Defined in:
lib/verizon/models/etx_client_type.rb

Overview

The type of the client that is to be registered. This is one of the major traffic participant groups considered in V2X communication. The system uses this value to define which topics the client will be able to publish and subscribe to. Values: - Vehicle - Vehicle with an enclosure around the passengers. (Subtypes: PassengerCar, Truck, Bus, EmergencyVehicle, SchoolBus, MaintenanceVehicle) - VulnerableRoadUser - Traffic participants without a protecting enclosure. (Subtypes: Motorcycle, Bicycle, Pedestrian, Scooter) - TrafficLightController - A Traffic light controller system. (Subtypes: NA) - InfrastructureSensor - Sensors that are deployed in the infrastructure. (Subtypes: RoadSideUnit, Camera, Lidar, Radar, InductiveLoop, MagneticSensor) - OnboardSensor - Sensors that are onboard on a vehicle(Subtypes: Camera, Lidar, Radar) - Software - A software system or application. (Subtypes: Platform, Application, NA)

Constant Summary collapse

ETX_CLIENT_TYPE =
[
  # TODO: Write general description for VEHICLE
  VEHICLE = 'Vehicle'.freeze,

  # TODO: Write general description for VULNERABLEROADUSER
  VULNERABLEROADUSER = 'VulnerableRoadUser'.freeze,

  # TODO: Write general description for TRAFFICLIGHTCONTROLLER
  TRAFFICLIGHTCONTROLLER = 'TrafficLightController'.freeze,

  # TODO: Write general description for INFRASTRUCTURESENSOR
  INFRASTRUCTURESENSOR = 'InfrastructureSensor'.freeze,

  # TODO: Write general description for ONBOARDSENSOR
  ONBOARDSENSOR = 'OnboardSensor'.freeze,

  # TODO: Write general description for SOFTWARE
  SOFTWARE = 'Software'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = VEHICLE) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/verizon/models/etx_client_type.rb', line 47

def self.from_value(value, default_value = VEHICLE)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'vehicle' then VEHICLE
  when 'vulnerableroaduser' then VULNERABLEROADUSER
  when 'trafficlightcontroller' then TRAFFICLIGHTCONTROLLER
  when 'infrastructuresensor' then INFRASTRUCTURESENSOR
  when 'onboardsensor' then ONBOARDSENSOR
  when 'software' then SOFTWARE
  else
    default_value
  end
end

.validate(value) ⇒ Object



41
42
43
44
45
# File 'lib/verizon/models/etx_client_type.rb', line 41

def self.validate(value)
  return false if value.nil?

  ETX_CLIENT_TYPE.include?(value)
end