ndef

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: GPL-3.0 Imports: 5 Imported by: 0 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.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NDEF markers
	NdefEnd = []byte{0xFE}

	// ErrNoNDEF is returned when no NDEF record is found.
	ErrNoNDEF = errors.New("no NDEF record found")
	// ErrInvalidNDEF is returned when the NDEF format is invalid.
	ErrInvalidNDEF = errors.New("invalid NDEF format")
)

Functions

func BuildMessage

func BuildMessage(text string) ([]byte, error)

BuildMessage is an alias for BuildTextMessage for backward compatibility

func BuildTextMessage

func BuildTextMessage(text string) ([]byte, error)

BuildTextMessage creates an NDEF message with a single text record

func ParseToText

func ParseToText(data []byte) (string, error)

ParseToText parses raw NDEF data and returns the first text or URI record as a string

func ValidateNDEFMessage

func ValidateNDEFMessage(data []byte) error

ValidateNDEFMessage validates basic NDEF message structure

Types

type NDEFMessage

type NDEFMessage struct {
	Records []NDEFRecord
}

NDEFMessage represents an NDEF message

type NDEFRecord

type NDEFRecord struct {
	Text    string
	URI     string
	Type    NDEFRecordType
	Payload []byte
}

NDEFRecord represents a single NDEF record

type NDEFRecordType

type NDEFRecordType string

NDEFRecordType represents the type of an NDEF record

const (
	// NDEFTypeText represents a text record type
	NDEFTypeText NDEFRecordType = "text"
	// NDEFTypeURI represents a URI record type
	NDEFTypeURI NDEFRecordType = "uri"
)

Jump to

Keyboard shortcuts

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