Module: DjiMqttConnect::Types

Defined in:
lib/dji_mqtt_connect/types.rb

Overview

Types binding for dry-types

Constant Summary collapse

NullInteger =

DJI does not like null, so it returns Integer 0 instead of a Decimal…

Types::Strict::Integer.constrained(eql: 0)
ErrorInteger =

Negative values indicate a fault

Types::Strict::Integer.constrained(lt: 0)
UUID =

Not a Strict UUID format… turns out DJI doesn’t follow one

Strict::String.constrained(format: /\A[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\z/i)
Timestamp =

Just make sure Timestamps are 13 digits long

Types::Integer & Types::Coercible::String.constrained(format: /\A[1-9][0-9]{12}\z/)
SerialNumber =

Serial Numbers are alphanumeric with optional hyphen

Types::String.constrained(format: /\A[0-9A-Z]+(-[0-9A-Z]+)?\z/)
FlightID =

Flight ID is a string with at least 1 character

Types::String.constrained(min_size: 1)
Latitude =

lat/lng coordinates

NullInteger | Types::JSON::Decimal.constrained(gteq: -90, lteq: 90)
Longitude =
NullInteger | Types::JSON::Decimal.constrained(gteq: -180, lteq: 180)
AIRCRAFT_DOMAIN =

Device Details

0
PAYLOAD_DOMAIN =
1
REMOTE_CONTROLLER_DOMAIN =
2
DOCK_DOMAIN =
3
DeviceDomain =

dock returns this value as string

Types::Coercible::Integer.enum(AIRCRAFT_DOMAIN, PAYLOAD_DOMAIN, REMOTE_CONTROLLER_DOMAIN, DOCK_DOMAIN)
DeviceType =
Types::Integer
DeviceSubType =
Types::Integer
InvalidTemperature =

maximum temp of k-type thermocouple, errors are usually 30K+

Types::Integer.constrained(gteq: 1300)
Temperature =
InvalidTemperature | Types::JSON::Decimal
EventsProgressStepKey =

bid”,“check_work_mode”:“Check whether to enter remote debugging mode”,“check_task_state”:“Check if the DJI Dock is free”,“land_mcu_reboot”:“Land MCU reboot”,“rain_mcu_reboot”:“Weather station MCU reboot”,“core_mcu_reboot”:“Central control MCU reboot”,“sdr_reboot”:“SDR reboot”,“write_reboot_param_file”:“Write reboot flag”,“get_drone_power_state”:“Get battery charge state”,“close_putter”:“Close the putter”,“check_wired_connect_state”:“Get aircraft state”,“open_drone”:“Open the plane”,“open_alarm”:“Open sound and light alarm”,“check_scram_state”:“Check if the emergency stop switch is pressed”,“open_cover”:“Open the hatch”,“check_drone_sdr_connect_state”:“Establish SDR wireless connection”,“turn_on_drone”:“Turn the plane on”,“drone_paddle_forward”:“Turn on forward paddle”,“close_cover”:“Close the hatch”,“drone_paddle_reverse”:“Turn on reverse paddle”,“drone_paddle_stop”:“Stop Paddle Rotation”,“free_putter”:“Free Putter”,“stop_charge”:“Stop charging”

Types::String.enum(
  "get_bid",
  "check_work_mode",
  "check_task_state",
  "land_mcu_reboot",
  "rain_mcu_reboot",
  "core_mcu_reboot",
  "sdr_reboot",
  "write_reboot_param_file",
  "get_drone_power_state",
  "close_putter",
  "check_wired_connect_state",
  "open_drone",
  "open_alarm",
  "check_scram_state",
  "open_cover",
  "check_drone_sdr_connect_state",
  "turn_on_drone",
  "drone_paddle_forward",
  "close_cover",
  "drone_paddle_reverse",
  "drone_paddle_stop",
  "free_putter",
  "stop_charge",
  "plc_check"
)
ServicesOutputStatus =

progress”,“ok”:“success”,“paused”:“paused”,“rejected”:“rejected”,“failed”:“failed”,“canceled”:“canceled or stopped”,“timeout”:“timeout”

Types::String.enum(
  SERVICE_OUTPUT_STATUS_SENT = "sent",
  SERVICE_OUTPUT_STATUS_IN_PROGRESS = "in_progress",
  SERVICE_OUTPUT_STATUS_OK = "ok",
  SERVICE_OUTPUT_STATUS_PAUSED = "paused",
  SERVICE_OUTPUT_STATUS_REJECTED = "rejected",
  SERVICE_OUTPUT_STATUS_FAILED = "failed",
  SERVICE_OUTPUT_STATUS_CANCELED = "canceled",
  SERVICE_OUTPUT_STATUS_TIMEOUT = "timeout"
)
VideoQuality =

Video Quality definition”,“3”:“High definition”,“4”:“Ultra-high definition”

Types::Integer.enum(
  VIDEO_QUALITY_ADAPTIVE = 0,
  VIDEO_QUALITY_SMOOTH = 1,
  VIDEO_QUALITY_STANDARD_DEFINITION = 2,
  VIDEO_QUALITY_HIGH_DEFINITION = 3,
  VIDEO_QUALITY_ULTRA_HIGH_DEFINITION = 4
)
VideoType =

Video Type “ir”:“Infrared”,“normal”:“Default”,“wide”:“Wide-angle”,“zoom”:“Zoom”

Types::String.enum(
  VIDEO_TYPE_INFRARED = "ir",
  VIDEO_TYPE_NORMAL = "normal",
  VIDEO_TYPE_WIDE_ANGLE = "wide",
  VIDEO_TYPE_ZOOM = "zoom"
)
ResultCode =

Result for messages

Types::Integer.constrained(gteq: 0)