Documentation
¶
Overview ¶
Package iw contains utility functions to wrap around the iw program.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWatcherClosed = errors.New("event channel is closed")
ErrWatcherClosed is an error for detecting that watcher is closed.
Functions ¶
This section is empty.
Types ¶
type EventLogger ¶
type EventLogger struct {
// contains filtered or unexported fields
}
EventLogger captures events on a WiFi interface with "iw event".
func NewEventLogger ¶
func NewEventLogger(ctx context.Context, dut *dut.DUT, ops ...EventWatcherOption) (*EventLogger, error)
NewEventLogger creates and starts a new EventLogger. Note that the logger may not be ready right after this function returned due to race condition, and it probably won't be fixed. Choose other solution if possible.
func (*EventLogger) ConnectedTime ¶
func (e *EventLogger) ConnectedTime() (time.Time, error)
ConnectedTime finds the first connected event and returns the time.
func (*EventLogger) DisconnectTime ¶
func (e *EventLogger) DisconnectTime() (time.Time, error)
DisconnectTime finds the first disconnect event and returns the time.
func (*EventLogger) Events ¶
func (e *EventLogger) Events() []*Event
Events returns the captured events till now. Caller should not modify the returned slice.
func (*EventLogger) EventsByType ¶
func (e *EventLogger) EventsByType(ets ...EventType) []*Event
EventsByType returns events captured with given EventType.
type EventWatcher ¶
type EventWatcher struct {
// contains filtered or unexported fields
}
EventWatcher captures events from a WiFi interface with "iw event".
func NewEventWatcher ¶
func NewEventWatcher(ctx context.Context, dut *dut.DUT, ops ...EventWatcherOption) (*EventWatcher, error)
NewEventWatcher creates and starts a new EventWatcher. Note that the watcher may not be ready right after this function returned due to race condition, and it probably won't be fixed. Choose other solution if possible.
func (*EventWatcher) Stop ¶
func (e *EventWatcher) Stop() error
Stop stops the EventWatcher. Note that it also closes the channel, that is, events are dropped even if they arrived before calling Stop() if the channel buffer is full.
func (*EventWatcher) Wait ¶
func (e *EventWatcher) Wait(ctx context.Context) (*Event, error)
Wait waits for the next event. If there is no more event (i.e., channel has been closed), Wait returns an ErrWatcherClosed.
func (*EventWatcher) WaitByType ¶
WaitByType waits for the next matched event. Similar to Wait, a ErrWatcherClosed may be returned.
type EventWatcherOption ¶
type EventWatcherOption func(*eventWatcherConfig)
EventWatcherOption is a function object type used to specify options of NewEventWatcher.
func EventsBufferSize ¶
func EventsBufferSize(size int) EventWatcherOption
EventsBufferSize returns a Option that sets the buffer size of the events channel.