Class: ProconBypassMan::DeviceStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/device_status.rb

Constant Summary collapse

INITIALIZED =
:initialized
RUNNING =
:running
CONNECTED_BUT_SLEEPING =

コードはつながっているが、switchがsleepしているとき

:connected_but_sleeping
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

Class Method Summary collapse

Class Method Details

.change_to_connected_but_error!Object



35
36
37
38
# File 'lib/procon_bypass_man/device_status.rb', line 35

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

.change_to_connected_but_sleeping!Object



20
21
22
23
# File 'lib/procon_bypass_man/device_status.rb', line 20

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

.change_to_device_error!Object



30
31
32
33
# File 'lib/procon_bypass_man/device_status.rb', line 30

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

.change_to_procon_not_found_error!Object



25
26
27
28
# File 'lib/procon_bypass_man/device_status.rb', line 25

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

.change_to_running!Object



15
16
17
18
# File 'lib/procon_bypass_man/device_status.rb', line 15

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

.change_to_setting_syntax_error_and_shutdown!Object



40
41
42
43
# File 'lib/procon_bypass_man/device_status.rb', line 40

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

.currentObject



11
12
13
# File 'lib/procon_bypass_man/device_status.rb', line 11

def self.current
  @@status || INITIALIZED
end