device

package
v2.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 28 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(id uuid.UUID, level pkgLog.Level) pkgLog.Logger

Types

type CAPoolGetter

type CAPoolGetter interface {
	IsValid() bool
	GetPool() (*x509.CertPool, error)
}

type CloudConfig

type CloudConfig struct {
	Enabled bool
	cloud.Config
}

type Config

type Config struct {
	ID                    uuid.UUID
	Name                  string
	ProtocolIndependentID uuid.UUID
	ResourceTypes         []string
	MaxMessageSize        uint32
	Cloud                 CloudConfig
	Credential            CredentialConfig
}

func (*Config) Validate

func (cfg *Config) Validate() error

type CredentialConfig

type CredentialConfig struct {
	Enabled bool
	credential.Config
}

type Device

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

func New

func New(cfg Config, opts ...Option) (*Device, error)

func (*Device) AddResources added in v2.4.1

func (d *Device) AddResources(resource ...Resource)

func (*Device) Close

func (d *Device) Close()

func (*Device) CloseAndDeleteResource

func (d *Device) CloseAndDeleteResource(resourceHref string) bool

CloseAndDeleteResource resource is closed and also unpublished from the cloud

func (*Device) ExportConfig

func (d *Device) ExportConfig() Config

func (*Device) GetCloudManager

func (d *Device) GetCloudManager() *cloud.Manager

func (*Device) GetID

func (d *Device) GetID() uuid.UUID
func (d *Device) GetLinks(request *net.Request) (links schema.ResourceLinks)

func (*Device) GetLinksFilteredBy

func (d *Device) GetLinksFilteredBy(endpoints schema.Endpoints, deviceIDfilter uuid.UUID, resourceTypesFitler []string, policyBitMaskFitler schema.BitMask) (links schema.ResourceLinks)

func (*Device) GetLoop added in v2.4.0

func (d *Device) GetLoop() *eventloop.Loop

func (*Device) GetName

func (d *Device) GetName() string

func (*Device) GetProtocolIndependentID

func (d *Device) GetProtocolIndependentID() uuid.UUID

func (*Device) GetResource

func (d *Device) GetResource(resourceHref string) (Resource, bool)

func (*Device) GetResourceTypes

func (d *Device) GetResourceTypes() []string

func (*Device) HandleRequest

func (d *Device) HandleRequest(req *net.Request) (*pool.Message, error)

func (*Device) Init

func (d *Device) Init()

func (*Device) LoadAndDeleteResource

func (d *Device) LoadAndDeleteResource(resourceHref string) (Resource, bool)

LoadAndDeleteResource resource need to be closed after usage and also unpublished from the cloud

func (*Device) Range

func (d *Device) Range(f func(resourceHref string, resource Resource) bool)

type OnDeviceUpdated

type OnDeviceUpdated func(d *Device)

type Option

type Option func(*OptionsCfg)

func WithCAPool

func WithCAPool(caPool CAPoolGetter) Option

func WithEventLoop added in v2.4.0

func WithEventLoop(loop *eventloop.Loop) Option

func WithGetAdditionalPropertiesForResponse

func WithGetAdditionalPropertiesForResponse(getAdditionalProperties device.GetAdditionalPropertiesForResponseFunc) Option

func WithGetCertificates

func WithGetCertificates(getCertificates cloud.GetCertificates) Option

func WithLogger

func WithLogger(logger log.Logger) Option

func WithOnDeviceUpdated

func WithOnDeviceUpdated(onDeviceUpdated OnDeviceUpdated) Option

type OptionsCfg

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

type Resource

type Resource interface {
	Close()
	ETag() []byte
	GetHref() string
	GetResourceTypes() []string
	GetResourceInterfaces() []string
	HandleRequest(req *net.Request) (*pool.Message, error)
	GetPolicyBitMask() schema.BitMask
	SetObserveHandler(loop *eventloop.Loop, createSubscription resources.CreateSubscriptionFunc)
	UpdateETag()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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