Open emillindq opened 6 months ago
It is not the prettiest as I have not found a way to make it simpler than this, but it is fully flexible, you can create a complete script with as many matches and chats you want at runtime :)
one key note is that the entire script has to be prepared before you run it, there is no way to change it dynamically while it is being executed, and that is by design :)
@bjarki-trackunit Thanks for your input! I've been sitting all day pondering on how to implement the APN settings, adding additional states like dial1, apn and dial2 feels bloated. But modifying modem_chat to support semi-dynamic requests via macros is not trivial. One limitation I think it reasonable is to force the modem to be suspended when using the apn set API.
Would really appreciate your input into implementing this. Thanks!
Is your enhancement proposal related to a problem? Please describe. When configuring a modem_cellular instance, some AT commands needs to be dependent on runtime configurations, for instance APN settings. At the moment, this setting comes from Kconfig and there's no possibility to easily customize AT commands run-time.
Describe the solution you'd like A new AT command macro, for instance
MODEM_CHAT_SCRIPT_CMD_RESP_DYNAMIC(_request_cb, _response_match)
where the callback is called to provide the required AT command. I can implement this, but before putting way too much time on this I'd like input from maintainer @bjarki-trackunitDescribe alternatives you've considered Inserting additional states like DIAL1, APN, DIAL2 and use
modem_chat_run_script
to send it in a state transition, however today all AT commands are static and the above suggestion would potentially solve other cases.Additional context![image](https://github.com/zephyrproject-rtos/zephyr/assets/73964476/8d87d902-d9d3-45f8-964f-ca9c06ae941e)