Struct foxbox_taxonomy::services::Service [] [src]

pub struct Service {
    pub tags: HashSet<Id<TagId>>,
    pub id: Id<ServiceId>,
    pub properties: HashMap<String, String>,
    pub getters: HashMap<Id<Getter>, Channel<Getter>>,
    pub setters: HashMap<Id<Setter>, Channel<Setter>>,
    pub adapter: Id<AdapterId>,
}

Metadata on a service. A service is a device or collection of devices that may offer services. The FoxBox itself is a service offering services such as a clock, communicating with the user through her smart devices, etc.

JSON

A service is represented by an object with the following fields:

Fields

tags

Tags describing the service.

These tags can be set by the user, adapters or applications. They are used by applications to find services and services.

For instance, a user may set tag "entrance" to all services placed in the entrance of his house, or a tag "blue" to a service controlling blue lights. An adapter may set tags "plugged" or "battery" to devices that respectively depend on a plugged power source or on a battery.

id

An id unique to this service.

properties

Service properties that are set at creation time. For instance, these can be device manufacturer, model, etc.

getters

Getter channels connected directly to this service.

setters

Setter channels connected directly to this service.

adapter

Identifier of the adapter for this service.

Methods

impl Service

fn empty(id: Id<ServiceId>, adapter: Id<AdapterId>) -> Self

Create an empty service.

Trait Implementations

impl Deserialize for Service

fn deserialize<__D>(deserializer: &mut __D) -> Result<Service, __D::Error> where __D: Deserializer

impl Serialize for Service

fn serialize<__S>(&self, serializer: &mut __S) -> Result<(), __S::Error> where __S: Serializer

impl ToJSON for Service

fn to_json(&self, parts: &mut BinaryParts) -> JSON

impl ServiceLike for Service

fn id(&self) -> &Id<ServiceId>

fn adapter(&self) -> &Id<AdapterId>

fn with_tags<F>(&self, f: F) -> bool where F: Fn(&HashSet<Id<TagId>>) -> bool

fn has_getters<F>(&self, f: F) -> bool where F: Fn(&Channel<Getter>) -> bool

fn has_setters<F>(&self, f: F) -> bool where F: Fn(&Channel<Setter>) -> bool

impl SelectedBy<ServiceSelector> for Service

fn matches(&self, selector: &ServiceSelector) -> bool

Derived Implementations

impl Clone for Service

fn clone(&self) -> Service

1.0.0fn clone_from(&mut self, source: &Self)

impl Debug for Service

fn fmt(&self, __arg_0: &mut Formatter) -> Result