device

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

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) GetThingDescriptionManager added in v2.5.0

func (d *Device) GetThingDescriptionManager() *thingDescription.Manager

GetThingDescriptionManager returns thing description manager of the device.

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 GetThingDescription added in v2.5.0

type GetThingDescription func(ctx context.Context, d *Device, endpoints schema.Endpoints) *wotTD.ThingDescription

type OnDeviceUpdated

type OnDeviceUpdated func(d *Device)

type Option

type Option func(*OptionsCfg)

func WithCAPool

func WithCAPool(caPool CAPoolGetter) Option

func WithCloudOptions added in v2.4.3

func WithCloudOptions(cloudOptions ...cloud.Option) 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

func WithThingDescription added in v2.5.0

func WithThingDescription(getThingDescription GetThingDescription) 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()
	SupportsOperations() resources.SupportedOperation
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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