nmxutil

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DURATION_FOREVER time.Duration = math.MaxInt64

Variables

View Source
var Debug bool
View Source
var ListenLog = &log.Logger{
	Out:       os.Stderr,
	Formatter: &logFormatter,
	Level:     log.DebugLevel,
}
View Source
var OmpRes string = "/omgr"

Functions

func Assert

func Assert(cond bool)

func DecodeCbor

func DecodeCbor(cbor []byte) (interface{}, error)

func DecodeCborMap

func DecodeCborMap(cbor []byte) (map[string]interface{}, error)

func EncodeCbor

func EncodeCbor(value interface{}) ([]byte, error)

func EncodeCborMap

func EncodeCborMap(value map[string]interface{}) ([]byte, error)

func Fragment

func Fragment(b []byte, mtu int) [][]byte

func GetNextId

func GetNextId() uint32

func IsAlready

func IsAlready(err error) bool

func IsBleHost

func IsBleHost(err error) bool

func IsBleSecurity

func IsBleSecurity(err error) bool

func IsBleSesnDisconnect

func IsBleSesnDisconnect(err error) bool

func IsRspTimeout

func IsRspTimeout(err error) bool

func IsScanTmo

func IsScanTmo(err error) bool

func IsSesnAlreadyOpen

func IsSesnAlreadyOpen(err error) bool

func IsSesnClosed

func IsSesnClosed(err error) bool

func IsXport

func IsXport(err error) bool

func LogAddCoapListener

func LogAddCoapListener(parentLevel int, desc string)

func LogAddListener

func LogAddListener(parentLevel int, key interface{}, id uint32,
	name string)

func LogAddNmpListener

func LogAddNmpListener(parentLevel int, seq uint8)

func LogListener

func LogListener(parentLevel int, title string, extra string)

func LogRemoveCoapListener

func LogRemoveCoapListener(parentLevel int, desc string)

func LogRemoveListener

func LogRemoveListener(parentLevel int, key interface{}, id uint32,
	name string)

func LogRemoveNmpListener

func LogRemoveNmpListener(parentLevel int, seq uint8)

func NextNmpSeq

func NextNmpSeq() uint8

func NextToken

func NextToken() []byte

func SeqToToken

func SeqToToken(seq uint8) []byte

func SetLogLevel

func SetLogLevel(level log.Level)

func StopAndDrainTimer

func StopAndDrainTimer(timer *time.Timer)

Types

type AlreadyError

type AlreadyError struct {
	Text string
}

Indicates an attempt to transition to the already-current state.

func NewAlreadyError

func NewAlreadyError(text string) *AlreadyError

func (*AlreadyError) Error

func (err *AlreadyError) Error() string

type Bcaster

type Bcaster struct {
	// contains filtered or unexported fields
}

func (*Bcaster) Clear

func (b *Bcaster) Clear()

func (*Bcaster) Listen

func (b *Bcaster) Listen(depth int) chan interface{}

func (*Bcaster) Send

func (b *Bcaster) Send(val interface{})

func (*Bcaster) SendAndClear

func (b *Bcaster) SendAndClear(val interface{})

func (*Bcaster) StopListening

func (b *Bcaster) StopListening(ch chan interface{})

type BleHostError

type BleHostError struct {
	Text   string
	Status int
}

func FmtBleHostError

func FmtBleHostError(status int, format string,
	args ...interface{}) *BleHostError

func NewBleHostError

func NewBleHostError(status int, text string) *BleHostError

func ToBleHost

func ToBleHost(err error) *BleHostError

func (*BleHostError) Error

func (e *BleHostError) Error() string

type BleSecurityError

type BleSecurityError struct {
	Text string
}

Represents a BLE pairing failure due to missing or mismatched key material.

func NewBleSecurityError

func NewBleSecurityError(text string) *BleSecurityError

func ToBleSecurity

func ToBleSecurity(err error) *BleSecurityError

