void _flush_dhcp_ack_timer(void);
void _destroy_dhcp_ack_timer(char *mac_addr);
+int _set_hostapd_tx_power(unsigned int txpower);
+unsigned int _get_hostapd_tx_power(void);
#endif
<arg type="s" name="rangestop" direction="in"/>
<arg type="u" name="result" direction="out"/>
</method>
+ <method name="hostapd_set_txpower">
+ <arg type="u" name="txpower" direction="in"/>
+ <arg type="u" name="result" direction="out"/>
+ </method>
+ <method name="hostapd_get_txpower">
+ <arg type="u" name="result" direction="out"/>
+ </method>
<!-- Signal (D-Bus) definitions -->
<signal name="net_closed">
</signal>
return TRUE;
}
+gboolean tethering_set_hostapd_tx_power(Tethering *obj,
+ GDBusMethodInvocation *context, gint txpower)
+{
+ DBG("+\n");
+
+ GVariant *var = NULL;
+ int result = 0;
+
+ g_assert(obj != NULL);
+ g_assert(context != NULL);
+ result = _set_hostapd_tx_power(txpower);
+ var = g_variant_new("(u)", result);
+
+ g_dbus_method_invocation_return_value(context, var);
+ g_variant_unref(var);
+
+ DBG("-\n");
+ return TRUE;
+}
+
+gboolean tethering_get_hostapd_tx_power(Tethering *obj,
+ GDBusMethodInvocation *context)
+{
+ DBG("+\n");
+
+ GVariant *var = NULL;
+ unsigned int txpower = 0;
+
+ g_assert(obj != NULL);
+ g_assert(context != NULL);
+ txpower = _get_hostapd_tx_power();
+ var = g_variant_new("(u)", txpower);
+ g_dbus_method_invocation_return_value(context, var);
+ g_variant_unref(var);
+
+ DBG("-\n");
+ return TRUE;
+}
+
static void __handle_dnsmasq_dhcp_status_changed_cb(GDBusConnection *connection,
const gchar *sender_name, const gchar *object_path,
const gchar *interface_name, const gchar *signal_name,
G_CALLBACK(softap_reload_settings), NULL);
g_signal_connect(softap_obj, "handle-get-station-info",
G_CALLBACK(softap_get_station_info), NULL);
+ g_signal_connect(tethering_obj, "handle-hostapd-get-txpower",
+ G_CALLBACK(tethering_get_hostapd_tx_power), NULL);
+ g_signal_connect(tethering_obj, "handle-hostapd-set-txpower",
+ G_CALLBACK(tethering_set_hostapd_tx_power), NULL);
_init_network((void *)tethering_obj);
_register_vconf_cb((void *)tethering_obj);
DBG("-\n");
return;
}
+int _set_hostapd_tx_power(unsigned int txpower)
+{
+ int ret = 0;
+ char req[HOSTAPD_REQ_MAX_LEN] = {0, };
+ int buf_len = 0;
+ char buf[MOBILE_AP_STR_INFO_LEN] = {0, };
+ buf_len = sizeof(buf);
+ snprintf(req, sizeof(req), "%s%u","SET txpower ",txpower);
+ ret = __send_hostapd_req(hostapd_ctrl_fd, req, strlen(req), buf, &buf_len);
+ if (ret != MOBILE_AP_ERROR_NONE) {
+ ERR("__send_to_hostapd is failed : %d\n", ret);
+ return ret;
+ }
+ return MOBILE_AP_ERROR_NONE;
+}
+
+unsigned int _get_hostapd_tx_power(void)
+{
+ int ret = 0;
+ int buf_len = 0;
+ char req[HOSTAPD_REQ_MAX_LEN] = {0, };
+ char buf[MOBILE_AP_STR_INFO_LEN] = {0, };
+ buf_len = sizeof(buf);
+ snprintf(req, sizeof(req), "%s","GET txpower");
+ ret = __send_hostapd_req(hostapd_ctrl_fd,
+ req, strlen(req), buf, &buf_len);
+ if (ret != MOBILE_AP_ERROR_NONE) {
+ ERR("__send_hostapd_req is failed : %d\n", ret);
+ return ret;
+ }
+ if (!strncmp(buf, "FAIL", 4)) {
+ ERR("FAIL is returned\n");
+ }
+ if (buf[0] == '\0') {
+ ERR("NULL string\n");
+ }
+ return (atoi (buf));
+}
+