I have a question concerning BLE. I am creating a service Location and Navigation Service. Just want to notify the long and lat coordinates.
First, I cannot read my LN feature
static gboolean handle_read_feature(
BluezGattCharacteristic1 *interface,
GDBusMethodInvocation *invocation,
GVariant *options,
gpointer user_data
)
{
//https://www.bt-test.systems/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.ln_feature.xml
guint32 feat = 0;
guint32 feat = (1 << 2);
g_print("%s called with feature : %s\n", __func__, feat);
GVariant *value = g_variant_new_uint32((const guint32)feat);
g_variant_ref_sink(value);
bluez_gatt_characteristic1_set_value(interface, value);
bluez_gatt_characteristic1_complete_read_value(interface, invocation, value);
g_variant_unref(value);
return TRUE;
}
Then when debugging, it says that “g_variant_new_fixed_array: array size 1 does not match given element_size 4.”
static void notify_long_lat(
BluezGattCharacteristic1 *gatt_characteristic_object,
guint32 longitude, guint32 latitude)
{
guint32 value_array = {longitude, latitude};
GVariant *value = g_variant_new_fixed_array(
G_VARIANT_TYPE_BYTESTRING, value_array, G_N_ELEMENTS(value_array), sizeof(value_array[0]));
bluez_gatt_characteristic1_set_value(gatt_characteristic_object, value);
}
Finally, do you know how am I supposed use the flag field as needed in this standard service. (file:///tmp/mozilla_mkasse0/LNS_V10.pdf)