neosensory_python package¶
Module contents¶
-
class
neosensory_python.NeoDevice(client)¶ Bases:
objectA class for controlling a connected Neosensory device with Bleak
-
async
accept_developer_api_terms()¶ After successfully calling auth as developer, use the accept command to agree to the Neosensory Developer API License (https://neosensory.com/legal/dev-terms-service/). Successfully calling this unlocks the following commands: audio start, audio stop, motors_clear_queue, motors start, motors_stop, motors vibrate.
-
async
clear_motor_queue()¶ Clear any vibration commands sitting the device’s motor FIFO queue. This should be called prior to streaming control frames using motors vibrate. This command requires successful developer authorization, otherwise, the command will fail.
-
async
disable_motors()¶ Clear the motors command queue and shut down the motor drivers. This command requires successful developer authorization, otherwise, the command will fail.
-
async
enable_motors()¶ Initialize and start the motors interface. The motors can then accept motors vibrate commands. This command requires successful developer authorization, otherwise, the command will fail.
-
async
enable_notifications(handler)¶ Enable notifications to be sent back to host computer
- Args:
handler: the handler function that processes the received reponse
-
async
get_battery_level()¶ Obtain the device’s battery level in %. This command does not require developer authorization
-
async
get_device_info()¶ Obtain various device and firmware information. This command does not require developer authorization.
-
async
pause_device_algorithm()¶ Pause the running algorithm on the device to accept motor control over the CLI. This command requires successful developer authorization, otherwise, the command will fail.
Request developer authorization. The CLI returns the message “Please type ‘accept’ and hit enter to agree to Neosensory Inc’s Developer Terms and Conditions, which can be viewed at https://neosensory.com/legal/dev-terms-service
-
async
resume_device_algorithm()¶ (Re)starts the device’s microphone audio acquisition and algorithm. This command requires successful developer authorization, otherwise, the command will fail. This is functionally the same as startAudio()
-
async
send_command(command)¶ Send a custom API command to Neosensory device
- Args:
command: command string, e.g. “device info”
-
set_client(new_client)¶ Set the Bleak client object
- Args:
new_client: the Bleak client object
-
async
start_audio()¶ (Re)starts the device’s microphone audio acquisition. This command requires successful developer authorization, otherwise, the command will fail.
-
async
stop_audio()¶ Stop the device’s microphone audio acquisition. This should be called prior to transmitting motor vibration data. This command requires successful developer authorization, otherwise, the command will fail.
-
async
stop_motors()¶ Send a frame that turns off the motors. Note: the API CLI command “motors stop” disables the motor drivers. This command requires successful developer authorization, otherwise, the command will fail. Assumes this is a 4-motor device (e.g. Neosensory Buzz)
-
async
vibrate_motors(motor_list)¶ - Set the actuators amplitudes on a connected Neosensory device.
Note: actuators will stay vibrating indefinitely on the last frame received until a new control * frame is received
- Args:
- motor_list: a list of motor intensity values on [0,255].
This is API call is designed for Neosensory Buzz–and assumes 4 motors. If the list length is > 4, the Buzz will put subsequent encodings on the queue to be played out on a 16 ms period.
-
async
-
neosensory_python.get_buzz_illusion_activations(linear_intensity, location, min_intensity, max_intensity, num_motors)¶ - Apply a haptic illusion across a Neosensory device
to create the sensation of a single arbitrary point around the wrist vibrating.
- Args:
linear_intensity: an intensity value on [0,1]
location: a location around the wrist on [0,1]
- min_intensity: a minimum motor intensity value.
Typically 0 or minimal perceptible motor activation value.
- max_intensity: a maximum motor intensity value.
For Neosensory Buzz, motor values can be on [0,255]
num_motors: number of motors on the device (4 for Neosensory Buzz)
- Returns:
A list of motor encodings representing an illusory point.
-
neosensory_python.get_motor_intensity(linear_intensity, min_intensity, max_intensity)¶ - Linearly map a value on [0,1] to a motor
vibration strenght on [min_intensity, max_intensity]
- Args:
linear_intensity: an intensity value on [0,1]
- min_intensity: a minimum motor intensity value.
Typically 0 or minimal perceptible motor activation value.
- max_intensity: a maximum motor intensity value.
For Neosensory Buzz, motor values can be on [0,255]
- Returns:
A linearly mapped value on [min_intensity, max_intensity]