#define TYPE_FIELD "string"
#define FEATURE_TAG "platform"
#define MODEL_CONFIG_TAG "model-config"
+#define CERTI_STACK_FILE "/var/lib/bluetooth/stack_test"
+#define CERTI_PROFILE_FILE "/var/lib/bluetooth/profile_test"
+
typedef enum {
TIZEN_PROFILE_UNKNOWN = 0,
TIZEN_MODEL_ROBOT = 0x80,
} tizen_model_t;
+typedef enum {
+ TIZEN_CERTI_MODE_UNKNOWN = 0,
+ TIZEN_CERTI_MODE_DISABLE = 0x1,
+ TIZEN_CERTI_MODE_STACK = 0x2,
+ TIZEN_CERTI_MODE_PROFILE = 0x4,
+} tizen_certifcation_mode_t;
+
static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
static tizen_model_t model = TIZEN_MODEL_UNKNOWN;
+static tizen_certifcation_mode_t certification_mode = TIZEN_CERTI_MODE_UNKNOWN;
static inline int __get_profile_from_model_config_xml(const char *field, char **value)
{
return model;
}
+static inline tizen_certifcation_mode_t _get_tizen_certification_mode(void)
+{
+ if (__builtin_expect(certification_mode != TIZEN_CERTI_MODE_UNKNOWN, 1))
+ return certification_mode;
+
+ if (access(CERTI_STACK_FILE, F_OK) == 0)
+ certification_mode |= TIZEN_CERTI_MODE_STACK;
+
+ if (access(CERTI_PROFILE_FILE, F_OK) == 0)
+ certification_mode |= TIZEN_CERTI_MODE_PROFILE;
+
+ if (certification_mode == TIZEN_CERTI_MODE_UNKNOWN)
+ certification_mode = TIZEN_CERTI_MODE_DISABLE;
+
+ return certification_mode;
+}
+
#define TIZEN_FEATURE_BLUEZ_BRCM_CHIP ((_get_tizen_profile()) == TIZEN_PROFILE_IVI)
#define TIZEN_FEATURE_BLUEZ_WEARABLE ((_get_tizen_profile()) == TIZEN_PROFILE_WEARABLE)
#define TIZEN_FEATURE_BLUEZ_SMS_ONLY ((_get_tizen_profile()) == TIZEN_PROFILE_WEARABLE)
#define TIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN ((_get_tizen_model()) == TIZEN_MODEL_TM1)
#define TIZEN_FEATURE_BLUEZ_SPEAKER_REFERENCE ((_get_tizen_model()) == TIZEN_MODEL_RPI3 && (_get_tizen_profile()) == TIZEN_PROFILE_COMMON)
#define TIZEN_FEATURE_ROBOT_REFERENCE ((_get_tizen_model()) == TIZEN_MODEL_ROBOT)
+#define TIZEN_FEATURE_BLUEZ_STACK_CERTIFICATION (((_get_tizen_certification_mode()) & TIZEN_CERTI_MODE_STACK) != 0)
+#define TIZEN_FEATURE_BLUEZ_PROFILE_CERTIFICATION (((_get_tizen_certification_mode()) & TIZEN_CERTI_MODE_PROFILE) != 0)
#endif /* __TIZEN_PROFILE_H__ */
#include "src/shared/gatt-client.h"
#if defined TIZEN_FEATURE_BLUEZ_MODIFY
#include "../log.h"
+#include "../../profile.h"
#endif
#include <assert.h>
return false;
}
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
att_id = bt_att_send(notify_data->client->att, BT_ATT_OP_WRITE_REQ,
pdu, sizeof(pdu), callback,
notify_data_ref(notify_data),
notify_data_unref);
+#else
+ att_id = 0;
+
+ if (!TIZEN_FEATURE_BLUEZ_STACK_CERTIFICATION) {
+ att_id = bt_att_send(notify_data->client->att, BT_ATT_OP_WRITE_REQ,
+ pdu, sizeof(pdu), callback,
+ notify_data_ref(notify_data),
+ notify_data_unref);
+ } else {
+ /* GAP/SEC/SEM/BV-56-C, GAP/SEC/SEM/BV-59-C
+ PTS expects to recieve the sperated value for notify and indicate
+ So seperate the value and send it
+ */
+ bool notify = false;
+ bool indicate = false;
+
+ if (pdu[2] & 0x01)
+ notify = true;
+
+ if (pdu[2] & 0x02)
+ indicate = true;
+
+ if (notify == true) {
+ pdu[2] = 0x01;
+
+ att_id = bt_att_send(notify_data->client->att, BT_ATT_OP_WRITE_REQ,
+ pdu, sizeof(pdu), callback,
+ notify_data_ref(notify_data),
+ notify_data_unref);
+ }
+
+ if (indicate == true) {
+ pdu[2] = 0x02;
+
+ att_id = bt_att_send(notify_data->client->att, BT_ATT_OP_WRITE_REQ,
+ pdu, sizeof(pdu), callback,
+ NULL,
+ NULL);
+ }
+ }
+#endif
+
notify_data->chrc->ccc_write_id = notify_data->att_id = att_id;
return !!att_id;
{
struct notify_data *notify_data = user_data;
+#if defined TIZEN_FEATURE_BLUEZ_MODIFY
+ if (TIZEN_FEATURE_BLUEZ_STACK_CERTIFICATION) {
+ if (notify_data == NULL)
+ return;
+ }
+#endif
+
assert(notify_data->chrc->ccc_write_id);
notify_data->chrc->ccc_write_id = 0;
#include "src/shared/util.h"
#include "src/shared/timeout.h"
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#include "../../profile.h"
+#endif
+
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
gatt_db_read_by_type(server->db, start, end, type, q);
if (queue_isempty(q)) {
-#ifdef TIZEN_CERTIFICATE
+#if defined TIZEN_FEATURE_BLUEZ_MODIFY
+ if (TIZEN_FEATURE_BLUEZ_STACK_CERTIFICATION) {
if (start == 0x00ff && end == 0x00ff) {
ecode = BT_ATT_ERROR_AUTHENTICATION;
goto error;
}
+ }
#endif
ecode = BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND;
goto error;
goto error;
}
-#ifdef TIZEN_CERTIFICATE
+#if defined TIZEN_FEATURE_BLUEZ_MODIFY
+ if (TIZEN_FEATURE_BLUEZ_STACK_CERTIFICATION) {
/* GATT/SR/GAW/BI-05-C
Write Characteristic Value - Insufficient Authentication (0x05)
For 0x2aff UUID, return authentication error
ecode = BT_ATT_ERROR_AUTHENTICATION;
goto error;
}
+ }
#endif
util_debug(server->debug_callback, server->debug_data,
attr = gatt_db_get_attribute(server->db, handle);
if (!attr) {
-#ifdef TIZEN_CERTIFICATE
+#if defined TIZEN_FEATURE_BLUEZ_MODIFY
+ if (TIZEN_FEATURE_BLUEZ_STACK_CERTIFICATION) {
/* GATT/SR/GAR/BI-34-C
GATT/SR/GAR/BI-35-C
Read Characteristic Value - Invalid Transport Access over LE or BR/EDR (0x80)
} else {
ecode = BT_ATT_ERROR_INVALID_HANDLE;
}
+ } else {
+ ecode = BT_ATT_ERROR_INVALID_HANDLE;
+ }
#else
ecode = BT_ATT_ERROR_INVALID_HANDLE;
#endif
goto error;
}
-#ifdef TIZEN_CERTIFICATE
+#if defined TIZEN_FEATURE_BLUEZ_MODIFY
+ if (TIZEN_FEATURE_BLUEZ_STACK_CERTIFICATION) {
/* GATT/SR/GAR/BI-04-C
Read Characteristic Value . Insufficient Authentication (0x05)
For 0x2AFF UUID, return authentication error
ecode = BT_ATT_ERROR_AUTHENTICATION;
goto error;
}
+ }
#endif
util_debug(server->debug_callback, server->debug_data,
goto error;
}
-#ifdef TIZEN_CERTIFICATE
+#if defined TIZEN_FEATURE_BLUEZ_MODIFY
+ if (TIZEN_FEATURE_BLUEZ_STACK_CERTIFICATION) {
/* GATT/SR/GAW/BI-12-C
Write Long Characteristic Value - Insufficient Authentication (0x05)
For 0x2af8 or 0x2aff UUID, return authentication error
ecode = BT_ATT_ERROR_AUTHENTICATION;
goto error;
}
+ }
#endif
util_debug(server->debug_callback, server->debug_data,