event

package
v0.0.0-...-7c28005 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidTimestamp uint64 = math.MaxUint64
)
View Source
const RadioMessagePsduOffset = 1

RadioMessagePsduOffset is the offset of mPsdu data in a received OpenThread RadioMessage, from OT-RFSIM platform, radio.h.

struct RadioMessage
{
	uint8_t mChannel;
	uint8_t mPsdu[OT_RADIO_FRAME_MAX_SIZE];
} OT_TOOL_PACKED_END;

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Delay uint64
	Type  EventType
	MsgId uint64
	//DataLen uint16
	Data []byte

	// metadata kept locally for this Event.
	NodeId       types.NodeId
	Timestamp    uint64
	MustDispatch bool
	Conn         net.Conn

	// supplementary payload data stored in Event.Data, depends on the event type.
	RadioCommData  RadioCommEventData
	RadioStateData RadioStateEventData
	NodeInfoData   NodeInfoEventData
	RfSimParamData RfSimParamEventData
	MsgToHostData  MsgToHostEventData
}

func (*Event) Copy

func (e *Event) Copy() Event

Copy creates a (struct) copy of the Event.

func (*Event) Deserialize

func (e *Event) Deserialize(data []byte) int

Deserialize deserializes []byte Event fields (as received from OpenThread node) into the Event object e. It returns the number of bytes used from `data` for the Deserialize operation, or 0 if the data buffer is incomplete i.e. does not contain one entire serialized Event.

func (*Event) Serialize

func (e *Event) Serialize() []byte

Serialize serializes this Event into []byte to send to OpenThread node, including fields partially.

func (*Event) String

func (e *Event) String() string

type EventType

type EventType = uint8
const (
	// Event type IDs (external, shared between OT-NS and OT node)
	EventTypeAlarmFired         EventType = 0
	EventTypeRadioReceived      EventType = 1
	EventTypeUartWrite          EventType = 2
	EventTypeRadioSpinelWrite   EventType = 3
	EventTypePostCmd            EventType = 4
	EventTypeStatusPush         EventType = 5
	EventTypeRadioCommStart     EventType = 6
	EventTypeRadioTxDone        EventType = 7
	EventTypeRadioChannelSample EventType = 8
	EventTypeRadioState         EventType = 9
	EventTypeRadioRxDone        EventType = 10
	EventTypeExtAddr            EventType = 11
	EventTypeNodeInfo           EventType = 12
	EventTypeNodeDisconnected   EventType = 14
	EventTypeRadioLog           EventType = 15
	EventTypeRadioRfSimParamGet EventType = 16
	EventTypeRadioRfSimParamSet EventType = 17
	EventTypeRadioRfSimParamRsp EventType = 18
	EventTypeLogWrite           EventType = 19
	EventTypeUdpToHost          EventType = 20
	EventTypeIp6ToHost          EventType = 21
	EventTypeUdpFromHost        EventType = 22
	EventTypeIp6FromHost        EventType = 23
)

type MsgToHostEventData

type MsgToHostEventData struct {
	SrcPort       uint16
	DstPort       uint16
	SrcIp6Address netip.Addr
	DstIp6Address netip.Addr
}

type NodeInfoEventData

type NodeInfoEventData struct {
	NodeId types.NodeId
}

type RadioCommEventData

type RadioCommEventData struct {
	Channel  uint8
	PowerDbm int8
	Error    uint8
	Duration uint64
}

type RadioStateEventData

type RadioStateEventData struct {
	Channel     uint8
	PowerDbm    int8
	RxSensDbm   int8
	EnergyState types.RadioStates
	SubState    types.RadioSubStates
	State       types.RadioStates
	RadioTime   uint64
}

type RfSimParamEventData

type RfSimParamEventData struct {
	Param types.RfSimParam
	Value int32
}

Jump to

Keyboard shortcuts

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