Class: Cwmp::Cpe
- Inherits:
-
Object
- Object
- Cwmp::Cpe
- Defined in:
- lib/cwmp/cpe.rb
Instance Attribute Summary collapse
-
#acs_url ⇒ Object
Returns the value of attribute acs_url.
-
#manufacturer ⇒ Object
Returns the value of attribute manufacturer.
-
#oui ⇒ Object
Returns the value of attribute oui.
-
#serial ⇒ Object
Returns the value of attribute serial.
-
#software_version ⇒ Object
Returns the value of attribute software_version.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(acs_url, periodic, h = {}) ⇒ Cpe
constructor
A new instance of Cpe.
- #loop ⇒ Object
- #poweroff ⇒ Object
- #poweron ⇒ Object
- #reboot ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize(acs_url, periodic, h = {}) ⇒ Cpe
Returns a new instance of Cpe.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cwmp/cpe.rb', line 9 def initialize (acs_url, periodic, h = {}) @acs_url = acs_url @serial = h[:serial] || "23434ds" @oui = h[:oui] || "006754" @software_version = h[:software_version] || "0.1.1" @manufacturer = h[:manufacturer] || "Moonar" @state = 'off' @periodic = Thread.new { periodic periodic } if periodic > 0 @conn_req = Thread.new { connection_request } @factory = true end |
Instance Attribute Details
#acs_url ⇒ Object
Returns the value of attribute acs_url.
7 8 9 |
# File 'lib/cwmp/cpe.rb', line 7 def acs_url @acs_url end |
#manufacturer ⇒ Object
Returns the value of attribute manufacturer.
7 8 9 |
# File 'lib/cwmp/cpe.rb', line 7 def manufacturer @manufacturer end |
#oui ⇒ Object
Returns the value of attribute oui.
7 8 9 |
# File 'lib/cwmp/cpe.rb', line 7 def oui @oui end |
#serial ⇒ Object
Returns the value of attribute serial.
7 8 9 |
# File 'lib/cwmp/cpe.rb', line 7 def serial @serial end |
#software_version ⇒ Object
Returns the value of attribute software_version.
7 8 9 |
# File 'lib/cwmp/cpe.rb', line 7 def software_version @software_version end |
#state ⇒ Object
Returns the value of attribute state.
7 8 9 |
# File 'lib/cwmp/cpe.rb', line 7 def state @state end |
Instance Method Details
#loop ⇒ Object
48 49 50 |
# File 'lib/cwmp/cpe.rb', line 48 def loop @conn_req.join end |
#poweroff ⇒ Object
31 32 33 |
# File 'lib/cwmp/cpe.rb', line 31 def poweroff @state = 'off' end |
#poweron ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/cwmp/cpe.rb', line 21 def poweron @state = 'on' if @factory do_connection '0 BOOTSTRAP' else do_connection '1 BOOT' end @factory = false end |
#reboot ⇒ Object
35 36 37 38 39 40 |
# File 'lib/cwmp/cpe.rb', line 35 def reboot @state = 'off' sleep 2 @state = 'on' do_connection '1 BOOT' end |
#reset ⇒ Object
42 43 44 45 46 |
# File 'lib/cwmp/cpe.rb', line 42 def reset poweroff @factory = true poweron end |