Programmatic Scan¶
The programmatic_scan module demonstrates how to run a CLI command from your program and capture its output for program use.
Build it from project programmaticScanDemo.
Function Details¶
The following is an overview of the functions used in the programmatic_scan module.
static void processScanResults(
const char *ssid,
const uint8_t *bssid,
uint8_t channel,
int rssi,
unsigned char security_suite,
unsigned char encr_flags
) {...}
Print debug information to trouble log.
Read formatted input from a string and send to
processScanResults().
Write the data to the scan line and then yield control to other threads using
ltrx_thread_yield.
Determine if the scan is completed, and if so, write the new line. Then, yield control to other threads using
ltrx_thread_yield.
Flush data from the output stream.
Close the output stream.
Use
ltrx_ip_address_state()to see if the IP interface is up. If not, useltrx_thread_sleep()to pause the thread for 1000 ms to allow time for WLAN0 to come up.Use
ltrx_input_stream_init_from_const_char()to construct input stream from const character, and when up, send "Starting scan." message to trouble log.Use
ltrx_cli_command_loop()to enter command line interface.Closes the input stream with
ltrx_input_stream_close()and pause the thread withltrx_thread_sleep().