char *phone_number = NULL;
int error_code = BT_ERROR_NONE;
int event_index = -1;
- bluetooth_network_device_info_t *dev_info = NULL;
bt_gatt_char_value_t *char_val = NULL;
media_metadata_attributes_t *metadata = NULL;
bluetooth_authentication_request_info_t *auth_information = NULL;
case BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED:
BT_INFO("BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED");
- dev_info = (bluetooth_network_device_info_t *)(param->param_data);
-
- if (param->result != BLUETOOTH_ERROR_NONE)
- BT_ERR("Fail to connect the network server");
-
- _bt_convert_address_to_string(&device_addr, &dev_info->device_address);
- ((bt_nap_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
- (TRUE, device_addr, dev_info->interface_name, bt_event_slot_container[event_index].user_data);
-
- if (device_addr != NULL)
- free(device_addr);
break;
case BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED:
BT_INFO("BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED");
- dev_info = (bluetooth_network_device_info_t *)(param->param_data);
-
- if (param->result != BLUETOOTH_ERROR_NONE)
- BT_ERR("Fail to disconnect the network server");
-
- _bt_convert_address_to_string(&device_addr, &dev_info->device_address);
- ((bt_nap_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
- (FALSE, device_addr, dev_info->interface_name, bt_event_slot_container[event_index].user_data);
-
- if (device_addr != NULL)
- free(device_addr);
break;
case BLUETOOTH_EVENT_NETWORK_DISCONNECTED:
BT_INFO("BLUETOOTH_EVENT_NETWORK_DISCONNECTED");
- bd_addr = (bluetooth_device_address_t *)(param->param_data);
- _bt_convert_address_to_string(&device_addr, bd_addr);
-
- ((bt_panu_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
- (_bt_get_error_code(param->result), FALSE, device_addr, BLUETOOTH_NETWORK_NAP_ROLE,
- bt_event_slot_container[event_index].user_data);
- if (device_addr != NULL)
- free(device_addr);
break;
case BLUETOOTH_EVENT_NETWORK_CONNECTED:
BT_INFO("BLUETOOTH_EVENT_NETWORK_CONNECTED");
- bd_addr = (bluetooth_device_address_t *)(param->param_data);
- _bt_convert_address_to_string(&device_addr, bd_addr);
-
- ((bt_panu_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
- (_bt_get_error_code(param->result), TRUE, device_addr, BLUETOOTH_NETWORK_NAP_ROLE,
- bt_event_slot_container[event_index].user_data);
- if (device_addr != NULL)
- free(device_addr);
break;
case BLUETOOTH_EVENT_HDP_CONNECTED:
* limitations under the License.
*/
-#include <glib.h>
-#include <dlog.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
-#include <bluetooth-api.h>
-
#include "bluetooth.h"
#include "bluetooth_private.h"
-#define BT_CHECK_PAN_SUPPORT() \
-{ \
- BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); \
- BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_TETHERING); \
-}
-
-/* LCOV_EXCL_START */
int bt_nap_activate(void)
{
- int error = BT_ERROR_NONE;
-
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- error = bluetooth_network_activate_server();
- error = _bt_get_error_code(error);
- if (error != BT_ERROR_NONE)
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-
- return error;
+ return BT_ERROR_NOT_SUPPORTED;
}
int bt_nap_deactivate(void)
{
- int error = BT_ERROR_NONE;
-
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- error = bluetooth_network_deactivate_server();
- error = _bt_get_error_code(error);
- if (error != BT_ERROR_NONE)
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-
- return error;
+ return BT_ERROR_NOT_SUPPORTED;
}
-/* bluez don't support the disconnect API about NAP server */
-/* So we implement this, deactivate the server and re-activate the server */
int bt_nap_disconnect_all(void)
{
- int error = BT_ERROR_NONE;
-
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- error = bluetooth_network_deactivate_server();
- error = _bt_get_error_code(error);
- if (error != BT_ERROR_NONE)
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
- else
- return bt_nap_activate();
-
- return error;
+ return BT_ERROR_NOT_SUPPORTED;
}
int bt_nap_disconnect(const char *remote_address)
{
- int error = BT_ERROR_INVALID_PARAMETER;
- bluetooth_device_address_t addr_hex = { {0,} };
-
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(remote_address);
- _bt_convert_address_to_hex(&addr_hex, remote_address);
- error = bluetooth_network_server_disconnect(&addr_hex);
- error = _bt_get_error_code(error);
- if (error != BT_ERROR_NONE) {
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error),
- error);
- }
- return error;
+ return BT_ERROR_NOT_SUPPORTED;
}
int bt_nap_set_connection_state_changed_cb(
bt_nap_connection_state_changed_cb callback,
void *user_data)
{
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(callback);
- _bt_set_cb(BT_EVENT_NAP_CONNECTION_STATE_CHANGED, callback, user_data);
- return BT_ERROR_NONE;
-
+ return BT_ERROR_NOT_SUPPORTED;
}
int bt_nap_unset_connection_state_changed_cb(void)
{
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- _bt_unset_cb(BT_EVENT_NAP_CONNECTION_STATE_CHANGED);
- return BT_ERROR_NONE;
+ return BT_ERROR_NOT_SUPPORTED;
}
int bt_panu_set_connection_state_changed_cb(
bt_panu_connection_state_changed_cb callback,
void *user_data)
{
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(callback);
- _bt_set_cb(BT_EVENT_PAN_CONNECTION_STATE_CHANGED, callback, user_data);
- return BT_ERROR_NONE;
+ return BT_ERROR_NOT_SUPPORTED;
}
int bt_panu_unset_connection_state_changed_cb(void)
{
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- _bt_unset_cb(BT_EVENT_PAN_CONNECTION_STATE_CHANGED);
- return BT_ERROR_NONE;
+ return BT_ERROR_NOT_SUPPORTED;
}
int bt_panu_connect(const char *remote_address, bt_panu_service_type_e type)
{
- int error = BT_ERROR_INVALID_PARAMETER;
- bluetooth_device_address_t addr_hex = { {0,} };
-
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(remote_address);
- _bt_convert_address_to_hex(&addr_hex, remote_address);
- if (BT_PANU_SERVICE_TYPE_NAP == type) {
- error = bluetooth_network_connect(&addr_hex,
- BLUETOOTH_NETWORK_NAP_ROLE, NULL);
- error = _bt_get_error_code(error);
- if (error != BT_ERROR_NONE) {
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error),
- error);
- }
- }
- return error;
+ return BT_ERROR_NOT_SUPPORTED;
}
int bt_panu_disconnect(const char *remote_address)
{
- int error = BT_ERROR_INVALID_PARAMETER;
- bluetooth_device_address_t addr_hex = { {0,} };
-
- BT_CHECK_PAN_SUPPORT();
- BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(remote_address);
- _bt_convert_address_to_hex(&addr_hex, remote_address);
- error = bluetooth_network_disconnect(&addr_hex);
- error = _bt_get_error_code(error);
- if (error != BT_ERROR_NONE) {
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error),
- error);
- }
- return error;
+ return BT_ERROR_NOT_SUPPORTED;
}
-/* LCOV_EXCL_STOP */