sensor_server

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ISServer

type ISServer interface {
	Start()
	Stop()
	AddSensor(Sensor)
	RemoveSensor(Sensor)
	Write(Sensor, []byte)
}

* * 服务器 *

type ISensor

type ISensor interface {
	Sn() string                 // 获取编号
	Session() Session           // 会话
	Ping() []byte               // PING包
	OnRegister(sn string) error // 注册成功
	OnLine()                    // 上线
	OffLine()                   // 掉线
	OnError(error)              // 出错
	OnData([]byte)              // 来数据
}

* * 传感器接口 *

func NewSensor

func NewSensor(session Session) ISensor

type Sensor

type Sensor struct {
	Authed bool
	// contains filtered or unexported fields
}

func (*Sensor) OffLine

func (s *Sensor) OffLine()

func (*Sensor) OnData

func (s *Sensor) OnData([]byte)

func (*Sensor) OnError

func (s *Sensor) OnError(error)

func (*Sensor) OnLine

func (s *Sensor) OnLine()

func (*Sensor) OnRegister

func (s *Sensor) OnRegister(sn string) error

func (*Sensor) Ping

func (s *Sensor) Ping() []byte

func (*Sensor) Session

func (s *Sensor) Session() Session

func (*Sensor) Sn

func (s *Sensor) Sn() string

type SensorServer

type SensorServer struct {
	// contains filtered or unexported fields
}

func NewSensorServer

func NewSensorServer() *SensorServer

func (*SensorServer) Init

func (dm *SensorServer) Init(config *ini.Section) error

func (*SensorServer) PluginMetaInfo

func (hh *SensorServer) PluginMetaInfo() typex.XPluginMetaInfo

func (*SensorServer) Service

func (cs *SensorServer) Service(arg typex.ServiceArg) typex.ServiceResult

* * 服务调用接口 *

func (*SensorServer) Start

func (dm *SensorServer) Start(typex.RuleX) error

func (*SensorServer) Stop

func (dm *SensorServer) Stop() error

type SensorWorker

type SensorWorker struct {
	Ctx    context.Context
	Cancel context.CancelFunc
	// contains filtered or unexported fields
}

* * 设备的工作进程 *

func (*SensorWorker) Run

func (w *SensorWorker) Run()

type Session

type Session struct {
	Id        string
	Transport net.Conn
}

* * 设备会话层 *

func NewSession

func NewSession(Transport net.Conn) Session

Jump to

Keyboard shortcuts

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