muka/go-bluetooth

Getting error (code: 13) GATT_INVALID_ATTRIBUTE_LENGTH

rocc0 opened this issue · 1 comments

Hello, using this example I created more complicated app on peripheral, which has notification, read, write and encrypted write chars.
As the client I'm using app written on Dart, which uses library in which I also found issue for the same error where they talking about firmware issue.

The problem is: when app writes short value, like timestamp, peripheral receives it, but when it writes long one in chunks of maximal MTU size(except last chunk) in adb I see an error (code: 13) GATT_INVALID_ATTRIBUTE_LENGTH.

Example code:

        service1, err := a.NewService("bf3a0000")
	if err != nil {
		return err
	}
	char1, err := service1.NewChar("bf3a0005")
	if err != nil {
		return err
	}
	char1.Properties.Flags = []string{gatt.FlagCharacteristicWrite}
	char1.OnWrite(func(c *service.Char, value []byte) ([]byte, error) {
		return value, nil
	})
	if err = service1.AddChar(char1); err != nil {
		return err
	}

As I understood this error is about changing MTU size dynamically on by the client, is it correct?

As a dongle for the peripheral I'm using ASUS BT-500, which uses rtl8761bt, OS Ubuntu 22.04, Bluez version 5.64.

solved by changing MTU on app side to 500 bytes instead of 512