×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

get solver results (newSolverResults) in a DBUS python script

  • Posts: 29
  • Thank you received: 11
After triggering a capture and solve method in my DBUS-based python script using an ekos/align interface along the following lines:
...
align_object = bus.get_object("org.kde.kstars", # Connection name
                                "/KStars/Ekos/Align" # Object's path
                                )
...
align_iface = dbus.Interface(align_object, 'org.kde.kstars.Ekos.Align')
...
align_iface.captureAndSolve()

I would like to be able to access the content contained in the following C++ method in align.cpp:
    emit newSolverResults(orientation, ra, dec, pixscale);
    QJsonObject solution =
    {
        {"camera", m_Camera->getDeviceName()},
        {"ra", SolverRAOut->text()},
        {"de", SolverDecOut->text()},
        {"dRA", m_TargetDiffRA},
        {"dDE", m_TargetDiffDE},
        {"targetDiff", m_TargetDiffTotal},
        {"pix", pixscale},
        {"PA", solverPA},
        {"fov", FOVOut->text()},
    };

Does anyone out there know how I might get that information from within a python script? Thanks.
5 months 4 days ago #97376

Please Log in or Create an account to join the conversation.

  • Posts: 29
  • Thank you received: 11
In the process of digging around, it seems like if I install a signal handler in my python script for the 'newSolution' event of the '/KStars/Ekos/Align' object of the DBUS 'org.kde.kstars ' connection, then the arguments passed with that signal should have what I was looking for.

Unfortunately, with all the deprecations to dbus-python and with my limited knowledge of python, I don't seem to be doing it correctly.

For experimentation purposes, I am using this catch-all signal handler"
def signal_handler(*args, **kwargs):
    global results
    for i, arg in enumerate(args):
        print("arg:%d        %s" % (i, str(arg)))
    print('kwargs:')
    print(kwargs)
    print('---end----')
and trying to register it via:
bus = dbus.SessionBus()
bus.add_signal_receiver(signal_handler,
                            signal_name='newSolution',
                            bus_name='org.kde.kstars',
                            dbus_interface='org.kde.kstars.Ekos.Align',
                            path='/KStars/Ekos/Align',
                            interface_keyword='interface',
                            member_keyword='member',
                            path_keyword='path',
                            message_keyword='msg')
Either I am not registering the handler properly or I need to get an additional thread involved. It just isn't clear to me how to do that.

Any help is appreciated.
5 months 2 days ago #97395

Please Log in or Create an account to join the conversation.

Time to create page: 0.498 seconds