static void __handle_wifi_tether_on(void* user_data)
{
- DBG("+\n");
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
data = th->enabled_user_data[type];
g_print("=====wifi_tether_on callback is called=====\n");
+
ecb(TETHERING_ERROR_NONE, type, is_requested, data);
}
static void __handle_wifi_tether_off(void* user_data)
{
- DBG("+\n");
-
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
code = TETHERING_DISABLED_BY_TIMEOUT;
*/
g_print("=====wifi_tether_off callback is called=====\n");
+
dcb(TETHERING_ERROR_NONE, type, code, data);
return;
static void __handle_usb_tether_on(void* user_data)
{
- DBG("+\n");
-
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
data = th->enabled_user_data[type];
g_print("=====usb_tether_on callback is called=====\n");
+
ecb(TETHERING_ERROR_NONE, type, is_requested, data);
}
static void __handle_usb_tether_off(void* user_data)
{
- DBG("+\n");
-
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
code = TETHERING_DISABLED_BY_USB_DISCONNECTION;
*/
g_print("=====usb_tether_off callback is called=====\n");
+
dcb(TETHERING_ERROR_NONE, type, code, data);
return;
static void __handle_bt_tether_on(void* user_data)
{
- DBG("+\n");
-
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
data = th->enabled_user_data[type];
g_print("=====bt_tether_on callback is called=====\n");
+
ecb(TETHERING_ERROR_NONE, type, is_requested, data);
}
static void __handle_bt_tether_off(void* user_data)
{
- DBG("+\n");
-
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
code = TETHERING_DISABLED_BY_TIMEOUT;
*/
g_print("=====bt_tether_off callback is called=====\n");
+
dcb(TETHERING_ERROR_NONE, type, code, data);
return;
*/
static void __handle_ssid_visibility_changed(struct connman_technology* technology, void* user_data)
{
- DBG("+\n");
-
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
visible = !connman_get_wifi_tethering_hidden(technology);
g_print("=====wifi_ssid_visibility_changed callback is called=====\n");
-
+
scb(visible, data);
return;
static void __handle_passphrase_changed(struct connman_technology* technology, void *user_data)
{
- DBG("+\n");
-
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
*tethering = (tethering_h)th;
DBG("Tethering Handle : 0x%X\n", th);
- connman_lib_init();
+ if (connman_lib_init() != CONNMAN_LIB_ERR_NONE)
+ return TETHERING_ERROR_OPERATION_FAILED;
connman_set_technology_added_cb(__handle_technology_added, th);
*/
API int tethering_enable(tethering_h tethering, tethering_type_e type)
{
- DBG("+\n");
-
_retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(tethering) is NULL\n");
org_tizen_tethering_enable_usb_tethering_async(proxy,
__cfm_cb, (gpointer)tethering); */
technology = connman_get_technology(TECH_TYPE_GADGET);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_enable_tethering(technology);
break;
th->ssid ? th->ssid : "", "", false,
__cfm_cb, (gpointer)tethering);*/
technology = connman_get_technology(TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_enable_tethering(technology);
break;
__cfm_cb, (gpointer)tethering);
*/
technology = connman_get_technology(TECH_TYPE_BLUETOOTH);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_enable_tethering(technology);
break;
__cfm_cb, (gpointer)tethering);*/
technology = connman_get_technology(TECH_TYPE_GADGET);
- connman_enable_tethering(technology);
+ if (technology != NULL)
+ connman_enable_tethering(technology);
technology = connman_get_technology(TECH_TYPE_WIFI);
- connman_enable_tethering(technology);
+ if (technology != NULL)
+ connman_enable_tethering(technology);
technology = connman_get_technology(TECH_TYPE_BLUETOOTH);
- connman_enable_tethering(technology);
+ if (technology != NULL)
+ connman_enable_tethering(technology);
break;
default:
org_tizen_tethering_disable_usb_tethering_async(proxy,
__cfm_cb, (gpointer)tethering);*/
technology = connman_get_technology(TECH_TYPE_GADGET);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_disable_tethering(technology);
break;
org_tizen_tethering_disable_wifi_tethering_async(proxy,
__cfm_cb, (gpointer)tethering);*/
technology = connman_get_technology(TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_disable_tethering(technology);
break;
case TETHERING_TYPE_BT:
org_tizen_tethering_disable_bt_tethering_async(proxy,
__cfm_cb, (gpointer)tethering);*/
technology = connman_get_technology(TECH_TYPE_BLUETOOTH);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_disable_tethering(technology);
break;
org_tizen_tethering_disable_bt_tethering_async(proxy,
__cfm_cb, (gpointer)tethering);*/
technology = connman_get_technology(TECH_TYPE_GADGET);
- connman_disable_tethering(technology);
+ if (technology != NULL)
+ connman_disable_tethering(technology);
technology = connman_get_technology(TECH_TYPE_WIFI);
- connman_disable_tethering(technology);
+ if (technology != NULL)
+ connman_disable_tethering(technology);
technology = connman_get_technology(TECH_TYPE_BLUETOOTH);
- connman_disable_tethering(technology);
+ if (technology != NULL)
+ connman_disable_tethering(technology);
break;
default :
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_technology_set_property_changed_cb(technology,
TECH_PROP_TETHERING_HIDDEN,
__handle_ssid_visibility_changed,
th->ssid_visibility_changed_cb = NULL;
th->ssid_visibility_user_data = NULL;
-
+
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_technology_unset_property_changed_cb(
technology,
TECH_PROP_TETHERING_HIDDEN);
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_technology_set_property_changed_cb(technology,
TECH_PROP_TETHERING_PASSPHRASE,
__handle_passphrase_changed,
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_technology_unset_property_changed_cb(
technology,
TECH_PROP_TETHERING_PASSPHRASE);
{
_retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(tethering) is NULL\n");
- DBG("+\n");
/* __tethering_h *th = (__tethering_h *)tethering;
DBusGProxy *proxy = th->client_bus_proxy;
org_tizen_tethering_set_wifi_tethering_security_type_async(proxy, type_str,
__wifi_set_security_type_cb, (gpointer)tethering);
*/
- DBG("-\n");
return TETHERING_ERROR_NONE;
}
"parameter(tethering) is NULL\n");
_retvm_if(type == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(type) is NULL\n");
- DBG("+\n");
/* __tethering_h *th = (__tethering_h *)tethering;
DBusGProxy *proxy = th->client_bus_proxy;
g_free(type_str);
*/
- DBG("-\n");
return TETHERING_ERROR_NONE;
}
*/
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_set_wifi_tethering_identifier(technology, ssid);
+
return TETHERING_ERROR_NONE;
}
"parameter(tethering) is NULL\n");
_retvm_if(ssid == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(ssid) is NULL\n");
- DBG("+\n");
/* __tethering_h *th = (__tethering_h *)tethering;
DBusGProxy *proxy = th->client_bus_proxy;
*/
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
- *ssid = strdup(connman_get_wifi_tethering_identifier(technology));
- DBG("-\n");
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
+ const char* identifier = connman_get_wifi_tethering_identifier(technology);
+ if (identifier == NULL)
+ *ssid = NULL;
+ else
+ *ssid = strdup(identifier);
+
return TETHERING_ERROR_NONE;
}
{
_retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(tethering) is NULL\n");
- DBG("+\n");
/* __tethering_h *th = (__tethering_h *)tethering;
DBusGProxy *proxy = th->client_bus_proxy;
*/
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_set_wifi_tethering_hidden(technology, !visible);
- DBG("-\n");
return TETHERING_ERROR_NONE;
}
"parameter(tethering) is NULL\n");
_retvm_if(visible == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(visible) is NULL\n");
- DBG("+\n");
/* __tethering_h *th = (__tethering_h *)tethering;
DBusGProxy *proxy = th->client_bus_proxy;
*/
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
- *visible = !connman_get_wifi_tethering_hidden(technology);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
+ *visible = !connman_get_wifi_tethering_hidden(technology);
- DBG("-\n");
return TETHERING_ERROR_NONE;
}
"parameter(tethering) is NULL\n");
_retvm_if(passphrase == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(passphrase) is NULL\n");
- DBG("+\n");
/* __tethering_h *th = (__tethering_h *)tethering;
DBusGProxy *proxy = th->client_bus_proxy;
*/
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
connman_set_wifi_tethering_passphrase(technology, passphrase);
- DBG("-\n");
+
return TETHERING_ERROR_NONE;
}
"parameter(tethering) is NULL\n");
_retvm_if(passphrase == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(passphrase) is NULL\n");
- DBG("+\n");
/* __tethering_h *th = (__tethering_h *)tethering;
DBusGProxy *proxy = th->client_bus_proxy;
*/
struct connman_technology *technology = connman_get_technology(
TECH_TYPE_WIFI);
- *passphrase = strdup(connman_get_wifi_tethering_passphrase(technology));
- DBG("-\n");
+ if (technology == NULL)
+ return TETHERING_ERROR_INVALID_OPERATION;
+
+ const char* password = connman_get_wifi_tethering_passphrase(technology);
+ if (password == NULL)
+ *passphrase = NULL;
+ else
+ *passphrase = strdup(password);
+
return TETHERING_ERROR_NONE;
}