Sha256: 3b7fac2f543e92ebf574f71815382dbc96b76c9137918fc895d5d8b05a09325d
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true require "dry-types" module DjiMqttConnect # Types binding for dry-types module Types include Dry::Types() # DJI does not like null, so it returns Integer 0 instead of a Decimal... NullInteger = Types::Strict::Integer.constrained(eql: 0) # Not a Strict UUID format... turns out DJI doesn't follow one UUID = 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) # Just make sure Timestamps are positive Timestamp = Types::Integer.constrained(gteq: 0) SerialNumber = Types::String # lat/lng coordinates Latitude = NullInteger | Types::JSON::Decimal.constrained(gteq: -90, lteq: 90) Longitude = NullInteger | Types::JSON::Decimal.constrained(gteq: -180, lteq: 180) # Device Details AIRCRAFT_DOMAIN = 0 PAYLOAD_DOMAIN = 1 REMOTE_CONTROLLER_DOMAIN = 2 DOCK_DOMAIN = 3 DeviceDomain = Types::Coercible::Integer.enum(AIRCRAFT_DOMAIN, PAYLOAD_DOMAIN, REMOTE_CONTROLLER_DOMAIN, DOCK_DOMAIN) # dock returns this value as string DeviceType = Types::Integer DeviceSubType = Types::Integer InvalidTemperature = Types::Integer.constrained(gteq: 1300) # maximum temp of k-type thermocouple, errors are usually 30K+ Temperature = InvalidTemperature | Types::JSON::Decimal end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dji_mqtt_connect-0.1.13.1 | lib/dji_mqtt_connect/types.rb |
dji_mqtt_connect-0.1.13 | lib/dji_mqtt_connect/types.rb |