}
/* Characteristic Object Properties */
- props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ;
- perms = BLUETOOTH_GATT_PERMISSION_READ;
+ props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ |
+ BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE;
+ perms = BLUETOOTH_GATT_PERMISSION_READ |
+ BLUETOOTH_GATT_PERMISSION_WRITE;
char_uuid = _otp_convert_uuid_to_uuid128(OTP_OBJECT_PROP_UUID);
ret = add_new_characteristic(char_uuid, perms, props,
&otp_object_prop_obj_path);
g_free(uuid);
break;
case OACP_DELETE:
+ if (opcode == OACP_DELETE &&
+ ~(selected_object->props & OBJECT_DELETE)) {
+ ret = OACP_PROCEDURE_NOT_SUPPORTED;
+ goto fail;
+ }
snprintf(absolute_file_path, sizeof(absolute_file_path),
"%s%s", directory, selected_object->name);
ret = OACP_OPCODE_NOT_SUPPORTED;
break;
case OACP_EXECUTE:
+ if (opcode == OACP_EXECUTE &&
+ ~(selected_object->props & OBJECT_EXECUTE)) {
+ ret = OACP_PROCEDURE_NOT_SUPPORTED;
+ goto fail;
+ }
snprintf(absolute_file_path, sizeof(absolute_file_path),
"file://%s%s", directory, selected_object->name);
break;
case OACP_READ:
case OACP_WRITE:
+ if (opcode == OACP_WRITE &&
+ ~(selected_object->props & OBJECT_WRITE)) {
+ ret = OACP_PROCEDURE_NOT_SUPPORTED;
+ goto fail;
+ }
+
+ if (opcode == OACP_READ &&
+ ~(selected_object->props & OBJECT_READ)) {
+ ret = OACP_PROCEDURE_NOT_SUPPORTED;
+ goto fail;
+ }
+
object_offset = (uint32_t)(value[4] & 0xFF) << 24 |
(uint32_t)(value[3] & 0xFF) << 16 |
(uint32_t)(value[2] & 0xFF) << 8 |
err = _bt_otp_open_otc_and_listen(remote_addr, "ListenOtc");
if (err != BLUETOOTH_ERROR_NONE) {
- ret = OACP_OPERATION_FAILED;
+ ret = OACP_CHANNEL_UNAVAILABLE;
_bt_otp_free_oacp_op();
goto fail;
}
guint16 offset = 0;
char *value = NULL;
struct indicate_info info;
+
g_variant_get(var, "(&s&s&syq@ay)",
&char_path, &svc_handle,
&addr, &req_id, &offset, &val);
if (len != 0) {
if (!g_strcmp0(char_path, otp_oacp_obj_path)) {
- result = _bt_otp_oacp_write_cb(value, len, offset, addr, &info);
+ if (!OACP_indicate)
+ result = BLUETOOTH_ERROR_CCC_IMPROPERLY_CONFIGURED;
+ else
+ result = _bt_otp_oacp_write_cb(value, len, offset, addr, &info);
} else if (!g_strcmp0(char_path, otp_olcp_obj_path)) {
- result = _bt_otp_olcp_write_cb(value, len, offset, &info);
+ if (!OLCP_indicate)
+ result = BLUETOOTH_ERROR_CCC_IMPROPERLY_CONFIGURED;
+ else
+ result = _bt_otp_olcp_write_cb(value, len, offset, &info);
} else if (!g_strcmp0(char_path, otp_object_name_obj_path)) {
if (oacp_create) {
/* OACP_CREATE is ongoing */