Namespace: Lens.Machines

Lens.Machines allows you interact with the LuXoR device your app is running on, as well as discover and interact with nearby machines.

LuXoR devices have capabilities, which you can turn on and off from your apps. In addition, apps can define RPCs, which can be invoked by apps running on nearby machines.

See RPCs for more information on defining and calling RPCs.

Static Properties

Lens.Machines.localhost ARCore/machines.js, line 208

The local LuminAR machine.

Static Methods

Lens.Machines.all() → {Machine[]} ARCore/machines.js, line 113

Returns a list of all nearby machines.

Lens.Machines.findByCapability(name) → {Array.<Machine>} ARCore/machines.js, line 164

Finds all machines with the given capability.

Argument Type Description
name String

Name of the capability

Returns:

Array of matching Machines

Lens.Machines.findByDB(name) → {Array.<Machine>} ARCore/machines.js, line 194

Finds all machines with the given DB.

Argument Type Description
name String

Name of the DB

Returns:

Array of matching Machines

Lens.Machines.findById(id) → {Machine} ARCore/machines.js, line 146

Finds a machine, given its id.

Argument Type Description
id String
Returns:

The Machine with the given id, or null if no such machine exists.

Lens.Machines.findByRPC(name) → {Array.<Machine>} ARCore/machines.js, line 179

Finds all machines with the given RPC.

Argument Type Description
name String

Name of the RPC

Returns:

Array of matching Machines

Lens.Machines.machine(name) → {Machine} ARCore/machines.js, line 125

Finds a machine, given its name.

Argument Type Description
name String
Returns:

The Machine with the given name, or null if no such machine exists.

Lens.Machines.subscribe(fn, filter) → {Binding} ARCore/machines.js, line 86

Subscribes a function to be called when capabilities or RPCs are added and/or removed.

Argument Type Attributes Description
fn function

A callback function, invoked when a capability is added or removed. Gets the Capability, Machine, or Lens.DB as the first argument, the state (either "added" or "removed") as the second argument, and the type ("rpc", "db" or "capability") as the third argument.

filter Object <optional>

Filters to limit which capability additions/removals the subscriber function is called for.

Properties
Argument Type Attributes Description
machine Machine | String | RegExp <optional>

A Machine, or a string or RegExp to match the machine name against.

name String | RegExp <optional>

A string or RegExp to match the capability name against.

state String <optional>

Either "added" or "removed", if you only want to be notified of that state.

type String <optional>

"rpc", "db", or "capability", if you only want to be notified of that type.

Returns:

A binding that can be used to unsubscribe.