Page 1 of 1

GIMX Web API and Android application

Posted: Sun Jan 06, 2019 12:22 am
by Lucashsmello
I'm currently developing a GIMX Web API to serve an android application that starts/stops and monitors GIMX on a remote device (RPi for example). I am using python-flask-RESTful to implement it. The code is found here: https://github.com/Lucashsmello/GIMX-WebAPI.

This project is in the very beginning.

Currently the WebAPI service only uses gimx binary with its options, stdout+stderr and key events (ex: generate shift+ESC programmatically to stop gimx) to control and monitor GIMX process. Capturing status and error on stdout and stderr are not reliable and not easy. I think a proper solution should use a GIMX API that provides functionality to monitor and control gimx. Is there anything better than using "stdout+stderr+keyevents" already implemented or someone planning to implement?.


A screenshot of the current state of the android application:


It can start,stop, get the list of configurations files and monitor some errors. It usually works.
This is my first time developing a Web Server/API and i have low experience in Android development, therefore development is being very slow and any suggestions and help are welcome.

Re: GIMX Web API and Android application

Posted: Sun Jan 06, 2019 8:04 pm
by Matlo
Status could be provided via UDP packets using the same format as for controlling a remote instance.
https://gimx.fr/wiki/index.php?title=Network_API

Re: GIMX Web API and Android application

Posted: Tue Jan 08, 2019 12:06 pm
by Lucashsmello
Thanks. I have some questions:
  • When does GIMX starts listening for udp packets? After or before connection with console and adapter is established?
  • I did not find any documentation about exit/return codes of gimx command line. What are the exit codes?

Re: GIMX Web API and Android application

Posted: Thu Jan 10, 2019 8:26 am
by Matlo
GIMX can be cut into two stages. In the first one, it initializes all resources and, if using an adapter, synchronously detects its. In the second one, it just waits for events to happen from one of the resources. In this step most of the processing is asynchronous and non-blocking.

Following this logic, initializing a socket should be performed in the first stage, and processing received data should be performed in the second stage.
Lucashsmello wrote:
Tue Jan 08, 2019 12:06 pm
When does GIMX starts listening for udp packets? After or before connection with console and adapter is established?
It starts listening in the initialization stage, but no event gets processed before the end of the stage, which includes detecting the adapter.
Lucashsmello wrote:
Tue Jan 08, 2019 12:06 pm
I did not find any documentation about exit/return codes of gimx command line. What are the exit codes?
https://github.com/matlo/GIMX/blob/ae68 ... gimx.h#L26