func (*BleSecurityError) Error

func (err *BleSecurityError) Error() string

type BleSesnDisconnectError

type BleSesnDisconnectError struct {
	Text   string
	Reason int
}

func NewBleSesnDisconnectError

func NewBleSesnDisconnectError(reason int,
	text string) *BleSesnDisconnectError

func (*BleSesnDisconnectError) Error

func (e *BleSesnDisconnectError) Error() string

type Blocker

type Blocker struct {
	// contains filtered or unexported fields
}

Blocks a variable number of waiters until Unblock() is called. Subsequent waiters are unblocked until the next call to Block().

func (*Blocker) Start

func (b *Blocker) Start()

func (*Blocker) Started

func (b *Blocker) Started() bool

func (*Blocker) Unblock

func (b *Blocker) Unblock(val interface{})

func (*Blocker) UnblockAndRestart

func (b *Blocker) UnblockAndRestart(val interface{})

func (*Blocker) Wait

func (b *Blocker) Wait(timeout time.Duration, stopChan <-chan struct{}) (
	interface{}, error)

type ErrFunnel

type ErrFunnel struct {
	LessCb     ErrLessFn
	AccumDelay time.Duration
	// contains filtered or unexported fields
}

Aggregates errors that occur close in time. The most severe error gets reported.

func (*ErrFunnel) Insert

func (f *ErrFunnel) Insert(err error)

func (*ErrFunnel) Wait

func (f *ErrFunnel) Wait() chan error

type ErrLessFn

type ErrLessFn func(a error, b error) bool

type ErrProcFn

type ErrProcFn func(err error)

type RspTimeoutError

type RspTimeoutError struct {
	Text string
}

Represents a application-layer timeout (e.g., NMP or CoAP); request sent, but no response received.

func FmtRspTimeoutError

func FmtRspTimeoutError(format string, args ...interface{}) *RspTimeoutError

func NewRspTimeoutError

func NewRspTimeoutError(text string) *RspTimeoutError

func (*RspTimeoutError) Error

func (e *RspTimeoutError) Error() string

type SRWaiter

type SRWaiter struct {
	// contains filtered or unexported fields
}

type ScanTmoError

type ScanTmoError struct {
	Text string
}

func NewScanTmoError

func NewScanTmoError(text string) *ScanTmoError

func (*ScanTmoError) Error

func (e *ScanTmoError) Error() string

type SesnAlreadyOpenError

type SesnAlreadyOpenError struct {
	Text string
}

func NewSesnAlreadyOpenError

func NewSesnAlreadyOpenError(text string) *SesnAlreadyOpenError

func (*SesnAlreadyOpenError) Error

func (e *SesnAlreadyOpenError) Error() string

type SesnClosedError

type SesnClosedError struct {
	Text string
}

func NewSesnClosedError

func NewSesnClosedError(text string) *SesnClosedError

func (*SesnClosedError) Error

func (e *SesnClosedError) Error() string

type SingleResource

type SingleResource struct {
	// contains filtered or unexported fields
}

func NewSingleResource

func NewSingleResource() SingleResource

func (*SingleResource) Abort

func (s *SingleResource) Abort(err error)

func (*SingleResource) Acquire

func (s *SingleResource) Acquire(token interface{}) <-chan error

Appends an entry to the wait queue and returns a channel for the caller to block on. The caller must either read from the channel or call StopWaiting().

func (*SingleResource) Acquired

func (s *SingleResource) Acquired() bool

func (*SingleResource) Release

func (s *SingleResource) Release() bool

@return true if a pending waiter acquired the resource;

false if the resource is now free.

func (*SingleResource) StopWaiting

func (s *SingleResource) StopWaiting(token interface{}, err error)

type XportError

type XportError struct {
	Text string
}

Represents a low-level transport error.

func NewXportError

func NewXportError(text string) *XportError

func (*XportError) Error

func (e *XportError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL