Class: XBeeRuby::Request
- Inherits:
-
Object
- Object
- XBeeRuby::Request
- Defined in:
- lib/xbee-ruby/request.rb
Direct Known Subclasses
Constant Summary collapse
- @@frame_id =
1
Instance Attribute Summary collapse
-
#frame_id ⇒ Object
readonly
Returns the value of attribute frame_id.
-
#frame_type ⇒ Object
readonly
Returns the value of attribute frame_type.
Class Method Summary collapse
Instance Method Summary collapse
- #frame_data ⇒ Object
-
#initialize(frame_type = 0) ⇒ Request
constructor
A new instance of Request.
- #packet ⇒ Object
Constructor Details
#initialize(frame_type = 0) ⇒ Request
Returns a new instance of Request.
26 27 28 29 |
# File 'lib/xbee-ruby/request.rb', line 26 def initialize frame_type = 0 @frame_id = Request.next_frame_id @frame_type = frame_type end |
Instance Attribute Details
#frame_id ⇒ Object (readonly)
Returns the value of attribute frame_id.
23 24 25 |
# File 'lib/xbee-ruby/request.rb', line 23 def frame_id @frame_id end |
#frame_type ⇒ Object (readonly)
Returns the value of attribute frame_type.
24 25 26 |
# File 'lib/xbee-ruby/request.rb', line 24 def frame_type @frame_type end |
Class Method Details
.next_frame_id ⇒ Object
17 18 19 20 21 |
# File 'lib/xbee-ruby/request.rb', line 17 def self.next_frame_id @@frame_id.tap do |id| @@frame_id = (id + 1) % 256 end end |
Instance Method Details
#frame_data ⇒ Object
31 32 33 |
# File 'lib/xbee-ruby/request.rb', line 31 def frame_data raise 'Override to return frame data as a byte array' end |