Documentation
¶
Index ¶
- Variables
- func RxCoap(cl *nmcoap.Listener, timeout time.Duration) (coap.Message, error)
- func TxCoap(s Sesn, mp nmcoap.MsgParams) error
- func TxRxCoap(s Sesn, mp nmcoap.MsgParams, opts TxOptions) (coap.Message, error)
- func TxRxMgmt(s Sesn, m *nmp.NmpMsg, o TxOptions) (nmp.NmpRsp, error)
- func TxRxMgmtAsync(s Sesn, m *nmp.NmpMsg, o TxOptions, ch chan nmp.NmpRsp, errc chan error) error
- type MgmtProto
- type NotifyCb
- type OnCloseFn
- type PeerSpec
- type Sesn
- type SesnCfg
- type SesnCfgBle
- type SesnCfgBleCentral
- type SesnCfgLora
- type TxOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var DfltTxOptions = TxOptions{ Timeout: 10 * time.Second, Tries: 1, }
Functions ¶
func RxCoap ¶
RxCoap performs a blocking receive of a CoAP message. It returns a nil message if the specified listener is closed while the function is running.
Types ¶
type Sesn ¶
type Sesn interface {
// Initiates communication with the peer. For connection-oriented
// transports, this creates a connection.
// Returns:
// * nil: success.
// * nmxutil.SesnAlreadyOpenError: session already open.
// * other error
Open() error
// Ends communication with the peer. For connection-oriented transports,
// this closes the connection.
// * nil: success.
// * nmxutil.SesnClosedError: session not open.
// * other error
Close() error
// Indicates whether the session is currently open.
IsOpen() bool
// Retrieves the maximum data payload for incoming data packets.
MtuIn() int
// Retrieves the maximum data payload for outgoing data packets.
MtuOut() int
MgmtProto() MgmtProto
// Indicates whether the session uses the TCP form of CoAP.
CoapIsTcp() bool
// Stops a receive operation in progress. This must be called from a
// separate thread, as sesn receive operations are blocking.
AbortRx(nmpSeq uint8) error
RxAccept() (Sesn, *SesnCfg, error)
RxCoap(opt TxOptions) (coap.Message, error)
// Performs a blocking transmit a single management request (NMP / OMP) and
// listens for the response.
// * nil: success.
// * nmxutil.SesnClosedError: session not open.
// * other error
TxRxMgmt(m *nmp.NmpMsg, timeout time.Duration) (nmp.NmpRsp, error)
TxRxMgmtAsync(m *nmp.NmpMsg, timeout time.Duration, ch chan nmp.NmpRsp, errc chan error) error
// Creates a listener for incoming CoAP messages matching the specified
// criteria.
ListenCoap(mc nmcoap.MsgCriteria) (*nmcoap.Listener, error)
// Cancels the CoAP listener with the specified criteria.
StopListenCoap(mc nmcoap.MsgCriteria)
// Transmits a CoAP message.
TxCoap(m coap.Message) error
// Returns a transmit and a receive callback used to manipulate CoAP
// messages
Filters() (nmcoap.TxMsgFilter, nmcoap.RxMsgFilter)
// Sets the transmit and a receive callback used to manipulate CoAP
// messages
SetFilters(txFilter nmcoap.TxMsgFilter, rxFilter nmcoap.RxMsgFilter)
}
Represents a communication session with a specific peer. The particulars vary according to protocol and transport. Several Sesn instances can use the same Xport.
type SesnCfg ¶
type SesnCfg struct {
// General configuration.
MgmtProto MgmtProto
PeerSpec PeerSpec
OnCloseCb OnCloseFn
// Transport-specific configuration.
Ble SesnCfgBle
Lora SesnCfgLora
// Filters
TxFilter nmcoap.TxMsgFilter
RxFilter nmcoap.RxMsgFilter
}
func NewSesnCfg ¶
func NewSesnCfg() SesnCfg
type SesnCfgBle ¶
type SesnCfgBle struct {
// General configuration.
OwnAddrType bledefs.BleAddrType
EncryptWhen bledefs.BleEncryptWhen
CloseTimeout time.Duration
WriteRsp bool
// Central configuration.
Central SesnCfgBleCentral
}
type SesnCfgBleCentral ¶
Click to show internal directories.
Click to hide internal directories.