Execute Target Computer Command-Line Commands Via HTTP or HTTPS
By using the Target Computer REST Interface, you can control the target computer from the development computer system prompt. To enter target computer RTOS commands by using the REST interface, type the commands by using a console (keyboard) attached to the development computer.
Install Real-Time Application
At the system prompt, use the curl POST command to install a real-time application on the target computer. In this command, user slrt with password slrt is commanding the target computer at IP address 192.168.7.20 and port 8080 to install real-time application file slrt_ex_osc from the C:\TEMP folder on the development computer.
For Linux-based RTOS target computers that use a cross-compiler as part of the model build process, the real-time application MLDATX file that is generated on the development computer is binary. You can install this real-time application from the C:\TEMP folder on the development computer by using the command:
curl -i -X POST http://slrt:slrt@192.168.7.20:8080/applications/install?app=slrt_ex_osc.mldatx --header "Content-Type:application/octet-stream" --data-binary @C:/TEMP/slrt_ex_osc.mldatx
For Linux-based RTOS target computers that use a remote build process, the real-time application MLDATX file that is generated on the development computer is not compiled. To compile the real-time application for this platform, you use the install(tg,app) function from the MATLAB Command Window to run the remote build. For example:
install(tgLAB,'slrt_ex_osc.mldatx')
After running this command in MATLAB, you can run the curl install command:
curl -i -X PUT http://slrt:slrt@192.168.7.15:8080/applications/install?app=slrt_ex_osc
Load Real-Time Application
At the system prompt, use the curl PUT command to load an installed real-time application on the target computer. In this command, user slrt with password slrt is commanding the target computer at IP address 192.168.7.20 and port 8080 to load real-time application file slrt_ex_osc from the applications folder on the target computer.
curl -i -X PUT http://slrt:slrt@192.168.7.20:8080/applications/load?app=slrt_ex_osc
The status for the load of application slrt_ex_osc which was generated from model slrt_ex_osc is LOADED. Additional status information includes the application options: stop time, log level, polling threshold and file log max runs.
Start Real-Time Application
At the system prompt, use the curl PUT command to start execution of an installed and loaded real-time application on the target computer. In this command, user slrt with password slrt is commanding the target computer at IP address 192.168.7.20 and port 8080 to start execution of the installed and loaded real-time application file. The command also sets the stop time for the application to 100.
curl -i -X PUT http://slrt:slrt@192.168.7.20:8080/applications/start?stoptime=100
The status for the start of application slrt_ex_osc which was generated from model slrt_ex_osc is RUNNING. Additional status information includes the application options: stop time, log level, polling threshold and file log max runs.
Stop Real-Time Application
At the system prompt, use the curl PUT command to stop execution of a running real-time application on the target computer. In this command, user slrt with password slrt is commanding the target computer at IP address 192.168.7.20 and port 8080 to stop execution of the running real-time application file.
curl -i -X PUT http://slrt:slrt@192.168.7.20:8080/applications/stop
The status for the stop of application slrt_ex_osc which was generated from model slrt_ex_osc is DONE. Additional status information includes the application options: stop time, log level, polling threshold and file log max runs.
Secure HTTPS Operation
You can choose to use secure HTTPS protocol for the REST interface operations. For information about enabling HTTPS operation and setting up authorization, see setupTLSCertificate.
See Also
Target | PUT
load | GET
model-status | PUT
start | PUT
stop | setupTLSCertificate