I'm trying to set an int value to a characteristic in Tyzen framework and I have as a return value 'parameter invalid'. I've followed this tutorial:
https://developer.tizen.org/development/tutorials/native-application/network/bluetooth#gatt_setter
And this is my code:
ret = bt_gatt_client_create(remote_address, &client);
ret = bt_gatt_client_get_service(client, time_svc_uuid_16, &svc);
ret = bt_gatt_service_get_characteristic(svc, time_char_uuid_16, &chr);
ret = bt_gatt_characteristic_set_write_type(chr, BT_GATT_WRITE_TYPE_WRITE);
int data_output = 60;
ret = bt_gatt_set_int_value(chr, BT_DATA_TYPE_SINT32, data_output, 1);
if (ret == BT_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG, "bt_gatt_set_value success");
}
else if (ret == BT_ERROR_INVALID_PARAMETER)
{
dlog_print(DLOG_INFO, LOG_TAG, "BT_ERROR_INVALID_PARAMETER is failed : %d", ret);
}
else if (ret == BT_ERROR_OPERATION_FAILED)
{
dlog_print(DLOG_INFO, LOG_TAG, "BT_ERROR_OPERATION_FAILED is failed : %d", ret);
}
else if (ret == BT_ERROR_NOT_SUPPORTED)
{
dlog_print(DLOG_INFO, LOG_TAG, "BT_ERROR_NOT_SUPPORTED is failed : %d", ret);
}
else{
dlog_print(DLOG_INFO, LOG_TAG, "UNKNOWN bt_gatt_set_value is failed : %d", ret);
}
if I change this:
int data_output = 60;
ret = bt_gatt_set_int_value(chr, BT_DATA_TYPE_SINT32, data_output, 1);
for this:
char char_value[1] = {1 + (rand()%100)};
ret = bt_gatt_set_value(chr, char_value, 1);
I don't have any problem. But I need to send a signed integer
does anyone know what It could be the problem?