packet

package
v0.0.0-...-721237c Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySentry = 0xA2
	Meter    = 0xA5 // Bayer Contour glucometer
	RFRemote = 0xA6 // MMT-503 remote
	Pump     = 0xA7
	Sensor   = 0xA8
)

Medtronic packet types.

Variables

View Source
var ErrDecoding = errors.New("6b/4b decoding failure")

ErrDecoding indicates a 6b/4b decoding failure.

Functions

func CRC16

func CRC16(msg []byte) uint16

CRC16 computes the 16-bit CRC of the given data using the CCITT polynomial.

func CRC8

func CRC8(msg []byte) byte

CRC8 computes the 8-bit CRC of the given data using the WCDMA polynomial.

func Decode

func Decode(p []byte) ([]byte, error)

Decode performs 6b/4b decoding and CRC verification. It returns the decoded data, excluding the CRC byte.

func Decode6b4b

func Decode6b4b(src []byte) ([]byte, error)

Decode6b4b returns the 6b/4b decoding of the given data.

func Encode

func Encode(data []byte) []byte

Encode appends the CRC to the data and returns the 4b/6b-encoded result. This may modify data's underlying array.

func Encode4b6b

func Encode4b6b(src []byte) []byte

Encode4b6b returns the 4b/6b encoding of the given data.

func IsSensorType

func IsSensorType(b byte) bool

IsSensorType returns true for Sensor packet types.

Types

This section is empty.

Jump to

Keyboard shortcuts

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