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.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cwmp/cpe.rb', line 12 def initialize (acs_url, periodic, h = {}) @acs_url = acs_url @serial = h[:serial] || "23434ds" @oui = h[:oui] || "006754" @software_version = h[:software_version] || Cwmp::VERSION @manufacturer = h[:manufacturer] || "ruby-cwmp" @state = 'off' @periodic = Thread.new { periodic periodic } if periodic > 0 @conn_req = Thread.new { connection_request } @xmpp_req = Thread.new { xmpp_connection_request } @factory = true end |
Instance Attribute Details
#acs_url ⇒ Object
Returns the value of attribute acs_url.
10 11 12 |
# File 'lib/cwmp/cpe.rb', line 10 def acs_url @acs_url end |
#manufacturer ⇒ Object
Returns the value of attribute manufacturer.
10 11 12 |
# File 'lib/cwmp/cpe.rb', line 10 def manufacturer @manufacturer end |
#oui ⇒ Object
Returns the value of attribute oui.
10 11 12 |
# File 'lib/cwmp/cpe.rb', line 10 def oui @oui end |
#serial ⇒ Object
Returns the value of attribute serial.
10 11 12 |
# File 'lib/cwmp/cpe.rb', line 10 def serial @serial end |
#software_version ⇒ Object
Returns the value of attribute software_version.
10 11 12 |
# File 'lib/cwmp/cpe.rb', line 10 def software_version @software_version end |
#state ⇒ Object
Returns the value of attribute state.
10 11 12 |
# File 'lib/cwmp/cpe.rb', line 10 def state @state end |
Instance Method Details
#loop ⇒ Object
52 53 54 55 |
# File 'lib/cwmp/cpe.rb', line 52 def loop @xmpp_req.join @conn_req.join end |
#poweroff ⇒ Object
35 36 37 |
# File 'lib/cwmp/cpe.rb', line 35 def poweroff @state = 'off' end |
#poweron ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/cwmp/cpe.rb', line 25 def poweron @state = 'on' if @factory do_connection '0 BOOTSTRAP' else do_connection '1 BOOT' end @factory = false end |
#reboot ⇒ Object
39 40 41 42 43 44 |
# File 'lib/cwmp/cpe.rb', line 39 def reboot @state = 'off' sleep 2 @state = 'on' do_connection '1 BOOT' end |
#reset ⇒ Object
46 47 48 49 50 |
# File 'lib/cwmp/cpe.rb', line 46 def reset poweroff @factory = true poweron end |