Ravn::Bluez::State::

Connected class

Manage a connected client socket.

Public Instance Methods

on_event( event, data )

Route actor messages to the device.

# File lib/ravn/bluez/state/connected.rb, line 36
def on_event( event, data )
        case event
        when :write
                self.device.write( data )
        end
end
on_start()

Pushdown hook – called when this state first enters the stack.

# File lib/ravn/bluez/state/connected.rb, line 17
def on_start
        self.device.send_startup_message
end
update( * )

Transition if a connection is lost.

# File lib/ravn/bluez/state/connected.rb, line 24
def update( * )
        # Ensure the current health of the socket broker.
        self.device.check_broker

        unless self.device.socket
                self.log.warn "Lost connection to device."
                return :lost_connection
        end
end