Class: Crubyflie::CrubyflieURI

Inherits:
Object
  • Object
show all
Defined in:
lib/crubyflie/driver/radio_driver.rb

Overview

Small URI class since Ruby URI < 1.9.3 gives problems parsing Crazyflie URIs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri_str) ⇒ CrubyflieURI

Initialize an URI

Parameters:

  • uri_str (String)

    the URI



35
36
37
38
39
40
41
42
# File 'lib/crubyflie/driver/radio_driver.rb', line 35

def initialize(uri_str)
    @uri_str = uri_str
    @scheme, @dongle, @channel, @rate = split()
    if @scheme.nil? || @dongle.nil? || @channel.nil? || @rate.nil? ||
            @scheme != 'radio'
        raise InvalidURIException.new('Bad URI')
    end
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



32
33
34
# File 'lib/crubyflie/driver/radio_driver.rb', line 32

def channel
  @channel
end

#dongleObject (readonly)

Returns the value of attribute dongle.



32
33
34
# File 'lib/crubyflie/driver/radio_driver.rb', line 32

def dongle
  @dongle
end

#rateObject (readonly)

Returns the value of attribute rate.



32
33
34
# File 'lib/crubyflie/driver/radio_driver.rb', line 32

def rate
  @rate
end

#schemeObject (readonly)

Returns the value of attribute scheme.



32
33
34
# File 'lib/crubyflie/driver/radio_driver.rb', line 32

def scheme
  @scheme
end

Instance Method Details

#to_sString

Return URI as string

Returns:

  • (String)

    a string representation of the URI



46
47
48
# File 'lib/crubyflie/driver/radio_driver.rb', line 46

def to_s
    @uri_str
end