Javascript API

class tymio.Node()

Node

tymio.Node.disconnected

Whether the node is disconnected

tymio.Node.get_description()
Get the description from the device
The device must be in the ready state before requestibng the VM.
Throws:mobsya.fb.Error
Returns:external:Promise.<AsebaVMDescription>
tymio.Node.id

return the node id

tymio.Node.lock()
Lock the device

Locking a device is akin to take sole ownership of it until the connection is closed or the unlock method is explicitely called

The device must be in the ready state before it can be locked. Once a device is locked, all client will see the device becoming busy.

If the device can not be locked, an {@link mobsya.fb.Error} is raised.

Throws:mobsya.fb.Error
tymio.Node.run_aseba_program()
Run the code currently loaded on the vm
The device must be locked before calling this function
Throws:mobsya.fb.Error
tymio.Node.send_aseba_program(code)
Load an aseba program on the VM
The device must be locked before calling this function
Arguments:
  • code (external:String) – the aseba code to load
Throws:

mobsya.fb.Error

tymio.Node.status

The node status

tymio.Node.status_str

The node status converted to string.

tymio.Node.unlock()
Unlock the device
Once a device is unlocked, all client will see the device becoming ready. Once unlock, a device can’t be written to until loc
Throws:mobsya.fb.Error
class tymio.Client(url)
Arguments:
  • url (external:String) – : Web socket address
tymio.Client.on_nodes_changed(nodes)
Arguments:
  • nodes (Array.<Node>) – : Nodes whose status has changed.