utils

package
v0.0.0-...-3d3156d Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUFFLEN            uint32 = 65536
	QUEUELELN          uint32 = 65536
	PKTLEN             uint32 = 4500
	CONSUMER_NUMS      uint16 = 2000
	PROCUDER_NUMS      uint16 = 2000
	FRENQUENCE         uint32 = 10000
	SUBSNUMS           uint8  = 10
	TABLENUMS          uint32 = 65536
	HEADER_LEN         uint8  = 24
	SERVICE_HEADER_LEN uint8  = 6
	SUB_HEADER_LEN     uint8  = 8
	MTU                uint16 = 1500
)

UDP server configuration

View Source
const (
	OUTPUT_BUFFER_LEN uint32 = 65536
	RT_STREAM_FREQ    uint32 = 1
)

WebServer configuration

View Source
const (
	MSG_INNER uint8 = 0
	MSG_OUTER uint8 = 1
)

----------- Message Type

View Source
const (
	TYPE_NODATA        uint8 = 0
	TYPE_SENSOR        uint8 = 1
	TYPE_FDD           uint8 = 2
	TYPE_FDD_COMPONENT uint8 = 3
	TYPE_FDD_MEASURE   uint8 = 4
	TYPE_AGENT         uint8 = 5
	TYPE_OTHER         uint8 = 255
)

----------- Data Type

View Source
const (
	PRIORITY_LOW    uint8 = 1
	PRIORITY_NORMAL uint8 = 3
	PRIORITY_MEDIUM uint8 = 5
	PRIORITY_HIGHT  uint8 = 7
)

------------ Priority

View Source
const (
	SER_SEND      uint8 = 0
	SER_REQUEST   uint8 = 1
	SER_PUBLISH   uint8 = 2
	SER_SUBSCRIBE uint8 = 3
	SER_RESPONSE  uint8 = 0x0A
)

------------ OPTION

View Source
const (
	FLAG_SINGLE  uint8 = 0
	FLAG_STREAM  uint8 = 1
	FLAG_WARNING uint8 = 0xFE
	FLAG_ERROR   uint8 = 0xFF
)

------------ FLAG

View Source
const (
	TIME_SIMU_START uint32 = 0
	TIME_SIMU_LAST  uint32 = 0xFFFFFFFF
)

------------ SIMU TIME

View Source
const (
	PARAMTER_REQUEST_LAST uint16 = 0xFFFF
	PARAMTER_EMPTY        uint16 = 0
)

----------- PARAMTER

View Source
const (
	RESERVED uint8 = 0
)

------------ Reserved

View Source
const (
	VERSION_V0 uint8 = 0
)

------------ Version

Variables

View Source
var SYSTEM_ID = map[string]uint8{
	"GCC":   0,
	"HMS":   1,
	"STR":   2,
	"SPL":   11,
	"CORR":  10,
	"ECLSS": 5,
	"PWR":   3,
	"AGT":   6,
	"IE":    8,
	"DTB":   9,
	"EXT":   7,
}

Functions

func DoubleContains

func DoubleContains(s []float64, i float64) bool

func LoadFromJson

func LoadFromJson(path string, server JsonStandard) error

----------- Common static functions ----------

func StringToInt

func StringToInt(s string) (int, error)

func Uint16Contains

func Uint16Contains(s []uint16, i uint16) bool

func Uint32Contains

func Uint32Contains(s []uint32, i uint32) bool

func Uint8Contains

func Uint8Contains(s []uint8, i uint8) bool

Types

type ClientStandard

type ClientStandard interface {
	Send() error
	Listen() (PacketStandard, error)
}

type HandlerStandard

type HandlerStandard interface {
	Init() error
	Write() error
	Read() ([]float64, error)
}

type JsonStandard

type JsonStandard interface {
}

type PacketStandard

type PacketStandard interface {
	FromBuff() (PacketStandard, error)
	ToBuff() ([]byte, error)
}

type ServiceStandard

type ServiceStandard interface {
	Init() error
	Send() error
	Publish() error
	Request() ([]float64, error)
	Subscribe() (chan float64, error)
	Close() error
}

Jump to

Keyboard shortcuts

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