cloud

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidActivationCode   = "invalid activation code"
	ErrRequireConfirmationCode = "confirmation code is required"
	ErrInvalidDataSize         = "invalid data size"

	CmdUseData = "data" // data$<size in KB>
)
View Source
const (
	APDUCommunicateTimeout = "6600"
)

Variables

View Source
var (
	GSMNumberSign = []byte{0x23} // #
	GSMDollarSign = []byte{0x02} // $
)

GSM 7-bit encoding, see https://en.wikipedia.org/wiki/GSM_03.38

View Source
var (
	ErrConnNotFound = errors.New("conn not found")
)
View Source
var (
	ErrTagUnknown = errors.New("unknown tag")
)
View Source
var GSM7CharacterSet = map[rune]byte{
	'@': 0x00,
	'£': 0x01,
	'$': 0x02,
	'¥': 0x03,
	'_': 0x11,
	'!': 0x21,
	'#': 0x23,
	'%': 0x25,
	'&': 0x26,
	'(': 0x28,
	')': 0x29,
	'*': 0x2A,
	'+': 0x2B,
	',': 0x2C,
	'-': 0x2D,
	'.': 0x2E,
	'/': 0x2F,
	':': 0x3A,
	';': 0x3B,
	'<': 0x3C,
	'=': 0x3D,
	'>': 0x3E,
	'?': 0x3F,
}

Functions

func NewAPDU

func NewAPDU(conn *Conn) driver.APDU

func ToGSM7 added in v1.0.6

func ToGSM7(b []byte) []byte

func ToTitle

func ToTitle(s string) string

Types

type Conn

type Conn struct {
	Id   string
	Conn *net.TCPConn
	APDU driver.APDU
	// contains filtered or unexported fields
}

func NewConn

func NewConn(id string, conn *net.TCPConn) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Handle

func (c *Conn) Handle(tag Tag, data []byte)

func (*Conn) Read

func (c *Conn) Read() (Tag, []byte, error)

func (*Conn) RegisterHandler added in v1.0.1

func (c *Conn) RegisterHandler(tag Tag, handler Handler) error

func (*Conn) Send

func (c *Conn) Send(tag Tag, data []byte) error

type Handler

type Handler = func(ctx context.Context, conn *Conn, data []byte) error

type Manager

type Manager interface {
	Add(id string, conn *Conn)
	Remove(id string)
	Get(id string) (*Conn, error)
	GetAll() []*Conn
	Len() int
}

func NewManager

func NewManager() Manager

type Server

type Server interface {
	Listen(address string) error
	Shutdown() error
}

func NewServer

func NewServer(manager Manager) Server

type Tag

type Tag byte
const (
	TagMessageBox          Tag = 0x00
	TagManagement          Tag = 0x01
	TagDownloadProfile     Tag = 0x02
	TagProcessNotification Tag = 0x03
	TagReboot              Tag = 0xFB
	TagClose               Tag = 0xFC
	TagAPDULock            Tag = 0xFD
	TagAPDU                Tag = 0xFE
	TagAPDUUnlock          Tag = 0xFF
)

Jump to

Keyboard shortcuts

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