return ECORE_CALLBACK_RENEW;
}
-/* Device Commands */
-static Eina_Bool
-_on_cmd_device_propose_scan(__UNUSED__ char *cmd, char *args)
-{
- char *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_propose_scan
- (e, _method_success_check, "device_propose_scan"))
- printf(":::Proposing scan %s...\n", path);
- else
- fputs("ERROR: can't propose scan\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_get_address(__UNUSED__ char *cmd, char *args)
-{
- const char *address, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_address_get(e, &address))
- printf(":::Device %s Address = \"%s\"\n", path, address);
- else
- fputs("ERROR: can't get device address\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_get_name(__UNUSED__ char *cmd, char *args)
-{
- const char *name, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_name_get(e, &name))
- printf(":::Device %s Name = \"%s\"\n", path, name);
- else
- fputs("ERROR: can't get device name\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_get_type(__UNUSED__ char *cmd, char *args)
-{
- const char *type, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_type_get(e, &type))
- printf(":::Device %s Type = \"%s\"\n", path, type);
- else
- fputs("ERROR: can't get device type\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_get_interface(__UNUSED__ char *cmd, char *args)
-{
- const char *interface, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_interface_get(e, &interface))
- printf(":::Device %s Interface = \"%s\"\n", path, interface);
- else
- fputs("ERROR: can't get device interface\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_get_powered(__UNUSED__ char *cmd, char *args)
-{
- char *path;
- Eina_Bool powered;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_powered_get(e, &powered))
- printf(":::Device %s Powered = %hhu\n", path, powered);
- else
- fputs("ERROR: can't get device powered\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_set_powered(__UNUSED__ char *cmd, char *args)
-{
- char *device_path, *next_args;
- Eina_Bool powered;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- device_path = args;
- next_args = _tok(args);
- if (!next_args)
- {
- fputs("ERROR: missing the powered value\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- powered = !!atol(next_args);
-
- e = e_connman_device_get(device_path);
- if (e_connman_device_powered_set
- (e, powered, _method_success_check, "device_set_powered"))
- printf(":::Device %s powered set to %hhu\n", device_path, powered);
- else
- fputs("ERROR: can't set device powered\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_get_scan_interval(__UNUSED__ char *cmd, char *args)
-{
- char *path;
- unsigned short scan_interval;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_scan_interval_get(e, &scan_interval))
- printf(":::Device %s ScanInterval = %hu\n", path, scan_interval);
- else
- fputs("ERROR: can't get device scan interval\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_set_scan_interval(__UNUSED__ char *cmd, char *args)
-{
- char *device_path, *next_args, *p;
- unsigned short scan_interval;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- device_path = args;
- next_args = _tok(args);
- if (!next_args)
- {
- fputs("ERROR: missing the scan interval value\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- scan_interval = strtol(next_args, &p, 0);
- if (p == next_args)
- {
- fprintf(stderr, "ERROR: invalid number \"%s\".\n", next_args);
- return ECORE_CALLBACK_RENEW;
- }
-
- e = e_connman_device_get(device_path);
- if (e_connman_device_scan_interval_set
- (e, scan_interval, _method_success_check, "device_set_scan_interval"))
- printf(":::Device %s scan interval set to %hu\n", device_path, scan_interval);
- else
- fputs("ERROR: can't set device scan interval\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_get_scanning(__UNUSED__ char *cmd, char *args)
-{
- char *path;
- Eina_Bool scanning;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_scanning_get(e, &scanning))
- printf(":::Device %s Scanning = %hhu\n", path, scanning);
- else
- fputs("ERROR: can't get device scanning\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_device_get_networks(__UNUSED__ char *cmd, char *args)
-{
- E_Connman_Element **networks;
- unsigned int count;
- char *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (!e_connman_device_networks_get(e, &count, &networks))
- {
- fputs("ERROR: can't get networks\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
-
- printf("BEG: all device network elements count = %d\n", count);
- _elements_print(networks, count);
- return ECORE_CALLBACK_RENEW;
-}
-
/* Profile Commands */
static Eina_Bool
}
-/* Network Commands */
-
-static Eina_Bool
-_on_cmd_network_get_address(__UNUSED__ char *cmd, char *args)
-{
- const char *address, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_address_get(e, &address))
- printf(":::Network %s Address = \"%s\"\n", path, address);
- else
- fputs("ERROR: can't get network address\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_name(__UNUSED__ char *cmd, char *args)
-{
- const char *name, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_name_get(e, &name))
- printf(":::Network %s Name = \"%s\"\n", path, name);
- else
- fputs("ERROR: can't get network name\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_connected(__UNUSED__ char *cmd, char *args)
-{
- char *path;
- Eina_Bool connected;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_connected_get(e, &connected))
- printf(":::Network %s Connected = %hhu\n", path, connected);
- else
- fputs("ERROR: can't get network connected\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_strength(__UNUSED__ char *cmd, char *args)
-{
- char *path;
- unsigned char strength;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_strength_get(e, &strength))
- printf(":::Network %s Strength = %#02hhx (%d)\n", path, strength, strength);
- else
- fputs("ERROR: can't get network strength\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_frequency(__UNUSED__ char *cmd, char *args)
-{
- char *path;
- unsigned short frequency;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_frequency_get(e, &frequency))
- printf(":::Network %s Frequency = %#04hx (%d)\n", path, frequency, frequency);
- else
- fputs("ERROR: can't get network frequency\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_device(__UNUSED__ char *cmd, char *args)
-{
- E_Connman_Element *e, *device;
- char *path;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (!e_connman_network_device_get(e, &device))
- fputs("ERROR: can't get network device\n", stderr);
- else
- e_connman_element_print(stderr, device);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_wifi_ssid(__UNUSED__ char *cmd, char *args)
-{
- unsigned char *bytes;
- char *path;
- unsigned int i, count;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_wifi_ssid_get(e, &count, &bytes))
- {
- printf(":::Network %s Wifi SSID = ", path);
- for (i = 0; i < count; i++)
- printf("%#02hhx (\"%c\"), ", bytes[i], bytes[i]);
- printf("\n");
- }
- else
- fputs("ERROR: can't get network wifi ssid\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_wifi_mode(__UNUSED__ char *cmd, char *args)
-{
- const char *wifi_mode, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_wifi_mode_get(e, &wifi_mode))
- printf(":::Network %s Wifi Mode = \"%s\"\n", path, wifi_mode);
- else
- fputs("ERROR: can't get network wifi mode\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_wifi_security(__UNUSED__ char *cmd, char *args)
-{
- const char *wifi_security, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_wifi_security_get(e, &wifi_security))
- printf(":::Network %s Wifi Security = \"%s\"\n", path, wifi_security);
- else
- fputs("ERROR: can't get network wifi security\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_wifi_passphrase(__UNUSED__ char *cmd, char *args)
-{
- const char *wifi_passphrase, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_wifi_passphrase_get(e, &wifi_passphrase))
- printf(":::Network %s Wifi Passphrase = \"%s\"\n", path, wifi_passphrase);
- else
- fputs("ERROR: can't get network wifi passphrase\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_wifi_channel(__UNUSED__ char *cmd, char *args)
-{
- char *path;
- E_Connman_Element *e;
- unsigned short wifi_channel;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_wifi_channel_get(e, &wifi_channel))
- printf(":::Network %s Wifi Channel = %#02hx (%d)\n", path, wifi_channel, wifi_channel);
- else
- fputs("ERROR: can't get network wifi channel\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_network_get_wifi_eap(__UNUSED__ char *cmd, char *args)
-{
- const char *wifi_eap, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_wifi_eap_get(e, &wifi_eap))
- printf(":::Network %s Wifi EAP = \"%s\"\n", path, wifi_eap);
- else
- fputs("ERROR: can't get network wifi eap\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
/* Services Commands */
static Eina_Bool
_on_cmd_service_connect(__UNUSED__ char *cmd, char *args)
static Eina_Bool
_on_cmd_service_get_security(__UNUSED__ char *cmd, char *args)
{
- const char *security, *path;
+ const E_Connman_Array *security;
+ const char *path;
E_Connman_Element *e;
if (!args)
e = e_connman_service_get(path);
if (e_connman_service_security_get(e, &security))
- printf(":::Service %s Security = \"%s\"\n", path, security);
+ {
+ Eina_Array_Iterator iterator;
+ unsigned int i;
+ const char *entry;
+ if (security->type != DBUS_TYPE_STRING)
+ {
+ fprintf(stderr, "ERROR: expected type '%c' but got '%c' for "
+ "security array.\n",
+ DBUS_TYPE_STRING, security->type);
+ return ECORE_CALLBACK_RENEW;
+ }
+ printf(":::Service %s Security = ", path);
+ EINA_ARRAY_ITER_NEXT(security->array, i, entry, iterator)
+ printf("\"%s\", ", entry);
+ putchar('\n');
+ }
else
fputs("ERROR: can't get service security\n", stderr);
return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
-_on_cmd_service_get_ethernet_netmask(__UNUSED__ char *cmd, char *args)
-{
- const char *ethernet_netmask, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the service path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_service_get(path);
- if (e_connman_service_ethernet_netmask_get(e, ðernet_netmask))
- printf(":::Service %s Ethernet Netmask = \"%s\"\n",
- path, ethernet_netmask);
- else
- fputs("ERROR: can't get service ethernet netmask\n", stderr);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_on_cmd_technology_get_devices(__UNUSED__ char *cmd, char *args)
-{
- E_Connman_Element **devices;
- E_Connman_Element *e;
- unsigned int count;
- char *path;
-
- if (!args)
- {
- fputs("ERROR: missing the technology path\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- _tok(args);
- path = args;
-
- e = e_connman_technology_get(path);
- if (!e_connman_technology_devices_get(e, &count, &devices))
- {
- fputs("ERROR: can't get devices\n", stderr);
- return ECORE_CALLBACK_RENEW;
- }
- printf("BEG: all technology devices count = %d\n", count);
- _elements_print(devices, count);
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
_on_cmd_technology_get_state(__UNUSED__ char *cmd, char *args)
{
const char *state, *path;
{"manager_profile_remove", _on_cmd_manager_profile_remove},
{"manager_profile_get_active", _on_cmd_manager_profile_get_active},
{"manager_profile_set_active", _on_cmd_manager_profile_set_active},
- {"device_propose_scan", _on_cmd_device_propose_scan},
- {"device_get_address", _on_cmd_device_get_address},
- {"device_get_name", _on_cmd_device_get_name},
- {"device_get_type", _on_cmd_device_get_type},
- {"device_get_interface", _on_cmd_device_get_interface},
- {"device_get_powered", _on_cmd_device_get_powered},
- {"device_set_powered", _on_cmd_device_set_powered},
- {"device_get_scan_interval", _on_cmd_device_get_scan_interval},
- {"device_set_scan_interval", _on_cmd_device_set_scan_interval},
- {"device_get_scanning", _on_cmd_device_get_scanning},
- {"device_get_networks", _on_cmd_device_get_networks},
{"profile_get_name", _on_cmd_profile_get_name},
{"profile_set_name", _on_cmd_profile_set_name},
{"profile_get_offline_mode", _on_cmd_profile_get_offline_mode},
{"profile_set_offline_mode", _on_cmd_profile_set_offline_mode},
{"profile_get_services", _on_cmd_profile_get_services},
- {"network_get_address", _on_cmd_network_get_address},
- {"network_get_name", _on_cmd_network_get_name},
- {"network_get_connected", _on_cmd_network_get_connected},
- {"network_get_strength", _on_cmd_network_get_strength},
- {"network_get_frequency", _on_cmd_network_get_frequency},
- {"network_get_device", _on_cmd_network_get_device},
- {"network_get_wifi_ssid", _on_cmd_network_get_wifi_ssid},
- {"network_get_wifi_mode", _on_cmd_network_get_wifi_mode},
- {"network_get_wifi_security", _on_cmd_network_get_wifi_security},
- {"network_get_wifi_passphrase", _on_cmd_network_get_wifi_passphrase},
- {"network_get_wifi_channel", _on_cmd_network_get_wifi_channel},
- {"network_get_wifi_eap", _on_cmd_network_get_wifi_eap},
{"service_connect", _on_cmd_service_connect},
{"service_disconnect", _on_cmd_service_disconnect},
{"service_remove", _on_cmd_service_remove},
{"service_get_ethernet_method", _on_cmd_service_get_ethernet_method},
{"service_get_ethernet_address", _on_cmd_service_get_ethernet_address},
{"service_get_ethernet_mtu", _on_cmd_service_get_ethernet_mtu},
- {"service_get_ethernet_netmask", _on_cmd_service_get_ethernet_netmask},
- {"technology_get_devices", _on_cmd_technology_get_devices},
{"technology_get_state", _on_cmd_technology_get_state},
{"technology_get_type", _on_cmd_technology_get_type},
{"technology_get_name", _on_cmd_technology_get_name},