/*****************************************************************************
- * Standard headers
+ * Standard headers
*****************************************************************************/
#define _GNU_SOURCE
#include <stdio.h>
#include <gio/gio.h>
/*****************************************************************************
- * System headers
+ * System headers
*****************************************************************************/
#include <vconf.h>
#include <system_info.h>
/*****************************************************************************
- * Wi-Fi Direct Service headers
+ * Wi-Fi Direct Service headers
*****************************************************************************/
#include "wifi-direct.h"
#include "wifi-direct-internal.h"
#include "wifi-direct-ipc.h"
/*****************************************************************************
- * Macros and Typedefs
+ * Macros and Typedefs
*****************************************************************************/
/*****************************************************************************
- * Global Variables
+ * Global Variables
*****************************************************************************/
wifi_direct_client_info_s g_client_info = {
.is_registered = FALSE,
};
/*****************************************************************************
- * Local Functions Definition
+ * Local Functions Definition
*****************************************************************************/
#ifdef __NR_gettid
g_source_remove(g_client_info.g_source_id);
g_client_info.g_source_id = -1;
- // Protect standard input / output / error
+ /* Protect standard input / output / error */
if (g_client_info.sync_sockfd > 0)
close(g_client_info.sync_sockfd);
g_client_info.sync_sockfd = -1;
g_client_info.is_registered = FALSE;
- // Initialize callbacks
+ /* Initialize callbacks */
g_client_info.activation_cb = NULL;
g_client_info.discover_cb = NULL;
g_client_info.connection_cb = NULL;
#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
g_client_info.service_cb = NULL;
- g_client_info.user_data_for_cb_service= NULL;
+ g_client_info.user_data_for_cb_service = NULL;
#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
static char *__wfd_print_event(wfd_client_event_e event)
{
- switch (event)
- {
+ switch (event) {
case WIFI_DIRECT_CLI_EVENT_INVALID:
return "WIFI_DIRECT_CLI_EVENT_INVALID";
break;
static char *__wfd_print_error(wifi_direct_error_e error)
{
- switch (error)
- {
+ switch (error) {
case WIFI_DIRECT_ERROR_NONE:
return "WIFI_DIRECT_ERROR_NONE";
case WIFI_DIRECT_ERROR_NOT_PERMITTED:
{
__WDC_LOG_FUNC_START__;
- switch (event)
- {
+ switch (event) {
case WIFI_DIRECT_CLI_EVENT_ACTIVATION:
return WIFI_DIRECT_DEVICE_STATE_ACTIVATED;
break;
char *__wfd_client_print_cmd(wifi_direct_cmd_e cmd)
{
- switch (cmd)
- {
+ switch (cmd) {
case WIFI_DIRECT_CMD_REGISTER:
return "WIFI_DIRECT_CMD_REGISTER";
case WIFI_DIRECT_CMD_INIT_ASYNC_SOCKET:
WDC_LOGE("Polling error from socket[%d]. [%s]", sock, strerror(errno));
return -1;
} else if (res == 0) {
- WDC_LOGD( "poll timeout. socket is busy");
+ WDC_LOGD("poll timeout. socket is busy");
return 1;
} else {
if (p_fd.revents & POLLERR) {
return WIFI_DIRECT_ERROR_RESOURCE_BUSY;
}
- while(data_len) {
+ while (data_len) {
rbytes = read(sockfd, data, data_len);
if (rbytes <= 0) {
WDC_LOGE("Failed to read socket[%d] [%s]", sockfd, strerror(errno));
memset(&client_noti, 0, sizeof(wifi_direct_client_noti_s));
- // 1.Read socket
+ /* 1.Read socket */
res = __wfd_client_read_socket(sockfd, (char*) &client_noti,
sizeof(wifi_direct_client_noti_s));
if (res <= 0) {
__WDC_LOG_FUNC_END__;
return false;
}
- WDC_LOGD( "Received Event is [%d,%s], error[%d]", client_noti.event,
+ WDC_LOGD("Received Event is [%d,%s], error[%d]", client_noti.event,
__wfd_print_event(client_noti.event), client_noti.error);
event = client_noti.event;
memcpy(param2, client_noti.param2, sizeof(client_noti.param2));
- // 2. dispatch event
+ /* 2. dispatch event */
switch (event) {
case WIFI_DIRECT_CLI_EVENT_ACTIVATION:
case WIFI_DIRECT_CLI_EVENT_DEACTIVATION:
param1, client->user_data_for_cb_connection);
break;
- // ToDo: Handling IP lease event...
+ /* ToDo: Handling IP lease event... */
case WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND:
if (!client->ip_assigned_cb) {
WDC_LOGE("ip_assigned_cb is NULL!!");
int i = 0;
WDC_LOGD("------------------------------------------");
- for (i = 0; i < num; i++)
- {
+ for (i = 0; i < num; i++) {
WDC_LOGD("== Peer index : %d ==", i);
WDC_LOGD("is Group Owner ? %s", list[i].is_group_owner ? "YES" : "NO");
WDC_LOGD("device_name : %s", list[i].device_name);
GDBusConnection *netconfig_bus = NULL;
GError *g_error = NULL;
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
netconfig_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &g_error);
if (netconfig_bus == NULL) {
- if(g_error != NULL) {
+ if (g_error != NULL) {
WDC_LOGE("Couldn't connect to system bus "
"error [%d: %s]", g_error->code, g_error->message);
g_error_free(g_error);
NULL,
&g_error);
- if(g_error !=NULL) {
+ if (g_error != NULL) {
WDC_LOGE("g_dbus_connection_call_sync() failed"
"error [%d: %s]", g_error->code, g_error->message);
g_error_free(g_error);
__WDC_LOG_FUNC_END__;
return res;
}
- if(!wifi_direct_enable) {
+ if (!wifi_direct_enable) {
WDC_LOGE("Wi-Fi Direct not supported");
return WIFI_DIRECT_ERROR_NOT_SUPPORTED;
}
WDC_LOGD("Connecting to server socket to register sync socket [%d]", sockfd);
while (retry_count > 0) {
res = connect(sockfd, (struct sockaddr*) &saddr, sizeof(saddr));
- if (!res){
+ if (!res) {
WDC_LOGD("Succeeded to connect to server socket[%s]", strerror(errno));
break;
}
g_client_info.g_source_id = g_source_id;
- // Initialize callbacks
+ /* Initialize callbacks */
g_client_info.activation_cb = NULL;
g_client_info.discover_cb = NULL;
g_client_info.connection_cb = NULL;
#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
g_client_info.service_cb = NULL;
- g_client_info.user_data_for_cb_service= NULL;
+ g_client_info.user_data_for_cb_service = NULL;
#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
__WDC_LOG_FUNC_END__;
pos1 = services;
pos2 = g_strdup(services);
- pos1 = strtok (pos1,",\n");
+ pos1 = strtok(pos1, ",\n");
while (pos1) {
cnt++;
- pos1 = strtok (NULL, ",\n");
+ pos1 = strtok(NULL, ",\n");
}
WDC_LOGD("Total Service Count = %d", cnt);
g_free(pos2);
return NULL;
}
- pos2 = strtok (pos2,",\n");
+ pos2 = strtok(pos2, ",\n");
while (pos2 != NULL) {
char *s = strchr(pos2, ' ');
if (s) {
*s = '\0';
result[i++] = strdup(pos2);
- pos2 = strtok (NULL, ",\n");
+ pos2 = strtok(NULL, ",\n");
}
}
}
} else {
*count = 0;
if (result) {
- for (j=0; j<i && result[j] != NULL; j++)
+ for (j = 0; j < i && result[j] != NULL; j++)
free(result[j]);
free(result);
}
}
if (num > 0) {
- buff = (wfd_discovery_entry_s*) g_try_malloc0_n(num, sizeof (wfd_discovery_entry_s));
+ buff = (wfd_discovery_entry_s*) g_try_malloc0_n(num, sizeof(wfd_discovery_entry_s));
if (!buff) {
WDC_LOGE("Failed to alloc memory");
pthread_mutex_unlock(&g_client_info.mutex);
num * sizeof(wfd_discovery_entry_s));
if (num_tmp) {
WDC_LOGD("Rest data should be read out");
- buff_tmp = (wfd_discovery_entry_s*) g_try_malloc0_n(num_tmp, sizeof (wfd_discovery_entry_s));
+ buff_tmp = (wfd_discovery_entry_s*) g_try_malloc0_n(num_tmp, sizeof(wfd_discovery_entry_s));
if (buff_tmp) {
__wfd_client_read_socket(g_client_info.sync_sockfd, (char*) buff_tmp,
num_tmp * sizeof(wfd_discovery_entry_s));
peer_list->is_persistent_group_owner = buff[i].is_persistent_go;
peer_list->primary_device_type = buff[i].category;
peer_list->secondary_device_type = buff[i].subcategory;
- peer_list->supported_wps_types= buff[i].wps_cfg_methods;
+ peer_list->supported_wps_types = buff[i].wps_cfg_methods;
#ifdef TIZEN_FEATURE_WIFI_DISPLAY
peer_list->is_miracast_device = buff[i].is_wfd_device;
#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
int res = WIFI_DIRECT_ERROR_NONE;
if ((g_client_info.is_registered == false)
- || (g_client_info.client_id == WFD_INVALID_ID))
- {
+ || (g_client_info.client_id == WFD_INVALID_ID)) {
WDC_LOGE("Client is NOT registered.");
__WDC_LOG_FUNC_END__;
return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
return WIFI_DIRECT_ERROR_OPERATION_FAILED;
}
- res= __wfd_client_read_socket(g_client_info.sync_sockfd, (char*) buff,
+ res = __wfd_client_read_socket(g_client_info.sync_sockfd, (char*) buff,
num * sizeof(wfd_connected_peer_info_s));
pthread_mutex_unlock(&g_client_info.mutex);
} else if (num < 1) {
return WIFI_DIRECT_ERROR_OPERATION_FAILED;
}
- res= __wfd_client_read_socket(g_client_info.sync_sockfd, (char*) buff,
+ res = __wfd_client_read_socket(g_client_info.sync_sockfd, (char*) buff,
num * sizeof(wfd_connected_peer_info_s));
pthread_mutex_unlock(&g_client_info.mutex);
if (res <= 0) {
for (i = 0; i < num; i++) {
peer_list = (wifi_direct_connected_peer_info_s *) g_try_malloc0(sizeof(wifi_direct_connected_peer_info_s));
peer_list->device_name = g_strdup(buff[i].device_name);
- peer_list->ip_address= (char*) g_try_malloc0(IPSTR_LEN);
+ peer_list->ip_address = (char*) g_try_malloc0(IPSTR_LEN);
g_snprintf(peer_list->ip_address, IPSTR_LEN, IPSTR, IP2STR(buff[i].ip_address));
peer_list->mac_address = (char*) calloc(1, MACSTR_LEN);
g_snprintf(peer_list->mac_address, MACSTR_LEN, MACSTR, MAC2STR(buff[i].mac_address));
- peer_list->interface_address = (char*) g_try_malloc0( MACSTR_LEN);
+ peer_list->interface_address = (char*) g_try_malloc0(MACSTR_LEN);
g_snprintf(peer_list->interface_address, MACSTR_LEN, MACSTR, MAC2STR(buff[i].intf_address));
peer_list->p2p_supported = buff[i].is_p2p;
peer_list->primary_device_type = buff[i].category;
__WDC_LOG_FUNC_END__;
return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
}
- WDC_LOGD( "writing msg hdr is success!\n");
+ WDC_LOGD("writing msg hdr is success!\n");
status = __wfd_client_write_socket(g_client_info.sync_sockfd, (void*) device_name,
WIFI_DIRECT_MAX_DEVICE_NAME_LEN);
get_str = vconf_get_str(VCONFKEY_IFNAME);
if (!get_str) {
- WDC_LOGD( "vconf (%s) value is NULL!!!\n", VCONFKEY_IFNAME);
+ WDC_LOGD("vconf (%s) value is NULL!!!\n", VCONFKEY_IFNAME);
__WDC_LOG_FUNC_END__;
return WIFI_DIRECT_ERROR_NOT_PERMITTED;
}
- WDC_LOGD( "VCONFKEY_IFNAME(%s) : %s\n", VCONFKEY_IFNAME, get_str);
+ WDC_LOGD("VCONFKEY_IFNAME(%s) : %s\n", VCONFKEY_IFNAME, get_str);
*name = g_strdup(get_str);
g_free(get_str);
result = wifi_direct_get_state(&status);
WDC_LOGD("wifi_direct_get_state() state=[%d], result=[%d]", status, result);
- if( status < WIFI_DIRECT_STATE_CONNECTED) {
+ if (status < WIFI_DIRECT_STATE_CONNECTED) {
WDC_LOGE("Device is not connected!");
__WDC_LOG_FUNC_END__;
return WIFI_DIRECT_ERROR_NOT_PERMITTED;
result = wifi_direct_get_state(&status);
WDC_LOGD("wifi_direct_get_state() state=[%d], result=[%d]", status, result);
- if(status < WIFI_DIRECT_STATE_CONNECTED) {
+ if (status < WIFI_DIRECT_STATE_CONNECTED) {
WDC_LOGE("Device is not connected!");
__WDC_LOG_FUNC_END__;
return WIFI_DIRECT_ERROR_NOT_PERMITTED;
*state = (wifi_direct_state_e) rsp.param1;
/* for CAPI : there is no WIFI_DIRECT_STATE_GROUP_OWNER type in CAPI */
- if(*state == WIFI_DIRECT_STATE_GROUP_OWNER)
+ if (*state == WIFI_DIRECT_STATE_GROUP_OWNER)
*state = WIFI_DIRECT_STATE_CONNECTED;
__WDC_LOG_FUNC_END__;
*type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV;
#else /* TIZEN_TV */
WDC_LOGD("Current second_dev_type [%d]", WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL);
- *type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL; // smart phone dual mode (wifi and cellular)
+ *type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL; /* smart phone dual mode (wifi and cellular) */
#endif /* TIZEN_TV */
__WDC_LOG_FUNC_END__;
num * sizeof(wfd_persistent_group_info_s));
if (num_tmp) {
WDC_LOGD("Rest data should be read out");
- buff_tmp = (wfd_persistent_group_info_s*) calloc(num_tmp, sizeof (wfd_persistent_group_info_s));
+ buff_tmp = (wfd_persistent_group_info_s*) calloc(num_tmp, sizeof(wfd_persistent_group_info_s));
if (buff_tmp) {
__wfd_client_read_socket(g_client_info.sync_sockfd, (char*) buff_tmp,
num_tmp * sizeof(wfd_persistent_group_info_s));
}
}
pthread_mutex_unlock(&g_client_info.mutex);
- if (res <= 0){
+ if (res <= 0) {
free(buff);
WDC_LOGE("socket read error.");
__wfd_reset_control();
return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
}
- if (rsp.cmd !=req.cmd) {
+ if (rsp.cmd != req.cmd) {
WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
return WIFI_DIRECT_ERROR_OPERATION_FAILED;
}
len = strlen(info1) + strlen(info2) + 2;
WDC_LOGD("info [%s|%s], len [%d]", info1, info2, len);
- buf= g_try_malloc0(sizeof(wifi_direct_client_request_s) + len);
+ buf = g_try_malloc0(sizeof(wifi_direct_client_request_s) + len);
if (NULL == buf) {
WDC_LOGE("Failed to allocate memory for buf");
return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
wfd_discovery_entry_s *buff = NULL;
- buff = (wfd_discovery_entry_s*) g_try_malloc0(sizeof (wfd_discovery_entry_s));
+ buff = (wfd_discovery_entry_s*) g_try_malloc0(sizeof(wfd_discovery_entry_s));
if (!buff) {
WDC_LOGE("Failed to alloc memory");
pthread_mutex_unlock(&g_client_info.mutex);
peer->is_persistent_group_owner = buff->is_persistent_go;
peer->primary_device_type = buff->category;
peer->secondary_device_type = buff->subcategory;
- peer->supported_wps_types= buff->wps_cfg_methods;
+ peer->supported_wps_types = buff->wps_cfg_methods;
#ifdef TIZEN_FEATURE_WIFI_DISPLAY
peer->is_miracast_device = buff->is_wfd_device;
#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
__WDC_LOG_FUNC_END__;
return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
}
- WDC_LOGD( "writing msg hdr is success!\n");
+ WDC_LOGD("writing msg hdr is success!\n");
status = __wfd_client_write_socket(g_client_info.sync_sockfd, (void*) passphrase,
req.cmd_data_len);
return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
}
- if(!passphrase){
+ if (!passphrase) {
WDC_LOGE("NULL Param [passphrase]!");
__WDC_LOG_FUNC_END__;
return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
#include <wifi-direct.h>
-// For wifi-direct package internal use only
+/* For wifi-direct package internal use only */
#include <wifi-direct-internal.h>
#define RESET_COLOR "\e[m"
return "UNKNOWN";
}
-enum
-{
+enum {
CMD_QUIT,
CMD_FULL_MENU,
CMD_INITIALIZE,
CMD_START_DISCOVER_SPECIFIC_CHANNEL,
CMD_CANCEL_DISCOVER,
CMD_GET_DISVOCERY_RESULT,
- //CMD_SEND_PROVISION_DISCOVER_REQ,
+ /* CMD_SEND_PROVISION_DISCOVER_REQ, */
CMD_SEND_CONNECTION_REQ,
CMD_GET_LINK_STATUS,
CMD_CONNECT_PEER,
CMD_IS_PERSISTENT_GROUP_ACTIVATED,
CMD_GET_PERSISTENT_GROUP_LIST,
CMD_REMOVE_PERSISTENT_GROUP,
- //CMD_SET_GROUP_OWNER,
+ /* CMD_SET_GROUP_OWNER, */
CMD_SET_AUTO_CONNECTION,
CMD_IS_AUTO_CONNECTION,
- //CMD_SET_LISTEN_ONLY,
+ /* CMD_SET_LISTEN_ONLY, */
CMD_SET_WPS_PIN,
CMD_GET_WPS_PIN,
CMD_GET_SUPPORTED_WPS_MODE,
CMD_INVALID = 255,
};
-typedef struct
-{
+typedef struct {
int cmd;
char* menu_str;
} menu_str_t;
-menu_str_t g_menu_str[] =
-{
+menu_str_t g_menu_str[] = {
{ CMD_QUIT, "CMD_QUIT" },
{ CMD_FULL_MENU, "CMD_FULL_MENU" },
{ CMD_INITIALIZE, "CMD_INITIALIZE" },
{ CMD_START_DISCOVER_SPECIFIC_CHANNEL, "CMD_START_DISCOVER_SPECIFIC_CHANNEL" },
{ CMD_CANCEL_DISCOVER, "CMD_CANCEL_DISCOVER" },
{ CMD_GET_DISVOCERY_RESULT, "CMD_GET_DISVOCERY_RESULT" },
- //{ CMD_SEND_PROVISION_DISCOVER_REQ, "CMD_SEND_PROVISION_DISCOVER_REQ" },
+ /* { CMD_SEND_PROVISION_DISCOVER_REQ, "CMD_SEND_PROVISION_DISCOVER_REQ" }, */
{ CMD_SEND_CONNECTION_REQ, "CMD_SEND_CONNECTION_REQ" },
{ CMD_GET_LINK_STATUS, "CMD_GET_LINK_STATUS" },
{ CMD_IS_PERSISTENT_GROUP_ACTIVATED, "CMD_IS_PERSISTENT_GROUP_ACTIVATED" },
{ CMD_GET_PERSISTENT_GROUP_LIST, "CMD_GET_PERSISTENT_GROUP_LIST" },
{ CMD_REMOVE_PERSISTENT_GROUP, "CMD_REMOVE_PERSISTENT_GROUP" },
- //{ CMD_SET_GROUP_OWNER, "CMD_SET_GROUP_OWNER" },
+ /* { CMD_SET_GROUP_OWNER, "CMD_SET_GROUP_OWNER" }, */
{ CMD_SET_AUTO_CONNECTION, "CMD_SET_AUTO_CONNECTION" },
{ CMD_IS_AUTO_CONNECTION, "CMD_IS_AUTO_CONNECTION" },
- //{ CMD_SET_LISTEN_ONLY, "CMD_SET_LISTEN_ONLY" },
+ /* { CMD_SET_LISTEN_ONLY, "CMD_SET_LISTEN_ONLY" }, */
{ CMD_SET_WPS_PIN, "CMD_SET_WPS_PIN" },
{ CMD_GET_WPS_PIN, "CMD_GET_WPS_PIN" },
{ CMD_GET_SUPPORTED_WPS_MODE, "CMD_GET_SUPPORTED_WPS_MODE" },
{ CMD_GET_IP_ADDR, "CMD_GET_IP_ADDR" },
{ CMD_REGISTER_SERVICE, "CMD_REGISTER_SERVICE" },
{ CMD_DEREGISTER_SERVICE, "CMD_DEREGISTER_SERVICE" },
- { CMD_START_SERVICE_DISCOVERY,"CMD_START_SERVICE_DISCOVERY" },
- { CMD_CANCEL_SERVICE_DISCOVERY,"CMD_CANCEL_SERVICE_DISCOVERY" },
+ { CMD_START_SERVICE_DISCOVERY, "CMD_START_SERVICE_DISCOVERY" },
+ { CMD_CANCEL_SERVICE_DISCOVERY, "CMD_CANCEL_SERVICE_DISCOVERY" },
{ CMD_INCREASE_OEM_LOGLEVEL, "CMD_INCREASE_OEM_LOGLEVEL" },
{ CMD_DECREASE_OEM_LOGLEVEL, "CMD_DECREASE_OEM_LOGLEVEL" },
{ -1, NULL }, };
-struct appdata
-{
+struct appdata {
GMainLoop* main_loop;
wifi_direct_discovered_peer_info_s peer_list[MAX_PEER_NUM];
{
printf("Parsing argument...\n");
int opt;
- while ((opt = getopt(argc, argv, "t:u:p:a:")) != -1)
- {
+ while ((opt = getopt(argc, argv, "t:u:p:a:")) != -1) {
printf("Parsing argument...:%c\n", opt);
- switch (opt)
- {
+ switch (opt) {
case 't':
default:
prt_help(argv[0]);
if (len == 0)
return "";
- // remove "CMD_"
- // lower char
- // replance "_" to space
- for (i = 0, j = 4; i < len; i++, j++)
- {
+ /* remove "CMD_" */
+ /* lower char */
+ /* replance "_" to space */
+ for (i = 0, j = 4; i < len; i++, j++) {
if (str[j] >= 'A' && str[j] <= 'Z')
static_buffer[i] = str[j] + 'a' - 'A';
else if (str[j] == '_')
static_buffer[i] = ' ';
else
- {
static_buffer[i] = str[j];
- }
}
static_buffer[j] = '\0';
int i;
printf("Call Test Program\n");
- for (i = 0; g_menu_str[i].cmd != -1; i++)
- {
- if(i%4 == 0)
+ for (i = 0; g_menu_str[i].cmd != -1; i++) {
+ if (i % 4 == 0)
printf("\n");
printf(" %02d: %-32s ", g_menu_str[i].cmd,
cmd_transform(g_menu_str[i].menu_str));
return -1;
len = strlen(str);
- for (i = 0; i < len; i++)
- {
+ for (i = 0; i < len; i++) {
if (str[i] < '0' || str[i] > '9')
return -2;
}
int target = -1;
int i;
- if (ad==NULL)
+ if (ad == NULL)
return 0;
list = ad->peer_list;
- for(i=0; i<ad->peer_count; i++)
- {
- printf ("index [%d] MAC [%s] Owner=[%s] SSID[%s]\n",
+ for (i = 0; i < ad->peer_count; i++) {
+ printf("index [%d] MAC [%s] Owner=[%s] SSID[%s]\n",
i,
list[i].mac_address,
list[i].is_group_owner ? "YES" : "NO",
if (scanf(" %3d", &target) < 1)
return -1;
- if (target < 0 || target > ad->peer_count)
- {
+ if (target < 0 || target > ad->peer_count) {
printf("Wrong contact index [%d]\n", target);
return -1;
- }
- else
- {
+ } else
ad->selected_peer_index = target;
- }
return 1;
}
wifi_direct_connected_peer_info_s* list;
int i, j;
- if (ad==NULL)
+ if (ad == NULL)
return;
list = ad->connected_peer_list;
- for(i=0; i<ad->connected_peer_count; i++)
- {
+ for (i = 0; i < ad->connected_peer_count; i++) {
if (list[i].service_count == 0) {
- printf ("index [%d] MAC [%s] SSID[%s] \n", i, list[i].mac_address, list[i].device_name);
+ printf("index [%d] MAC [%s] SSID[%s] \n", i, list[i].mac_address, list[i].device_name);
} else {
char services[256] = {0,};
unsigned int len = 0;
- printf ("Service Count = [%d][%p]\n" ,list[i].service_count,list[i].service_list);
- for (j=0; j<list[i].service_count && list[i].service_list != NULL; j++) {
- printf ("Service[%p]=%s\n", list[i].service_list[j], list[i].service_list[j]);
+ printf("Service Count = [%d][%p]\n", list[i].service_count, list[i].service_list);
+ for (j = 0; j < list[i].service_count && list[i].service_list != NULL; j++) {
+ printf("Service[%p]=%s\n", list[i].service_list[j], list[i].service_list[j]);
snprintf(services + len, 256-len, " %s", list[i].service_list[j]);
len = len + strlen(list[i].service_list[j]) + 1;
}
- printf ("index [%d] MAC [%s] SSID[%s] Services=[%s]\n", i, list[i].mac_address, list[i].device_name, services);
+ printf("index [%d] MAC [%s] SSID[%s] Services=[%s]\n", i, list[i].mac_address, list[i].device_name, services);
}
}
wifi_direct_discovered_peer_info_s* list;
int i, j;
- if (ad==NULL)
+ if (ad == NULL)
return;
list = ad->peer_list;
- for(i=0; i<ad->peer_count; i++)
- {
+ for (i = 0; i < ad->peer_count; i++) {
if (list[i].service_count == 0) {
- printf ("index [%d] MAC [%s] Owner=[%s] connected=[%d] SSID[%s] ctg=[%d/%d] \n",
+ printf("index [%d] MAC [%s] Owner=[%s] connected=[%d] SSID[%s] ctg=[%d/%d] \n",
i,
list[i].mac_address,
list[i].is_group_owner ? "YES" : "NO",
} else {
char services[256] = {0,};
unsigned int len = 0;
- printf ("Service Count = [%d][%p]\n" ,list[i].service_count,list[i].service_list);
- for (j=0; j<list[i].service_count && list[i].service_list != NULL; j++) {
- printf ("Service[%p]=%s\n", list[i].service_list[j], list[i].service_list[j]);
+ printf("Service Count = [%d][%p]\n", list[i].service_count, list[i].service_list);
+ for (j = 0; j < list[i].service_count && list[i].service_list != NULL; j++) {
+ printf("Service[%p]=%s\n", list[i].service_list[j], list[i].service_list[j]);
snprintf(services + len, 256-len, " %s", list[i].service_list[j]);
len = len + strlen(list[i].service_list[j]) + 1;
}
- printf ("index [%d] MAC [%s] Owner=[%s] connected=[%d] SSID[%s] ctg=[%d/%d] Services=[%s]\n",
+ printf("index [%d] MAC [%s] Owner=[%s] connected=[%d] SSID[%s] ctg=[%d/%d] Services=[%s]\n",
i,
list[i].mac_address,
list[i].is_group_owner ? "YES" : "NO",
{
__FUNC_ENTER__;
- switch (device_state)
- {
-
+ switch (device_state) {
case WIFI_DIRECT_DEVICE_STATE_ACTIVATED:
event_printf("event -WIFI_DIRECT_DEVICE_STATE_ACTIVATED\n");
break;
struct appdata* ad = (struct appdata*) user_data;
- if(NULL != peer)
- {
- if ( ad->peer_count >= MAX_PEER_NUM )
- return false; // break out of the loop
+ if (NULL != peer) {
+ if (ad->peer_count >= MAX_PEER_NUM)
+ return false; /* break out of the loop */
memcpy(&ad->peer_list[ad->peer_count], peer, sizeof(wifi_direct_discovered_peer_info_s));
ad->peer_count++;
}
- return true; // continue with the next iteration of the loop
+ return true; /* continue with the next iteration of the loop */
}
bool _cb_connected_peers_impl(wifi_direct_connected_peer_info_s* peer, void* user_data)
struct appdata* ad = (struct appdata*) user_data;
- if(NULL != peer)
- {
- if ( ad->connected_peer_count >= MAX_PEER_NUM )
- return false; // break out of the loop
+ if (NULL != peer) {
+ if (ad->connected_peer_count >= MAX_PEER_NUM)
+ return false; /* break out of the loop */
memcpy(&ad->connected_peer_list[ad->connected_peer_count], peer, sizeof(wifi_direct_connected_peer_info_s));
ad->connected_peer_count++;
}
- return true; // continue with the next iteration of the loop
+ return true; /* continue with the next iteration of the loop */
}
bool _cb_persistent_groups_impl(const char* mac_address, const char* ssid, void* user_data)
{
__FUNC_ENTER__;
- if(NULL != mac_address)
+ if (NULL != mac_address)
printf("mac_address=[%s]\n", mac_address);
- if(NULL != ssid)
+ if (NULL != ssid)
printf("ssid=[%s]\n", ssid);
- return true; // continue with the next iteration of the loop
+ return true; /* continue with the next iteration of the loop */
}
void _cb_discover(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data)
struct appdata* ad = (struct appdata*) user_data;
- switch (discovery_state)
- {
+ switch (discovery_state) {
+ case WIFI_DIRECT_DISCOVERY_STARTED:
+ event_printf("event - WIFI_DIRECT_DISCOVERY_STARTED\n");
+ break;
- case WIFI_DIRECT_DISCOVERY_STARTED:
- event_printf("event - WIFI_DIRECT_DISCOVERY_STARTED\n");
- break;
+ case WIFI_DIRECT_ONLY_LISTEN_STARTED:
+ event_printf("event - WIFI_DIRECT_ONLY_LISTEN_STARTED\n");
+ break;
- case WIFI_DIRECT_ONLY_LISTEN_STARTED:
- event_printf("event - WIFI_DIRECT_ONLY_LISTEN_STARTED\n");
- break;
+ case WIFI_DIRECT_DISCOVERY_FINISHED:
+ event_printf("event - WIFI_DIRECT_DISCOVERY_FINISHED\n");
+ break;
- case WIFI_DIRECT_DISCOVERY_FINISHED:
- event_printf("event - WIFI_DIRECT_DISCOVERY_FINISHED\n");
- break;
+ case WIFI_DIRECT_DISCOVERY_FOUND:
+ {
+ int ret;
+ event_printf("event - WIFI_DIRECT_DISCOVERY_FOUND\n");
- case WIFI_DIRECT_DISCOVERY_FOUND:
- {
- int ret;
- event_printf("event - WIFI_DIRECT_DISCOVERY_FOUND\n");
+ memset(ad->peer_list, 0x00, sizeof(wifi_direct_discovered_peer_info_s)*MAX_PEER_NUM);
+ ad->peer_count = 0;
+ ad->selected_peer_index = 0;
- memset(ad->peer_list, 0x00, sizeof(wifi_direct_discovered_peer_info_s)*MAX_PEER_NUM);
- ad->peer_count = 0;
- ad ->selected_peer_index = 0;
+ ret = wifi_direct_foreach_discovered_peers(_cb_discovered_peers_impl, (void*)ad);
+ printf("wifi_direct_foreach_discovered_peers() ret=[%d]\n", ret);
+ }
+ break;
- ret = wifi_direct_foreach_discovered_peers(_cb_discovered_peers_impl, (void*)ad);
- printf("wifi_direct_foreach_discovered_peers() ret=[%d]\n", ret);
- }
+ case WIFI_DIRECT_DISCOVERY_LOST:
+ event_printf("event - WIFI_DIRECT_DISCOVERY_LOST\n");
break;
- case WIFI_DIRECT_DISCOVERY_LOST:
- event_printf("event - WIFI_DIRECT_DISCOVERY_LOST\n");
- break;
-
- default:
- break;
+ default:
+ break;
}
- // _activate_push_cb((void*)NULL, (Evas_Object*)NULL, (void*)NULL);
+ /* _activate_push_cb((void*)NULL, (Evas_Object*)NULL, (void*)NULL); */
}
-void _cb_peer_found(int error_code, wifi_direct_discovery_state_e discovery_state, const char * mac_address,void *user_data)
+void _cb_peer_found(int error_code, wifi_direct_discovery_state_e discovery_state, const char * mac_address, void *user_data)
{
__FUNC_ENTER__;
- switch (discovery_state)
+ switch (discovery_state) {
+ case WIFI_DIRECT_DISCOVERY_FOUND:
{
- case WIFI_DIRECT_DISCOVERY_FOUND:
- {
- event_printf("event - WIFI_DIRECT_DISCOVERY_FOUND\n");
-
- if(mac_address[0] != '\0') {
- printf("Peer Address is %s", mac_address);
- wifi_direct_discovered_peer_info_s* peer_info = NULL;
-
- wifi_direct_get_peer_info((char *)mac_address, &peer_info);
- if(peer_info !=NULL) {
- printf ("MAC [%s] Owner=[%s] connected=[%d] SSID[%s] ctg=[%d/%d]",
- peer_info->mac_address,
- peer_info->is_group_owner ? "YES" : "NO",
- peer_info->is_connected,
- peer_info->device_name,
- peer_info->primary_device_type,
- peer_info->secondary_device_type
- );
- if(peer_info->mac_address)
- free(peer_info->mac_address);
- if(peer_info->interface_address)
- free(peer_info->interface_address);
- if(peer_info)
- free(peer_info);
- }
+ event_printf("event - WIFI_DIRECT_DISCOVERY_FOUND\n");
+
+ if (mac_address[0] != '\0') {
+ printf("Peer Address is %s", mac_address);
+ wifi_direct_discovered_peer_info_s* peer_info = NULL;
+
+ wifi_direct_get_peer_info((char *)mac_address, &peer_info);
+ if (peer_info != NULL) {
+ printf("MAC [%s] Owner=[%s] connected=[%d] SSID[%s] ctg=[%d/%d]",
+ peer_info->mac_address,
+ peer_info->is_group_owner ? "YES" : "NO",
+ peer_info->is_connected,
+ peer_info->device_name,
+ peer_info->primary_device_type,
+ peer_info->secondary_device_type
+ );
+ if (peer_info->mac_address)
+ free(peer_info->mac_address);
+ if (peer_info->interface_address)
+ free(peer_info->interface_address);
+ if (peer_info)
+ free(peer_info);
}
}
- break;
+ }
+ break;
- default:
- break;
+ default:
+ break;
}
}
{
__FUNC_ENTER__;
- switch (discovery_state)
- {
-
- case WIFI_DIRECT_SERVICE_DISCOVERY_STARTED:
- event_printf("event - WIFI_DIRECT_SERVICE_DISCOVERY_STARTED\n");
- break;
-
- case WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED:
- event_printf("event - WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED\n");
- break;
-
- case WIFI_DIRECT_SERVICE_DISCOVERY_FOUND:
- {
- event_printf("event - WIFI_DIRECT_SERVICE_DISCOVERY_FOUND\n");
- if (mac_address != NULL)
- printf("Peer Wi-Fi Direct mac address %s\n", mac_address);
- if (response_data != NULL)
- printf("Peer service response %s\n", (char *)response_data);
- if (service_type == WIFI_DIRECT_SERVICE_TYPE_ALL)
- printf("Service type = WIFI_DIRECT_SERVICE_TYPE_ALL\n");
- else if (service_type == WIFI_DIRECT_SERVICE_TYPE_BONJOUR)
- printf("Service type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR\n");
- else if (service_type == WIFI_DIRECT_SERVICE_TYPE_UPNP)
- printf("Service type = WIFI_DIRECT_SERVICE_TYPE_UPNP\n");
- else if (service_type == WIFI_DIRECT_SERVICE_TYPE_BT_ADDR)
- printf("Service type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR\n");
- else if (service_type == WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO)
- printf("service_type == WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO");
- else
- printf("Requested Service !!! NOT FOUND !!!\n");
- }
+ switch (discovery_state) {
+ case WIFI_DIRECT_SERVICE_DISCOVERY_STARTED:
+ event_printf("event - WIFI_DIRECT_SERVICE_DISCOVERY_STARTED\n");
break;
- default:
+ case WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED:
+ event_printf("event - WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED\n");
break;
+
+ case WIFI_DIRECT_SERVICE_DISCOVERY_FOUND:
+ {
+ event_printf("event - WIFI_DIRECT_SERVICE_DISCOVERY_FOUND\n");
+ if (mac_address != NULL)
+ printf("Peer Wi-Fi Direct mac address %s\n", mac_address);
+ if (response_data != NULL)
+ printf("Peer service response %s\n", (char *)response_data);
+ if (service_type == WIFI_DIRECT_SERVICE_TYPE_ALL)
+ printf("Service type = WIFI_DIRECT_SERVICE_TYPE_ALL\n");
+ else if (service_type == WIFI_DIRECT_SERVICE_TYPE_BONJOUR)
+ printf("Service type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR\n");
+ else if (service_type == WIFI_DIRECT_SERVICE_TYPE_UPNP)
+ printf("Service type = WIFI_DIRECT_SERVICE_TYPE_UPNP\n");
+ else if (service_type == WIFI_DIRECT_SERVICE_TYPE_BT_ADDR)
+ printf("Service type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR\n");
+ else if (service_type == WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO)
+ printf("service_type == WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO");
+ else
+ printf("Requested Service !!! NOT FOUND !!!\n");
+ }
+ break;
+
+ default:
+ break;
}
__FUNC_EXIT__;
}
char *ip_addr = NULL;
bool owner;
- switch (connection_state)
- {
+ switch (connection_state) {
case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
{
event_printf("event - WIFI_DIRECT_CONNECTION_IN_PROGRESS\n");
- if ( error_code == WIFI_DIRECT_ERROR_NONE )
- {
- char _peer_mac[18]={0,};
+ if (error_code == WIFI_DIRECT_ERROR_NONE) {
+ char _peer_mac[18] = {0, };
- if(NULL != mac_address)
+ if (NULL != mac_address)
strncpy(_peer_mac, mac_address, strlen(mac_address));
- printf ("Connection start with [%s] \n", _peer_mac);
+ printf("Connection start with [%s] \n", _peer_mac);
event_printf("Error None\n");
}
}
{
event_printf("event - WIFI_DIRECT_CONNECTION_RSP\n");
- if ( error_code == WIFI_DIRECT_ERROR_NONE )
- {
- char incomming_peer_mac[18]={0,};
+ if (error_code == WIFI_DIRECT_ERROR_NONE) {
+ char incomming_peer_mac[18] = {0, };
char status[100] = {0,};
- if(NULL != mac_address)
+ if (NULL != mac_address)
strncpy(incomming_peer_mac, mac_address, strlen(mac_address));
- printf ("Connection response with [%s] \n", incomming_peer_mac);
+ printf("Connection response with [%s] \n", incomming_peer_mac);
event_printf("Error None\n");
wifi_direct_is_group_owner(&owner);
- if (owner)
- {
+ if (owner) {
wifi_direct_get_ip_address(&ip_addr);
- if(NULL!=ip_addr)
- {
+ if (NULL != ip_addr) {
sprintf(status, "<color=#FFFFFF>GO - IP : %s", ip_addr);
free(ip_addr);
}
- }
- else
- {
+ } else {
wifi_direct_get_ip_address(&ip_addr);
- if(NULL!=ip_addr)
- {
+ if (NULL != ip_addr) {
sprintf(status, "<color=#FFFFFF>STA - IP : %s", ip_addr);
free(ip_addr);
}
}
- }
- else
- {
- if ( error_code == WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT )
+ } else {
+ if (error_code == WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT)
event_printf("Error Code - WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT\n");
- else if ( error_code == WIFI_DIRECT_ERROR_AUTH_FAILED )
+ else if (error_code == WIFI_DIRECT_ERROR_AUTH_FAILED)
event_printf("Error Code - WIFI_DIRECT_ERROR_AUTH_FAILED\n");
- else if ( error_code == WIFI_DIRECT_ERROR_CONNECTION_FAILED )
+ else if (error_code == WIFI_DIRECT_ERROR_CONNECTION_FAILED)
event_printf("Error Code - WIFI_DIRECT_ERROR_CONNECTION_FAILED\n");
}
result = wifi_direct_get_local_wps_type(&wps_mode);
printf("wifi_direct_get__local_wps_type() result=[%d]\n", result);
- //BCMP2P_DISCOVER_ENTRY notification_data;
- //memcpy(¬ification_data, pNotificationData, sizeof(notification_data));
- if ( wps_mode == WIFI_DIRECT_WPS_TYPE_PBC)
- {
+ /* BCMP2P_DISCOVER_ENTRY notification_data; */
+ /* memcpy(¬ification_data, pNotificationData, sizeof(notification_data)); */
+ if (wps_mode == WIFI_DIRECT_WPS_TYPE_PBC) {
printf("wps_config is WIFI_DIRECT_WPS_TYPE_PBC\n");
- }
- else if ( wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY)
- {
+ } else if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY) {
printf("wps_config is WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY\n");
- char pin[9]= { 0, };
+ char pin[9] = { 0, };
int result;
struct appdata *ad = (struct appdata *) user_data;
if (scanf(" %8s", pin) < 1)
break;
- if( strlen(pin) > 0 )
+ if (strlen(pin) > 0)
result = wifi_direct_set_wps_pin(pin);
else
printf("Invalid PIN number\n");
- if ( result == WIFI_DIRECT_ERROR_NONE )
- {
+ if (result == WIFI_DIRECT_ERROR_NONE) {
int i = ad->selected_peer_index;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
result = wifi_direct_accept_connection(list[i].mac_address);
printf("wifi_direct_accept_connection() result=[%d]\n", result);
- }
- else
+ } else
printf("wifi_direct_set_wps_pin Error [%d]\n", result);
- }
- else if ( wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD )
- {
+ } else if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD) {
printf("wps_config is WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD\n");
char *pin = NULL;
result = wifi_direct_get_wps_pin(&pin);
printf("wifi_direct_get_wps_pin() result=[%d]\n", result);
- if ( NULL != pin )
- {
+ if (NULL != pin) {
printf("WPS_PIN [%s]\n", pin);
free(pin);
- }
- else
+ } else
printf("WPS_PIN is NULL !! \n");
- }
- else
- {
+ } else
printf("wps_config is unknown!\n");
- }
}
break;
memset(incomming_peer_mac, 0, sizeof(incomming_peer_mac));
- if(NULL != mac_address)
+ if (NULL != mac_address)
strncpy(incomming_peer_mac, mac_address, strlen(mac_address));
- printf ("Connection Request from [%s] \n", incomming_peer_mac);
+ printf("Connection Request from [%s] \n", incomming_peer_mac);
result = wifi_direct_get_local_wps_type(&wps_mode);
printf("wifi_direct_get_local_wps_type() result=[%d]\n", result);
result = wifi_direct_is_autoconnection_mode(&auto_connection_mode);
printf("wifi_direct_is_autoconnection_mode() result=[%d]\n", result);
- if(auto_connection_mode == TRUE)
- {
+ if (auto_connection_mode == TRUE) {
result = wifi_direct_accept_connection(incomming_peer_mac);
printf("wifi_direct_accept_connection() result=[%d]\n", result);
- }
- else
- {
- if ( wps_mode == WIFI_DIRECT_WPS_TYPE_PBC)
- {
+ } else {
+ if (wps_mode == WIFI_DIRECT_WPS_TYPE_PBC) {
char pushbutton;
printf("wps_config is WIFI_DIRECT_WPS_TYPE_PBC\n");
printf("************\n");
if (scanf(" %c", &pushbutton) < 1)
break;
- if( (pushbutton == 'Y') || (pushbutton == 'y') )
- {
+ if ((pushbutton == 'Y') || (pushbutton == 'y')) {
result = wifi_direct_accept_connection(incomming_peer_mac);
printf("wifi_direct_accept_connection() result=[%d]\n", result);
- }
- else
- {
+ } else {
result = wifi_direct_reject_connection(incomming_peer_mac);
printf("wifi_direct_reject_connection() result=[%d]\n", result);
}
- }
- else if ( wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD )
- {
+ } else if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD) {
printf("wps_config is WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD\n");
- char pin[9]= { 0, };
+ char pin[9] = { 0, };
memset(pin, 0x00, sizeof(pin));
printf("*********************\n");
if (scanf(" %8s", pin) < 1)
break;
- if( strlen(pin) > 0 )
+ if (strlen(pin) > 0)
result = wifi_direct_set_wps_pin(pin);
else
printf("Invalid PIN number\n");
- if ( result == WIFI_DIRECT_ERROR_NONE )
- {
+ if (result == WIFI_DIRECT_ERROR_NONE) {
result = wifi_direct_accept_connection(incomming_peer_mac);
printf("wifi_direct_accept_connection() result=[%d]\n", result);
- }
- else
+ } else
printf("wifi_direct_set_wps_pin Error [%d]\n", result);
- }
- else
- {
+ } else
printf("wps_config is unknown!\n");
- }
}
}
break;
{
event_printf("event - WIFI_DIRECT_DISCONNECTION_IND\n");
- if ( error_code == WIFI_DIRECT_ERROR_NONE )
- {
- char incomming_peer_mac[18]={0,};
+ if (error_code == WIFI_DIRECT_ERROR_NONE) {
+ char incomming_peer_mac[18] = {0, };
- if(NULL != mac_address)
+ if (NULL != mac_address)
strncpy(incomming_peer_mac, mac_address, strlen(mac_address));
- printf ("Disconnection IND from [%s] \n", incomming_peer_mac);
+ printf("Disconnection IND from [%s] \n", incomming_peer_mac);
event_printf("Error None\n");
}
{
event_printf("event - WIFI_DIRECT_DISCONNECTION_RSP\n");
- if ( error_code == WIFI_DIRECT_ERROR_NONE )
- {
- char incomming_peer_mac[18]={0,};
+ if (error_code == WIFI_DIRECT_ERROR_NONE) {
+ char incomming_peer_mac[18] = {0, };
- if(NULL != mac_address)
+ if (NULL != mac_address)
strncpy(incomming_peer_mac, mac_address, strlen(mac_address));
- printf ("Disconnection RSP with [%s] \n", incomming_peer_mac);
+ printf("Disconnection RSP with [%s] \n", incomming_peer_mac);
event_printf("Error None\n");
}
{
event_printf("event - WIFI_DIRECT_DISASSOCIATION_IND\n");
- if ( error_code == WIFI_DIRECT_ERROR_NONE )
- {
- char incomming_peer_mac[18]={0,};
+ if (error_code == WIFI_DIRECT_ERROR_NONE) {
+ char incomming_peer_mac[18] = {0, };
- if(NULL != mac_address)
+ if (NULL != mac_address)
strncpy(incomming_peer_mac, mac_address, strlen(mac_address));
- printf ("Disassociation IND from [%s] \n", incomming_peer_mac);
+ printf("Disassociation IND from [%s] \n", incomming_peer_mac);
event_printf("Error None\n");
}
{
__FUNC_ENTER__;
- if(NULL != mac_address)
- printf ("mac_address [%s] \n", mac_address);
+ if (NULL != mac_address)
+ printf("mac_address [%s] \n", mac_address);
else
- printf ("mac_address is NULL !!\n");
+ printf("mac_address is NULL !!\n");
- if(NULL != ip_address)
- printf ("ip_address [%s] \n", ip_address);
+ if (NULL != ip_address)
+ printf("ip_address [%s] \n", ip_address);
else
- printf ("ip_address is NULL !!\n");
+ printf("ip_address is NULL !!\n");
- if(NULL != interface_address)
- printf ("interface_address [%s] \n", interface_address);
+ if (NULL != interface_address)
+ printf("interface_address [%s] \n", interface_address);
else
- printf ("interface_address is NULL !!\n");
+ printf("interface_address is NULL !!\n");
__FUNC_EXIT__;
{
__FUNC_ENTER__;
- switch (type)
- {
- case WIFI_DIRECT_WPS_TYPE_PBC:
- printf("type=[WIFI_DIRECT_WPS_TYPE_PBC]\n");
- break;
- case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY:
- printf("type=[WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY]\n");
- break;
- case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD:
- printf("type=[WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD]\n");
- break;
- default:
- printf("ERROR : type=[%d]\n", type);
- break;
+ switch (type) {
+ case WIFI_DIRECT_WPS_TYPE_PBC:
+ printf("type=[WIFI_DIRECT_WPS_TYPE_PBC]\n");
+ break;
+ case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY:
+ printf("type=[WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY]\n");
+ break;
+ case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD:
+ printf("type=[WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD]\n");
+ break;
+ default:
+ printf("ERROR : type=[%d]\n", type);
+ break;
}
- return true; // continue with the next iteration of the loop
+ return true; /* continue with the next iteration of the loop */
}
int init_wfd_client(struct appdata *ad)
printf("cmd=[%d]\n", cmd);
- switch (cmd)
+ switch (cmd) {
+ case CMD_INITIALIZE:
{
- case CMD_INITIALIZE:
- {
- result = init_wfd_client(ad);
- printf("init_wfd_client() result=[%d]\n", result);
- }
- break;
+ result = init_wfd_client(ad);
+ printf("init_wfd_client() result=[%d]\n", result);
+ }
+ break;
- case CMD_SET_ACTIVATION_CB:
- {
- result = wifi_direct_set_device_state_changed_cb(_cb_activation, (void*)ad);
- printf("wifi_direct_set_device_state_changed_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_SET_ACTIVATION_CB:
+ {
+ result = wifi_direct_set_device_state_changed_cb(_cb_activation, (void*)ad);
+ printf("wifi_direct_set_device_state_changed_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_UNSET_ACTIVATION_CB:
- {
- result = wifi_direct_unset_device_state_changed_cb();
- printf("wifi_direct_unset_device_state_changed_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_UNSET_ACTIVATION_CB:
+ {
+ result = wifi_direct_unset_device_state_changed_cb();
+ printf("wifi_direct_unset_device_state_changed_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_SET_DISCOVER_CB:
- {
- result = wifi_direct_set_discovery_state_changed_cb(_cb_discover, (void*)ad);
- printf("wifi_direct_set_discovery_state_changed_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_SET_DISCOVER_CB:
+ {
+ result = wifi_direct_set_discovery_state_changed_cb(_cb_discover, (void*)ad);
+ printf("wifi_direct_set_discovery_state_changed_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_UNSET_DISCOVER_CB:
- {
- result = wifi_direct_unset_discovery_state_changed_cb();
- printf("wifi_direct_unset_discovery_state_changed_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_UNSET_DISCOVER_CB:
+ {
+ result = wifi_direct_unset_discovery_state_changed_cb();
+ printf("wifi_direct_unset_discovery_state_changed_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_SET_CONNECTION_CB:
- {
- result = wifi_direct_set_connection_state_changed_cb(_cb_connection, (void*)ad);
- printf("wifi_direct_set_connection_state_changed_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_SET_CONNECTION_CB:
+ {
+ result = wifi_direct_set_connection_state_changed_cb(_cb_connection, (void*)ad);
+ printf("wifi_direct_set_connection_state_changed_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_UNSET_CONNECTION_CB:
- {
- result = wifi_direct_unset_connection_state_changed_cb();
- printf("wifi_direct_unset_connection_state_changed_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_UNSET_CONNECTION_CB:
+ {
+ result = wifi_direct_unset_connection_state_changed_cb();
+ printf("wifi_direct_unset_connection_state_changed_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_SET_SERVICE_CB:
- {
- result = wifi_direct_set_service_state_changed_cb(_cb_service, (void*)ad);
- printf("wifi_direct_set_service_state_changed_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_SET_SERVICE_CB:
+ {
+ result = wifi_direct_set_service_state_changed_cb(_cb_service, (void*)ad);
+ printf("wifi_direct_set_service_state_changed_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_UNSET_SERVICE_CB:
- {
- result = wifi_direct_unset_service_state_changed_cb();
- printf("wifi_direct_unset_service_changed_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_UNSET_SERVICE_CB:
+ {
+ result = wifi_direct_unset_service_state_changed_cb();
+ printf("wifi_direct_unset_service_changed_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_SET_PEER_FOUND_CB:
- {
- result = wifi_direct_set_peer_found_cb(_cb_peer_found, (void*)ad);
- printf("wifi_direct_set_peer_found_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_SET_PEER_FOUND_CB:
+ {
+ result = wifi_direct_set_peer_found_cb(_cb_peer_found, (void*)ad);
+ printf("wifi_direct_set_peer_found_cb() result=[%d]\n", result);
+ }
+ break;
- case CMD_UNSET_PEER_FOUND_CB:
- {
- result = wifi_direct_unset_peer_found_cb();
- printf("wifi_direct_unset_peer_found_cb() result=[%d]\n", result);
- }
- break;
+ case CMD_UNSET_PEER_FOUND_CB:
+ {
+ result = wifi_direct_unset_peer_found_cb();
+ printf("wifi_direct_unset_peer_found_cb() result=[%d]\n", result);
+ }
+ break;
case CMD_DEINITIALIZE:
result = wifi_direct_deinitialize();
printf("wifi_direct_deinitialize() result=[%d]\n", result);
break;
case CMD_ACTIVATE_WIFI_DIRECT:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_activate();
printf("wifi_direct_activate() result=[%d]\n", result);
- if ( result == WIFI_DIRECT_ERROR_WIFI_USED )
+ if (result == WIFI_DIRECT_ERROR_WIFI_USED)
printf(" ERROR : WIFI_DIRECT_ERROR_WIFI_USED \n");
- else if ( result == WIFI_DIRECT_ERROR_MOBILE_AP_USED )
+ else if (result == WIFI_DIRECT_ERROR_MOBILE_AP_USED)
printf(" ERROR : WIFI_DIRECT_ERROR_MOBILE_AP_USED \n");
}
break;
case CMD_DEACTIVATE_WIFI_DIRECT:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_deactivate();
printf("wifi_direct_deactivate() result=[%d]\n", result);
}
break;
case CMD_START_DISCOVER_WITH_LISTEN_ONLY:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_start_discovery(TRUE, 15);
printf("wifi_direct_start_discovery() listen_only=[true] result=[%d]\n", result);
}
break;
case CMD_START_DISCOVER:
- if (ad != NULL)
- {
- //result = wifi_direct_start_discovery(FALSE, 15);
+ if (ad != NULL) {
+ /* result = wifi_direct_start_discovery(FALSE, 15); */
result = wifi_direct_start_discovery(FALSE, 0);
printf("wifi_direct_start_discovery() listen_only=[false] result=[%d]\n", result);
}
break;
case CMD_START_DISCOVER_SPECIFIC_CHANNEL:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int input;
printf("Select Discovery Channel :\n");
printf("1. WIFI_DIRECT_DISCOVERY_FULL_SCAN\n");
if (scanf(" %1d", &input) < 1)
break;
- switch(input)
+ switch (input) {
+ case 1:
{
- case 1 :
- {
- result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_FULL_SCAN);
- printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_FULL_SCAN, result);
- }
- break;
- case 2 :
- {
- result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL);
- printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL, result);
- }
- break;
- case 3 :
- {
- result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_CHANNEL1);
- printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_CHANNEL1, result);
- }
- break;
- case 4 :
- {
- result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_CHANNEL6);
- printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_CHANNEL6, result);
- }
- break;
- case 5 :
- {
- result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_CHANNEL11);
- printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_CHANNEL11, result);
- }
- break;
- default :
- printf("ERROR : Invalid Channel !!!\n");
- break;
+ result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_FULL_SCAN);
+ printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_FULL_SCAN, result);
+ }
+ break;
+ case 2:
+ {
+ result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL);
+ printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL, result);
+ }
+ break;
+ case 3:
+ {
+ result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_CHANNEL1);
+ printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_CHANNEL1, result);
+ }
+ break;
+ case 4:
+ {
+ result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_CHANNEL6);
+ printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_CHANNEL6, result);
+ }
+ break;
+ case 5:
+ {
+ result = wifi_direct_start_discovery_specific_channel(FALSE, 2, WIFI_DIRECT_DISCOVERY_CHANNEL11);
+ printf("wifi_direct_start_discovery_specific_channel() channel=[%d] result=[%d]\n", WIFI_DIRECT_DISCOVERY_CHANNEL11, result);
+ }
+ break;
+ default:
+ printf("ERROR : Invalid Channel !!!\n");
+ break;
}
}
break;
case CMD_CANCEL_DISCOVER:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_cancel_discovery();
printf("wifi_direct_cancel_discovery() result=[%d]\n", result);
}
break;
case CMD_GET_DISVOCERY_RESULT:
- if (ad != NULL)
- {
+ if (ad != NULL) {
memset(ad->peer_list, 0x00, sizeof(wifi_direct_discovered_peer_info_s)*MAX_PEER_NUM);
ad->peer_count = 0;
- ad ->selected_peer_index = 0;
+ ad->selected_peer_index = 0;
result = wifi_direct_foreach_discovered_peers(_cb_discovered_peers_impl, (void*)ad);
printf("wifi_direct_foreach_discovered_peers() ret=[%d]\n", result);
break;
case CMD_SEND_CONNECTION_REQ:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
result = wifi_direct_accept_connection(list[i].mac_address);
- printf ("Connecting... peer-index[%d] MAC [%s] Owner=[%s] SSID[%s]\n",
+ printf("Connecting... peer-index[%d] MAC [%s] Owner=[%s] SSID[%s]\n",
i,
list[i].mac_address,
list[i].is_group_owner ? "YES" : "NO",
break;
case CMD_DISCONNECT_ALL:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_disconnect_all();
printf("wifi_direct_disconnect_all() result=[%d]\n", result);
}
break;
case CMD_DISCONNECT:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
result = wifi_direct_disconnect(list[i].mac_address);
- printf ("Disconnecting... peer-index[%d] MAC [%s] SSID[%s]\n",
+ printf("Disconnecting... peer-index[%d] MAC [%s] SSID[%s]\n",
i,
list[i].mac_address,
list[i].device_name);
case CMD_GET_LINK_STATUS:
- if (ad != NULL)
- {
+ if (ad != NULL) {
wifi_direct_state_e status = 0;
result = wifi_direct_get_state(&status);
printf("wifi_direct_get_state() state=[%s(%d)], result=[%d]\n", print_link_state(status), status, result);
break;
case CMD_CONNECT_PEER:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
wifi_direct_wps_type_e wps_mode;
result = wifi_direct_get_local_wps_type(&wps_mode);
printf("wifi_direct_get_local_wps_type() result=[%d]\n", result);
- if( wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD )
- {
+ if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD)
printf("wifi_direct_generate_wps_pin() result=[%d]\n", result);
- }
int i = ad->selected_peer_index;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
result = wifi_direct_connect(list[i].mac_address);
- printf ("Connecting... peer-index[%d] MAC [%s] Owner=[%s] SSID[%s]\n",
+ printf("Connecting... peer-index[%d] MAC [%s] Owner=[%s] SSID[%s]\n",
i,
list[i].mac_address,
list[i].is_group_owner ? "YES" : "NO",
break;
case CMD_CANCEL_CONNECTION:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
break;
case CMD_ENABLE_PUSH_BUTTON:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_activate_pushbutton();
printf("wifi_direct_activate_pushbutton() result=[%d]\n", result);
}
break;
case CMD_CREATE_GROUP:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_create_group();
printf("wifi_direct_create_group() result=[%d]\n", result);
}
break;
case CMD_CANCEL_GROUP:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_destroy_group();
printf("wifi_direct_destroy_group() result=[%d]\n", result);
}
break;
case CMD_IS_GROUP_OWNER:
- if (ad != NULL)
- {
+ if (ad != NULL) {
bool is_group_owner;
result = wifi_direct_is_group_owner(&is_group_owner);
printf("wifi_direct_is_group_owner() is GO[%d] result=[%d]\n", is_group_owner, result);
}
break;
case CMD_REJECT:
- if (ad != NULL)
- {
- //result = wifi_direct_client_reject();
+ if (ad != NULL) {
+ /* result = wifi_direct_client_reject(); */
printf("Under construction...\n");
}
break;
case CMD_INVITE:
- if (ad != NULL)
- {
- //result = wifi_direct_client_invite();
+ if (ad != NULL) {
+ /* result = wifi_direct_client_invite(); */
printf("Under construction...\n");
}
break;
case CMD_SET_DEVICE_NAME:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
char *device_name = NULL;
printf("Input device name :\n");
else
printf("device_name: [%s]\n", device_name);
- if ((strlen(device_name) > 0))
- {
+ if ((strlen(device_name) > 0)) {
result = wifi_direct_set_device_name(device_name);
printf("wifi_direct_set_device_name() ret=[%d]\n", result);
}
case CMD_GET_DEVICE_NAME:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
char* device_name = NULL;
result = wifi_direct_get_device_name(&device_name);
printf("wifi_direct_get_device_name() result=[%d]\n", result);
- if (NULL != device_name)
- {
+ if (NULL != device_name) {
printf("ssid: [%s]\n", device_name);
free(device_name);
}
case CMD_GET_SSID:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
char* ssid = NULL;
result = wifi_direct_get_ssid(&ssid);
printf("wifi_direct_get_ssid() result=[%d]\n", result);
- if (NULL != ssid)
- {
+ if (NULL != ssid) {
printf("ssid: [%s]\n", ssid);
free(ssid);
}
break;
case CMD_SET_MAX_CLIENT:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int max_client;
wifi_direct_get_max_clients(&max_client);
break;
case CMD_GET_MAX_CLIENT:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int max_client;
result = wifi_direct_get_max_clients(&max_client);
break;
case CMD_ACTIVATE_PERSISTENT_GROUP:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_set_persistent_group_enabled(true);
- if(result != WIFI_DIRECT_ERROR_NONE)
+ if (result != WIFI_DIRECT_ERROR_NONE)
printf("Failed to wifi_direct_set_persistent_group_enabled() result=[%d]\n", result);
else
printf("wifi_direct_set_persistent_group_enabled() result=[%d]\n", result);
break;
case CMD_DEACTIVATE_PERSISTENT_GROUP:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_set_persistent_group_enabled(false);
- if(result != WIFI_DIRECT_ERROR_NONE)
+ if (result != WIFI_DIRECT_ERROR_NONE)
printf("Failed to wifi_direct_set_persistent_group_enabled() result=[%d]\n", result);
else
printf("wifi_direct_set_persistent_group_enabled() result=[%d]\n", result);
break;
case CMD_IS_PERSISTENT_GROUP_ACTIVATED:
- if (ad != NULL)
- {
+ if (ad != NULL) {
bool enabled;
result = wifi_direct_is_persistent_group_enabled(&enabled);
printf("wifi_direct_is_persistent_group_enabled() result=[%d]\n", result);
- if ( enabled == TRUE )
+ if (enabled == TRUE)
printf("Persistent Group mode!! \n");
else
printf("NOT Persistent group mode!! \n");
case CMD_GET_PERSISTENT_GROUP_LIST:
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_foreach_persistent_groups(_cb_persistent_groups_impl, (void*)ad);
printf("wifi_direct_foreach_persistent_groups() ret=[%d]\n", result);
}
break;
case CMD_REMOVE_PERSISTENT_GROUP:
- if (ad != NULL)
- {
+ if (ad != NULL) {
char *mac = NULL;
char *ssid = NULL;
else
printf("ssid: [%s]\n", ssid);
- if ((strlen(mac) > 0) && (strlen(ssid) > 0))
- {
+ if ((strlen(mac) > 0) && (strlen(ssid) > 0)) {
result = wifi_direct_remove_persistent_group(mac, ssid);
printf("wifi_direct_remove_persistent_group() ret=[%d]\n", result);
}
break;
case CMD_SET_AUTO_CONNECTION:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int autoconnection_mode;
printf("Input Auto connection: \n");
break;
case CMD_IS_AUTO_CONNECTION:
- if (ad != NULL)
- {
+ if (ad != NULL) {
bool auto_connection = false;
result = wifi_direct_is_autoconnection_mode(&auto_connection);
printf("wifi_direct_is_autoconnection_mode() result=[%d]\n", result);
- if ( auto_connection == TRUE )
+ if (auto_connection == TRUE)
printf("Auto connection mode !! \n");
else
printf("NOT Auto connection mode !! \n");
break;
case CMD_SET_WPS_PIN:
- if (ad != NULL)
- {
-
+ if (ad != NULL) {
char *pin = NULL;
printf("Input PIN number :\n");
break;
case CMD_GET_WPS_PIN:
- if (ad != NULL)
- {
+ if (ad != NULL) {
char *pin = NULL;
result = wifi_direct_get_wps_pin(&pin);
printf("wifi_direct_get_wps_pin() result=[%d]\n", result);
- if ( NULL != pin )
- {
+ if (NULL != pin) {
printf("WPS_PIN [%s]\n", pin);
free(pin);
- }
- else
+ } else
printf("WPS_PIN is NULL !! \n");
}
break;
case CMD_GET_SUPPORTED_WPS_MODE:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int supported_wps_mode = 0;
result = wifi_direct_foreach_supported_wps_types(_cb_foreach_supported_wps_impl, NULL);
printf("wifi_direct_foreach_supported_wps_types() result=[%d]\n", result);
- result = wifi_direct_get_supported_wps_mode (&supported_wps_mode);
+ result = wifi_direct_get_supported_wps_mode(&supported_wps_mode);
printf("wifi_direct_foreach_supported_wps_types() supported=[%d] result=[%d]\n", supported_wps_mode, result);
}
break;
case CMD_SET_CURRENT_WPS_MODE:
- if (ad != NULL)
- {
-
+ if (ad != NULL) {
wifi_direct_wps_type_e wps_mode;
int input;
result = wifi_direct_get_req_wps_type(&wps_mode);
- switch(wps_mode)
- {
- case WIFI_DIRECT_WPS_TYPE_PBC :
- printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PBC]\n");
- break;
- case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY :
- printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY]\n");
- break;
- case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD :
- printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD]\n");
- break;
- default :
- printf("ERROR : wps_mode=[%d]\n", wps_mode);
- break;
+ switch (wps_mode) {
+ case WIFI_DIRECT_WPS_TYPE_PBC:
+ printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PBC]\n");
+ break;
+ case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY:
+ printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY]\n");
+ break;
+ case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD:
+ printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD]\n");
+ break;
+ default:
+ printf("ERROR : wps_mode=[%d]\n", wps_mode);
+ break;
}
printf("Input new wps mode:\n");
if (scanf(" %1d", &input) < 1)
break;
- switch(input)
- {
- case 1 :
- wps_mode = WIFI_DIRECT_WPS_TYPE_PBC;
- break;
- case 2 :
- wps_mode = WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY;
- break;
- case 3 :
- wps_mode = WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD;
- break;
- default :
- printf("ERROR : Invalid input wps_mode!!!\n");
- break;
+ switch (input) {
+ case 1:
+ wps_mode = WIFI_DIRECT_WPS_TYPE_PBC;
+ break;
+ case 2:
+ wps_mode = WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY;
+ break;
+ case 3:
+ wps_mode = WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD;
+ break;
+ default:
+ printf("ERROR : Invalid input wps_mode!!!\n");
+ break;
}
result = wifi_direct_set_req_wps_type(wps_mode);
break;
case CMD_GET_CURRENT_WPS_MODE:
- if (ad != NULL)
- {
+ if (ad != NULL) {
wifi_direct_wps_type_e wps_mode;
result = wifi_direct_get_req_wps_type(&wps_mode);
printf("wifi_direct_get_wps_type() wps_mode=[%d], result=[%d]\n", wps_mode, result);
- switch(wps_mode)
- {
- case WIFI_DIRECT_WPS_TYPE_PBC :
- printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PBC]\n");
- break;
- case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY :
- printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY]\n");
- break;
- case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD :
- printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD]\n");
- break;
- default :
- printf("ERROR : wps_mode=[%d]\n", wps_mode);
- break;
+ switch (wps_mode) {
+ case WIFI_DIRECT_WPS_TYPE_PBC:
+ printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PBC]\n");
+ break;
+ case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY:
+ printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY]\n");
+ break;
+ case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD:
+ printf("Current wps_mode=[WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD]\n");
+ break;
+ default:
+ printf("ERROR : wps_mode=[%d]\n", wps_mode);
+ break;
}
}
break;
case CMD_GET_CONNECTED_PEERS_INFO:
- if (ad != NULL)
- {
+ if (ad != NULL) {
memset(ad->connected_peer_list, 0x00, sizeof(wifi_direct_connected_peer_info_s)*MAX_PEER_NUM);
ad->connected_peer_count = 0;
break;
case CMD_GET_GO_INTENT:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int go_intent;
result = wifi_direct_get_group_owner_intent(&go_intent);
break;
case CMD_SET_GO_INTENT:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int go_intent;
wifi_direct_get_group_owner_intent(&go_intent);
break;
case CMD_GET_DEVICE_MAC:
- if (ad != NULL)
- {
+ if (ad != NULL) {
char *device_mac = NULL;
result = wifi_direct_get_mac_address(&device_mac);
printf("wifi_direct_get_mac_addr() result=[%d]\n", result);
- if ( NULL != device_mac )
- printf ("MAC [%s] \n", device_mac);
+ if (NULL != device_mac)
+ printf("MAC [%s] \n", device_mac);
else
printf("device_mac is NULL !! \n");
}
break;
case CMD_IS_AUTONOMOUS_GROUP:
- if (ad != NULL)
- {
+ if (ad != NULL) {
bool autonomous_group;
result = wifi_direct_is_autonomous_group(&autonomous_group);
printf("wifi_direct_is_autonomous_group() result=[%d]\n", result);
- if ( autonomous_group == TRUE )
+ if (autonomous_group == TRUE)
printf("Autonomous Group !! \n");
else
printf("NOT Autonomous group !! \n");
break;
case CMD_GET_NETWORK_IF_NAME:
- if (ad != NULL)
- {
+ if (ad != NULL) {
char* name = NULL;
result = wifi_direct_get_network_interface_name(&name);
printf("wifi_direct_get_network_interface_name() result=[%d]\n", result);
- if (NULL != name)
- {
+ if (NULL != name) {
printf("name: [%s]\n", name);
free(name);
}
break;
case CMD_GET_SUBNET_MASK:
- if (ad != NULL)
- {
+ if (ad != NULL) {
char* subnet_mask = NULL;
result = wifi_direct_get_subnet_mask(&subnet_mask);
printf("wifi_direct_get_subnet_mask() result=[%d]\n", result);
- if (NULL != subnet_mask)
- {
+ if (NULL != subnet_mask) {
printf("subnet_mask: [%s]\n", subnet_mask);
free(subnet_mask);
}
case CMD_GET_GATEWAY_ADDR:
- if (ad != NULL)
- {
+ if (ad != NULL) {
char* gateway_address = NULL;
result = wifi_direct_get_gateway_address(&gateway_address);
printf("wifi_direct_get_gateway_address() result=[%d]\n", result);
- if (NULL != gateway_address)
- {
+ if (NULL != gateway_address) {
printf("gateway_address: [%s]\n", gateway_address);
free(gateway_address);
}
break;
case CMD_IS_DISCOVERABLE:
- if (ad != NULL)
- {
+ if (ad != NULL) {
bool discoverable = false;
result = wifi_direct_is_discoverable(&discoverable);
printf("wifi_direct_is_discoverable() result=[%d]\n", result);
- if ( discoverable == TRUE )
+ if (discoverable == TRUE)
printf("Discoverable state !! \n");
else
printf("NOT Discoverable state !! \n");
break;
case CMD_IS_LISTEN_ONLY:
- if (ad != NULL)
- {
+ if (ad != NULL) {
bool listen_only = false;
result = wifi_direct_is_listening_only(&listen_only);
printf("wifi_direct_is_listening_only() result=[%d]\n", result);
- if ( listen_only == TRUE )
+ if (listen_only == TRUE)
printf("Listen only state !! \n");
else
printf("NOT Listen only state !! \n");
break;
case CMD_GET_PRIMARY_DEVICE_TYPE:
- if (ad != NULL)
- {
+ if (ad != NULL) {
wifi_direct_primary_device_type_e type;
result = wifi_direct_get_primary_device_type(&type);
break;
case CMD_GET_SECONDARY_DEVICE_TYPE:
- if (ad != NULL)
- {
+ if (ad != NULL) {
wifi_direct_secondary_device_type_e type;
result = wifi_direct_get_secondary_device_type(&type);
break;
case CMD_GET_OPERATING_CHANNEL:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int operating_channel;
result = wifi_direct_get_operating_channel(&operating_channel);
case CMD_GET_IP_ADDR:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
char* ip_addr = NULL;
result = wifi_direct_get_ip_address(&ip_addr);
printf("wifi_direct_get_ip_address() result=[%d]\n", result);
- if(NULL != ip_addr)
- {
+ if (NULL != ip_addr) {
printf("IP [%s]\n", ip_addr);
free(ip_addr);
- }
- else
- {
+ } else {
printf("IP is NULL\n");
}
}
break;
case CMD_REGISTER_SERVICE:
- if (ad != NULL)
- {
+ if (ad != NULL) {
wifi_direct_service_type_e service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
unsigned int input;
char *info1 = NULL;
printf("5. WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO\n");
if (scanf(" %1u", &input) < 1)
break;
- printf("input = %u\n",input);
+ printf("input = %u\n", input);
- switch(input)
- {
- case 1 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
- break;
- case 2 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR;
- printf("Enter info 1\n");
- if (scanf(" %50ms", &info1) < 1)
- break;
+ switch (input) {
+ case 1:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
+ break;
+ case 2:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR;
+ printf("Enter info 1\n");
+ if (scanf(" %50ms", &info1) < 1)
+ break;
- printf("Enter info 2\n");
- if (scanf(" %50ms", &info2) < 1)
- free(info1);
+ printf("Enter info 2\n");
+ if (scanf(" %50ms", &info2) < 1)
+ free(info1);
- break;
- case 3 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_UPNP;
- printf("Enter info 1\n");
- if (scanf(" %50ms", &info1) < 1)
- break;
+ break;
+ case 3:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_UPNP;
+ printf("Enter info 1\n");
+ if (scanf(" %50ms", &info1) < 1)
+ break;
- printf("Enter info 2\n");
- if (scanf(" %50ms", &info2) < 1)
- free(info1);
+ printf("Enter info 2\n");
+ if (scanf(" %50ms", &info2) < 1)
+ free(info1);
- break;
- case 4 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR;
- break;
- case 5 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO;
- printf("Enter contact info\n");
- if (scanf(" %50ms", &str) < 1)
- break;
- break;
- default :
- printf("ERROR : Invalid input service_type!!!\n");
- break;
+ break;
+ case 4:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR;
+ break;
+ case 5:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO;
+ printf("Enter contact info\n");
+ if (scanf(" %50ms", &str) < 1)
+ break;
+ break;
+ default:
+ printf("ERROR : Invalid input service_type!!!\n");
+ break;
}
result = wifi_direct_register_service(service_type, info1, info2, &input);
break;
case CMD_DEREGISTER_SERVICE:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int input;
printf("Enter service id:\n");
}
break;
case CMD_START_SERVICE_DISCOVERY:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int input;
wifi_direct_service_type_e service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
printf("5. WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO\n");
if (scanf(" %1d", &input) < 1)
break;
- printf("input = %d\n",input);
+ printf("input = %d\n", input);
- switch(input)
- {
- case 1 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
- break;
- case 2 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR;
- break;
- case 3 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_UPNP;
- break;
- case 4 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR;
- break;
- case 5 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO;
- break;
- default :
- printf("ERROR : Invalid input service_type!!!\n");
- break;
+ switch (input) {
+ case 1:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
+ break;
+ case 2:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR;
+ break;
+ case 3:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_UPNP;
+ break;
+ case 4:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR;
+ break;
+ case 5:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO;
+ break;
+ default:
+ printf("ERROR : Invalid input service_type!!!\n");
+ break;
}
- if (select_peer(ad))
- {
+ if (select_peer(ad)) {
result = wifi_direct_start_service_discovery(
NULL, service_type);
- printf ("Service Discovery... broadcast service type[%d]\n",
+ printf("Service Discovery... broadcast service type[%d]\n",
service_type);
} else {
int i = ad->selected_peer_index;
result = wifi_direct_start_service_discovery(
list[i].mac_address, service_type);
- printf ("Service Discovery... peer-index[%d] MAC [%s] service type[%d]\n",
- i,list[i].mac_address, service_type);
+ printf("Service Discovery... peer-index[%d] MAC [%s] service type[%d]\n",
+ i, list[i].mac_address, service_type);
}
printf("wifi_direct_start_service_discovery() result=[%d]\n", result);
break;
case CMD_CANCEL_SERVICE_DISCOVERY:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int input;
wifi_direct_service_type_e service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
if (scanf(" %1d", &input) < 1)
break;
- printf("input = %d\n",input);
+ printf("input = %d\n", input);
- switch(input)
- {
- case 1 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
- break;
- case 2 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR;
- break;
- case 3 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_UPNP;
- break;
- case 4 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR;
- break;
- case 5 :
- service_type = WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO;
- break;
- default :
- printf("ERROR : Invalid input service_type!!!\n");
- break;
+ switch (input) {
+ case 1:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_ALL;
+ break;
+ case 2:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR;
+ break;
+ case 3:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_UPNP;
+ break;
+ case 4:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR;
+ break;
+ case 5:
+ service_type = WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO;
+ break;
+ default:
+ printf("ERROR : Invalid input service_type!!!\n");
+ break;
}
- if (select_peer(ad))
- {
+ if (select_peer(ad)) {
result = wifi_direct_cancel_service_discovery(
NULL, service_type);
- printf ("Service Discovery... broadcast service type[%d]\n",
+ printf("Service Discovery... broadcast service type[%d]\n",
service_type);
} else {
int i = ad->selected_peer_index;
result = wifi_direct_cancel_service_discovery(
list[i].mac_address, service_type);
- printf ("Service Discovery... peer-index[%d] MAC [%s] service type[%d]\n",
- i,list[i].mac_address, service_type);
+ printf("Service Discovery... peer-index[%d] MAC [%s] service type[%d]\n",
+ i, list[i].mac_address, service_type);
}
printf("wifi_direct_cancel_service_discovery() result=[%d]\n", result);
}
break;
case CMD_INIT_MIRACAST:
- if (ad != NULL)
- {
+ if (ad != NULL) {
int miracast_enable;
printf("Input miracast enable: \n");
case CMD_GET_PEER_INFO:
if (ad != NULL)
- if (select_peer(ad))
- {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
wifi_direct_discovered_peer_info_s* peer_info = NULL;
result = wifi_direct_get_peer_info(list[i].mac_address, &peer_info);
- if(peer_info !=NULL) {
- printf ("MAC [%s] Owner=[%s] connected=[%d] SSID[%s] ctg=[%d/%d]",
+ if (peer_info != NULL) {
+ printf("MAC [%s] Owner=[%s] connected=[%d] SSID[%s] ctg=[%d/%d]",
peer_info->mac_address,
peer_info->is_group_owner ? "YES" : "NO",
peer_info->is_connected,
peer_info->primary_device_type,
peer_info->secondary_device_type
);
- if(peer_info->mac_address)
+ if (peer_info->mac_address)
free(peer_info->mac_address);
- if(peer_info->interface_address)
+ if (peer_info->interface_address)
free(peer_info->interface_address);
- if(peer_info)
+ if (peer_info)
free(peer_info);
}
break;
case CMD_SET_PASSPHRASE:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
char passphrase[64] = {0, };
printf("Input passphrase :\n");
break;
case CMD_GET_PASSPHRASE:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
char* passphrase = NULL;
result = wifi_direct_get_passphrase(&passphrase);
printf("wifi_direct_get_passphrase() result=[%d]\n", result);
- if (NULL != passphrase)
- {
+ if (NULL != passphrase) {
printf("passphrase: [%s]\n", passphrase);
free(passphrase);
}
}
break;
case CMD_SET_AUTOCONNECTION_PEER:
- if (ad != NULL)
- {
+ if (ad != NULL) {
char * mac_address = NULL;
printf("\nEnter Mac_address: ");
if (scanf(" %18ms", &mac_address) < 1)
} else {
int rv = wifi_direct_set_autoconnection_peer(mac_address);
- if (rv == WIFI_DIRECT_ERROR_NONE)
- {
+ if (rv == WIFI_DIRECT_ERROR_NONE) {
free(mac_address);
- printf(MAKE_GREEN"SUCCESS %s"RESET_COLOR"\n",__func__);
+ printf(MAKE_GREEN"SUCCESS %s"RESET_COLOR"\n", __func__);
break;
}
printf(MAKE_RED"FAILED %s : %s"RESET_COLOR"\n", __func__, test_wfd_convert_error_to_string(rv));
break;
case CMD_INIT_DISPLAY:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_init_display();
printf("wifi_direct_init_display() result=[%d]\n", result);
}
break;
case CMD_DEINIT_DISPLAY:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
result = wifi_direct_deinit_display();
printf("wifi_direct_deinit_display() result=[%d]\n", result);
}
break;
case CMD_SET_DISPLAY:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
int rv = WIFI_DIRECT_ERROR_NONE;
int use_default = 0;
if (scanf(" %1d", &use_default) < 1)
break;
- if(use_default == 0) {
+ if (use_default == 0) {
rv = wifi_direct_set_display(WIFI_DIRECT_DISPLAY_TYPE_SOURCE, 7236, 1);
} else {
int display_type = 0;
rv = wifi_direct_set_display(display_type, port_number, hdcp);
}
- if(rv == WIFI_DIRECT_ERROR_NONE) {
- printf(MAKE_GREEN"Success %s : %s"RESET_COLOR"\n",__func__,test_wfd_convert_error_to_string(rv));
+ if (rv == WIFI_DIRECT_ERROR_NONE) {
+ printf(MAKE_GREEN"Success %s : %s"RESET_COLOR"\n", __func__, test_wfd_convert_error_to_string(rv));
break;
}
- printf(MAKE_RED"FAILED %s : %s"RESET_COLOR"\n",__func__,test_wfd_convert_error_to_string(rv));
+ printf(MAKE_RED"FAILED %s : %s"RESET_COLOR"\n", __func__, test_wfd_convert_error_to_string(rv));
break;
}
}
break;
case CMD_SET_DISPLAY_AVAILABILITY:
{
- if (ad != NULL)
- {
+ if (ad != NULL) {
int availability = 0;
printf("Enter Wi-Fi Display availability : ");
break;
int rv = wifi_direct_set_display_availability(availability);
- if (WIFI_DIRECT_ERROR_NONE == rv)
- {
+ if (WIFI_DIRECT_ERROR_NONE == rv) {
printf(MAKE_GREEN"Set Wi-Fi Display availability Successful"RESET_COLOR"\n");
break;
}
- printf(MAKE_RED"Set Wi-Fi Display availability : %s ",test_wfd_convert_error_to_string(rv));
+ printf(MAKE_RED"Set Wi-Fi Display availability : %s ", test_wfd_convert_error_to_string(rv));
printf(RESET_COLOR"\n");
break;
}
}
break;
case CMD_GET_PEER_DISPLAY_TYPE:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
wifi_direct_display_type_e type = WIFI_DIRECT_DISPLAY_TYPE_DUAL;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
}
break;
case CMD_GET_PEER_DISPLAY_AVAILABILITY:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
bool availability = false;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
}
break;
case CMD_GET_PEER_DISPLAY_HDCP:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
int hdcp;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
}
break;
case CMD_GET_PEER_DISPLAY_PORT:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
int port;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
}
break;
case CMD_GET_PEER_DISPLAY_THROUGHPUT:
- if (ad != NULL)
- {
- if (select_peer(ad))
- {
+ if (ad != NULL) {
+ if (select_peer(ad)) {
int i = ad->selected_peer_index;
int tput;
wifi_direct_discovered_peer_info_s* list = ad->peer_list;
errno = 0;
n = read(fd, buf, 1024);
- buf[n - 1] = '\0'; // remove new line...
- if (n == 0)
- {
+ buf[n - 1] = '\0'; /* remove new line... */
+ if (n == 0) {
printf("Error: read() from stdin returns 0.\n");
- }
- else if (n < 0)
- {
+ } else if (n < 0) {
printf("input: read, err=%s\n", strerror(errno));
- }
- else
- {
+ } else {
printf("\n\n");
- //printf("Read [%d]bytes data: [%s]\n", n, buf);
- //printf("Processing it ---------------------\n", n, buf);
+ /* printf("Read [%d]bytes data: [%s]\n", n, buf); */
+ /* printf("Processing it ---------------------\n", n, buf); */
}
process_input(buf, user_data);
GMainLoop *main_loop;
struct appdata *ad = NULL;
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif