Sha256: e903bba767659f959a8021a70d1c1691ae61637ab08ef6451470a2124a80d1ab

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

module Pione
  module Location
    # `NotificationBroadcastScheme` is a scheme for PIONE notification protocol
    # using UDP broadcast.
    #
    # @example
    #     URI.parse("pnb://255.255.255.255:56000")
    class NotificationBroadcastScheme < LocationScheme('pnb')
      COMPONENT = [:scheme, :host, :port]
    end

    # `NotificationUnicastScheme` is a scheme for PIONE notification protocol
    # using UDP unicast.
    #
    # @example
    #   URI.parse("pnu://192.168.100.10:56000")
    class NotificationUnicastScheme < LocationScheme('pnu')
      COMPONENT = [:scheme, :host, :port]
    end

    # `NotificationMulticastScheme` is a scheme for PIONE notification protocol
    # using UDP multicast.
    #
    # @example
    #     URI.parse("pnm://239.1.2.3:56000")
    #     URI.parse("pnm://239.1.2.4.56000?if=192.168.100.100")
    class NotificationMulticastScheme < LocationScheme('pnm')
      COMPONENT = [:scheme, :host, :port, :query] # path is fake

      def interface
        query_table["if"] if query
      end

      private

      def query_table
        if query
          query.split("&").each_with_object({}) do |part, table|
            key, val = part.split("=")
            table[key] = val
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pione-0.5.0 lib/pione/location/notification-scheme.rb
pione-0.5.0.alpha.2 lib/pione/location/notification-scheme.rb
pione-0.5.0.alpha.1 lib/pione/location/notification-scheme.rb
pione-0.4.2 lib/pione/location/notification-scheme.rb
pione-0.4.1 lib/pione/location/notification-scheme.rb
pione-0.4.0 lib/pione/location/notification-scheme.rb