Class: Artoo::Drivers::Pebble

Inherits:
Driver
  • Object
show all
Defined in:
lib/artoo/drivers/pebble.rb

Overview

The pebble driver behaviors

Constant Summary collapse

COMMANDS =
[:ping, :notification_sms, :notification_email, :set_nowplaying_metadata,
:get_versions, :get_installed_apps, :remove_app, :get_time, :set_time,
:system_message, :reset]

Instance Method Summary collapse

Instance Method Details

#handle_message_eventsObject



29
30
31
32
33
34
# File 'lib/artoo/drivers/pebble.rb', line 29

def handle_message_events
  while not connection.protocol.messages.empty? do 
    e = connection.protocol.messages.pop
    publish(event_topic_name(e[0].to_s), e[1])
  end          
end

#start_driverObject

Start driver and any required connections



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/artoo/drivers/pebble.rb', line 13

def start_driver
  begin
    every(interval) do
      handle_message_events
    end

    connection.listen_for_events(false)

    super
  rescue Exception => e
    Logger.error "Error starting Pebble driver!"
    Logger.error e.message
    Logger.error e.backtrace.inspect
  end
end