Closed mips171 closed 2 years ago
Hi
All currently app features are based on working API used by luci/web interface.
As far for new commands , My guess they should work.
I would suggest trying new command outside app development environment first.
You can use browser developer tools to extract working curl command and then start some trial and error :
If the curl command would return a good response , then you can try implementing it on the app.
HI,
I am wanting to add the ability to change settings on the device, like WiFi SSID and hostname. I am able to achieve this using uci set
followed by a uci apply
, but I am confused about how to pass the state from the text input widget to the commandParameters. If it's not too troublesome, would you be able to show an example for sharing the state from the form (such as deviceForm's _displayName ) to one of the ReplyBase classes?
lst.addAll(["uci", "set"]);
lst.add({
'config': 'system',
'section': 'system',
'values': {'hostname': "Hello World"}
});
Did you use developer tools to extract the command from web interface ?
a quick test shows a bit different parameters :
Yes, the example works on mine, but that is likely because I have done some customisations in my system's UCI database. Anyway, the command works and successfully sets and commits the entry in UCI. The problem is I cannot understand how to pass the text from the input field into the commandParameters.
I suggest you search google for an example on how to use flutter/dart, its not really directly related to the app.
Good place to start is https://flutter.dev/docs/cookbook/forms/retrieve-input
Try creating a new simple app so you can have more flexibility in understanding how flutter/dart works.
I'm trying to learn how to extend this program to have the ability to run an arbitrary command. Are there any special requirements for this? I see how the
/sbin/reboot
command is executed by ubus by way of jsonrpc. I am able to execute commands in BusyBox using ubus, like so:ubus call file exec '{ "command": "/etc/init.d/modemmanager", "params": [ "restart" ] }' | jsonfilter -e '@.stdout'
...which works, but this same command when set up as the following seems to not return any valid response. I always get the "bad response from device" error. Any tips?