Class: Ocpp::Rails::Configuration
- Inherits:
-
Object
- Object
- Ocpp::Rails::Configuration
- Defined in:
- lib/ocpp/rails.rb
Instance Attribute Summary collapse
-
#authentication_mode ⇒ Object
Returns the value of attribute authentication_mode.
-
#authorization_cleanup_enabled ⇒ Object
Returns the value of attribute authorization_cleanup_enabled.
-
#authorization_hooks ⇒ Object
Returns the value of attribute authorization_hooks.
-
#authorization_retention_days ⇒ Object
Returns the value of attribute authorization_retention_days.
-
#connection_timeout ⇒ Object
Returns the value of attribute connection_timeout.
-
#heartbeat_interval ⇒ Object
Returns the value of attribute heartbeat_interval.
-
#implausible_energy_jump_wh ⇒ Object
Returns the value of attribute implausible_energy_jump_wh.
-
#max_connection_attempts_per_minute ⇒ Object
Returns the value of attribute max_connection_attempts_per_minute.
-
#max_messages_per_minute ⇒ Object
Returns the value of attribute max_messages_per_minute.
-
#ocpp_version ⇒ Object
Returns the value of attribute ocpp_version.
-
#state_change_cleanup_enabled ⇒ Object
Returns the value of attribute state_change_cleanup_enabled.
-
#state_change_hooks ⇒ Object
Returns the value of attribute state_change_hooks.
-
#state_change_retention_days ⇒ Object
Returns the value of attribute state_change_retention_days.
-
#supported_versions ⇒ Object
Returns the value of attribute supported_versions.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register_authorization_hook(hook) ⇒ Object
- #register_state_change_hook(hook) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ocpp/rails.rb', line 42 def initialize @ocpp_version = "1.6" # Only 1.6 is implemented; expand when 2.x support lands. @supported_versions = [ "1.6" ] @heartbeat_interval = 300 @connection_timeout = 30 @state_change_hooks = [] @authorization_hooks = [] @state_change_retention_days = 30 @state_change_cleanup_enabled = true @authorization_retention_days = 30 @authorization_cleanup_enabled = true # Max plausible energy register increase between samples, in Wh; # readings jumping further are flagged. nil disables the check. @implausible_energy_jump_wh = 1_000_000 # :basic (OCPP-J Security Profile 1, HTTP Basic Auth) or :none. # :none accepts any client that knows a station identifier - only # for closed networks or during migration. @authentication_mode = :basic # Per-station ingress limits (fixed 60s windows, per process); # nil disables the respective check. @max_messages_per_minute = 300 @max_connection_attempts_per_minute = 12 end |
Instance Attribute Details
#authentication_mode ⇒ Object
Returns the value of attribute authentication_mode.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def authentication_mode @authentication_mode end |
#authorization_cleanup_enabled ⇒ Object
Returns the value of attribute authorization_cleanup_enabled.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def @authorization_cleanup_enabled end |
#authorization_hooks ⇒ Object
Returns the value of attribute authorization_hooks.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def @authorization_hooks end |
#authorization_retention_days ⇒ Object
Returns the value of attribute authorization_retention_days.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def @authorization_retention_days end |
#connection_timeout ⇒ Object
Returns the value of attribute connection_timeout.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def connection_timeout @connection_timeout end |
#heartbeat_interval ⇒ Object
Returns the value of attribute heartbeat_interval.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def heartbeat_interval @heartbeat_interval end |
#implausible_energy_jump_wh ⇒ Object
Returns the value of attribute implausible_energy_jump_wh.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def implausible_energy_jump_wh @implausible_energy_jump_wh end |
#max_connection_attempts_per_minute ⇒ Object
Returns the value of attribute max_connection_attempts_per_minute.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def max_connection_attempts_per_minute @max_connection_attempts_per_minute end |
#max_messages_per_minute ⇒ Object
Returns the value of attribute max_messages_per_minute.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def @max_messages_per_minute end |
#ocpp_version ⇒ Object
Returns the value of attribute ocpp_version.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def ocpp_version @ocpp_version end |
#state_change_cleanup_enabled ⇒ Object
Returns the value of attribute state_change_cleanup_enabled.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def state_change_cleanup_enabled @state_change_cleanup_enabled end |
#state_change_hooks ⇒ Object
Returns the value of attribute state_change_hooks.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def state_change_hooks @state_change_hooks end |
#state_change_retention_days ⇒ Object
Returns the value of attribute state_change_retention_days.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def state_change_retention_days @state_change_retention_days end |
#supported_versions ⇒ Object
Returns the value of attribute supported_versions.
36 37 38 |
# File 'lib/ocpp/rails.rb', line 36 def supported_versions @supported_versions end |
Instance Method Details
#register_authorization_hook(hook) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/ocpp/rails.rb', line 74 def (hook) unless hook.respond_to?(:call) raise ArgumentError, "Hook must respond to :call method" end @authorization_hooks << hook end |
#register_state_change_hook(hook) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/ocpp/rails.rb', line 67 def register_state_change_hook(hook) unless hook.respond_to?(:call) raise ArgumentError, "Hook must respond to :call method" end @state_change_hooks << hook end |