Sha256: a93e3056ffbd596db71dc1d312dbc63eb3e2580fb7f1ef33052a3c151bd7b49b
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 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) # 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
5 entries across 5 versions & 1 rubygems