Otii Ace TCP socket API compatibility

API reference: https://www.qoitech.com/help/tcpserver/#arc_is_connected

I am trying to use our python code (used to automate measurements using an Otii Arc device) to control an Otii Ace device, basically to perform the same measurements using higher supply voltages. I am using Otii windows software 3.1.0 in combination with Otii ace pro (FW 3.0.4)

Where I get stuck, while performing the same sequence of commands as with ace, is that the device seems not connected and the ‘project_start_recording’ command times out. (snippet of log below). I am using the command set prefixed with arc because the TCP interface does not seem to support ace prefixed counterparts. Or at least I could not find an Ace specific command set online.

What I do notice is that in the new version 3 windows software you first have to “Add” a device before you can access all the other controls. Does the TCP API support something similar that I am forgetting to call before recording? How can I connect my Ace box with the TCP API and my python code?

Log snippet:
arc_set_main {‘type’: ‘response’, ‘cmd’: ‘arc_set_main’, ‘data’: {}}
otii_create_project {‘type’: ‘response’, ‘cmd’: ‘otii_create_project’, ‘data’: {‘project_id’: 1}}
otii_get_active_project {‘type’: ‘response’, ‘cmd’: ‘otii_get_active_project’, ‘data’: {‘project_id’: 1}}
arc_is_connected {‘type’: ‘error’, ‘errorcode’: ‘Device not connected’, ‘cmd’: ‘arc_is_connected’, ‘data’: {}}
arc_enable_channel {‘type’: ‘error’, ‘errorcode’: ‘Device not connected’, ‘cmd’: ‘arc_enable_channel’, ‘data’: {}}
arc_enable_channel {‘type’: ‘error’, ‘errorcode’: ‘Device not connected’, ‘cmd’: ‘arc_enable_channel’, ‘data’: {}}
project_start_recording {‘type’: ‘error’, ‘errorcode’: ‘Command timeout’, ‘cmd’: ‘project_start_recording’, ‘data’: {}}
project_stop_recording {‘type’: ‘error’, ‘errorcode’: ‘Unknown error’, ‘cmd’: ‘project_stop_recording’, ‘data’: “Cannot access ‘a’ before initialization”}

Hi,

With otii_get_devices (https://www.qoitech.com/help/tcpserver/#otii_get_devices) you get a list of connected devices. There it states if it is an Arc or an Ace.
Do you connect explicitly to an Arc there perhaps?

Check something like this:

otii_object = otii.Otii(connection)
devices = otii_object.get_devices()
if len(devices) == 0:
    print("No device connected!")
    sys.exit()
for id, device in enumerate(devices):
    print("Device {0} is an {1}".format(id, device.type))
my_device=device[0] #Connecting to the first device found, regardless if it is Arc or Ace

You do not need to do any extra “Add” as is done in the UI, you should connect as before.
The TCP API is a little bit misleading as it says Arc, but it is the same for Ace.

I hope this makes it more clear.

Best regards,
Björn

Hi Bjorn,

Thanks for helping me out. Today I have found a solution for my problem. I executed the same python code on an existing setup using an Otii Arc and 2.8.3 software, and a new setup using an Otii Ace and 3.0.1 software, while comparing the output of all responses to TCP commands.

The problem was not in finding the device or using the correct device id. The problem was in a difference while creating a project in my python code.

Otii Arc with SW 2.8.4:

otii_get_active_project {'cmd': 'otii_get_active_project', 'data': {'project_id': -1}, 'type': 'response'}
otii_create_project {'cmd': 'otii_create_project', 'data': {'project_id': 1}, 'type': 'response'}
otii_get_active_project {'cmd': 'otii_get_active_project', 'data': {'project_id': 1}, 'type': 'response'}

Otii Ace with SW 3.0.1:

otii_get_active_project {'type': 'response', 'cmd': 'otii_get_active_project', 'data': {'project_id': 1}}
project_close {'type': 'response', 'cmd': 'project_close', 'data': {}}
otii_create_project {'type': 'response', 'cmd': 'otii_create_project', 'data': {'project_id': 1}}
otii_get_active_project {'type': 'response', 'cmd': 'otii_get_active_project', 'data': {'project_id': 1}}

In the newer setup there already was/is an active project available. When I try to close this project it does not go away (active project id never gets ‘-1’). Also, whenever I close a project, creating a new one or whatever else, the active project id always remains 1.

After closing a project and/or creating a new project the device becomes ‘Device not connected’. Querying an active project does not change behavior, I can do that as many times as I want.
I tried starting the TCP server via otiicli.exe, opening the windows app with and without creating a project and windows app with and without opening an existing project and nothing changed in the outcome. When I mess with the existing project (id ‘1’) the flow breaks.

For now I do something like this and that seems to work on both setups:

        active_project = self.__GetActiveProject()

        if (device_name == 'Arc' and  active_project > 0):
            self.__CloseProject(active_project)

        if (active_project < 0):
            self.__CreateProject() 

Did the way how to deal with projects change?