return le_dev_info;
}
+static bluetooth_ibeacon_device_info_t *__bt_get_ibeacon_device_info_in_message(GVariant *parameters, int *ret)
+{
+ bluetooth_ibeacon_device_info_t *ibeacon_dev_info = NULL;
+ const char *address = NULL;
+ short addr_type = 0;
+ int company_id = 0;
+ int ibeacon_type = 0;
+ int major_id = 0;
+ int minor_id = 0;
+ int measured_power = 0;
+ const char *uuid = NULL;
+ int result = BLUETOOTH_ERROR_NONE;
+
+ g_variant_get(parameters, "(i&snnn&snnn)", &result, &address,
+ &addr_type, &company_id, &ibeacon_type, &uuid, &major_id, &minor_id, &measured_power);
+ ibeacon_dev_info = g_malloc0(sizeof(bluetooth_ibeacon_device_info_t));
+ if (ibeacon_dev_info == NULL) {
+ result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+ goto done;
+ }
+
+ _bt_convert_addr_string_to_type(ibeacon_dev_info->device_address.addr, address);
+ ibeacon_dev_info->addr_type = addr_type;
+ ibeacon_dev_info->company_id = company_id;
+ ibeacon_dev_info->ibeacon_type = ibeacon_type;
+ ibeacon_dev_info->major_id = major_id;
+ ibeacon_dev_info->minor_id = minor_id;
+ ibeacon_dev_info->measured_power = measured_power;
+ ibeacon_dev_info->uuid_len = strlen(uuid);
+ memcpy(ibeacon_dev_info->uuid, uuid, ibeacon_dev_info->uuid_len);
+done:
+
+ *ret = result;
+
+ return ibeacon_dev_info;
+}
+
gboolean __bt_reliable_disable_cb(gpointer user_data)
{
BT_DBG("+");
}
g_free(le_device_info);
+ } else if (strcasecmp(signal_name, BT_IBEACON_DEVICE_FOUND) == 0) {
+ bluetooth_ibeacon_device_info_t *ibeacon_device_info;
+ BT_DBG("BT_IBEACON_DEVICE_FOUND");
+ ibeacon_device_info = __bt_get_ibeacon_device_info_in_message(parameters,
+ &result);
+ ret_if(ibeacon_device_info == NULL);
+
+ _bt_common_event_cb(BLUETOOTH_EVENT_REMOTE_IBEACON_DEVICE_FOUND,
+ result, ibeacon_device_info,
+ event_info->cb, event_info->user_data);
+
+ g_free(ibeacon_device_info);
}
}
}
}
+void _bt_send_ibeacon_scan_result_event(const bt_remote_ibeacon_dev_info_t *ibeacon_dev_info)
+{
+ int result = BLUETOOTH_ERROR_NONE;
+ GSList *l;
+ GVariant *param;
+ bt_adapter_le_scanner_t *scanner = NULL;
+
+ ret_if(ibeacon_dev_info == NULL);
+ BT_DBG("_bt_send_ibeacon_scan_result_event");
+
+ for (l = scanner_list; l != NULL; l = g_slist_next(l)) {
+ scanner = l->data;
+ if (scanner->is_scanning == FALSE)
+ continue;
+
+ param = g_variant_new("(isnnnsnnn)",
+ result,
+ ibeacon_dev_info->address,
+ ibeacon_dev_info->addr_type,
+ ibeacon_dev_info->company_id,
+ ibeacon_dev_info->ibeacon_type,
+ ibeacon_dev_info->uuid,
+ ibeacon_dev_info->major_id,
+ ibeacon_dev_info->minor_id,
+ ibeacon_dev_info->measured_power);
+
+ _bt_send_event(BT_LE_ADAPTER_EVENT, BLUETOOTH_EVENT_REMOTE_IBEACON_DEVICE_FOUND, param);
+ }
+}
+
int _bt_add_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type)
{
GDBusProxy *proxy;
event,
param);
g_free(address);
- }
+ } else if (strcasecmp(member, "iBeaconReport") == 0) {
+ bt_remote_ibeacon_dev_info_t *ibeacon_dev_info = NULL;
+
+ ret_if(_bt_is_le_scanning() == FALSE);
+ ibeacon_dev_info = g_malloc0(sizeof(bt_remote_ibeacon_dev_info_t));
+ if (ibeacon_dev_info == NULL)
+ return;
+
+ g_variant_get(msg, "(syuusuuy)", &ibeacon_dev_info->address,
+ &ibeacon_dev_info->addr_type,
+ &ibeacon_dev_info->company_id,
+ &ibeacon_dev_info->ibeacon_type,
+ &ibeacon_dev_info->uuid,
+ &ibeacon_dev_info->major_id,
+ &ibeacon_dev_info->minor_id,
+ &ibeacon_dev_info->measured_power);
+ _bt_send_ibeacon_scan_result_event(ibeacon_dev_info);
+ g_free(ibeacon_dev_info);
+ }
}
void __bt_set_audio_values(gboolean connected, char *address)
case BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED:
signal = BT_LE_DATA_LENGTH_CHANGED;
break;
+ case BLUETOOTH_EVENT_REMOTE_IBEACON_DEVICE_FOUND:
+ signal = BT_IBEACON_DEVICE_FOUND;
+ break;
default:
BT_ERR("Unknown event");
return BLUETOOTH_ERROR_INTERNAL;
void _bt_send_scan_result_event(const bt_remote_le_dev_info_t *le_dev_info, const bt_le_adv_info_t *adv_info);
+void _bt_send_ibeacon_scan_result_event(const bt_remote_ibeacon_dev_info_t *ibeacon_dev_info);
+
int _bt_add_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
int _bt_remove_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
} bt_remote_le_dev_info_t;
typedef struct {
+ char *address;
+ int addr_type;
+ int rssi;
+ int adv_type;
+ int company_id;
+ int ibeacon_type;
+ int major_id;
+ int minor_id;
+ int measured_power;
+ char *uuid;
+} bt_remote_ibeacon_dev_info_t;
+
+typedef struct {
int rssi;
int class;
char *address;
BLUETOOTH_EVENT_LE_DISCOVERY_STARTED, /**< Bluetooth event LE discovery started */
BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, /**< Bluetooth event LE discovery finished */
BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND, /**< Bluetooth event remote deice found (LE dev) */
+ BLUETOOTH_EVENT_REMOTE_IBEACON_DEVICE_FOUND, /**< Bluetooth event remote ibeacon device found (iBeacon LE dev) */
BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,/**< Bluetooth event remote device name updated*/
BLUETOOTH_EVENT_BONDING_FINISHED, /**< Bluetooth event bonding completed */
BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED, /**< Bluetooth event bonding removed */
} bluetooth_le_device_info_t;
typedef struct {
+ bluetooth_device_address_t device_address; /**< device address */
+ int addr_type; /**< address type*/
+ int rssi; /**< received strength signal*/
+ int adv_type;
+ int company_id; /** <Company ID> */
+ int ibeacon_type; /** <iBeacon type> */
+ int major_id; /** <Major ID> */
+ int minor_id; /** <Minor ID> */
+ int measured_power; /** <Measured Power value for proximity> */
+ int uuid_len; /** <uuid string len> */
+ char uuid[BLUETOOTH_UUID_STRING_MAX]; /** <customr/specific UUID> */
+} bluetooth_ibeacon_device_info_t;
+
+typedef struct {
int slot_id;
bluetooth_le_scan_filter_feature_t added_features; /**< added features */
bluetooth_device_address_t device_address; /**< device address */
#define BT_IPSP_CONNECTED "IpspConnected"
#define BT_IPSP_DISCONNECTED "IpspDisconnected"
#define BT_LE_DATA_LENGTH_CHANGED "LEDataLengthChanged"
+#define BT_IBEACON_DEVICE_FOUND "iBeaconDeviceFound"
#ifdef __cplusplus
}