Hallo!
I want to create a command line interface (CLI) to operate on the target device. I want it to be accessible from the ethernet. I’m using the lwIP stack for the ethernet, and it works.
I generally understand how to CLI works (creating the command, registering it and so on), but I cannot find any information how to ‘bind’ the CLI to the Ethernet connection.
How can I make the CLI to recieve and send the output over TCP? (actually even UDP should be fine)
Suprisingly I cannot find any documentation covering this specific topic.
thanks for the links!
I have one more question though.
Basically it looks that I need to implement a regular TCP packet exchange, then read the recieved command into a buffer and call a FreeRTOS_CLIProcessCommand() with this buffer as a paramter.
Generally it is very similar to something that can be done with simple “switch { case }” behaviour of the regular C ( eg. case 1 : func1(); case 2: func2() and so on ).
What is than the purpose of the CLI in this case? What are the advantages? Or maybe I am missing some crucial part of the concept…
I managed to get the CLI working.
To put it simply : i used the tcpip stack to read the incoming message and used it as a cInputString for the FreeRTOS_CLIProcessCommand(). The same function writes a buffer that needs to be sent back to the remote machine.
I will also answer my other question: basically speaking CLI could be replaced with switch:case commands . However the great advantage of CLI is that it makes it much easier to write functions and is to be understood as a layer of abstraction that is very usefull and way easier to maintain. Furthermore it comes with few basic functions that make starting wiht i easier.