Class: Takagi::Network::Base
- Inherits:
-
Object
- Object
- Takagi::Network::Base
- Defined in:
- lib/takagi/network/base.rb
Overview
Base class for all transport implementations. Each transport encapsulates protocol-specific framing, I/O, and metadata.
Class Method Summary collapse
-
.additional_schemes ⇒ Array<String>
Additional schemes this transport supports (e.g., [‘coaps’] for secure variant).
-
.default_port ⇒ Integer
Default port for this transport.
-
.reliable? ⇒ Boolean
Is this a reliable transport?.
-
.rfc ⇒ String
RFC reference for this transport.
-
.scheme ⇒ String
URI scheme for this transport (e.g., ‘coap’, ‘coap+tcp’).
Instance Method Summary collapse
-
#create_client(options = {}) ⇒ Object
Create a client for this transport.
-
#create_sender(options = {}) ⇒ Object
Create a sender for this transport.
-
#create_server(options = {}) ⇒ Object
Create a server for this transport.
-
#decode(data) ⇒ Message::Inbound
Decode binary data into a CoAP message.
-
#encode(message) ⇒ String
Encode a CoAP message for this transport.
Class Method Details
.additional_schemes ⇒ Array<String>
Additional schemes this transport supports (e.g., [‘coaps’] for secure variant)
35 36 37 |
# File 'lib/takagi/network/base.rb', line 35 def additional_schemes [] end |
.default_port ⇒ Integer
Default port for this transport
17 18 19 |
# File 'lib/takagi/network/base.rb', line 17 def default_port raise NotImplementedError, "#{self} must implement .default_port" end |
.reliable? ⇒ Boolean
Is this a reliable transport?
29 30 31 |
# File 'lib/takagi/network/base.rb', line 29 def reliable? raise NotImplementedError, "#{self} must implement .reliable?" end |
.rfc ⇒ String
RFC reference for this transport
23 24 25 |
# File 'lib/takagi/network/base.rb', line 23 def rfc raise NotImplementedError, "#{self} must implement .rfc" end |
.scheme ⇒ String
URI scheme for this transport (e.g., ‘coap’, ‘coap+tcp’)
11 12 13 |
# File 'lib/takagi/network/base.rb', line 11 def scheme raise NotImplementedError, "#{self} must implement .scheme" end |
Instance Method Details
#create_client(options = {}) ⇒ Object
Create a client for this transport
71 72 73 |
# File 'lib/takagi/network/base.rb', line 71 def create_client( = {}) raise NotImplementedError, "#{self.class} must implement #create_client" end |
#create_sender(options = {}) ⇒ Object
Create a sender for this transport
57 58 59 |
# File 'lib/takagi/network/base.rb', line 57 def create_sender( = {}) raise NotImplementedError, "#{self.class} must implement #create_sender" end |
#create_server(options = {}) ⇒ Object
Create a server for this transport
64 65 66 |
# File 'lib/takagi/network/base.rb', line 64 def create_server( = {}) raise NotImplementedError, "#{self.class} must implement #create_server" end |
#decode(data) ⇒ Message::Inbound
Decode binary data into a CoAP message
50 51 52 |
# File 'lib/takagi/network/base.rb', line 50 def decode(data) raise NotImplementedError, "#{self.class} must implement #decode" end |
#encode(message) ⇒ String
Encode a CoAP message for this transport
43 44 45 |
# File 'lib/takagi/network/base.rb', line 43 def encode() raise NotImplementedError, "#{self.class} must implement #encode" end |