Sha256: 24fe83687633e6cb94832a2208d5504387624caf71ef16ca7e30f6fcbd1905a1

Contents?: true

Size: 1.58 KB

Versions: 33

Compression:

Stored size: 1.58 KB

Contents

class ProconBypassMan::DeviceStatus
  INITIALIZED = :initialized
  RUNNING = :running
  CONNECTED_BUT_SLEEPING = :connected_but_sleeping # コードはつながっているが、switchがsleepしているとき
  PROCON_NOT_FOUND_ERROR = :procon_not_found_error # 繋がっていないとか、デバイスが使えない時
  CONNECTED_BUT_ERROR = :connected_but_error # 実行時エラーあたり
  SETTING_SYNTAX_ERROR_AND_SHUTDOWN = :setting_syntax_error_and_shutdown

  @@status = nil

  def self.current
    @@status || INITIALIZED
  end

  def self.change_to_running!
    @@status = RUNNING
    ProconBypassMan::SyncDeviceStatsJob.perform_async(ProconBypassMan::DeviceStatus.current)
  end

  def self.change_to_connected_but_sleeping!
    @@status = CONNECTED_BUT_SLEEPING
    ProconBypassMan::SyncDeviceStatsJob.perform_async(ProconBypassMan::DeviceStatus.current)
  end

  def self.change_to_procon_not_found_error!
    @@status = PROCON_NOT_FOUND_ERROR
    ProconBypassMan::SyncDeviceStatsJob.perform_async(ProconBypassMan::DeviceStatus.current)
  end

  def self.change_to_device_error!
    @@status = DEVICE_ERROR
    ProconBypassMan::SyncDeviceStatsJob.perform_async(ProconBypassMan::DeviceStatus.current)
  end

  def self.change_to_connected_but_error!
    @@status = CONNECTED_BUT_ERROR
    ProconBypassMan::SyncDeviceStatsJob.perform_async(ProconBypassMan::DeviceStatus.current)
  end

  def self.change_to_setting_syntax_error_and_shutdown!
    @@status = SETTING_SYNTAX_ERROR_AND_SHUTDOWN
    ProconBypassMan::SyncDeviceStatsJob.perform_async(ProconBypassMan::DeviceStatus.current)
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.2.3 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.2.2 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.2.1 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.2.0 lib/procon_bypass_man/device_status.rb
procon_bypass_man-0.1.23 lib/procon_bypass_man/device_status.rb