Module: MyoApi

Source:

Members

(inner) Arm

Source:
See:

(inner) ConnectionState

Source:
See:

(inner) LockingPolicy

Source:
See:

(inner) Pose

Source:
See:

(inner) UnlockType

Source:
See:

(inner) VibrationType

Source:
See:

(inner) XDirection

Source:
See:

Methods

(inner) attachByMacAddress(macAddress, sCb, eCb)

Attach / connect to a Myo device identified by its MAC address. When the device is connected, events will be fired, and can be processed registering a callback for the "attach" and / or "connect" event.
Parameters:
Name Type Description
macAddress string The MAC address of the device to be attached
sCb SuccessCallback Success callback
eCb ErrorCallback Error callback
Source:
Fires:
  • module:MyoApi#event:attach
  • module:MyoApi#event:connect

(inner) attachToAdjacentMyo(sCb, eCb)

Initiate attaching to a Myo that is physically very near to (almost touching) the Bluetooth radio. When the device is connected, events will be fired, and can be processed registering a callback for the "attach" and / or "connect" event.
Parameters:
Name Type Description
sCb SuccessCallback Success callback
eCb ErrorCallback Error callback
Source:
Fires:
  • module:MyoApi#event:attach
  • module:MyoApi#event:connect

(inner) attachToAdjacentMyos(count, sCb, eCb)

Initiate attaching to several Myos that are physically very near to (almost touching) the Bluetooth radio. When a device is connected, events will be fired, and can be processed registering a callback for the "attach" and / or "connect" event.
Parameters:
Name Type Description
count number The number of devices which want to be attached
sCb SuccessCallback Success callback
eCb ErrorCallback Error callback
Source:
Fires:
  • module:MyoApi#event:attach
  • module:MyoApi#event:connect

(inner) detach(macAddress, sCb, eCb)

Detach from the Myo device identified by its MAC address
Parameters:
Name Type Description
macAddress string The MAC address of the device to be detached
sCb SuccessCallback Success callback
eCb ErrorCallback Error callback
Source:
Fires:
  • module:MyoApi#event:detach
  • module:MyoApi#event:disconnect

(inner) getConnectedDevices(sCb, eCb)

Requests the list of currently connected Myo devices.
Parameters:
Name Type Description
sCb DeviceListCallback Callback to receive the result
eCb ErrorCallback
Source:
To Do:
  • TODO: return list synchronously?

(inner) getLockingPolicy(sCb, eCb)

Get the current local policy of the Hub
Parameters:
Name Type Description
sCb GetLockPolicyCallback Success callback
eCb ErrorCallback Error callback
Source:
To Do:
  • TODO: return info synchronously?

(inner) getMyoAttachAllowance(sCb, eCb)

Retrieve the current maximum number of devices allowed to connect at once.
Parameters:
Name Type Description
sCb SuccessCallback Callback which receives the requested number of devices
eCb ErrorCallback
Source:
To Do:
  • TODO: return number synchronously?

(inner) init(sCb, eCb)

Request to initialize the API. Will fail if the system doesn't support Bluetooth Low Energy
Parameters:
Name Type Description
sCb SuccessCallback Success callback
eCb ErrorCallback Error callback
Source:

(inner) isBluetoothEnabled(sCb, eCb)

Checks if the Bluetooth adapter is enabled
Parameters:
Name Type Description
sCb BooleanCallback Success callback. Receives 1 if the adapter is enabled, 0 otherwise.
eCb ErrorCallback Error callback
Source:

(inner) isSendingUsageData(sCb, eCb)

Retrieve the current state of the usage data sending option.
Parameters:
Name Type Description
sCb BooleanCallback
eCb ErrorCallback
Source:
To Do:
  • TODO: return bool synchronously?

(inner) now(sCb, eCb)

Requests the current timestamp to the API
Parameters:
Name Type Description
sCb SuccessCallback Success callback which receives the current timestamp as a Number representing the milliseconds since the Unix Epoch
eCb ErrorCallback
Source:

(inner) off(eventName, sCb, eCb)

Unregisters an event listener registered with MyoApi.on
Parameters:
Name Type Description
eventName string Name / type of event to unregister
sCb SuccessCallback
eCb ErrorCallback
Source:

(inner) on(eventName, onEventCb, onErrCb)

Registers an event listener. Use MyoApi.off to unregister
Parameters:
Name Type Description
eventName string One of the supported events: "connect", "disconnect", "pose", "attach", "detach", "armSync", "armUnsync", "unlock", "lock", "orientationData", "accelerometerData", "gyroscopeData", "rssi".
onEventCb EventCallback Callback to be called when an event is received. The signature depends on event, for example, for "pose": function(Myo myo, number timestamp, Pose pose)
onErrCb ErrorCallback Error callback.
Source:
To Do:
  • TODO: calculate edge and add parameter to event callback
  • TODO: timer function to reduce false positives?

(inner) openBluetoothConfig(sCb, eCb)

Opens the Bluetooth adapter configuration screen.
Parameters:
Name Type Description
sCb BooleanCallback Success callback. Receives 1 if the user turned on the Bluetooth adapter, 0 otherwise.
eCb ErrorCallback Error callback
Source:

(inner) openScanDialog(sCb, eCb)

Opens a native dialog which displays the Myo devices in range and gives the option to connect to them. No result is returned.
Parameters:
Name Type Description
sCb SuccessCallback Success callback
eCb ErrorCallback Error callback
Source:

(inner) setLockingPolicy(policy, sCb, eCb)

Set the locking policy for the connected Myos
Parameters:
Name Type Description
policy MyoApi.LockingPolicy Locking policy to be set
sCb SuccessCallback Success callback
eCb ErrorCallback Error callback
Source:

(inner) setMyoAttachAllowance(allowance, sCb, eCb)

Set the current maximum number of devices allowed to connect at once.
Parameters:
Name Type Description
allowance number Number of devices to allow to connect at the same time
sCb SuccessCallback
eCb ErrorCallback
Source:

(inner) setSendUsageData(isSend, sCb, eCb)

Enable or disable the option to send device usage data to Thalmic Labs over the network.
Parameters:
Name Type Description
isSend boolean Whether to send or not usage data to Thalmic
sCb SuccessCallback
eCb ErrorCallback
Source:

(inner) shutdown(sCb, eCb)

Request to free all resources of the API
Parameters:
Name Type Description
sCb SuccessCallback Success callback
eCb ErrorCallback Error callback
Source: