Documentation
¶
Overview ¶
Reference to https://datatracker.ietf.org/doc/html/rfc6690 unused for now
Index ¶
- Constants
- type Client
- type Config
- type Link
- type Object
- func (o *Object) AddGroup(group Object)
- func (o *Object) AddObject(path string, childObject ObjectAPI)
- func (o *Object) GetAllChildPaths() []string
- func (o Object) GetChildObject(path string) *Object
- func (o *Object) GetCoRELinkString() string
- func (o Object) ReadAll(baseName string) (Resource, error)
- type ObjectAPI
- type ObjectData
- type QueryParams
- type Resource
- type Task
- type TaskManager
Constants ¶
const ( EnableObserveAction uint32 = 0 DisableObserveAction uint32 = 1 )
const ( ObjectPathDelimiter = "/" ObjectRoot = "/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Config // contains filtered or unexported fields }
func (*Client) Delete ¶
De-register the client from the server Reference: https://www.openmobilealliance.org/release/LightweightM2M/V1_0-20170208-A/OMA-TS-LightweightM2M-V1_0-20170208-A.pdf#page=76
func (*Client) Register ¶
Register register the client to the server Reference: https://www.openmobilealliance.org/release/LightweightM2M/V1_0-20170208-A/OMA-TS-LightweightM2M-V1_0-20170208-A.pdf#page=27 Reference: https://www.openmobilealliance.org/release/LightweightM2M/V1_0-20170208-A/OMA-TS-LightweightM2M-V1_0-20170208-A.pdf#page=76
func (*Client) Update ¶
Update update registration Reference: https://www.openmobilealliance.org/release/LightweightM2M/V1_0-20170208-A/OMA-TS-LightweightM2M-V1_0-20170208-A.pdf#page=30 Reference: https://www.openmobilealliance.org/release/LightweightM2M/V1_0-20170208-A/OMA-TS-LightweightM2M-V1_0-20170208-A.pdf#page=76
type Config ¶
type Config struct { EndpointName string EndpointUrl string DeviceShifuHost string Settings v1alpha1.LwM2MSetting }
type Link ¶
type Link struct { ResourcePath string // ResourcePath is the path to the resource. Attributes map[string]string // Attributes are the attributes of the resource link. }
Link represents a single resource link with its attributes in CoRE Link Format.
type Object ¶
func (*Object) AddObject ¶
AddObject adds a child Object to target path input: path is the path of the child object. example: /1/0 input: childObject is the child object to be added
func (*Object) GetAllChildPaths ¶
GetAllChildPaths returns all the child paths of the object. example: [/1/0, /1/1]
func (Object) GetChildObject ¶
GetChildObject returns the child object at the given path if it exists.
func (*Object) GetCoRELinkString ¶
GetCoRELinkString returns the CoRE Link Format string for the object and its children. Reference to https://datatracker.ietf.org/doc/html/rfc6690 example: </>;rt="oma.lwm2m";ct="11543",</1/0>,</1/1>
type ObjectData ¶
type QueryParams ¶
type QueryParams string
const ( QueryParamsEndpointName QueryParams = "ep" QueryParamslifeTime QueryParams = "lt" QueryParamsLwM2MVersion QueryParams = "lwm2m" QueryParamsBindingMode QueryParams = "b" )
type Resource ¶
type Resource struct { BaseName string `json:"bn"` ResourceArray []ObjectData `json:"e"` }
func (*Resource) ReadAsJSON ¶
type Task ¶
type Task struct { Ticker *time.Ticker CancelFunc context.CancelFunc // contains filtered or unexported fields }
type TaskManager ¶
type TaskManager struct { Tasks map[string]*Task Lock sync.Mutex // contains filtered or unexported fields }
func NewTaskManager ¶
func NewTaskManager(ctx context.Context) *TaskManager
func (*TaskManager) AddTask ¶
func (m *TaskManager) AddTask(id string, interval time.Duration, fn func())
AddTask adds a new task to the task manager. The task will be executed every interval and run the given function and assign the task to the given id.
func (*TaskManager) CancelAllTasks ¶
func (m *TaskManager) CancelAllTasks()
CancelAllTasks cancels all the tasks in the task manager.
func (*TaskManager) CancelTask ¶
func (m *TaskManager) CancelTask(id string)
CancelTask cancels the task with the given id.
func (*TaskManager) ResetTask ¶
func (m *TaskManager) ResetTask(id string)
reset the task ticker for the given id