Documentation ¶
Index ¶
- func QueryParamsToString(queryParams []string) (str string)
- func SetIsReceiveHeartBeat(ishb bool)
- func SetIsReceiveResponseContent(isContent bool)
- type Env
- func (env *Env) AddRequestQuery(token string, requestQuery *RequestQuery)
- func (env *Env) AddTokenOfDeletedResource(token string)
- func (env *Env) Blocks() map[string]*libcoap.Pdu
- func (env *Env) CheckBlock(pdu *libcoap.Pdu) (bool, *string, *libcoap.Block)
- func (env *Env) CheckSessionReplacement() bool
- func (env *Env) CoapContext() *libcoap.Context
- func (env *Env) CoapSession() *libcoap.Session
- func (env *Env) DeleteTokenOfDeletedResource(token string)
- func (env *Env) EventChannel() chan Event
- func (env *Env) GetAllRequestQuery() map[string]*RequestQuery
- func (env *Env) GetBlockData(key string) *libcoap.Pdu
- func (env *Env) GetCurrentMissingHb() int
- func (env *Env) GetIsServerStopped() bool
- func (env *Env) GetMissingHbAllowed() int
- func (env *Env) GetRequestQuery(token string) *RequestQuery
- func (env *Env) GetTokenAndRequestQuery(query string) ([]byte, *RequestQuery)
- func (env *Env) InitialRequestBlockSize() *int
- func (env *Env) IntervalBeforeMaxAge() int
- func (env *Env) IsDeletedResource(token string) bool
- func (env *Env) IsHeartbeatAllowed() bool
- func (env *Env) IsPartialBlock() bool
- func (env *Env) IsTokenExist(key string) bool
- func (env *Env) QBlockSize() *int
- func (env *Env) RemoveRequestQuery(token string)
- func (env *Env) RenewEnv(context *libcoap.Context, session *libcoap.Session) *Env
- func (env *Env) Requests() map[string]*MessageTask
- func (env *Env) Run(task Task)
- func (env *Env) SecondRequestBlockSize() *int
- func (env *Env) SessionConfigMode() string
- func (env *Env) SessionConfigTask() *SessionConfigTask
- func (env *Env) SetCountMitigation(v messages.MitigationResponse, token string)
- func (env *Env) SetCurrentMissingHb(currentMissingHb int)
- func (env *Env) SetInitialRequestBlockSize(initialRequestBlockSize *int)
- func (env *Env) SetIntervalBeforeMaxAge(intervalBeforeMaxAge int)
- func (env *Env) SetIsPartialBlock(isPartialBlock bool)
- func (env *Env) SetIsServerStopped(isServerStopped bool)
- func (env *Env) SetMissingHbAllowed(missing_hb_allowed int)
- func (env *Env) SetReplacingSession(session *libcoap.Session)
- func (env *Env) SetRetransmitParams(maxRetransmit int, ackTimeout decimal.Decimal, ackRandomFactor decimal.Decimal)
- func (env *Env) SetRetransmitParamsForQBlock(qblockSize int, maxPayload int, nonMaxRetransmit int, nonTimeout float64, ...)
- func (env *Env) SetSecondRequestBlockSize(secondRequestBlockSize *int)
- func (env *Env) SetSessionConfigMode(sessionConfigMode string)
- func (env *Env) StopHeartBeat()
- func (env *Env) StopSessionConfig()
- func (env *Env) UpdateCountMitigation(req *libcoap.Pdu, v messages.MitigationResponse, token string)
- func (env *Env) WaitingForResponse(task *MessageTask) (pdu *libcoap.Pdu)
- type Event
- type EventBase
- type HeartBeatEvent
- type HeartBeatResponseHandler
- type HeartBeatTask
- type HeartBeatTimeoutHandler
- type MessageEvent
- type MessageTask
- func (t *MessageTask) AddResponse(pdu *libcoap.Pdu)
- func (task *MessageTask) GetMessage() *libcoap.Pdu
- func (task *MessageTask) GetResponseHandler() ResponseHandler
- func (task *MessageTask) GetTimeoutHandler() TimeoutHandler
- func (task *MessageTask) IsStop() bool
- func (task *MessageTask) SetMessage(pdu *libcoap.Pdu)
- func (task *MessageTask) Stop()
- type RequestQuery
- type ResponseHandler
- type SessionConfigEvent
- type SessionConfigResponseHandler
- type SessionConfigTask
- type SessionConfigTimeoutHandler
- type Task
- type TaskBase
- type TimeoutEvent
- type TimeoutHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueryParamsToString ¶
func SetIsReceiveHeartBeat ¶
func SetIsReceiveHeartBeat(ishb bool)
func SetIsReceiveResponseContent ¶
func SetIsReceiveResponseContent(isContent bool)
Types ¶
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
func (*Env) AddRequestQuery ¶
func (env *Env) AddRequestQuery(token string, requestQuery *RequestQuery)
func (*Env) AddTokenOfDeletedResource ¶
func (*Env) CheckBlock ¶
* Check Block received from server * parameter: * pdu: response pdu from server * return: * isMoreBlock(bool): false is last block; true is more block * etag(*int): etag option received from server * block(Block): block option sent to server
func (*Env) CheckSessionReplacement ¶
* Check if there is session that need to be replaced => do replacing
func (*Env) CoapContext ¶
func (*Env) CoapSession ¶
func (*Env) DeleteTokenOfDeletedResource ¶
func (*Env) EventChannel ¶
func (*Env) GetAllRequestQuery ¶
func (env *Env) GetAllRequestQuery() map[string]*RequestQuery
func (*Env) GetCurrentMissingHb ¶
func (*Env) GetIsServerStopped ¶
func (*Env) GetMissingHbAllowed ¶
func (*Env) GetRequestQuery ¶
func (env *Env) GetRequestQuery(token string) *RequestQuery
func (*Env) GetTokenAndRequestQuery ¶
func (env *Env) GetTokenAndRequestQuery(query string) ([]byte, *RequestQuery)
func (*Env) InitialRequestBlockSize ¶
func (*Env) IntervalBeforeMaxAge ¶
func (*Env) IsDeletedResource ¶
func (*Env) IsHeartbeatAllowed ¶
func (*Env) IsPartialBlock ¶
func (*Env) IsTokenExist ¶
func (*Env) QBlockSize ¶
func (*Env) RemoveRequestQuery ¶
func (*Env) Requests ¶
func (env *Env) Requests() map[string]*MessageTask
func (*Env) SecondRequestBlockSize ¶
func (*Env) SessionConfigMode ¶
func (*Env) SessionConfigTask ¶
func (env *Env) SessionConfigTask() *SessionConfigTask
func (*Env) SetCountMitigation ¶
func (env *Env) SetCountMitigation(v messages.MitigationResponse, token string)
* Set the number of mitigation in case receive response from getting all mitigation with observe option
func (*Env) SetCurrentMissingHb ¶
func (*Env) SetInitialRequestBlockSize ¶
func (*Env) SetIntervalBeforeMaxAge ¶
func (*Env) SetIsPartialBlock ¶
func (*Env) SetIsServerStopped ¶
func (*Env) SetMissingHbAllowed ¶
func (*Env) SetReplacingSession ¶
func (*Env) SetRetransmitParams ¶
func (*Env) SetRetransmitParamsForQBlock ¶
func (*Env) SetSecondRequestBlockSize ¶
func (*Env) SetSessionConfigMode ¶
func (*Env) StopHeartBeat ¶
func (env *Env) StopHeartBeat()
func (*Env) StopSessionConfig ¶
func (env *Env) StopSessionConfig()
func (*Env) UpdateCountMitigation ¶
func (env *Env) UpdateCountMitigation(req *libcoap.Pdu, v messages.MitigationResponse, token string)
* Update the number of observed mitigation * if response is notification response (Existed token mitigation all with observe is register): * mitigation status = 2, CountMitigation increase 1 * mitigation status = 6, CountMitigation decrease 1 * CountMitigation = 0, remove query request with token is token of all mitigation observer
func (*Env) WaitingForResponse ¶
func (env *Env) WaitingForResponse(task *MessageTask) (pdu *libcoap.Pdu)
* Waiting for response that received from server after sending request successfully * parameter: * task: the request task * return: * pdu: the response data
type HeartBeatEvent ¶
type HeartBeatEvent struct{ EventBase }
func (*HeartBeatEvent) Handle ¶
func (e *HeartBeatEvent) Handle(env *Env)
type HeartBeatResponseHandler ¶
type HeartBeatResponseHandler func(*HeartBeatTask, *libcoap.Pdu)
type HeartBeatTask ¶
type HeartBeatTask struct { TaskBase // contains filtered or unexported fields }
func NewHeartBeatTask ¶
func NewHeartBeatTask(interval time.Duration, retry int, timeout time.Duration, responseHandler HeartBeatResponseHandler, timeoutHandler HeartBeatTimeoutHandler) *HeartBeatTask
func (*HeartBeatTask) IsRunnable ¶
func (t *HeartBeatTask) IsRunnable() bool
type HeartBeatTimeoutHandler ¶
type HeartBeatTimeoutHandler func(*HeartBeatTask, *Env)
type MessageEvent ¶
type MessageEvent struct{ EventBase }
func (*MessageEvent) Handle ¶
func (e *MessageEvent) Handle(env *Env)
type MessageTask ¶
type MessageTask struct { TaskBase // contains filtered or unexported fields }
func NewMessageTask ¶
func NewMessageTask(message *libcoap.Pdu, interval time.Duration, retry int, timeout time.Duration, isStop bool, isHeartBeat bool, responseHandler ResponseHandler, timeoutHandler TimeoutHandler) *MessageTask
func (*MessageTask) AddResponse ¶
func (t *MessageTask) AddResponse(pdu *libcoap.Pdu)
func (*MessageTask) GetMessage ¶
func (task *MessageTask) GetMessage() *libcoap.Pdu
func (*MessageTask) GetResponseHandler ¶
func (task *MessageTask) GetResponseHandler() ResponseHandler
func (*MessageTask) GetTimeoutHandler ¶
func (task *MessageTask) GetTimeoutHandler() TimeoutHandler
func (*MessageTask) IsStop ¶
func (task *MessageTask) IsStop() bool
func (*MessageTask) SetMessage ¶
func (task *MessageTask) SetMessage(pdu *libcoap.Pdu)
func (*MessageTask) Stop ¶
func (task *MessageTask) Stop()
type RequestQuery ¶
type ResponseHandler ¶
type ResponseHandler func(*MessageTask, *libcoap.Pdu, *Env)
type SessionConfigEvent ¶
type SessionConfigEvent struct{ EventBase }
func (*SessionConfigEvent) Handle ¶
func (e *SessionConfigEvent) Handle(env *Env)
type SessionConfigResponseHandler ¶
type SessionConfigResponseHandler func(*SessionConfigTask, *libcoap.Pdu, *Env)
type SessionConfigTask ¶
type SessionConfigTask struct { TaskBase // contains filtered or unexported fields }
func NewSessionConfigTask ¶
func NewSessionConfigTask(message *libcoap.Pdu, interval time.Duration, responseHandler SessionConfigResponseHandler, timeoutHandler SessionConfigTimeoutHandler) *SessionConfigTask
func (*SessionConfigTask) MessageTask ¶
func (t *SessionConfigTask) MessageTask() *libcoap.Pdu
type SessionConfigTimeoutHandler ¶
type SessionConfigTimeoutHandler func(*SessionConfigTask, *Env)
type TimeoutEvent ¶
type TimeoutEvent struct{ EventBase }
func (*TimeoutEvent) Handle ¶
func (e *TimeoutEvent) Handle(env *Env)
type TimeoutHandler ¶
type TimeoutHandler func(*MessageTask, *Env)