}
static int
-_on_cmd_manager_get_connections(char *cmd, char *args)
-{
- unsigned int count;
- E_Connman_Element **connections;
-
- if (!e_connman_manager_connections_get(&count, &connections))
- {
- fputs("ERROR: can't get connections\n", stderr);
- return 1;
- }
- printf("BEG: all manager connections elements count = %d\n", count);
- _elements_print(connections, count);
- return 1;
-}
-
-static int
_on_cmd_manager_get_services(char *cmd, char *args)
{
unsigned int count;
}
path = args;
- if (e_connman_manager_register_agent(path, NULL, NULL))
+ if (e_connman_manager_agent_register(path, NULL, NULL))
printf(":::Registering agent %s...\n", path);
else
fprintf(stderr, "ERROR: can't register agent %s\n", path);
}
path = args;
- if (e_connman_manager_unregister_agent(path, NULL, NULL))
+ if (e_connman_manager_agent_unregister(path, NULL, NULL))
printf(":::Unregistering agent %s...\n", path);
else
fprintf(stderr, "ERROR: can't unregister agent %s\n", path);
}
static int
-_on_cmd_manager_get_policy(char *cmd, char *args)
-{
- const char *policy;
- if (e_connman_manager_policy_get(&policy))
- printf(":::Manager policy = \"%s\"\n", policy);
- else
- fputs("ERROR: can't get manager policy\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_manager_set_policy(char *cmd, char *args)
-{
- char *policy;
- if (!args)
- {
- fputs("ERROR: missing the policy value\n", stderr);
- return 1;
- }
- _tok(args);
- policy = args;
- if (e_connman_manager_policy_set(policy, NULL, NULL))
- printf(":::Manager policy set to \"%s\"\n", policy);
- else
- fputs("ERROR: can't set manager policy\n", stderr);
- return 1;
-}
-
-static int
_on_cmd_manager_get_offline_mode(char *cmd, char *args)
{
bool offline;
}
/* Device Commands */
-
-static int
-_on_cmd_device_create_network(char *cmd, char *args)
-{
- char *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
- e = e_connman_device_get(path);
- if (e_connman_device_network_create(e, NULL, NULL))
- printf(":::Creating Network %s...\n", path);
- else
- fputs("ERROR: can't create network\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_device_remove_network(char *cmd, char *args)
-{
- char *path, *device_path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return 1;
- }
- device_path = args;
- path = _tok(args);
-
- if (!path)
- {
- fputs("ERROR: missing the object network\n", stderr);
- return 1;
- }
- _tok(path);
-
- e = e_connman_device_get(device_path);
- if (e_connman_device_network_remove(e, path, NULL, NULL))
- printf(":::Removing Network %s...\n", path);
- else
- fputs("ERROR: can't remove network\n", stderr);
- return 1;
-}
-
static int
_on_cmd_device_propose_scan(char *cmd, char *args)
{
}
static int
-_on_cmd_device_get_policy(char *cmd, char *args)
-{
- const char *policy, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_policy_get(e, &policy))
- printf(":::Device %s Policy = \"%s\"\n", path, policy);
- else
- fputs("ERROR: can't get device policy\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_device_set_policy(char *cmd, char *args)
-{
- char *policy;
- const char *device_path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return 1;
- }
- device_path = args;
- policy = _tok(args);
-
- if (!policy)
- {
- fputs("ERROR: missing the policy value\n", stderr);
- return 1;
- }
- _tok(policy);
-
- e = e_connman_device_get(device_path);
- if (e_connman_device_policy_set(e, policy, NULL, NULL))
- printf(":::Device %s policy set to \"%s\"\n", device_path, policy);
- else
- fputs("ERROR: can't set device policy\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_device_get_priority(char *cmd, char *args)
-{
- char *path;
- unsigned char priority;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_device_get(path);
- if (e_connman_device_priority_get(e, &priority))
- printf(":::Device %s Priority = %#02hhx (%d)\n", path, priority, priority);
- else
- fputs("ERROR: can't get device priority\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_device_set_priority(char *cmd, char *args)
-{
- char *next_args, *device_path, *p;
- unsigned char priority;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the device path\n", stderr);
- return 1;
- }
- device_path = args;
- next_args = _tok(args);
- if (!next_args)
- {
- fputs("ERROR: missing the priority value\n", stderr);
- return 1;
- }
- _tok(next_args);
- priority = strtol(next_args, &p, 0);
- if (p == next_args)
- {
- fprintf(stderr, "ERROR: invalid number \"%s\".\n", next_args);
- return 1;
- }
-
- e = e_connman_device_get(device_path);
- if (e_connman_device_priority_set(e, priority, NULL, NULL))
- printf(":::Device %s priority set to %d\n", device_path, priority);
- else
- fputs("ERROR: can't set device priority\n", stderr);
- return 1;
-}
-
-static int
_on_cmd_device_get_powered(char *cmd, char *args)
{
char *path;
return 1;
}
-/* Connection Commands */
-
-static int
-_on_cmd_connection_get_type(char *cmd, char *args)
-{
- const char *type, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the connection path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_connection_get(path);
- if (e_connman_connection_type_get(e, &type))
- printf(":::Connection %s Type = \"%s\"\n", path, type);
- else
- fputs("ERROR: can't get connection type\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_connection_get_interface(char *cmd, char *args)
-{
- const char *interface, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the connection path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_connection_get(path);
- if (e_connman_connection_interface_get(e, &interface))
- printf(":::Connection %s Interface = \"%s\"\n", path, interface);
- else
- fputs("ERROR: can't get connection type\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_connection_get_device(char *cmd, char *args)
-{
- E_Connman_Element *e, *device;
- char *path;
-
- if (!args)
- {
- fputs("ERROR: missing the connection path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_connection_get(path);
- if (!e_connman_connection_device_get(e, &device))
- fputs("ERROR: can't get connection device\n", stderr);
- else
- e_connman_element_print(stderr, device);
- return 1;
-}
-
-static int
-_on_cmd_connection_get_network(char *cmd, char *args)
-{
- E_Connman_Element *e, *network;
- char *path;
-
- if (!args)
- {
- fputs("ERROR: missing the connection path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_connection_get(path);
- if (!e_connman_connection_network_get(e, &network))
- fputs("ERROR: can't get connection network\n", stderr);
- else
- e_connman_element_print(stderr, network);
- return 1;
-}
-
-static int
-_on_cmd_connection_get_strength(char *cmd, char *args)
-{
- char *path;
- unsigned char strength;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the connection path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_connection_get(path);
- if (e_connman_connection_strength_get(e, &strength))
- printf(":::Connection %s Strength = %#02hhx (%d)\n", path, strength, strength);
- else
- fputs("ERROR: can't get connection strength\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_connection_get_default(char *cmd, char *args)
-{
- char *path;
- bool connection_default;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the connection path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_connection_get(path);
- if (e_connman_connection_default_get(e, &connection_default))
- printf(":::Connection %s Default = %hhu\n", path, connection_default);
- else
- fputs("ERROR: can't get connection default\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_connection_get_ipv4_method(char *cmd, char *args)
-{
- const char *method, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the connection path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_connection_get(path);
- if (e_connman_connection_ipv4_method_get(e, &method))
- printf(":::Connection %s IPv4 Method = \"%s\"\n", path, method);
- else
- fputs("ERROR: can't get connection ipv4 method\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_connection_get_ipv4_address(char *cmd, char *args)
-{
- const char *address, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the connection path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_connection_get(path);
- if (e_connman_connection_ipv4_address_get(e, &address))
- printf(":::Connection %s IPv4 Address = \"%s\"\n", path, address);
- else
- fputs("ERROR: can't get connection ipv4 address\n", stderr);
- return 1;
-}
/* Network Commands */
static int
-_on_cmd_network_connect(char *cmd, char *args)
-{
- char *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_connect(e, NULL, NULL))
- printf(":::Connecting to Network %s...\n", path);
- else
- fputs("ERROR: can't connect to network\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_network_disconnect(char *cmd, char *args)
-{
- char *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_disconnect(e, NULL, NULL))
- printf(":::Disconnecting Network %s...\n", path);
- else
- fputs("ERROR: can't disconnect network\n", stderr);
- return 1;
-}
-
-static int
_on_cmd_network_get_name(char *cmd, char *args)
{
const char *name, *path;
}
static int
-_on_cmd_network_get_available(char *cmd, char *args)
-{
- const char *path;
- bool available;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_available_get(e, &available))
- printf(":::Network %s Available = %hhu\n", path, available);
- else
- fputs("ERROR: can't get network available\n", stderr);
- return 1;
-}
-
-static int
_on_cmd_network_get_connected(char *cmd, char *args)
{
char *path;
}
static int
-_on_cmd_network_get_remember(char *cmd, char *args)
-{
- char *path;
- bool remember;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return 1;
- }
- _tok(args);
- path = args;
-
- e = e_connman_network_get(path);
- if (e_connman_network_remember_get(e, &remember))
- printf(":::Network %s Remember = %hhu\n", path, remember);
- else
- fputs("ERROR: can't get network remember\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_network_set_remember(char *cmd, char *args)
-{
- char *network_path, *next_args;
- bool remember;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return 1;
- }
- network_path = args;
- next_args = _tok(args);
- if (!next_args)
- {
- fputs("ERROR: missing the remember value\n", stderr);
- return 1;
- }
- _tok(next_args);
- remember = !!atol(next_args);
-
- e = e_connman_network_get(network_path);
- if (e_connman_network_remember_set(e, remember, NULL, NULL))
- printf(":::Network %s remember set to %d\n", network_path, remember);
- else
- fputs("ERROR: can't set network remember\n", stderr);
- return 1;
-}
-
-static int
_on_cmd_network_get_strength(char *cmd, char *args)
{
char *path;
}
static int
-_on_cmd_network_set_wifi_mode(char *cmd, char *args)
-{
- char *wifi_mode;
- const char *network_path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return 1;
- }
- network_path = args;
- wifi_mode = _tok(args);
-
- if (!wifi_mode)
- {
- fputs("ERROR: missing the wifi mode value\n", stderr);
- return 1;
- }
- _tok(wifi_mode);
-
- e = e_connman_network_get(network_path);
- if (e_connman_network_wifi_mode_set(e, wifi_mode, NULL, NULL))
- printf(":::Network %s wifi mode set to \"%s\"\n", network_path, wifi_mode);
- else
- fputs("ERROR: can't set network wifi mode\n", stderr);
- return 1;
-}
-
-static int
_on_cmd_network_get_wifi_security(char *cmd, char *args)
{
const char *wifi_security, *path;
}
static int
-_on_cmd_network_set_wifi_security(char *cmd, char *args)
-{
- char *wifi_security, *network_path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return 1;
- }
- network_path = args;
- wifi_security = _tok(args);
-
- if (!wifi_security)
- {
- fputs("ERROR: missing the wifi security value\n", stderr);
- return 1;
- }
- _tok(wifi_security);
-
- e = e_connman_network_get(network_path);
- if (e_connman_network_wifi_security_set(e, wifi_security, NULL, NULL))
- printf(":::Network %s wifi security set to \"%s\"\n", network_path, wifi_security);
- else
- fputs("ERROR: can't set network wifi security\n", stderr);
- return 1;
-}
-
-static int
_on_cmd_network_get_wifi_passphrase(char *cmd, char *args)
{
const char *wifi_passphrase, *path;
return 1;
}
-static int
-_on_cmd_network_set_wifi_passphrase(char *cmd, char *args)
-{
- char *wifi_passphrase, *network_path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the network path\n", stderr);
- return 1;
- }
- network_path = args;
- wifi_passphrase = _tok(args);
-
- if (!wifi_passphrase)
- {
- fputs("ERROR: missing the wifi passphrase value\n", stderr);
- return 1;
- }
- _tok(wifi_passphrase);
-
- e = e_connman_network_get(network_path);
- if (e_connman_network_wifi_passphrase_set(e, wifi_passphrase, NULL, NULL))
- printf(":::Network %s wifi passphrase set to \"%s\"\n", network_path, wifi_passphrase);
- else
- fputs("ERROR: can't set network wifi passphrase\n", stderr);
- return 1;
-}
-
/* Services Commands */
-
static int
_on_cmd_service_connect(char *cmd, char *args)
{
}
static int
-_on_cmd_service_set_ipv4_method(char *cmd, char *args)
-{
- char *ipv4_method, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the service path\n", stderr);
- return 1;
- }
- path = args;
- ipv4_method = _tok(args);
-
- if (!ipv4_method)
- {
- fputs("ERROR: missing the ipv4 method value\n", stderr);
- return 1;
- }
- _tok(ipv4_method);
-
- e = e_connman_service_get(path);
- if (e_connman_service_ipv4_method_set(e, ipv4_method, NULL, NULL))
- printf(":::Service %s set to ipv4 method\"%s\"\n", path, ipv4_method);
- else
- fputs("ERROR: can't set service ipv4 method\n", stderr);
- return 1;
-}
-
-static int
_on_cmd_service_get_ipv4_address(char *cmd, char *args)
{
const char *ipv4_address, *path;
return 1;
}
-static int
-_on_cmd_service_set_ipv4_address(char *cmd, char *args)
-{
- char *ipv4_address, *path;
- E_Connman_Element *e;
-
- if (!args)
- {
- fputs("ERROR: missing the service path\n", stderr);
- return 1;
- }
- path = args;
- ipv4_address= _tok(args);
-
- if (!ipv4_address)
- {
- fputs("ERROR: missing the ipv4 address value\n", stderr);
- return 1;
- }
- _tok(ipv4_address);
-
- e = e_connman_service_get(path);
- if (e_connman_service_ipv4_address_set(e, ipv4_address, NULL, NULL))
- printf(":::Service %s ipv4 address set to \"%s\"\n", path, ipv4_address);
- else
- fputs("ERROR: can't set service ipv4 address\n", stderr);
- return 1;
-}
-
static int
_on_input(void *data, Ecore_Fd_Handler *fd_handler)
{"manager_get", _on_cmd_manager_get},
{"manager_get_profiles", _on_cmd_manager_get_profiles},
{"manager_get_devices", _on_cmd_manager_get_devices},
- {"manager_get_connections", _on_cmd_manager_get_connections},
{"manager_get_services", _on_cmd_manager_get_services},
{"manager_register_agent", _on_cmd_manager_register_agent},
{"manager_unregister_agent", _on_cmd_manager_unregister_agent},
{"manager_get_state", _on_cmd_manager_get_state},
- {"manager_get_policy", _on_cmd_manager_get_policy},
- {"manager_set_policy", _on_cmd_manager_set_policy},
{"manager_get_offline_mode", _on_cmd_manager_get_offline_mode},
{"manager_set_offline_mode", _on_cmd_manager_set_offline_mode},
- {"device_create_network", _on_cmd_device_create_network},
- {"device_remove_network", _on_cmd_device_remove_network},
{"device_propose_scan", _on_cmd_device_propose_scan},
{"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_policy", _on_cmd_device_get_policy},
- {"device_set_policy", _on_cmd_device_set_policy},
- {"device_get_priority", _on_cmd_device_get_priority},
- {"device_set_priority", _on_cmd_device_set_priority},
{"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},
{"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},
- {"connection_get_type", _on_cmd_connection_get_type},
- {"connection_get_interface", _on_cmd_connection_get_interface},
- {"connection_get_strength", _on_cmd_connection_get_strength},
- {"connection_get_default", _on_cmd_connection_get_default},
- {"connection_get_device", _on_cmd_connection_get_device},
- {"connection_get_network", _on_cmd_connection_get_network},
- {"connection_get_ipv4_method", _on_cmd_connection_get_ipv4_method},
- {"connection_get_ipv4_address", _on_cmd_connection_get_ipv4_address},
- {"network_connect", _on_cmd_network_connect},
- {"network_disconnect", _on_cmd_network_disconnect},
{"network_get_name", _on_cmd_network_get_name},
- {"network_get_available", _on_cmd_network_get_available},
{"network_get_connected", _on_cmd_network_get_connected},
- {"network_get_remember", _on_cmd_network_get_remember},
- {"network_set_remember", _on_cmd_network_set_remember},
{"network_get_strength", _on_cmd_network_get_strength},
{"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_set_wifi_mode", _on_cmd_network_set_wifi_mode},
{"network_get_wifi_security", _on_cmd_network_get_wifi_security},
- {"network_set_wifi_security", _on_cmd_network_set_wifi_security},
{"network_get_wifi_passphrase", _on_cmd_network_get_wifi_passphrase},
- {"network_set_wifi_passphrase", _on_cmd_network_set_wifi_passphrase},
{"service_connect", _on_cmd_service_connect},
{"service_disconnect", _on_cmd_service_disconnect},
{"service_remove", _on_cmd_service_remove},
{"service_get_mnc", _on_cmd_service_get_mnc},
{"service_get_roaming", _on_cmd_service_get_roaming},
{"service_get_ipv4_method", _on_cmd_service_get_ipv4_method},
- {"service_set_ipv4_method", _on_cmd_service_set_ipv4_method},
{"service_get_ipv4_address", _on_cmd_service_get_ipv4_address},
- {"service_set_ipv4_address", _on_cmd_service_set_ipv4_address},
{NULL, NULL}
};
static const struct test_desc test_desc_manager[] = {
TEST_DESC_STRING_GET_GLOBAL(e_connman_manager_state_get, 0),
- TEST_DESC_STRING_GET_GLOBAL(e_connman_manager_policy_get, 0),
- //TEST_DESC_STRING_SET_GLOBAL(e_connman_manager_policy_set, 0),
TEST_DESC_BOOL_GET_GLOBAL(e_connman_manager_offline_mode_get, 0),
//TEST_DESC_BOOL_SET_GLOBAL(e_connman_manager_offline_mode_set, 0),
TEST_DESC_ELEMENTS_GET_GLOBAL(e_connman_manager_profiles_get, 0),
TEST_DESC_ELEMENTS_GET_GLOBAL(e_connman_manager_devices_get, 0),
- TEST_DESC_ELEMENTS_GET_GLOBAL(e_connman_manager_connections_get, 1),
TEST_DESC_ELEMENTS_GET_GLOBAL(e_connman_manager_services_get, 1),
TEST_DESC_SENTINEL
};
TEST_DESC_STRING_GET(e_connman_device_name_get, 0),
TEST_DESC_STRING_GET(e_connman_device_type_get, 0),
TEST_DESC_STRING_GET(e_connman_device_interface_get, 0),
- TEST_DESC_STRING_GET(e_connman_device_policy_get, 0),
- //TEST_DESC_STRING_SET(e_connman_device_policy_set, 0),
- TEST_DESC_UCHAR_GET(e_connman_device_priority_get, 0),
- //TEST_DESC_UCHAR_SET(e_connman_device_priority_set, 0),
TEST_DESC_BOOL_GET(e_connman_device_powered_get, 0),
//TEST_DESC_BOOL_SET(e_connman_device_powered_set, 0),
TEST_DESC_USHORT_GET(e_connman_device_scan_interval_get, 1),
TEST_DESC_SENTINEL
};
-static const struct test_desc test_desc_connection[] = {
- TEST_DESC_STRING_GET(e_connman_connection_type_get, 0),
- TEST_DESC_STRING_GET(e_connman_connection_interface_get, 0),
- TEST_DESC_UCHAR_GET(e_connman_connection_strength_get, 0),
- TEST_DESC_BOOL_GET(e_connman_connection_default_get, 0),
- TEST_DESC_ELEMENT_GET(e_connman_connection_device_get, 0),
- TEST_DESC_ELEMENT_GET(e_connman_connection_network_get, 0),
- TEST_DESC_STRING_GET(e_connman_connection_ipv4_method_get, 0),
- TEST_DESC_STRING_GET(e_connman_connection_ipv4_address_get, 0),
- TEST_DESC_SENTINEL
-};
-
static const struct test_desc test_desc_network[] = {
TEST_DESC_STRING_GET(e_connman_network_name_get, 0),
- TEST_DESC_BOOL_GET(e_connman_network_available_get, 0),
TEST_DESC_BOOL_GET(e_connman_network_connected_get, 0),
- TEST_DESC_BOOL_GET(e_connman_network_remember_get, 0),
- //TEST_DESC_BOOL_SET(e_connman_network_remember_set, 0),
TEST_DESC_UCHAR_GET(e_connman_network_strength_get, 1),
TEST_DESC_ELEMENT_GET(e_connman_network_device_get, 0),
TEST_DESC_UCHAR_ARRAY_GET(e_connman_network_wifi_ssid_get, 1),
TEST_DESC_STRING_GET(e_connman_network_wifi_mode_get, 1),
- // TEST_DESC_STRING_SET(e_connman_network_wifi_mode_set, 1),
TEST_DESC_STRING_GET(e_connman_network_wifi_security_get, 1),
- // TEST_DESC_STRING_SET(e_connman_network_wifi_security_set, 1),
TEST_DESC_STRING_GET(e_connman_network_wifi_passphrase_get, 1),
- //TEST_DESC_STRING_SET(e_connman_network_wifi_passphrase_set, 1),
TEST_DESC_SENTINEL
};
TEST_DESC_STRING_GET(e_connman_service_mnc_get, 1),
TEST_DESC_BOOL_GET(e_connman_service_roaming_get, 1),
TEST_DESC_STRING_GET(e_connman_service_ipv4_method_get, 1),
- //TEST_DESC_STRING_SET(e_connman_service_ipv4_method_set, 1),
TEST_DESC_STRING_GET(e_connman_service_ipv4_address_get, 1),
- //TEST_DESC_STRING_SET(e_connman_service_ipv4_address_set, 1),
TEST_DESC_SENTINEL
};
_test_element(element, test_desc_device);
else if (e_connman_element_is_profile(element))
_test_element(element, test_desc_profile);
- else if (e_connman_element_is_connection(element))
- _test_element(element, test_desc_connection);
else if (e_connman_element_is_network(element))
_test_element(element, test_desc_network);
else if (e_connman_element_is_manager(element))
struct {
Eina_Inlist *properties_get;
Eina_Inlist *property_set;
- Eina_Inlist *network_create;
- Eina_Inlist *network_remove;
- Eina_Inlist *network_connect;
- Eina_Inlist *network_disconnect;
Eina_Inlist *agent_register;
Eina_Inlist *agent_unregister;
Eina_Inlist *device_propose_scan;
int _references;
};
+ /* General Public API */
EAPI unsigned int e_connman_system_init(E_DBus_Connection *edbus_conn) EINA_ARG_NONNULL(1);
EAPI unsigned int e_connman_system_shutdown(void);
+ /* Low-Level API */
EAPI bool e_connman_manager_sync_elements(void);
EAPI bool e_connman_elements_get_all(unsigned int *count, E_Connman_Element ***p_elements) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
/* Manager Methods */
-
EAPI E_Connman_Element *e_connman_manager_get(void) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_manager_register_agent(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data);
- EAPI bool e_connman_manager_unregister_agent(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data);
+ EAPI bool e_connman_manager_agent_register(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data);
+ EAPI bool e_connman_manager_agent_unregister(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data);
EAPI bool e_connman_manager_state_get(const char **state);
- EAPI bool e_connman_manager_policy_get(const char **policy);
- EAPI bool e_connman_manager_policy_set(const char *policy, E_DBus_Method_Return_Cb cb, const void *data);
-
EAPI bool e_connman_manager_offline_mode_get(bool *offline);
EAPI bool e_connman_manager_offline_mode_set(bool offline, E_DBus_Method_Return_Cb cb, const void *data);
EAPI bool e_connman_manager_profiles_get(unsigned int *count, E_Connman_Element ***p_elements);
EAPI bool e_connman_manager_devices_get(unsigned int *count, E_Connman_Element ***p_elements);
- EAPI bool e_connman_manager_connections_get(unsigned int *count, E_Connman_Element ***p_elements);
EAPI bool e_connman_manager_services_get(unsigned int *count, E_Connman_Element ***p_elements);
- // TODO: profile_add (not implemented in connman right now)
- // TODO: profile_remove (not implemented in connman right now)
- // TODO: profile_active_get (not implemented in connman right now)
- // TODO: profile_active_set (not implemented in connman right now)
-
-
- /* Device Methods */
+ // TODO: profile_create()
+ // TODO: profile_remove()
+ // TODO: profile_active_get()
+ // TODO: profile_active_set()
+ // TODO: request_scan()
+ // TODO: technology_enable()
+ // TODO: technology_disable()
+ // TODO: technology_default_get()
+ // TODO: technologies_available_get()
+ // TODO: technologies_enabled_get()
+ // TODO: technologies_connected_get()
+ // TODO: service_connect() (actually creates and connect)
+ // TODO: signal E_CONNMAN_EVENT_MANAGER_STATE_CHANGED
+
+
+ /* Device Methods: Low-Level API */
EAPI E_Connman_Element *e_connman_device_get(const char *path) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_device_network_create(E_Connman_Element *device, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_device_network_remove(E_Connman_Element *device, const char *network_path, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
-
EAPI bool e_connman_device_propose_scan(E_Connman_Element *device, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_device_name_get(const E_Connman_Element *device, const char **name) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_device_interface_get(const E_Connman_Element *device, const char **interface) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_device_policy_get(const E_Connman_Element *device, const char **policy) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_device_policy_set(E_Connman_Element *device, const char *policy, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
-
- EAPI bool e_connman_device_priority_get(const E_Connman_Element *device, unsigned char *priority) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_device_priority_set(E_Connman_Element *device, unsigned char priority, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
-
EAPI bool e_connman_device_powered_get(const E_Connman_Element *device, bool *powered) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_device_powered_set(E_Connman_Element *device, bool powered, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_device_networks_get(const E_Connman_Element *device, unsigned int *count, E_Connman_Element ***p_elements) EINA_ARG_NONNULL(1, 2, 3) EINA_PURE EINA_WARN_UNUSED_RESULT;
- // TODO: network_join (harder, need to think of good api that do not suck)
// TODO: address_get
/* Profile Methods */
-
EAPI E_Connman_Element *e_connman_profile_get(const char *path) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_profile_name_get(const E_Connman_Element *profile, const char **name) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_profile_services_get(const E_Connman_Element *profile, unsigned int *count, E_Connman_Element ***p_elements) EINA_ARG_NONNULL(1, 2, 3) EINA_PURE EINA_WARN_UNUSED_RESULT;
- /* Connection Methods */
-
- EAPI E_Connman_Element *e_connman_connection_get(const char *path) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
-
- EAPI bool e_connman_connection_type_get(const E_Connman_Element *connection, const char **type) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
-
- EAPI bool e_connman_connection_interface_get(const E_Connman_Element *connection, const char **interface) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
-
- EAPI bool e_connman_connection_strength_get(const E_Connman_Element *connection, unsigned char *strength) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
-
- EAPI bool e_connman_connection_default_get(const E_Connman_Element *connection, bool *connection_default) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
+ // TODO: name_set()
- EAPI bool e_connman_connection_device_get(const E_Connman_Element *connection, E_Connman_Element **element) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_connection_network_get(const E_Connman_Element *connection, E_Connman_Element **element) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_connection_ipv4_method_get(const E_Connman_Element *connection, const char **method) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_connection_ipv4_address_get(const E_Connman_Element *connection, const char **address) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
-
- // TODO: ipv4_gateway_get
- // TODO: ipv4_netmask_get
-
-
- /* Network Methods */
+ /* Network Methods: Low-Level API (Informational-only) */
EAPI E_Connman_Element *e_connman_network_get(const char *path) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_network_connect(E_Connman_Element *network, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_network_disconnect(E_Connman_Element *network, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
-
EAPI bool e_connman_network_name_get(const E_Connman_Element *network, const char **name) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_network_available_get(const E_Connman_Element *network, bool *available) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
-
EAPI bool e_connman_network_connected_get(const E_Connman_Element *network, bool *connected) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_network_remember_get(const E_Connman_Element *network, bool *remember) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_network_remember_set(E_Connman_Element *network, bool remember, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
-
EAPI bool e_connman_network_strength_get(const E_Connman_Element *network, unsigned char *strength) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_network_device_get(const E_Connman_Element *network, E_Connman_Element **element) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_network_wifi_ssid_get(const E_Connman_Element *network, unsigned int *count, unsigned char **wifi_ssid) EINA_ARG_NONNULL(1, 2, 3) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_network_wifi_mode_get(const E_Connman_Element *network, const char **wifi_mode) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_network_wifi_mode_set(E_Connman_Element *network, const char *wifi_mode, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_network_wifi_security_get(const E_Connman_Element *network, const char **wifi_security) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_network_wifi_security_set(E_Connman_Element *network, const char *wifi_security, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_network_wifi_passphrase_get(const E_Connman_Element *network, const char **wifi_passphare) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_network_wifi_passphrase_set(E_Connman_Element *network, const char *wifi_passphrase, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
// TODO: address_get
+ // TODO: wifi_channel_get (missing in their docs)
+ // TODO: wifi_eap_get (missing in their docs, only if ieee8021x)
+ // TODO: frequency_get (missing in their docs)
- /* Services Methods */
+ /* Services Methods */
EAPI E_Connman_Element *e_connman_service_get(const char *path) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_service_connect(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_service_remove(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
- // TODO: clear_property
+ EAPI bool e_connman_service_clear_property(E_Connman_Element *service, const char *property, E_DBus_Method_Return_Cb cb, const void *data);
EAPI bool e_connman_service_move_before(E_Connman_Element *service, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_service_move_after(E_Connman_Element *service, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_service_roaming_get(const E_Connman_Element *service, bool *roaming) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_service_ipv4_method_set(E_Connman_Element *service, const char *method, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_service_ipv4_address_set(E_Connman_Element *service, const char *address, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
+
+ // TODO: immutable_get
+ // TODO: ipv4_netmask_get
+ // TODO: ipv4_gateway_get
+ // TODO: ipv4_configuration_metod_get
+ // TODO: ipv4_configuration_metod_set
+ // TODO: ipv4_configuration_address_get
+ // TODO: ipv4_configuration_address_set
+ // TODO: ipv4_configuration_netmask_get
+ // TODO: ipv4_configuration_netmask_set
+ // TODO: ipv4_configuration_gateway_get
+ // TODO: ipv4_configuration_gateway_set
+ // TODO: ethernet_method_get
+ // TODO: ethernet_address_get
+ // TODO: ethernet_mtu_get
+ // TODO: ethernet_speed_get
+ // TODO: ethernet_duplex_get
#ifdef __cplusplus
}
E_Connman.h \
e_connman_private.h \
e_connman.c \
-e_connman_connection.c \
e_connman_device.c \
e_connman_element.c \
e_connman_manager.c \
+++ /dev/null
-#include "e_connman_private.h"
-
-E_Connman_Element *
-e_connman_connection_get(const char *path)
-{
- E_Connman_Element *connection;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
-
- connection = e_connman_element_get(path);
- if (!connection)
- return NULL;
-
- if (!e_connman_element_is_connection(connection))
- {
- WRN("path '%s' is not a connection!", path);
- return NULL;
- }
-
- return connection;
-}
-
-/**
- * Get property "Type" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * The connection type (for example "wifi", etc.)
- *
- * @param connection_path to get property.
- * @param type where to store the property value, must be a pointer
- * to string (const char **), it will not be allocated or
- * copied and references will be valid until element changes,
- * so copy it if you want to use it later.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_connection_type_get(const E_Connman_Element *connection, const char **type)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(type, 0);
- return e_connman_element_property_get_stringshared
- (connection, e_connman_prop_type, NULL, type);
-}
-
-/**
- * Get property "Interface" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * The connection interface (for example "eth0" etc.)
- *
- * This value is for pure informational purposes. It
- * is not guaranteed that it is always present.
- *
- * @param connection_path to get property.
- * @param interface where to store the property value, must be a pointer
- * to string (const char **), it will not be allocated or
- * copied and references will be valid until element changes,
- * so copy it if you want to use it later.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_connection_interface_get(const E_Connman_Element *connection, const char **interface)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(interface, 0);
- return e_connman_element_property_get_stringshared
- (connection, e_connman_prop_interface, NULL, interface);
-}
-
-/**
- * Get property "Strength" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * Indicates the signal strength of the connection.
- *
- * This property is optional and not always present.
- *
- * @param connection_path to get property.
- * @param strength where to store the property value, must be a pointer
- * to byte (unsigned char*).
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_connection_strength_get(const E_Connman_Element *connection, unsigned char *strength)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(strength, 0);
- return e_connman_element_property_get_stringshared
- (connection, e_connman_prop_strengh, NULL, strength);
-}
-
-/**
- * Get property "Default" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * Indicates if it is a default connection. It is
- * possible to have multiple default connections.
- *
- * @param connection_path to get property.
- * @param connection_default where to store the property value, must be a
- * pointer to boolean (bool *).
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_connection_default_get(const E_Connman_Element *connection, bool *connection_default)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection_default, 0);
- return e_connman_element_property_get_stringshared
- (connection, e_connman_prop_default, NULL, connection_default);
-}
-
-/**
- * Get the device element this connection has
- * been established with.
- *
- * @param connection_path to get property.
- * @param element where to store element, just changed if return is 1
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_connection_device_get(const E_Connman_Element *connection, E_Connman_Element **element)
-{
- const char *device_path;
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(element, 0);
- if (!e_connman_element_property_get_stringshared
- (connection, e_connman_prop_device, NULL, &device_path))
- return 0;
- *element = e_connman_element_get(device_path);
- return 1;
-}
-
-/**
- * Get the network element this connection
- * belongs to.
- *
- * @param connection_path to get property.
- * @param element where to store element, just changed if return is 1
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_connection_network_get(const E_Connman_Element *connection, E_Connman_Element **element)
-{
- const char *network_path;
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(element, 0);
- if (!e_connman_element_property_get_stringshared
- (connection, e_connman_prop_network, NULL, &network_path))
- return 0;
- *element = e_connman_element_get(network_path);
- return 1;
-}
-
-/**
- * Get property "IPv4.Method" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * Indicates the way how the IPv4 settings were
- * configured. Possible values here are "dhcp"
- * and "static".
- *
- * @param connection_path to get property.
- * @param method where to store the property value, must be a pointer
- * to string (const char **), it will not be allocated or
- * copied and references will be valid until element changes,
- * so copy it if you want to use it later.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_connection_ipv4_method_get(const E_Connman_Element *connection, const char **method)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(method, 0);
- return e_connman_element_property_get_stringshared
- (connection, e_connman_prop_ipv4_method, NULL, method);
-}
-
-/**
- * Get property "IPv4.Address" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * Shows the current configured IPv4 address.
- *
- * @param connection_path to get property.
- * @param address where to store the property value, must be a pointer
- * to string (const char **), it will not be allocated or
- * copied and references will be valid until element changes,
- * so copy it if you want to use it later.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_connection_ipv4_address_get(const E_Connman_Element *connection, const char **address)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(connection, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(address, 0);
- return e_connman_element_property_get_stringshared
- (connection, e_connman_prop_ipv4_address, NULL, address);
-}
return device;
}
-static void
-_e_connman_device_network_create_callback(void *user_data __UNUSED__, DBusMessage *msg __UNUSED__, DBusError *err __UNUSED__)
-{
- WRN("FIXME need to receive the network object path");
-}
-
-/**
- * Creates a network object from the specified properties. Valid
- * properties are WiFi.SSID, WiFi.Security and WiFi.Passphrase.
- *
- * Call method CreateNetwork(dict_network) at the given device
- * on server.
- *
- * @param device_path to call method on server.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_device_network_create(E_Connman_Element *device, E_DBus_Method_Return_Cb cb, const void *data)
-{
- const char name[] = "CreateNetwork";
- DBusMessageIter itr, v;
- DBusMessage *msg;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(device, 0);
-
- msg = dbus_message_new_method_call
- (e_connman_system_bus_name_get(), device->path, device->interface,
- name);
-
- if (!msg)
- return 0;
-
- dbus_message_iter_init_append(msg, &itr);
- dbus_message_iter_open_container(&itr, DBUS_TYPE_ARRAY,
- DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
- DBUS_TYPE_STRING_AS_STRING
- DBUS_TYPE_VARIANT_AS_STRING
- DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &v);
-
- /* FIXME need to create the message */
-
- dbus_message_iter_close_container(&itr, &v);
- return e_connman_element_message_send
- (device, name, _e_connman_device_network_create_callback,
- msg, &device->_pending.network_create, cb, data);
-}
-
-/**
- * Removes a previoulsy created network object.
- *
- * Call method RemoveNetwork(network) at the given device on server in order to remove
- * it.
- *
- * @param device_path to call method on server.
- * @param network_path network path to be removed.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_device_network_remove(E_Connman_Element *device, const char *network_path, E_DBus_Method_Return_Cb cb, const void *data)
-{
- const char name[] = "RemoveNetwork";
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(device, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(network_path, 0);
- return e_connman_element_call_with_path
- (device, name, network_path, NULL,
- &device->_pending.network_remove, cb, data);
-}
-
/**
* Propose device to scan.
*
}
/**
- * Get property "Policy" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * Setting of the device power and connection policy.
- * Possible values are "ignore", "off", "auto"
- * and "manual".
- *
- * The policy defines on how the device is initialized
- * when brought up and how it connects. The actual
- * device power state can be changed independently to
- * this value.
- *
- * If a device is switched off and the policy is changed
- * to "auto" or "manual", the device will be switched
- * on. For a current active device changing the policy
- * to "off" results in powering down the device.
- *
- * The "ignore" policy can be set for devices that are
- * detected, but managed by a different entity on the
- * system. For example for complex network setups.
- *
- * Devices that can connect to various networks, the
- * difference between "auto" or "manual" defines if
- * known networks are connected automatically or not.
- * For simple devices like Ethernet cards, setting
- * the "manual" policy might fail.
- *
- * @param device_path to get property.
- * @param policy where to store the property value, must be a pointer
- * to string (const char **), it will not be allocated or
- * copied and references will be valid until element changes,
- * so copy it if you want to use it later.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_device_policy_set()
- */
-bool
-e_connman_device_policy_get(const E_Connman_Element *device, const char **policy)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(device, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(policy, 0);
- return e_connman_element_property_get_stringshared
- (device, e_connman_prop_policy, NULL, policy);
-}
-
-/**
- * Call method SetProperty("Policy", policy) at the given element on server.
- *
- * This is a server call, not local, so it may fail and in that case
- * no property is updated locally. If the value was set the event
- * E_CONNMAN_EVENT_ELEMENT_UPDATED will be added to main loop.
- *
- * Setting of the device power and connection policy.
- * Possible values are "ignore", "off", "auto"
- * and "manual".
- *
- * The policy defines on how the device is initialized
- * when brought up and how it connects. The actual
- * device power state can be changed independently to
- * this value.
- *
- * If a device is switched off and the policy is changed
- * to "auto" or "manual", the device will be switched
- * on. For a current active device changing the policy
- * to "off" results in powering down the device.
- *
- * The "ignore" policy can be set for devices that are
- * detected, but managed by a different entity on the
- * system. For example for complex network setups.
- *
- * Devices that can connect to various networks, the
- * difference between "auto" or "manual" defines if
- * known networks are connected automatically or not.
- * For simple devices like Ethernet cards, setting
- * the "manual" policy might fail.
- *
- * @param device_path to set property.
- * @param policy value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_device_policy_get()
- */
-bool
-e_connman_device_policy_set(E_Connman_Element *device, const char *policy, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(device, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(policy, 0);
- return e_connman_element_property_set_full
- (device, e_connman_prop_policy, DBUS_TYPE_STRING, policy, cb, data);
-}
-
-/**
- * Get property "Priority" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * The device priority. Higher values indicate the
- * preference for this device.
- *
- * @param device_path to get property.
- * @param priority where to store the property value, must be a pointer
- * to byte (unsigned char *).
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_device_priority_set()
- */
-bool
-e_connman_device_priority_get(const E_Connman_Element *device, unsigned char *priority)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(device, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(priority, 0);
- return e_connman_element_property_get_stringshared
- (device, e_connman_prop_priority, NULL, priority);
-}
-
-/**
- * Call method SetProperty("Priority", priority) at the given element on server.
- *
- * This is a server call, not local, so it may fail and in that case
- * no property is updated locally. If the value was set the event
- * E_CONNMAN_EVENT_ELEMENT_UPDATED will be added to main loop.
- *
- * The device priority. Higher values indicate the
- * preference for this device.
- *
- * @param device_path to set property.
- * @param priority value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_device_priority_get()
- */
-bool
-e_connman_device_priority_set(E_Connman_Element *device, unsigned char priority, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(device, 0);
- return e_connman_element_property_set_full
- (device, e_connman_prop_priority, DBUS_TYPE_BYTE, &priority, cb, data);
-}
-
-/**
* Get property "Powered" value.
*
* If this property isn't found then 0 is returned.
e_connman_element_pending_cancel_and_free(&element->_pending.properties_get);
e_connman_element_pending_cancel_and_free(&element->_pending.property_set);
- e_connman_element_pending_cancel_and_free(&element->_pending.network_create);
- e_connman_element_pending_cancel_and_free(&element->_pending.network_remove);
- e_connman_element_pending_cancel_and_free(&element->_pending.network_connect);
- e_connman_element_pending_cancel_and_free(&element->_pending.network_disconnect);
e_connman_element_pending_cancel_and_free(&element->_pending.agent_register);
e_connman_element_pending_cancel_and_free(&element->_pending.agent_unregister);
e_connman_element_pending_cancel_and_free(&element->_pending.device_propose_scan);
* @return 1 on success, 0 otherwise.
*/
bool
-e_connman_manager_register_agent(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
+e_connman_manager_agent_register(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
{
const char name[] = "RegisterAgent";
E_Connman_Element *element;
* @return 1 on success, 0 otherwise.
*/
bool
-e_connman_manager_unregister_agent(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
+e_connman_manager_agent_unregister(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
{
const char name[] = "UnregisterAgent";
E_Connman_Element *element;
}
/**
- * Get property "Policy" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * The global connection policy of a system. This
- * allows to configure how connections are established
- * and also when they are taken down again.
- *
- * Possible values are "single", "multiple" and "ask".
- *
- * For the single policy, the priority setting of the
- * device defines which becomes the default connection
- * when multiple are available.
- *
- * @param policy where to store the property value, must be a pointer
- * to string (const char **), it will not be allocated or
- * copied and references will be valid until element changes,
- * so copy it if you want to use it later.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_manager_policy_set()
- */
-bool
-e_connman_manager_policy_get(const char **policy)
-{
- E_Connman_Element *element;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(policy, 0);
-
- element = e_connman_manager_get();
- if (!element)
- return 0;
- return e_connman_element_property_get_stringshared
- (element, e_connman_prop_policy, NULL, policy);
-}
-
-/**
- * Call method SetProperty("Policy", policy) at the given element on server.
- *
- * This is a server call, not local, so it may fail and in that case
- * no property is updated locally. If the value was set the event
- * E_CONNMAN_EVENT_ELEMENT_UPDATED will be added to main loop.
- *
- * The global connection policy of a system. This
- * allows to configure how connections are established
- * and also when they are taken down again.
- *
- * Possible values are "single", "multiple" and "ask".
- *
- * For the single policy, the priority setting of the
- * device defines which becomes the default connection
- * when multiple are available.
- *
- * @param policy value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_manager_policy_get()
- */
-bool
-e_connman_manager_policy_set(const char *policy, E_DBus_Method_Return_Cb cb, const void *data)
-{
- E_Connman_Element *element;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(policy, 0);
-
- element = e_connman_manager_get();
- if (!element)
- return 0;
-
- return e_connman_element_property_set_full
- (element, e_connman_prop_policy, DBUS_TYPE_STRING, policy, cb, data);
-}
-
-/**
* Get property "OfflineMode" value.
*
* If this property isn't found then 0 is returned.
}
/**
- * Connect to network.
- *
- * Call method Connect() at the given network on server in order to
- * connect to it.
- *
- * @param network_path to call method on server.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_network_connect(E_Connman_Element *network, E_DBus_Method_Return_Cb cb, const void *data)
-{
- const char name[] = "Connect";
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
- return e_connman_element_call_full
- (network, name, NULL, &network->_pending.network_connect, cb, data);
-}
-
-/**
- * Disconnect from network.
- *
- * Call method Disconnect() at the given network on server in order to
- * disconnect from it.
- *
- * @param network_path to call method on server.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_network_disconnect(E_Connman_Element *network, E_DBus_Method_Return_Cb cb, const void *data)
-{
- const char name[] = "Disconnect";
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
- return e_connman_element_call_full
- (network, name, NULL, &network->_pending.network_disconnect, cb, data);
-}
-
-/**
* Get property "Name" value.
*
* If this property isn't found then 0 is returned.
}
/**
- * Get property "Available" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * Indicates that this network is in range and
- * ready to be used.
- *
- * The scanning process can change this property.
- *
- * @param network_path to get property.
- * @param available where to store the property value, must be a pointer
- * to boolean (bool **).
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_connman_network_available_get(const E_Connman_Element *network, bool *available)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(available, 0);
- return e_connman_element_property_get_stringshared
- (network, e_connman_prop_available, NULL, available);
-}
-
-/**
* Get property "Connected" value.
*
* If this property isn't found then 0 is returned.
}
/**
- * Get property "Remember" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * Indicates that this network will be remembered.
- *
- * For manually created networks this is set by
- * default.
- *
- * @param network_path to get property.
- * @param remember where to store the property value, must be a pointer
- * to boolean (bool **).
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_network_remember_set()
- */
-bool
-e_connman_network_remember_get(const E_Connman_Element *network, bool *remember)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(remember, 0);
- return e_connman_element_property_get_stringshared
- (network, e_connman_prop_remember, NULL, remember);
-}
-
-/**
- * Call method SetProperty("Remember", remember) at the given element on server.
- *
- * This is a server call, not local, so it may fail and in that case
- * no property is updated locally. If the value was set the event
- * E_CONNMAN_EVENT_ELEMENT_UPDATED will be added to main loop.
- *
- * Indicates that this network will be remembered.
- *
- * For manually created networks this is set by
- * default.
- *
- * @param network_path to set property.
- * @param remember value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_network_remember_get()
- */
-bool
-e_connman_network_remember_set(E_Connman_Element *network, bool remember, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
- return e_connman_element_property_set_full
- (network, e_connman_prop_remember, DBUS_TYPE_BOOLEAN, &remember, cb, data);
-}
-
-/**
* Get property "Strength" value.
*
* If this property isn't found then 0 is returned.
* so copy it if you want to use it later.
*
* @return 1 on success, 0 otherwise.
- * @see e_connman_network_wifi_mode_set()
*/
bool
e_connman_network_wifi_mode_get(const E_Connman_Element *network, const char **wifi_mode)
}
/**
- * Call method SetProperty("WiFi.Mode", wifi_mode) at the given element on server.
- *
- * This is a server call, not local, so it may fail and in that case
- * no property is updated locally. If the value was set the event
- * E_CONNMAN_EVENT_ELEMENT_UPDATED will be added to main loop.
- *
- * If the network type is WiFi, then this property is
- * present and contains the mode of the network. The
- * possible values are "managed" or "adhoc".
- *
- * For scanned networks this value is read only, but in
- * case the network was manually created it is also
- * changeable.
- *
- * @param network_path to set property.
- * @param wifi_mode value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_network_wifi_mode_get()
- */
-bool
-e_connman_network_wifi_mode_set(E_Connman_Element *network, const char *wifi_mode, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(wifi_mode, 0);
- return e_connman_element_property_set_full
- (network, e_connman_prop_wifi_mode, DBUS_TYPE_STRING, wifi_mode, cb, data);
-}
-
-/**
* Get property "WiFi.Security" value.
*
* If this property isn't found then 0 is returned.
* so copy it if you want to use it later.
*
* @return 1 on success, 0 otherwise.
- * @see e_connman_network_wifi_security_set()
*/
bool
e_connman_network_wifi_security_get(const E_Connman_Element *network, const char **wifi_security)
}
/**
- * Call method SetProperty("WiFi.Security", wifi_security) at the given element on server.
- *
- * This is a server call, not local, so it may fail and in that case
- * no property is updated locally. If the value was set the event
- * E_CONNMAN_EVENT_ELEMENT_UPDATED will be added to main loop.
- *
- * If the network type is WiFi, then this property is
- * present and contains the security method or key
- * management setting.
- *
- * For scanned networks this value is read only, but in
- * case the network was manually created it is also
- * changeable.
- *
- * Possible values are "none", "wep", "wpa" and "wpa2".
- *
- * @param network_path to set property.
- * @param wifi_security value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_network_wifi_security_get()
- */
-bool
-e_connman_network_wifi_security_set(E_Connman_Element *network, const char *wifi_security, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(wifi_security, 0);
- return e_connman_element_property_set_full
- (network, e_connman_prop_wifi_security, DBUS_TYPE_STRING,
- wifi_security, cb, data);
-}
-
-/**
* Get property "WiFi.Passphrase" value.
*
* If this property isn't found then 0 is returned.
* so copy it if you want to use it later.
*
* @return 1 on success, 0 otherwise.
- * @see e_connman_network_wifi_passphrase_set()
*/
bool
e_connman_network_wifi_passphrase_get(const E_Connman_Element *network, const char **wifi_passphrase)
return e_connman_element_property_get_stringshared
(network, e_connman_prop_wifi_passphrase, NULL, wifi_passphrase);
}
-
-/**
- * Call method SetProperty("WiFi.Passphrase", wifi_passphrase) at the given element on server.
- *
- * This is a server call, not local, so it may fail and in that case
- * no property is updated locally. If the value was set the event
- * E_CONNMAN_EVENT_ELEMENT_UPDATED will be added to main loop.
- *
- * If the network type is WiFi and a passhrase is
- * requires, then this property is present and contains
- * the passphrase in clear text.
- *
- * For systems using PolicyKit, the access to this value
- * will be protected by the security policy.
- *
- * @param network_path to set property.
- * @param wifi_passphrase value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_network_wifi_passphrase_get()
- */
-bool
-e_connman_network_wifi_passphrase_set(E_Connman_Element *network, const char *wifi_passphrase, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
- return e_connman_element_property_set_full
- (network, e_connman_prop_wifi_passphrase, DBUS_TYPE_STRING,
- wifi_passphrase, cb, data);
-}
* so copy it if you want to use it later.
*
* @return 1 on success, 0 otherwise.
- * @see e_connman_service_ipv4_method_set()
*/
bool
e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method)
}
/**
- * Set property "IPv4.Method" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * The IPv4 configuration method. Possible values here
- * are "dhcp" and "static".
- *
- * @param service_path to get property.
- * @param method value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_service_ipv4_method_get()
- */
-bool
-e_connman_service_ipv4_method_set(E_Connman_Element *service, const char *method, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
- return e_connman_element_property_set_full
- (service, e_connman_prop_ipv4_method, DBUS_TYPE_STRING,
- method, cb, data);
-}
-
-/**
* Get property "IPv4.Address" value.
*
* If this property isn't found then 0 is returned.
* so copy it if you want to use it later.
*
* @return 1 on success, 0 otherwise.
- * @see e_connman_service_ipv4_address_set()
*/
bool
e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address)
return e_connman_element_property_get_stringshared
(service, e_connman_prop_ipv4_address, NULL, address);
}
-
-/**
- * Set property "IPv4.Address" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * The current configured IPv4 address.
- *
- * @param service_path to get property.
- * @param address value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- * @see e_connman_service_ipv4_address_get()
- */
-bool
-e_connman_service_ipv4_address_set(E_Connman_Element *service, const char *address, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
- return e_connman_element_property_set_full
- (service, e_connman_prop_ipv4_address, DBUS_TYPE_STRING,
- address, cb, data);
-}