Skip to content

Commit

Permalink
ctxlink/wifi: Remove unwanted monitor wifi options.
Browse files Browse the repository at this point in the history
  • Loading branch information
sidprice committed Jan 20, 2025
1 parent ac6b1f2 commit 791891e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const command_s cmd_list[] = {
{"battery", cmd_target_battery, "Reads the battery state"},
#endif
#ifdef PLATFORM_HAS_WIFI
{"wifi", cmd_wifi, "Show/Set Wi-Fi connection [-forget] [AP name,passphrase]"},
{"wifi", cmd_wifi, "Show/Set Wi-Fi connection [AP name,passphrase]"},
#endif
#ifdef ENABLE_RTT
{"rtt", cmd_rtt,
Expand Down
23 changes: 10 additions & 13 deletions src/platforms/ctxlink/WiFi_Server.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ void app_task_wait_spin(void)
//
// Using the passed arguments, attempt to connect to a Wi-Fi AP
//
void wifi_connect(int argc, const char **argv, char *buffer, uint32_t size, bool save)
void wifi_connect(int argc, const char **argv, char *buffer, uint32_t size)
{
char ssid[64] = {0};
char pass_phrase[64] = {0};
Expand Down Expand Up @@ -767,21 +767,18 @@ void wifi_connect(int argc, const char **argv, char *buffer, uint32_t size, bool
//
app_state = app_state_wait_for_wifi_connect;
m2m_wifi_connect_sc(ssid, strlen(ssid), M2M_WIFI_SEC_WPA_PSK, &pass_phrase, M2M_WIFI_CH_ALL);
//
// For now lets spin here calling app_tasks
//
uint32_t wait_timeout = 2000U;
while (1) {
platform_tasks();
if (app_state == app_state_spin)
break;
platform_delay(1);
if (wait_timeout-- == 0)
break;
}
}
}

//
// Disconnect from network
//
void wifi_disconnect(void)
{
app_state = app_state_wait_for_disconnect;
m2m_wifi_disconnect();
}

void handle_socket_bind_event(SOCKET *sock, bool *running_state)
{
if (m2m_wifi_get_socket_event_data()->bindStatus == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/ctxlink/WiFi_Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ uint8_t wifi_get_next(void);
uint8_t wifi_get_next_to(uint32_t timeout);

void wifi_get_ip_address(char *buffer, uint32_t size);
void wifi_connect(int argc, const char **argv, char *buffer, uint32_t size, bool save);
void wifi_connect(int argc, const char **argv, char *buffer, uint32_t size);
void app_task_wait_spin(void);
void wifi_disconnect(void);
#ifdef __cplusplus
Expand Down
22 changes: 1 addition & 21 deletions src/platforms/ctxlink/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,27 +163,7 @@ const char *platform_wifi_state(int argc, const char **argv)
(void)argv;
memset(parameters, 0x00, sizeof(parameters));
if (argc > 1) {
bool forget = false;
bool save = false;
//
// Check for an option
//
if (argv[1][0] == '-') {
//
// two options are support:
// -forget <- forget the current Wi-Fi connection
// -save <- Save the parameters in NVM (Passed to the wifi_connect call)
//
if (argv[1][1] == 's')
save = true;
else if (argv[1][1] == 'f')
forget = true;
}
if (forget)
wifi_disconnect() ;
else
wifi_connect(argc, argv, parameters, sizeof(parameters), save);

wifi_connect(argc, argv, parameters, sizeof(parameters));
app_task_wait_spin();
}
wifi_get_ip_address(parameters, sizeof(parameters));
Expand Down

0 comments on commit 791891e

Please sign in to comment.