task

package
v0.0.0-...-dd13c3c Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetEnv

func SetEnv(value *Env)

* Get env * return: * env the evironment

Types

type Env

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

func GetEnv

func GetEnv() *Env

* Get env * return: * env the evironment

func NewEnv

func NewEnv(context *libcoap.Context) *Env

* Env constructor * parameter: * context the signal context * return: * env the new env

func (*Env) CoapContext

func (env *Env) CoapContext() *libcoap.Context

* Get env context * return: * context the context

func (*Env) EventChannel

func (env *Env) EventChannel() chan Event

* Get env event * return: * channel the event

func (*Env) HandleResponse

func (env *Env) HandleResponse(session *libcoap.Session, pdu *libcoap.Pdu)

func (*Env) HandleTimeout

func (env *Env) HandleTimeout(session *libcoap.Session, sent *libcoap.Pdu)

func (*Env) HeartBeatMechaism

func (env *Env) HeartBeatMechaism(session *libcoap.Session, customer *models.Customer)

Handle heartbeat from server to client

func (*Env) RemoveSession

func (env *Env) RemoveSession(session *libcoap.Session)

Remove session in env

func (*Env) RenewEnv

func (env *Env) RenewEnv(context *libcoap.Context, currentSession *libcoap.Session) *Env

* The renew env with session if have * parameter: * context the signal context * session the current transaction session * return: * env the renew env

func (*Env) Run

func (env *Env) Run(session *libcoap.Session, task Task)

* Env running method * parameter: * task the task need run

type Event

type Event interface {
	Task() Task
	Handle(*Env)
}

type EventBase

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

func (EventBase) Task

func (e EventBase) Task() Task

type HeartBeatEvent

type HeartBeatEvent struct{ EventBase }

func (*HeartBeatEvent) Handle

func (e *HeartBeatEvent) Handle(env *Env)

type HeartBeatMessageTask

type HeartBeatMessageTask struct {
	TaskBase
	// contains filtered or unexported fields
}

func NewHeartBeatMessageTask

func NewHeartBeatMessageTask(message *libcoap.Pdu, retry int, timeout time.Duration, interval time.Duration,
	responseHandler HeartBeatResponseHandler, timeoutHandler HeartBeatTimeoutHandler) *HeartBeatMessageTask

type HeartBeatResponseHandler

type HeartBeatResponseHandler func(*HeartBeatMessageTask, *libcoap.Pdu)

type HeartBeatTimeoutHandler

type HeartBeatTimeoutHandler func(*HeartBeatMessageTask, *Env)

type Task

type Task interface {
	// contains filtered or unexported methods
}

type TaskBase

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

type TimeoutEvent

type TimeoutEvent struct{ EventBase }

func (*TimeoutEvent) Handle

func (e *TimeoutEvent) Handle(env *Env)

Jump to

Keyboard shortcuts

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