3. Using etee Python API

3.1. Quickstart

etee driver automatically detects an eteeDongle and connects to it through the EteeController class’ connect() method. To start the eteeController data stream, call the class start_data(), followed by the run() method to initiate the data loop. While the data loop is running, the etee driver will read the eteeController serial data, parse it and store the results in its internal buffer.

1# Import the etee API library
2from etee import EteeController
3
4# Instantiate the driver class
5etee = EteeController()
6
7etee.connect()     # Connect the eteeDongle to the driver
8etee.start_data()  # Request eteeControllers to start data stream
9etee.run()         # Start data loop

Once the driver is running, data getter functions can be called to get etee data.

while True:
   # Data getter functions
   left_trackpad_x = etee.get_trackpad_x('left')
   left_trackpad_y = etee.get_trackpad_y('left')

   # Print the values
   print(f"Finger touch identified at position [{left_trackpad_x}, {left_trackpad_y}] in the left eteeController.")
   time.sleep(0.01)

For more information, see: 4.2.1. Data Getters Functions.

Alternatively, it may be preferable to retrieve data through an event-based method, where data processing functions can be added as callbacks to data events.

# Function to be added as callback
def process_left_index_pressure():
   left_index_pull = etee.get_index_pull('left')
   left_index_force = etee.get_index_force('left')
   print(f"The pressure of the left index finger is: pull = {left_index_pull}, force = {left_index_force}.")

# Connect callback to data reception events
etee.left_hand_received.connect(process_left_index_pressure)

After this, when the driver starts running, the process_left_index_pressure() function will run every time a left-hand data packet is received by the driver.

The API library defines a few events, such as data receiving events and device connection/disconnection events, among others. A callback function can be connected to any of these events. For more information, see: 4.4. Event-Based Programming.

3.2. Methods and Class Constructors

You can find the full reference of available methods and classes under the 6. API Reference section.