Released the Python version of “Adventurer3 Control -5” with some functional restrictions.
The source is here on Github.
How to use
After downloading the source, it works by launching Console.py with the IP address of Adventurer3 as an argument.
Available commands are 4 types of p, s, jobstop, q. The command to transfer the file and start printing has not been ported yet.
Also, it does not include the function to search for IP of Adventurer3 automatically.
Code description
Adventurer3/Controller.py
Communication parts with Adventurer3 are organized into classes.
Of those created in C #, I removed only the file transfer part and ported it to Python.
The IP address of Adventurer3 is passed by constructor.
It is not as difficult as this code, so it is possible to add new commands.
If you want to use it, instead of sending commands directly with Send on the upper side, it may be easier to maintain the code later if you hide the method extension and Send here.
Console.py
Management of Controller object and stuffed UI part.
In the C # version, I keep connecting to Adventurer3. Therefore, on this side, the status acquisition command was sent from Adventurer 3 without timing out. In order to realize this, I was doing asynchronous processing or special processing when the connection was disconnected, but I feel that it is not necessary to always connect at all for the moment, so send a command to Adventurer3 Whenever I do, I try to connect / disconnect.
The code of the communication part with Adventurer 3 is written as follows.
if self.adv3.Start():
self.adv3.UpdateStatus()
self.adv3.End()
print(self.adv3.GetStatus())
Next thing to do
The Python environment is a relationship built with Visual Studio on Windows, and this code has not yet run on Raspberry Pi.
Next, I would like to check if the above code works on Raspberry Pi, and based on the operation check, verify that Raspberry Pi can be used as a Web server and control over the Web can not be performed.
コメント