Ravn::Net::

Message class

A message passed between nodes on a LAN.

Constants

OPTIONAL_FIELDS

An Array of Symbols containing the names of optional fields in addition to the superclass

REQUIRED_FIELDS

An Array of Symbols containing the names of required fields in addition to the superclass.

VALID_FIELDS

An Array of Symbols containing the names of all valid fields in addition to the superclass

Attributes

callsign RW

The callsign associated with the event

ce RW

The (optional) ce of the event

detail RW

The (optional) detail of the event

hae RW

The (optional) hae (decimal height-above-ellipsoid in meters) of the event

item RW

The (optional) item of the event

le RW

The (optional) le of the event

opex RW

The (optional) opex of the event

origin_event R

The ZRE event that sent this message (if there was one)

pos RW

The (optional) pos (tuple of decimal latitude, longitude) of the event

priority RW

The (optional) priority of the event

source R

The unique ID of the message’s source

to RW

The callsign of the intended recipient of the message

version R

The version of the Ravn-Net protocol.

Public Class Methods

new( type, fields={} )

Create a new event of the specified type and with the given payload.

# File lib/ravn/net/message.rb, line 53
def initialize( type, fields={} )
        super

        @version  = fields[ :version ] || Ravn::Net::Protocol.version
        @source   = fields[ :source ]  || Ravn::Net.node_id

        @priority = fields[ :priority ]
        @pos      = fields[ :pos ]
        @hae      = fields[ :hae ]
        @ce       = fields[ :ce ]
        @le       = fields[ :le ]
        @opex     = fields[ :opex ]
        @item     = fields[ :item ]
        @detail   = fields[ :detail ]
        @to       = fields[ :to ]

        @origin_event = fields[ :origin_event ]
        @callsign = fields[ :callsign ] || @origin_event&.peer_name
end
optional_fields()

Return an Array of Symbols that describe which fields are optional for messages.

# File lib/ravn/net/message.rb, line 40
def self::optional_fields
        return super | OPTIONAL_FIELDS
end
required_fields()

Return an Array of Symbols that describe which fields are required for messages.

# File lib/ravn/net/message.rb, line 33
def self::required_fields
        return super | REQUIRED_FIELDS
end
valid_fields()

Return an Array of Symbols that describe which fields are valid for messages.

# File lib/ravn/net/message.rb, line 47
def self::valid_fields
        return super | VALID_FIELDS
end

Public Instance Methods

inspect_details()

Return the detail part of the inspect output.

# File lib/ravn/net/message.rb, line 132
def inspect_details
        details = "{%s} %s id: %s ver: %s time: %0.3f source: %s (%s) to: %s, data: %p" % [
                self.type,
                self.callsign,
                self.id,
                self.version,
                self.time,
                self.source,
                self.callsign,
                self.to || "(all)",
                self.data,
        ]

        return details
end