B4J Question Best way to pass data back to Python script

mpearson

Member
Licensed User
Longtime User
Hello,
I currently am implementing the following minus the argv portion, as that's not needed for my application:
https://www.b4x.com/android/forum/t...cript-with-parameters-from-b4j.60283/#content

The server is a standard B4J web server running on a raspberry pi. The python script is used to manage a network of 802.15.4 wireless modules. It uses the standard python libraries but has some special syntax for it's methods. The pi has hardware connected to it and the python script has to run continuously to maintain the network.

I currently run the python script like the above example shows. I have the script coded to use print statements which are intercepted by the B4J web server.

This works great for sending data in that direction. It is a bit more challenging sending information the other direction. For example, if my mobile app presses a button, I may need to take action in the python script in order to make something happen.

I've used files to pass information in the past and have considered a database going forward, but am not sure if that's the cleanest method. I wanted to throw it out there in case anyone had a cleaner suggestion.

Thanks,
Mike
 
Last edited:
Top