ebib

package module
v0.0.0-...-e6e7955 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: BSD-2-Clause-Patent Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ebib-go

A Go library for the Ebib protocol.

Usage

Coming soon...

License

Ebib is free software, distributed under the BSD 2-clause + Patent license. See COPYING for details.

Documentation

Index

Constants

View Source
const (
	BibStatusSize = 5 // size of an encoded bib status
)

Variables

This section is empty.

Functions

func MaxBibStatuses

func MaxBibStatuses(t transport.Transport, raceAbbrev string) int

Returns the maximum number of [BibStatus]es which can fit in a single transmission over the transport.Transport t given the race abbreviation raceAbbrev for this event.

func PackBibStatuses

func PackBibStatuses(statuses []*BibStatus, epoch time.Time) []byte

Encodes a slice of [BibStatus]es into a contiguous buffer for transmission. The epoch time of the race must be given in order to properly encode the timestamp.

func ReceiveLoop

func ReceiveLoop(t transport.Transport, handle PacketHandler) (err error)

ReceiveLoop continuously receives Ebib packets via the transport.Transport t and delivers them to handle for processing. The ebibv1.AckType returned by handle will be sent to the originating station in response, unless handle returns ebibv1.AckType_ACK_TYPE_UNSPECIFIED.

If handle returns a non-nil error, ReceiveLoop will exit, returning that error.

func SendPacket

func SendPacket(t transport.Transport, destAddr transport.Addr, p *ebibv1.EbibPacket) (seq uint32, err error)

Sends the Ebib packet p to the destination destAddr using the transport.Transport t and returns the sequence number assigned to this packet.

If the serialized packet exceeds the MTU of t, then p will automatically be split into a ebibv1.Multipart and sent. In this case, SendPacket will not return until the last multipart segment has been transmitted or an error occurs.

Types

type BibStatus

type BibStatus struct {
	// Time this status occurred.
	Timestamp time.Time
	// Bib ID of the race participant. Does not necessarily match the real bib
	// number worn by the participant.
	BibId uint16
	// Ebib status code.
	StatusCode uint8
}

A status update for a race participant.

func DeserializeBibStatus

func DeserializeBibStatus(b []byte, epoch time.Time) *BibStatus

Decodes a binary bib status update in b into a BibStatus. The epoch time of the race must be given in order to properly decode the timestamp.

func UnpackBibStatuses

func UnpackBibStatuses(b []byte, epoch time.Time) []*BibStatus

Decodes a slice of [BibStatus]es from a contiguous buffer. The epoch time of the race must be given in order to properly decode the timestamp.

func (*BibStatus) Serialize

func (bs *BibStatus) Serialize(b []byte, epoch time.Time)

Encodes a bib status into the buffer b for transmission. The epoch time of the race must be given in order to properly encode the timestamp. b must be at least BibStatusSize in length.

type PacketHandler

type PacketHandler func(p *ebibv1.EbibPacket, addr *transport.PacketAddr) (ebibv1.AckType, error)

A PacketHandler is a function which processes a received Ebib packet p. addr contains the packet's address info. It returns an ebibv1.AckType indicating the result of processing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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