Documentation ¶
Index ¶
- type Container
- type Manager
- type Thing
- func (t *Thing) AddAction(name string) bool
- func (t *Thing) AddEventSubscription(f func(message topic.ThingEventMessage))
- func (t *Thing) GetPropertyValue(name string) (any, error)
- func (t *Thing) OnEvent(event *events.EventDescription)
- func (t *Thing) RemoveAction(name string) bool
- func (t *Thing) SetSelectedCapability(selectedCapability string)
- func (t *Thing) SetTitle(title string)
- func (t *Thing) UnmarshalJSON(data []byte) error
- type ThingPin
- type ThingsContainer
- func (c *ThingsContainer) CreateThing(data []byte) (*Thing, error)
- func (c *ThingsContainer) GetMapOfThings() map[string]*Thing
- func (c *ThingsContainer) GetThing(id string) *Thing
- func (c *ThingsContainer) GetThingPropertyValue(thingId, propName string) (any, error)
- func (c *ThingsContainer) GetThings() (ts []*Thing)
- func (c *ThingsContainer) RemoveThing(thingId string) error
- func (c *ThingsContainer) SetThingPropertyValue(thingId, propName string, value any) (any, error)
- func (c *ThingsContainer) UpdateThing(thing *Thing) error
- type ThingsStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container interface { SetThingPropertyValue(thingId, propertyName string, value any) (any, error) GetThingPropertyValue(thingId, propertyName string) (any, error) Publish(topic2 topic.Topic, args ...any) Subscribe(topic2 topic.Topic, f any) error Unsubscribe(topic2 topic.Topic, f any) GetThing(thing string) *Thing GetThings() []*Thing }
type Manager ¶
type Manager interface { SetPropertyValue(ctx context.Context, thingId, propertyName string, value any) (any, error) GetPropertyValue(thingId, propertyName string) (any, error) GetPropertiesValue(thingId string) (map[string]any, error) Publish(topic2 topic.Topic, args ...any) Subscribe(topic2 topic.Topic, f any) error }
type Thing ¶
type Thing struct { *wot.Thing Pin *ThingPin `json:"pin,omitempty"` CredentialsRequired bool `json:"credentialsRequired,omitempty"` //The state of the thing SelectedCapability string `json:"selectedCapability,omitempty"` Connected bool `json:"-"` //FloorplanVisibility bool `json:"floorplanVisibility"` //FloorplanX uint `json:"floorplanX"` //FloorplanY uint `json:"floorplanY"` //LayoutIndex uint `json:"layoutIndex"` GroupId string `json:"groupId,omitempty"` // contains filtered or unexported fields }
func AsWebOfThing ¶
func (*Thing) AddEventSubscription ¶
func (t *Thing) AddEventSubscription(f func(message topic.ThingEventMessage))
func (*Thing) OnEvent ¶
func (t *Thing) OnEvent(event *events.EventDescription)
func (*Thing) RemoveAction ¶
func (*Thing) SetSelectedCapability ¶
func (*Thing) UnmarshalJSON ¶
type ThingsContainer ¶
ThingsContainer 管理所有Thing Models 向外部发送ThingAdded,ThingRemoved,ThingModify,ThingConnected事件
func NewThingsContainerModel ¶
func NewThingsContainerModel(manager Manager, store ThingsStorage) *ThingsContainer
NewThingsContainerModel 管理所有Thing Models
func (*ThingsContainer) CreateThing ¶
func (c *ThingsContainer) CreateThing(data []byte) (*Thing, error)
CreateThing container和store中创建Thing ThingAdded事件
func (*ThingsContainer) GetMapOfThings ¶
func (c *ThingsContainer) GetMapOfThings() map[string]*Thing
func (*ThingsContainer) GetThing ¶
func (c *ThingsContainer) GetThing(id string) *Thing
func (*ThingsContainer) GetThingPropertyValue ¶
func (c *ThingsContainer) GetThingPropertyValue(thingId, propName string) (any, error)
func (*ThingsContainer) GetThings ¶
func (c *ThingsContainer) GetThings() (ts []*Thing)
func (*ThingsContainer) RemoveThing ¶
func (c *ThingsContainer) RemoveThing(thingId string) error
RemoveThing 从container和store中删除Thing 向定阅发送ThingRemoved事件
func (*ThingsContainer) SetThingPropertyValue ¶
func (c *ThingsContainer) SetThingPropertyValue(thingId, propName string, value any) (any, error)
func (*ThingsContainer) UpdateThing ¶
func (c *ThingsContainer) UpdateThing(thing *Thing) error
UpdateThing 在container和Store中更新Thing
Click to show internal directories.
Click to hide internal directories.